devops icon indicating copy to clipboard operation
devops copied to clipboard

Jenkinsfile 参数化构建

Open heidsoft opened this issue 2 years ago • 0 comments

parameters { string(name: 'BRANCH', defaultValue: 'master', description: 'Branch to checkout') string(name: 'COMMIT', defaultValue: 'HEAD', description: 'Commit to checkout') }

stages { stage('Checkout') { steps { git branch: "${params.BRANCH}", url: 'https://github.com/username/repo.git' sh "git checkout ${params.COMMIT}" } } // 其他的stages... }

heidsoft avatar Nov 06 '23 06:11 heidsoft