Jenkins Pipeline sh display name/label

后端 未结 8 1351

With Jenkins 2 Pipeline plugin, there\'s a useful feature allowing a quick overview of the pipeline stages and status of steps, including logging output.

However, if

8条回答
  •  甜味超标
    2020-12-24 05:23

    Try this, a good workaround

    import org.jenkinsci.plugins.workflow.cps.CpsThread
    import org.jenkinsci.plugins.workflow.actions.LabelAction
    
    
        def test() {
        def xyz = "Prints PWD"
        try {
            sh script: 'pwd'
        }
        finally {
            CpsThread.current().head.get().addAction(new LabelAction("Shell script ${xyz} "))
        }
    }
    

提交回复
热议问题