You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何在Jenkins Blue Ocean中禁用Jenkins函数日志?

解决Jenkins Blue中readJSON、httpRequest步骤单独显示的问题

可以通过以下几种实用方法隐藏这些步骤的日志和独立条目,提升流水线可读性:

方法一:用script块包裹目标步骤

将readJSON和httpRequest放在script块内执行,Jenkins Blue会把整个script块识别为单个步骤,不会拆分内部的函数调用为单独条目:

script {
    def apiResponse = httpRequest 'https://example.com/api/data'
    def parsedData = readJSON text: apiResponse.content
}

方法二:利用httpRequest的quiet参数

部分版本的httpRequest插件支持quiet参数,设置为true可直接抑制该步骤的日志输出和独立条目显示:

def apiResponse = httpRequest quiet: true, url: 'https://example.com/api/data'

注:readJSON暂无官方提供的类似参数,建议结合第一种方法处理。

方法三:封装自定义步骤统一控制

如果多处用到这些操作,可以封装成自定义流水线步骤,调用时仅显示自定义步骤的条目:

def fetchAndParseJson(String targetUrl) {
    script {
        def resp = httpRequest quiet: true, url: targetUrl
        return readJSON text: resp.content
    }
}

// 调用时仅显示fetchAndParseJson这一个步骤
def data = fetchAndParseJson('https://example.com/api/data')

内容的提问来源于stack exchange,提问作者GSerum_

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.05 17:00:56