Jenkins Pipeline sh display name/label

后端 未结 8 1390

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:09

    Update Feb 2019:

    According to gertvdijk's answer below, it is now possible to assign an optional label to the sh step, starting from v2.28, and for those who can't upgrade yet, there's also a workaround. Please check his answer for details and comments!


    Previous version (hover to see it):

    As far as I know, that's currently not possible. In the Jenkins tracker, there is a Name or alias Shell Script Step (sh) issue which is similar to your situation:

    The sh step adds a "Shell Script" step in the Pipeline. However, there could be multiple such steps including steps from various plugins (e.g., Docker), which makes it hard to distinguish the steps. We should perhaps add an optional parameter to sh to specify a name or alias which would then appear in the pipeline steps. e.g., the following can be the step for npm which would show as "Shell script: npm" in the pipeline view.

    sh cmd:"npm install", name: "npm"
    However, it was closed as a duplicate of the older Allow stage to operate as a labelled block which has been fixed recently and seems to be included in v2.2 of the pipeline-stage-step-plugin (see changelog).

    It seems that stages can now be nested and they will appear in the view table, but I don't think it's what you're looking for.

提交回复
热议问题