Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You can use the <a href="https://wiki.jenkins-ci.org/display/JENKINS/Build+Name+Setter+Plugin" rel="nofollow">Build Name Setter Plugin</a> to change the name based on available Tokens. I'm not sure if a TOKEN exists for your Git branch name, but if all else fails, you can use a shell script build step and write it to a property file, and then use the macro: ${PROPFILE,..}, e.g.:</p> <pre><code>#${BUILD_NUMBER}_${PROPFILE,file="parameters.properties",property="BUILD_TYPE"} </code></pre> <p>Alternatively, you can use the <a href="https://wiki.jenkins-ci.org/display/JENKINS/Build+Name+Setter+Plugin" rel="nofollow">Description Setter Plugin</a> to change the build description (that also appears in the Build Executor status) based on the build output. Again, you can use the same trick and use a shell script to print out the branch name in the build output, and use a regex to parse it out of your build log.</p> <p>A small limitation: either of this will only update the name/description after the job completes, so for long-running jobs, it's not immediately visible. But for short ones, and for audit purposes, this works well.</p> <p>[EDIT] Some time later, I started using the <a href="https://wiki.jenkins-ci.org/display/JENKINS/EnvInject+Plugin" rel="nofollow">EnvInject plugin</a>, which adds my build parameters to the environment early enough for the <a href="https://wiki.jenkins-ci.org/display/JENKINS/Build+Name+Setter+Plugin" rel="nofollow">Build Name Setter Plugin</a> to use them.</p> <p>This has the advantage of setting the build name immediately.</p> <p>Also, you can get the <strong>Git branch</strong> with ${GIT_BRANCH}. Here's the doc for it:</p> <pre><code>${GIT_BRANCH} Expands to the name of the branch that was built. Parameters: all If specified, all the branches that point to the given commit is listed. By default, the token expands to just one of them. fullName If specified, this token expands to the full branch name, such as 'origin/master'. Otherwise, it only expands to the short name, such as 'master'. </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload