加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
Jenkinsfile 4.69 KB
一键复制 编辑 原始数据 按行查看 历史
pll 提交于 2023-03-14 10:11 . refactor: remove build configureServer stage
pipeline {
agent { label 'docker' }
stages {
stage('Build Configure') {
agent {
docker {
image 'openatc/pnpm:6-node14'
args '-v /data/.pnpm-store:/root/.local/share/pnpm/store --entrypoint=\'\''
reuseNode true
}
}
steps {
dir("${env.WORKSPACE}/OpenATC-Admin-ui/OpenATC-Configer-web") {
sh 'pnpm install --no-frozen-lockfile'
sh 'pnpm run package:prod'
sh 'pnpm run build'
sh 'tar -zcvf Configdist.tar.gz dist'
}
}
}
stage('Build Web') {
agent {
docker {
image 'openatc/pnpm:6-node14'
args '-v /data/.pnpm-store:/root/.local/share/pnpm/store --entrypoint=\'\''
reuseNode true
}
}
steps {
dir("${env.WORKSPACE}/OpenATC-Admin-ui/OpenATC-Admin-web") {
sh 'pnpm install --no-frozen-lockfile'
sh 'pnpm run build'
sh 'rm ../../OpenATC-Admin-server/agent/src/main/resources/static -rf'
sh 'cp -r dist ../../OpenATC-Admin-server/agent/src/main/resources/static'
// todo: sh 'cp -r /root/UserManual ../../OpenATC-Admin-server/agent/src/main/resources/static'
sh 'tar -zcvf admindist.tar.gz dist'
}
}
}
stage('Build Server Agent') {
agent {
docker {
image 'maven:amazoncorretto'
args '-v /data/.m2:/root/.m2 --entrypoint=\'\''
reuseNode true
}
}
steps {
dir("${env.WORKSPACE}/OpenATC-Admin-server") {
sh 'mvn clean install'
}
}
}
// stage('Build Configer Server') {
// agent {
// docker {
// image 'maven:amazoncorretto'
// args '-v /data/.m2:/root/.m2 --entrypoint=\'\''
// reuseNode true
// }
// }
// steps {
// dir("${env.WORKSPACE}/OpenATC-Admin-server/configserver") {
// sh 'mvn clean package'
// }
// }
// }
stage('Publish') {
steps {
// archiveArtifacts artifacts: 'OpenATC-Admin-server/target/agent.jar, OpenATC-Admin-server/configserver/target/ConfigServer.jar, OpenATC-Admin-ui/OpenATC-Configer-web/Configdist.tar.gz, OpenATC-Admin-ui/OpenATC-Admin-web/admindist.tar.gz', followSymlinks: false, onlyIfSuccessful: true
archiveArtifacts artifacts: 'OpenATC-Admin-server/target/agent.jar, OpenATC-Admin-ui/OpenATC-Configer-web/Configdist.tar.gz, OpenATC-Admin-ui/OpenATC-Admin-web/admindist.tar.gz', followSymlinks: false, onlyIfSuccessful: true
}
}
stage('Building image & push') {
steps {
script {
def buildImg
echo "building img for branch: ${env.BRANCH_NAME} and tag: ${env.TAG_NAME}"
if (env.BRANCH_NAME == 'master' || (env.TAG_NAME) != null ) {
buildImg=docker.build('openatc/openatc-admin:latest', "${env.WORKSPACE}/OpenATC-Admin-server/agent")
} else {
buildImg=docker.build("openatc/openatc-admin-${env.BRANCH_NAME}:latest", "${env.WORKSPACE}/OpenATC-Admin-server/agent")
}
docker.withRegistry('', 'openatc-docker-hub') {
buildImg.push()
}
}
}
}
stage('Add Docker Version Tag') {
when {
buildingTag()
}
steps {
sh "docker tag openatc/openatc-admin:latest openatc/openatc-admin:${env.TAG_NAME}"
script {
docker.withRegistry('', 'openatc-docker-hub') {
docker.image("openatc/openatc-admin:${env.TAG_NAME}").push()
}
}
}
}
}
post {
failure{
emailext to: "${env.OPENATC_FAILURE_MAIL_RECV}",
subject: "jenkins build:${currentBuild.currentResult}: ${env.JOB_NAME}",
body: "${currentBuild.currentResult}: Job ${env.JOB_NAME}\nMore Info can be found here: ${env.BUILD_URL}"
}
}
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化