pipeline {
agent any
parameters {
gitParameter(
branchFilter: 'origin/(.*)', //高级中设置为这个
defaultValue: 'master',
name: 'BRANCH',
type: 'PT_BRANCH',
useRepository: 'https://gitlab.lingtingshidai.com/lt/java/lt-comment-service.git'
)
}
stages {
stage('Checkout') {
steps {
git branch: "${params.BRANCH}", credentialsId: '0f085850-1868-454d-8520-f59542af257f', url: 'https://gitlab.lingtingshidai.com/lt/java/lt-comment-service.git'
}
}
stage('Build') {
steps {
script {
sh 'source /etc/profile && /usr/local/jenkins/apache-maven-3.6.3/bin/mvn clean package -U -Dmaven.test.skip=true -B'
}
}
}
}
}
标签:comment,pipeline,git,service,lt,BRANCH,分支 From: https://www.cnblogs.com/cheyunhua/p/18293578