gpt4 book ai didi

jenkins - 如何在 Jenkins 的控制台输出中隐藏 checkout scm 步骤输出

转载 作者:行者123 更新时间:2023-12-03 13:42:29 25 4
gpt4 key购买 nike

我在 Jenkinsfile(脚本化管道)中的第一个阶段是 checkout scm,它简要描述了 GitHub checkouts 和所有与修订相关的事情 我不想在 Jenkins 控制台输出中显示 .

是否可以在 Jenkins 的控制台输出中隐藏它。
以下控制台输出来自 Jenkins,用于结帐 scm 步骤,我想隐藏它

Cloning the remote Git repository
Cloning repository https://github.com/forpi/cherry-pik.git
> git init /home/ubuntu/.jenkins/workspace/Dummy-project # timeout=10
Fetching upstream changes from https://github.com/forpi/cherry-pik.git
> git --version # timeout=10
> git fetch --tags --progress https://github.com/forpi/cherry-pik.git +refs/heads/*:refs/remotes/origin/*
> git config remote.origin.url https://github.com/forpi/cherry-pik.git # timeout=10
> git config --add remote.origin.fetch +refs/heads/*:refs/remotes/origin/* # timeout=10
> git config remote.origin.url https://github.com/forpi/cherry-pik.git # timeout=10
Fetching upstream changes from https://github.com/forpi/cherry-pik.git
> git fetch --tags --progress https://github.com/forpi/cherry-pik.git +refs/heads/*:refs/remotes/origin/*

> git rev-parse refs/remotes/origin/master^{commit} # timeout=10
> git rev-parse refs/remotes/origin/origin/master^{commit} # timeout=10
Checking out Revision b80c4d6b655429d7f84347b4192461cc3d68283e (refs/remotes/origin/master)
> git config core.sparsecheckout # timeout=10
> git checkout -f b80c4d6b69c429d7f84347b4192461cc3d68283e
> git branch -a -v --no-abbrev # timeout=10
> git checkout -b master b80c4d6b655429d7f84347b4192461cc3d68283e
Commit message: "lets try this again"

最佳答案

Checkout scm 可以选择提供这样的参数,并且有一个安静的操作模式可用

checkout([$class: 'SubversionSCM', 
additionalCredentials: [],
locations: [[cancelProcessOnExternalsFail: true,
credentialsId: '234243-45654-234randomstuff',
depthOption: 'infinity',
ignoreExternalsOption: true,
local: '.',
remote: 'https://starkindustries/ironman/superGlueForThanosFingers/repo']],
**quietOperation: true,**
workspaceUpdater: [$class: 'UpdateUpdater']])

你也可以试试这个
checkout scm &> /dev/null

这将抑制 stdout 和 stderr,除非 git 命令失败

或者

如果您想使用 git 结帐
git checkout origin master --quiet
git checkout origin master --q

这是 git 中的一个可用选项。

希望能帮助到你 :)

关于jenkins - 如何在 Jenkins 的控制台输出中隐藏 checkout scm 步骤输出,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52107661/

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