使用 Jenkinsfile 创建一个基于master 的release candidate 分支,请用pipeline 声明式代码实现,包括git stage凭证使用SSH的实现
时间: 2023-04-10 09:04:58 浏览: 71
pipeline {
agent any
stages {
stage('Checkout') {
steps {
checkout([$class: 'GitSCM', branches: [[name: 'master']], doGenerateSubmoduleConfigurations: false, extensions: [], submoduleCfg: [], userRemoteConfigs: [[credentialsId: 'ssh-credentials', url: 'git@github.com:username/repo.git']]])
}
}
stage('Create Release Candidate Branch') {
steps {
sh 'git checkout -b release-candidate'
sh 'git push origin release-candidate'
}
}
}
post {
success {
echo 'Release candidate branch created successfully!'
}
failure {
echo 'Failed to create release candidate branch!'
}
}
options {
gitCredentialsId('ssh-credentials')
}
}