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

标签 jenkins github devops

我在 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/

相关文章:

git - 使用 git 删除不在本地存储库中的分支

git - 查询有关以窗口用户身份使用 git 和 VS2010 的问题

html - 如何将可下载文件添加到我的 Github.io 页面?

java - 如果我的修复包含两个 java 文件,我将在 git 中提交两个文件。 Jenkins 应该生成包含两个 .class 文件但不是所有文件的 .zip 文件

build - 有没有办法自动执行 SEO 检查?

git - 使用 Appian 进行版本管理和持续部署?

Azure DevOps 项目 SharePoint 门户 : Document Repository

GitHub 操作 : sharing/referencing jobs between workflows

linux - 禁用 linux 用户身份验证,除了通过 ldap

java - Jenkins/Hudson 参数使用