Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-21070

"Set build displayname" does not work

    XMLWordPrintable

Details

    Description

      Nothing happens if I activate the option "Build Environment" > "Create Delivery Pipeline version" > "Set build displayname". The display name of the builds of this job are still named #NNN (for example #26).

      Attachments

        Issue Links

          Activity

            Also, not sure if I'm doing it wrong, but the Version associated with each pipeline instance is not set either, it seems to be stuck with the build name of the first build job in the pipeline. Would this be related ?

            pmatignon Patrice Matignon added a comment - Also, not sure if I'm doing it wrong, but the Version associated with each pipeline instance is not set either, it seems to be stuck with the build name of the first build job in the pipeline. Would this be related ?

            The first job in the pipeline can just use "Create Delivery Pipeline version".
            So make sure that the first job entered in the delivery pipeline view as the initial job are configured with "Build Environment" > "Create Delivery Pipeline version" > "Set build displayname".

            patbos Patrik Boström added a comment - The first job in the pipeline can just use "Create Delivery Pipeline version". So make sure that the first job entered in the delivery pipeline view as the initial job are configured with "Build Environment" > "Create Delivery Pipeline version" > "Set build displayname".

            So in effect, for any other job in the pipeline this function is ineffective?
            If so, I think this restriction 1) is not made very clear ; and 2) might not be fully justified. If you agree, I could enter a couple different JIRA's.

            pmatignon Patrice Matignon added a comment - So in effect, for any other job in the pipeline this function is ineffective? If so, I think this restriction 1) is not made very clear ; and 2) might not be fully justified. If you agree, I could enter a couple different JIRA's.

            I agree it is not clear that the version of the pipeline is set by the first job build display name.
            It can also be done with the Build Setter Plugin (https://wiki.jenkins-ci.org/display/JENKINS/Build+Name+Setter+Plugin).
            I will make sure that the wiki will have that information.

            Just to understand your problem better, do you want to set the version later in the pipeline?

            patbos Patrik Boström added a comment - I agree it is not clear that the version of the pipeline is set by the first job build display name. It can also be done with the Build Setter Plugin ( https://wiki.jenkins-ci.org/display/JENKINS/Build+Name+Setter+Plugin ). I will make sure that the wiki will have that information. Just to understand your problem better, do you want to set the version later in the pipeline?

            Thanks for the quick feedback Patrick.
            Yes, I have some "pre-release" tasks in the first stage, that can't really determine the pipeline version yet (at least not the way I want it).
            Also, if any job in the pipeline has the "Set Delivery Pipeline Version" section in its configuration, it implies that the pipeline version could be set/reset at any time during the build flow within that instance. And why couldn't it ?

            pmatignon Patrice Matignon added a comment - Thanks for the quick feedback Patrick. Yes, I have some "pre-release" tasks in the first stage, that can't really determine the pipeline version yet (at least not the way I want it). Also, if any job in the pipeline has the "Set Delivery Pipeline Version" section in its configuration, it implies that the pipeline version could be set/reset at any time during the build flow within that instance. And why couldn't it ?
            7bit Julian M. added a comment - - edited

            Hi Patrik, thanks for getting back to me so fast. I understand it sets the displayname only in the first job. But for me, it is NOT setting it in the initial job, where I activated this option.

            My setup is:

            1. job: Activated "Create delivery pipeline" + "Set build displayname"
            2-4 job: Set ${PIPELINE_VERSION} by using the Build Setter plugin

            Still, my builds are named #26 for example. I am still using Jenkins 1.518 (because we built a lot of legacy Java 5 projects, which do not build good on newer versions), perhaps this could be an issue?

            7bit Julian M. added a comment - - edited Hi Patrik, thanks for getting back to me so fast. I understand it sets the displayname only in the first job. But for me, it is NOT setting it in the initial job, where I activated this option. My setup is: 1. job: Activated "Create delivery pipeline" + "Set build displayname" 2-4 job: Set ${PIPELINE_VERSION} by using the Build Setter plugin Still, my builds are named #26 for example. I am still using Jenkins 1.518 (because we built a lot of legacy Java 5 projects, which do not build good on newer versions), perhaps this could be an issue?

            Hi Julian,

            I tried Jenkins 1.518 with Delivery Pipeline Plugin 0.6.7.
            Created a job "a" with "Create Delivery Pipeline version", "set display name" and template 1.0.0.${BUILD_NUMBER}
            Created a job "b" with Build Name Setter with build name ${ENV,var="PIPELINE_VERSION"}.
            Job a triggers b.

            Both build are named with the version 1.0.0.1 after the first build.

            So I cant reproduce your problem.
            The plugin supports Jenkins 1.509 and greater so the your version of Jenkins should not be the problem.

            Can you give me some more details?
            What JVM and version are used for Jenkins?
            What template are you using for the version in the first job?

            patbos Patrik Boström added a comment - Hi Julian, I tried Jenkins 1.518 with Delivery Pipeline Plugin 0.6.7. Created a job "a" with "Create Delivery Pipeline version", "set display name" and template 1.0.0.${BUILD_NUMBER} Created a job "b" with Build Name Setter with build name ${ENV,var="PIPELINE_VERSION"}. Job a triggers b. Both build are named with the version 1.0.0.1 after the first build. So I cant reproduce your problem. The plugin supports Jenkins 1.509 and greater so the your version of Jenkins should not be the problem. Can you give me some more details? What JVM and version are used for Jenkins? What template are you using for the version in the first job?

            Hi Patrice,

            Versions should be created as early as possible for a pipeline instance, but I can see your point that it should be possible to change/update the version in a later task/job if the version cant be generated in the first job. I suggest that you create a new issue for that.

            patbos Patrik Boström added a comment - Hi Patrice, Versions should be created as early as possible for a pipeline instance, but I can see your point that it should be possible to change/update the version in a later task/job if the version cant be generated in the first job. I suggest that you create a new issue for that.
            7bit Julian M. added a comment -

            Since you tried it successful, I tested a few settings. It seems like it's the pattern. It is not working if you are having an "+" in your pattern.

            My pattern was like 1.6.0+${BUILD_NUMBER}.${SVN_REVISION} (according to Semantic Versioning http://semver.org/ ). No displayname is set if this pattern is choosen.
            If I change it to 1.6.0_${BUILD_NUMBER}, it's working.

            7bit Julian M. added a comment - Since you tried it successful, I tested a few settings. It seems like it's the pattern. It is not working if you are having an "+" in your pattern. My pattern was like 1.6.0+${BUILD_NUMBER}.${SVN_REVISION} (according to Semantic Versioning http://semver.org/ ). No displayname is set if this pattern is choosen. If I change it to 1.6.0_${BUILD_NUMBER}, it's working.

            I have now managed to recreate your problem, and it was the pattern that was the problem.
            Unfortunately it is just possible to see the error in the Jenkins log file:

            WARNING: Error creating version
            org.jenkinsci.plugins.tokenmacro.MacroEvaluationException: Unrecognized macro 'SVN_REVISION' in '1.6.0+${BUILD_NUMBER}.${SVN_REVISION}'
            	at org.jenkinsci.plugins.tokenmacro.TokenMacro.expand(TokenMacro.java:198)
            

            If you change the pattern to:

            1.6.0+${BUILD_NUMBER}.${ENV,var="SVN_REVISION"} 
            

            it works.

            I will add a error message the the console output of the build to it will be easier to see these types of errors.

            patbos Patrik Boström added a comment - I have now managed to recreate your problem, and it was the pattern that was the problem. Unfortunately it is just possible to see the error in the Jenkins log file: WARNING: Error creating version org.jenkinsci.plugins.tokenmacro.MacroEvaluationException: Unrecognized macro 'SVN_REVISION' in '1.6.0+${BUILD_NUMBER}.${SVN_REVISION}' at org.jenkinsci.plugins.tokenmacro.TokenMacro.expand(TokenMacro.java:198) If you change the pattern to: 1.6.0+${BUILD_NUMBER}.${ENV,var="SVN_REVISION"} it works. I will add a error message the the console output of the build to it will be easier to see these types of errors.
            7bit Julian M. added a comment -

            Great, thanks for your fast help.

            7bit Julian M. added a comment - Great, thanks for your fast help.

            Patrice, I have created JENKINS-21149 for changing pipeline version in later stages/tasks.

            patbos Patrik Boström added a comment - Patrice, I have created JENKINS-21149 for changing pipeline version in later stages/tasks.

            People

              patbos Patrik Boström
              7bit Julian M.
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: