gpt4 book ai didi

jenkins - 如何获取 Jenkins Pipeline 构建以显示特定分支的更改历史记录(更改)

转载 作者:行者123 更新时间:2023-12-02 02:59:51 24 4
gpt4 key购买 nike

我正在使用声明性管道和常规脚本来检查我的分支。我使用结帐步骤结帐:

    [$class: 'GitSCM', 
branches: [[name: "${selectedBranch}"]],
browser: [$class: 'BitbucketWeb', repoUrl: 'myURL'],
doGenerateSubmoduleConfigurations: false,
extensions:
[[$class: 'CloneOption', noTags: false, reference: "${cloneReference}", shallow: true, timeout: 5]],
submoduleCfg: [],
userRemoteConfigs: [[url: "${projectDetails.repositoryAddress}"]]])

效果很好。但是,当查看更改历史记录时,它显示了我的共享库的历史记录,而不是 checkout 的实际分支的历史记录。这意味着我获得了 Jenkins 常规更改的所有历史记录,但没有正在构建的实际解决方案/源代码的历史记录。我找不到克服这个问题的方法。

在我的 Jenkins 工作中我看到了这个:

Started by user Me

Revision: 53eb41e0c05fd4cb466268947102990b2b14354e
GroovyImplementation
Revision: 825d8201904b000f479ebc91c9d244cfb956dd85
refs/remotes/origin/releases/release-2.18

在“更改”页面上,我看到“GroovyImplementation”的更改(通常没有),但我希望对“refs/remotes/origin/releases/release-2.18”进行更改,这是有意义的更改所在。

类似地,在舞台 View 上,我看到“GroovyImplementation”的提交数量,而不是发布分支的数量。

如何在不使用多管道构建的情况下显示发布分支的 checkout 信息?

最佳答案

由于您使用的是分支 selectedBranch - 您想要的内容应该由 SCM step plugin 提供开箱即用的支持(changelog 默认设置为 true)。

但是,我发现它不起作用,所以你可以做的是使用此插件的扩展:[$class: 'ChangelogToBranch', options: [compareRemote: 'myURL',compareTarget: "${selectedBranch}"]]

如您所见,extensions: 获取一个数组数组,因此您只需将此扩展添加到现有的中即可,例如

extensions: 
[
[$class: 'CloneOption', noTags: false, reference: "${cloneReference}", shallow: true, timeout: 5],
[$class: 'ChangelogToBranch', options: [compareRemote: 'myURL', compareTarget: "${selectedBranch}"]]
],

关于jenkins - 如何获取 Jenkins Pipeline 构建以显示特定分支的更改历史记录(更改),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60233023/

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