从Gerrit到Bitbucket的远程分支



最近我们已经从使用 gerrit 转向 Bitbucket。Gerrit 中很少有远程分支需要连接到 Bitbucket。由于分支数量很多,因此需要自动化。任何指针都会有所帮助

示例 jenkinsfile 将远程分支从 gerrit 推送到 Bitbucket -


// ssh credentials
def credentials_id = 'XXXXXXXXXXXXXXX-UUUUUU-III'
pipeline {
options {
buildDiscarder(logRotator(numToKeepStr: '600'))
disableConcurrentBuilds()
}
agent { node { label 'Master' } }
stages {
stage('try') {
steps {
checkout(
[
$class: 'GitSCM',
branches: [
[
name: '${gerrit-branch-name}'
]
],
doGenerateSubmoduleConfigurations: false,
extensions: [
[
$class: 'CheckoutOption',
timeout: 20
],
[ $class: 'LocalBranch',
localBranch: '${local-branch-name-bitbucket}'
]
],
gitTool: 'Default',
submoduleCfg: [],
userRemoteConfigs: [
[
credentialsId: credentials_id,
name: 'gerrit',
url: '${gerrit-URL}'
],
[
credentialsId: credentials_id,
name: 'bitbucket',
url: '${bitbucket-URL}'
]
]
]
)
}
}
stage('Push updates of branch to Bitbucket') {
steps {
bat 'git push --tags bitbucket ${gerrit-branch-name}:refs/heads/${local-branch-name-bitbucket}`enter code here`'
}
}    
}
}

相关内容

  • 没有找到相关文章

最新更新