gpt4 book ai didi

jenkins - 如何在 jenkins 中执行 "Prune stale remote-tracking branches"上的代码?

转载 作者:行者123 更新时间:2023-12-05 02:16:53 25 4
gpt4 key购买 nike

删除分支后,我想为作业创建的工件(例如 AMI、docker 图像、terraform 服务)执行额外的清理代码。我正在使用声明式管道,是否有钩子(Hook)或插件可以让我实现这一点?

最佳答案

管道部分的附加行为 下有一个选项。请注意,此处选择了来自 SCM 定义的管道脚本。

Pipeline script from SCM

这也可以通过checkout 步骤在管道脚本中完成。 https://jenkins.io/doc/pipeline/steps/workflow-scm-step/

$类:PruneStaleBranch

使用 Jenkins 片段生成器生成的示例:

checkout([$class: 'GitSCM', branches: [[name: '*/master']], 
doGenerateSubmoduleConfigurations: false, extensions: [[$class:
'PruneStaleBranch']], submoduleCfg: [], userRemoteConfigs:
[[credentialsId: 'credential-id-here', url: 'git@github.com:my-
repo.git']]])

关于jenkins - 如何在 jenkins 中执行 "Prune stale remote-tracking branches"上的代码?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48936345/

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