如何在Jenkins的控制台输出中隐藏checkout scm step输出 [英] How to hide the checkout scm step output in console output of Jenkins

查看:230
本文介绍了如何在Jenkins的控制台输出中隐藏checkout scm step输出的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Jenkinsfile(脚本化管道)中的第一阶段是checkout scm,它简要介绍了GitHub Checkout和所有与修订有关的内容,我不想在Jenkins控制台输出中显示.

My first stage in Jenkinsfile(scripted pipeline) is checkout scm, which gives a brief description about the GitHub checkouts and all revision related things which I don't want to display in Jenkins console output.

是否可以将其隐藏在Jenkins的控制台输出中.以下控制台输出来自Jenkins,用于我想隐藏的scm步骤

Is it possible to hide this in console output of Jenkins. following console output is from Jenkins for checkout scm step, which I want to hide

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" 

推荐答案

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

Checkout scm has option to provide arguments like this and there is a quietoperation mode availabe

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

除非git命令失败,否则这将禁止stdout和stderr

This will suppress stdout and stderr, unless the git command fails

如果您想使用git结帐

If you want to checkout using git

git checkout origin master --quiet
git checkout origin master --q

哪些是git中可用的选项.

Which is an available option in git.

希望它会有所帮助:)

这篇关于如何在Jenkins的控制台输出中隐藏checkout scm step输出的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆