devops
devops copied to clipboard
Jenkinsfile 参数化构建
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... }