Files
tra-app/Jenkinsfile
T
2026-03-28 20:41:03 +08:00

74 lines
1.8 KiB
Groovy
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
pipeline {
agent any
tools {
}
environment {
}
stages {
stage('打印环境变量') {
steps {
echo "当前分支:${env.GIT_BRANCH}"
echo "使用的凭据ID${env.GIT_CREDS}"
}
}
stage('代码拉取') {
steps {
git url: 'https://git.home.tymas.cn:8000/tianyan/tra-app.git',
branch: env.GIT_BRANCH,
credentialsId: env.GIT_CREDS
}
}
//
// stage('构建 & 测试') {
// steps {
// sh 'mvn clean package -DskipTests'
// sh 'mvn test'
// }
// // 构建产物归档
// post {
// success {
// archiveArtifacts artifacts: 'target/*.jar', followSymlinks: false
// }
// }
// }
//
// stage('构建 Docker 镜像') {
// steps {
// sh 'docker build -t myapp:${BUILD_NUMBER} .'
// }
// }
//
// stage('推送镜像') {
// steps {
// sh '''
// docker login -u ${DOCKER_CREDS_USR} -p ${DOCKER_CREDS_PSW}
// docker push myapp:${BUILD_NUMBER}
// '''
// }
// }
//
// stage('部署到服务器') {
// steps {
// sh 'docker stop myapp && docker rm myapp || true'
// sh 'docker run -d -p 8080:8080 --name myapp myapp:${BUILD_NUMBER}'
// }
// }
}
post {
always {
echo '流水线已结束'
}
success {
echo '🎉 项目部署成功!'
}
failure {
echo '⚠️ 部署失败,请检查日志!'
}
}
}