pipeline { agent any environment { PATH = "/opt/maven3.8.8/bin:/opt/node/bin:${env.PATH}" } tools { maven 'maven388' } stages { stage('前端代码打包') { steps { sh "cd ruoyi-ui && npm install && npm run build:prod && cp -r dist ../cloud/ruoyi-nginx" echo "前端代码打包完成" } } stage('后端代码打包') { steps { sh "mvn clean package -Dmaven.test.skip=true && cp ruoyi-admin/target/ruoyi-admin.jar cloud/ruoyi-java" echo "后端代码打包完成" } } stage('构建镜像') { steps { sh "docker build -t 192.168.96.141/library/ruoyi-nginx:${tag} cloud/ruoyi-nginx" echo "构建镜像完成" sh "docker build -t 192.168.96.141/library/ruoyi-java:${tag} cloud/ruoyi-java" } } stage('推送镜像') { steps { sh ''' docker push 192.168.96.141/library/ruoyi-nginx:${tag} docker push 192.168.96.141/library/ruoyi-java:${tag} ''' echo "镜像推送完成" } } stage('运行') { steps { sh ''' kubectl apply -f ./cloud/deploy ''' } } } post { always { emailext ( subject: '项目 【$PROJECT_NAME】 第【$BUILD_NUMBER】次构建 - $BUILD_STATUS!', body: '''
构建结果 - ${BUILD_STATUS} |
构建信息 |
最近提交
${CHANGES_SINCE_LAST_SUCCESS, reverse=true, format="%c", changesFormat=" |