Search code examples
pipelinego-cd

Creating customized Pipeline Label in GoCD pipeline


I want to add the branch name which I have pointed in my Materials section in GoCD pipeline.

Currently, my pipeline label has the count and commits hash.

For example:

if my branch name is "master" the label should be 104-master-82862b9a99599130e0306429882ead4c22d07ce4

if my branch name is "US73173" the label should be 104-US73173-82862b9a99599130e0306429882ead4c22d07ce4

Please help me on this.


Solution

  • You should be able to do this by:

    1. Creating a pipeline parameter in the Parameters tab to specify your git branch. ex: name: mybranch value: US73173
    2. Using the new pipeline parameter to specify your branch instead of directly specifying it for the material in the Materials tab ex: #{mybranch}
    3. Edit the label template on the pipeline in the General Options tab to use the new pipeline parameter. For example: ${COUNT}-#{mybranch}-${git}

    Go-CD Labels: https://docs.gocd.org/current/configuration/admin_use_custom_pipeline_label.html