1 Star 1 Fork 0

何俊峰/弈联之家

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
Jenkinsfile 3.24 KB
一键复制 编辑 原始数据 按行查看 历史
何俊峰 提交于 2024-01-09 13:37 . v1.1.1
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
'''
}
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/he-junfeng1/yilian-home.git
git@gitee.com:he-junfeng1/yilian-home.git
he-junfeng1
yilian-home
弈联之家
dev

搜索帮助