pipeline git引數化構建
阿新 • • 發佈:2022-04-06
1.外掛
git parameter
2.程式碼
pipeline { parameters { gitParameter branchFilter: 'origin/(.*)', defaultValue: 'master', name: 'BRANCH', type: 'PT_BRANCH' choice choices: ['dev', 'test'], name: 'NAMESPACE' } options { buildDiscarder(logRotator(numToKeepStr: '15')) timestamps() timeout(time:1, unit:'HOURS') } agent {label 'jnlp-slave'} stages { stage('set buildDescription') { steps { script { buildName ("${JOB_NAME}-${env.BUILD_NUMBER}") buildDescription ("部署環境: ${params.NAMESPACE} \n 程式碼分支:${params.BRANCH}") } } } stage('Source') { steps { //sh 'git clone http://192.168.90.170:32187/root/demo-java.git' git branch: "${params.BRANCH}", url: 'http://192.168.90.170:32187/root/demo-java.git' } } }