加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
Jenkinsfile 5.88 KB
一键复制 编辑 原始数据 按行查看 历史
yaoxi 提交于 2024-02-26 15:36 . pnpm镜像源切换为国内
pipeline {
agent { label 'buildx' }
stages {
stage('submodule pull') {
steps {
dir("${env.WORKSPACE}") {
sh 'pwd'
sh 'git submodule update --init --recursive'
}
}
}
stage('Build Docs') {
agent {
docker {
image 'openatc/mkdocs-tools:1.4.2'
reuseNode true
}
}
steps {
dir("${env.WORKSPACE}/openatc-doc/OpenATCAdminManual_cn") {
sh 'mkdocs build --no-directory-urls'
}
dir("${env.WORKSPACE}/openatc-doc/OpenATCAdminManual_eng") {
sh 'mkdocs build --no-directory-urls'
}
dir("${env.WORKSPACE}/openatc-doc/OpenATCconfigerManual_cn") {
sh 'mkdocs build --no-directory-urls'
}
dir("${env.WORKSPACE}/openatc-doc/OpenATCconfigerManual_eng") {
sh 'mkdocs build --no-directory-urls'
}
dir("${env.WORKSPACE}/openatc-doc") {
sh 'rm UserManual -rf'
sh 'rm configserver -rf'
sh 'mkdir -p UserManual/openatcAdmin'
sh 'mkdir -p configserver/UserManual/openatcConfig'
sh 'cp -r OpenATCAdminManual_cn/site/ UserManual/openatcAdmin/zh/'
sh 'cp -r OpenATCAdminManual_eng/site/ UserManual/openatcAdmin/en/'
sh 'cp -r OpenATCconfigerManual_cn/site/ configserver/UserManual/openatcConfig/zh/'
sh 'cp -r OpenATCconfigerManual_eng/site/ configserver/UserManual/openatcConfig/en/'
}
}
}
stage('Build Configure') {
agent {
docker {
image 'openatc/pnpm:6-node14'
args '-v /data/.pnpm-store:/root/.local/share/pnpm/store -u 0:0 --entrypoint=\'\''
reuseNode true
}
}
steps {
dir("${env.WORKSPACE}/OpenATC-Admin-ui/OpenATC-Configer-web") {
sh 'pnpm config set registry https://registry.npmmirror.com/'
sh 'pnpm install --no-frozen-lockfile'
sh 'pnpm run package:prod'
sh 'pnpm run build'
sh 'tar -zcvf Configdist.tar.gz dist'
sh 'cp -r ../../openatc-doc/configserver/UserManual dist'
sh 'tar -zcvf ConfigWithUserManual.tar.gz dist'
}
}
}
stage('Build Web') {
agent {
docker {
image 'openatc/pnpm:6-node14'
args '-v /data/.pnpm-store:/root/.local/share/pnpm/store -u 0:0 --entrypoint=\'\''
reuseNode true
}
}
steps {
dir("${env.WORKSPACE}/OpenATC-Admin-ui/OpenATC-Admin-web") {
sh 'pnpm config set registry https://registry.npmmirror.com/'
sh 'pnpm install --no-frozen-lockfile'
sh 'pnpm run build'
sh 'rm ../../OpenATC-Admin-server/agent/src/main/resources/static -rf'
sh 'cp -r ../../openatc-doc/UserManual dist'
sh 'cp -r ../../openatc-doc/configserver/UserManual dist'
sh 'cp -r dist ../../OpenATC-Admin-server/agent/src/main/resources/static'
// sh 'cp -r ../../openatc-doc/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 -u 0:0 --entrypoint=\'\''
reuseNode true
}
}
steps {
dir("${env.WORKSPACE}/OpenATC-Admin-server") {
sh 'mvn clean install'
}
}
}
stage('Publish') {
steps {
archiveArtifacts artifacts: 'OpenATC-Admin-server/target/agent.jar, OpenATC-Admin-ui/OpenATC-Configer-web/Configdist.tar.gz,OpenATC-Admin-ui/OpenATC-Configer-web/ConfigWithUserManual.tar.gz, OpenATC-Admin-ui/OpenATC-Admin-web/admindist.tar.gz', followSymlinks: false, onlyIfSuccessful: true
}
}
stage('Building image & push') {
steps {
dir("${env.WORKSPACE}/OpenATC-Admin-server/agent") {
script {
echo "building img for branch: ${env.BRANCH_NAME} and tag: ${env.TAG_NAME}"
if ( env.TAG_NAME != null ){
sh "docker buildx build --platform linux/amd64,linux/arm64/v8 -t openatc/openatc-admin:${env.TAG_NAME} --push ."
} else if (env.BRANCH_NAME == 'master') {
sh "docker buildx build --platform linux/amd64,linux/arm64/v8 -t openatc/openatc-admin:latest --push ."
} else {
sh "docker buildx build --platform linux/amd64,linux/arm64/v8 -t openatc/openatc-admin-${env.BRANCH_NAME}:latest --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 助手
尝试更多
代码解读
代码找茬
代码优化