代码拉取完成,页面将自动刷新
node ('dev_test') {
catchError {
stage("Vars") {
script {
//环境变量,不同项目不同
env.group_n = "common"
env.project_n = "yilianzhijia"
env.PROJECT_NAME = "yilianzhijia"
env.des = "奕联之家"
}
}
stage("dev") {
script {
if (env.BRANCH_NAME == 'dev') {
git branch: "dev", credentialsId: 'dev', url: "https://gitlab.yi-types.vip:88/${group_n}/${project_n}.git"
sh '''
export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/bdisk/download/node-v16.17.1-linux-x64/bin:/usr/local/nginx-1.22.0/sbin:/root/bin
npm install -verbose --registry=https://registry.npm.taobao.org --unsafe-perm=true --legacy-peer-deps
npm rebuild node-sass --registry=https://registry.npm.taobao.org --unsafe-perm=true
npm run build:dev -verbose --registry=https://registry.npm.taobao.org --unsafe-perm=true
mkdir -p /home/docker/nginx/html/${PROJECT_NAME}-dev
rm -rfv /home/docker/nginx/html/${PROJECT_NAME}-dev/dist
\\cp -av dist /home/docker/nginx/html/${PROJECT_NAME}-dev/
echo "Deploy success"
'''
}
}
}
stage("test") {
script {
if (env.BRANCH_NAME == 'test') {
git branch: "test", credentialsId: 'dev', url: "https://gitlab.yi-types.vip:88/${group_n}//${project_n}.git"
sh '''
export PATH=/bdisk/download/apache-maven-3.8.6/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/bdisk/download/node-v16.17.1-linux-x64/bin:/usr/local/nginx-1.22.0/sbin:/bdisk/download/jdk1.8.0_341/bin:/bdisk/download/jdk1.8.0_341/jre/bin:/root/bin
npm config set sass_binary_site https://npm.taobao.org/mirrors/node-sass/
npm install -verbose --registry=https://registry.npm.taobao.org --unsafe-perm=true --legacy-peer-deps
npm rebuild node-sass --registry=https://registry.npm.taobao.org --unsafe-perm=true
npm run build:test -verbose --registry=https://registry.npm.taobao.org --unsafe-perm=true
mkdir -p /home/docker/nginx/html/${PROJECT_NAME}-test
rm -rfv /home/docker/nginx/html/${PROJECT_NAME}-test/dist
\\cp -av dist /home/docker/nginx/html/${PROJECT_NAME}-test/
'''
}
}
}
stage("master") {
script {
if (env.BRANCH_NAME == 'master') {
currentBuild.result = "ABORTED"
}
}
}
stage("main") {
script {
if (env.BRANCH_NAME == 'main') {
currentBuild.result = "ABORTED"
}
}
}
}
if (currentBuild.result == "FAILURE") {
sh '''
sh /bdisk/sh/fail_to_feishu_front.sh
'''
}
else if (currentBuild.result != "ABORTED") {
sh '''
sh /bdisk/sh/success_to_feishu.sh
'''
}
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。