bitbucket - 从 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`'
}
}
}
}
推荐阅读
- ios - 更改 Xcode 11 后未找到架构 x86_64 的符号
- java - System.err.print(ln) 与 system.out.println 在同一行吗?JAVA
- python - 把Python的输入函数变成C
- reactjs - 除了异步操作之外,redux 中的“副作用”究竟是什么?
- swift - 当我物理更新我的 Firestore 数据库字段时,我的应用程序无法访问这些新字段,并显示旧字段
- tkinter - tkinter 的文件对话框询问打开文件名无法显示文件系统
- r - 如何按组查找滚动列中的前 3 个值?
- c# - 创建视图后未将对象引用设置为对象的实例
- quickfix - 如何启动/停止特定会话连接
- amazon-web-services - 如何在 jupyter 中显示完整输出不仅是最后一个结果 - 对于 aws emr pyspark