gpt4 book ai didi

git - 我如何在声明性的 Jenkins 管道脚本中添加 git fetch 标签

转载 作者:行者123 更新时间:2023-12-05 07:29:08 27 4
gpt4 key购买 nike

我是 Jenkins 和 Git 的新手,我仍在尝试弄清楚如何使用 jenkins 声明式管道脚本。我也只有很少的编程背景,所以 groovy 脚本对我来说有点陌生。

在我的声明性管道脚本中,我希望能够在 jenkins 构建过程中 pull 存储库时获取我所有的 git 标签和描述。

目前我拥有的是:

stage ('get_repo') {
checkout([$class: 'GitSCM',
branches: [[name: '*/rc']],
doGenerateSubmoduleConfigurations: false,
extensions: [],
submoduleCfg: [],
userRemoteConfigs: [[credentialsId: 'git',
url: 'git@bitbucket.org:myrepo/myrepo.git']]])
}

我不确定我应该添加什么。提前致谢!

最佳答案

试试这个

checkout([$class: 'GitSCM',
branches: [[name: '*/master']],
doGenerateSubmoduleConfigurations: false,
extensions: [[$class: 'CloneOption',
depth: 0,
**noTags**: **false**,
reference: '', shallow: false]],
submoduleCfg: [],
userRemoteConfigs: [[]]]
)

关于git - 我如何在声明性的 Jenkins 管道脚本中添加 git fetch 标签,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52908292/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com