@@ -35,25 +35,14 @@ pipeline {
}
stage('构建项目') {
- when {
- branch 'feature/jenkinsfile'
- }
- steps {
- nodejs('v16'){
- sh '''
- npm run build:test
- '''
- stage('构建项目') {
- branch 'feature/jenkinsfile2'
steps {
nodejs('v16'){
sh '''
- npm run build:uat
+ if [ "$branch" == "feature/jenkinsfile" ]; then
+ npm run build:test
+ elif [ "$branch" == "feature/jenkinsfile2" ]; then
+ npm run build:uat
+ fi
'''