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

The build name setter does not work for multi-configuration jobs

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Major Major
    • None
    • iMac OS X 10.6.8

      I have installed Jenkins 1.409.1 and build-name-setter 1.3. I have enabled the build-name-setter for a free-stype software project and it works. However when I enable it for a multi-configuration job it does not work right. For the purposes of description I will refer to the multi-configuration job as the parent job, and to the individual jobs the defined in the Configuration Matrix as the child jobs. In the parent job configuration I set the build name to a simple string. Here is what happens: The parent job uses the standard incrementing build number rather than the string. The child jobs in the Configuration Matrix do correctly use the string as the build name. However if I use an environment variable as the build name, the child jobs' names are blank - as though the environment variables are not passed to the child jobs. Note the specific environment variable I tried to use in JOB-REVISION (comes from the version setter plugin I think).

      Screen shot #1 is a free-style software project that works with the new build name (#3.0.18).
      Screen shot #2 is a multi-configuration project (parent) - you can see that the build name is the incrementing number even though I've enabled the build-name-setter.
      Screen shot #3 is one of the multi-configuration project's child jobs. You can see where it works with a simple string (FRED), but the blanks are attempts at using $(ENV,var="JOB_REVISION"}.

      I am not sure if the fault lies in this plugin, or in the core Jenkins code that implements the multi-configuration job. Please advise if this bug should be reported to a different component.

          [JENKINS-10613] The build name setter does not work for multi-configuration jobs

          Lev Mishin added a comment -

          try to use new version of the plugin and Jenkins

          Lev Mishin added a comment - try to use new version of the plugin and Jenkins

          Marek Martyniak added a comment - - edited

          I have the same issue. Jenkins ver. 1.624. Plugin ver. 1.5.1.

          Marek Martyniak added a comment - - edited I have the same issue. Jenkins ver. 1.624. Plugin ver. 1.5.1.

          Jeremy Rampon added a comment -

          Jenkins 1.647 with plugin version 1.5.1.

          Here is how my matrix project is setup.

          Part 1
          In the Build Environment section, I set the build-name-setter option to #${BUILD_NUMBER} ${ENV,var="VERSION"}. This is so that as soon as the build starts, we can tell what base version it's building. This works fine – meaning the parent matrix job is correctly renamed, while the children still have their original name based on the project matrix values.

          Part 2
          In addition to the above, in the Build section, I have an "Update build name" build type, with "use macro" set to #${BUILD_NUMBER} ${PROPFILE,file="properties.txt",property="BUILD_TAG"}. At the end of the builds for each of the matrix project's children I see in the log that it seems to work as expected:

          • Evaluated macro: '#1_some-tag'
          • Setting build name to '#1_some-tag'

          But the actual matrix project build name still shows the name set in part 1 above.

          Any idea what could be causing this?

          Jeremy Rampon added a comment - Jenkins 1.647 with plugin version 1.5.1. Here is how my matrix project is setup. Part 1 In the Build Environment section, I set the build-name-setter option to #${BUILD_NUMBER} ${ENV,var="VERSION"}. This is so that as soon as the build starts, we can tell what base version it's building. This works fine – meaning the parent matrix job is correctly renamed, while the children still have their original name based on the project matrix values. Part 2 In addition to the above, in the Build section, I have an "Update build name" build type, with "use macro" set to #${BUILD_NUMBER} ${PROPFILE,file="properties.txt",property="BUILD_TAG"}. At the end of the builds for each of the matrix project's children I see in the log that it seems to work as expected: Evaluated macro: '#1_some-tag' Setting build name to '#1_some-tag' But the actual matrix project build name still shows the name set in part 1 above. Any idea what could be causing this?

          Lev Mishin added a comment -

          jeremyrampon It would be great if you provide an xml configuration of your jobs

          Lev Mishin added a comment - jeremyrampon It would be great if you provide an xml configuration of your jobs

          Jeremy Rampon added a comment -

          Hi Lev, here it is:

          <?xml version='1.0' encoding='UTF-8'?>
          <matrix-project plugin="matrix-project@1.6">
            <actions/>
            <description></description>
            <keepDependencies>false</keepDependencies>
            <properties>
              <jenkins.model.BuildDiscarderProperty>
                <strategy class="hudson.tasks.LogRotator">
                  <daysToKeep>20</daysToKeep>
                  <numToKeep>-1</numToKeep>
                  <artifactDaysToKeep>-1</artifactDaysToKeep>
                  <artifactNumToKeep>-1</artifactNumToKeep>
                </strategy>
              </jenkins.model.BuildDiscarderProperty>
              <com.sonyericsson.jenkins.plugins.bfa.model.ScannerJobProperty plugin="build-failure-analyzer@1.14.0">
                <doNotScan>false</doNotScan>
              </com.sonyericsson.jenkins.plugins.bfa.model.ScannerJobProperty>
              <com.sonyericsson.rebuild.RebuildSettings plugin="rebuild@1.25">
                <autoRebuild>false</autoRebuild>
                <rebuildDisabled>false</rebuildDisabled>
              </com.sonyericsson.rebuild.RebuildSettings>
              <hudson.model.ParametersDefinitionProperty>
                <parameterDefinitions>
                  <com.seitenbau.jenkins.plugins.dynamicparameter.StringParameterDefinition plugin="dynamicparameter@0.2.0">
                    <name>VERSION</name>
                    <description></description>
                    <__uuid>86a701b9-58cb-400b-b581-aae0b266f14c</__uuid>
                    <__remote>false</__remote>
                    <__script>new Date().format(&quot;yy.M.d&quot;)</__script>
                    <__localBaseDirectory serialization="custom">
                      <hudson.FilePath>
                        <default>
                          <remote>/apps/jenkins/dynamic_parameter/classpath</remote>
                        </default>
                        <boolean>true</boolean>
                      </hudson.FilePath>
                    </__localBaseDirectory>
                    <__remoteBaseDirectory>dynamic_parameter_classpath</__remoteBaseDirectory>
                    <__classPath></__classPath>
                    <readonlyInputField>false</readonlyInputField>
                  </com.seitenbau.jenkins.plugins.dynamicparameter.StringParameterDefinition>
                  <hudson.model.StringParameterDefinition>
                    <name>COMMIT_ID</name>
                    <description></description>
                    <defaultValue>refs/heads/devp</defaultValue>
                  </hudson.model.StringParameterDefinition>
                  <hudson.plugins.matrix__configuration__parameter.MatrixCombinationsParameterDefinition plugin="matrix-combinations-parameter@1.0.9">
                    <name>PLATFORM</name>
                    <description></description>
                    <defaultCombinationFilter>(BuildNode==&quot;windows&quot;) || (BuildNode==&quot;linux&quot;)</defaultCombinationFilter>
                  </hudson.plugins.matrix__configuration__parameter.MatrixCombinationsParameterDefinition>
                </parameterDefinitions>
              </hudson.model.ParametersDefinitionProperty>
            </properties>
            <scm class="hudson.plugins.git.GitSCM" plugin="git@2.4.4">
              <configVersion>2</configVersion>
              <userRemoteConfigs>
                <hudson.plugins.git.UserRemoteConfig>
                  <url>some-git-server</url>
                  <credentialsId>some-cred-id</credentialsId>
                </hudson.plugins.git.UserRemoteConfig>
              </userRemoteConfigs>
              <branches>
                <hudson.plugins.git.BranchSpec>
                  <name>${COMMIT_ID}</name>
                </hudson.plugins.git.BranchSpec>
              </branches>
              <doGenerateSubmoduleConfigurations>false</doGenerateSubmoduleConfigurations>
              <submoduleCfg class="list"/>
              <extensions>
                <hudson.plugins.git.extensions.impl.LocalBranch>
                  <localBranch>devp</localBranch>
                </hudson.plugins.git.extensions.impl.LocalBranch>
              </extensions>
            </scm>
            <quietPeriod>20</quietPeriod>
            <scmCheckoutRetryCount>3</scmCheckoutRetryCount>
            <assignedNode>master</assignedNode>
            <canRoam>false</canRoam>
            <disabled>false</disabled>
            <blockBuildWhenDownstreamBuilding>false</blockBuildWhenDownstreamBuilding>
            <blockBuildWhenUpstreamBuilding>false</blockBuildWhenUpstreamBuilding>
            <authToken>some-token</authToken>
            <triggers/>
            <concurrentBuild>true</concurrentBuild>
            <customWorkspace>sandbox</customWorkspace>
            <axes>
              <hudson.matrix.LabelExpAxis>
                <name>BuildType</name>
                <values>
                  <string>debug</string>
                  <string>release</string>
                </values>
              </hudson.matrix.LabelExpAxis>
              <hudson.matrix.LabelExpAxis>
                <name>BuildNode</name>
                <values>
                  <string>windows</string>
                  <string>linux</string>
                </values>
              </hudson.matrix.LabelExpAxis>
              <hudson.matrix.LabelExpAxis>
                <name>NodeType</name>
                <values>
                  <string>build</string>
                </values>
              </hudson.matrix.LabelExpAxis>
            </axes>
            <builders>
              <hudson.tasks.Shell>
                <command>#!/bin/bash --login
          cd ${WORKSPACE} && bash build.sh &quot;${VERSION}&quot; &quot;${BuildType}&quot;
          </command>
              </hudson.tasks.Shell>
              <org.jenkinsci.plugins.buildnameupdater.BuildNameUpdater plugin="build-name-setter@1.6.3">
                <buildName>version.txt</buildName>
                <macroTemplate>#${BUILD_NUMBER}_${PROPFILE,file=&quot;properties.txt&quot;,property=&quot;BUILD_TAG&quot;}</macroTemplate>
                <fromFile>false</fromFile>
                <fromMacro>true</fromMacro>
                <macroFirst>false</macroFirst>
              </org.jenkinsci.plugins.buildnameupdater.BuildNameUpdater>
            </builders>
            <publishers>
              <hudson.tasks.Fingerprinter>
                <targets>*.fingerprint</targets>
              </hudson.tasks.Fingerprinter>
              <hudson.tasks.ArtifactArchiver>
                <artifacts>build/**/logs/*.log</artifacts>
                <allowEmptyArchive>true</allowEmptyArchive>
                <onlyIfSuccessful>false</onlyIfSuccessful>
                <fingerprint>false</fingerprint>
                <defaultExcludes>true</defaultExcludes>
                <caseSensitive>true</caseSensitive>
              </hudson.tasks.ArtifactArchiver>
              <hudson.tasks.junit.JUnitResultArchiver plugin="junit@1.11">
                <testResults>build/**/test-results/**/*.xml</testResults>
                <keepLongStdio>false</keepLongStdio>
                <healthScaleFactor>1.0</healthScaleFactor>
                <allowEmptyResults>false</allowEmptyResults>
              </hudson.tasks.junit.JUnitResultArchiver>
              <hudson.plugins.parameterizedtrigger.BuildTrigger plugin="parameterized-trigger@2.30">
                <configs>
                  <hudson.plugins.parameterizedtrigger.BuildTriggerConfig>
                    <configs>
                      <hudson.plugins.parameterizedtrigger.FileBuildParameters>
                        <propertiesFile>properties.txt</propertiesFile>
                        <failTriggerOnMissing>true</failTriggerOnMissing>
                        <useMatrixChild>true</useMatrixChild>
                        <combinationFilter>(BuildNode==&quot;windows&quot;)&amp;&amp;(BuildType==&quot;release&quot;)</combinationFilter>
                        <onlyExactRuns>true</onlyExactRuns>
                      </hudson.plugins.parameterizedtrigger.FileBuildParameters>
                    </configs>
                    <projects>SmokeTesting</projects>
                    <condition>FAILED_OR_BETTER</condition>
                    <triggerWithNoParameters>false</triggerWithNoParameters>
                  </hudson.plugins.parameterizedtrigger.BuildTriggerConfig>
                </configs>
              </hudson.plugins.parameterizedtrigger.BuildTrigger>
            </publishers>
            <buildWrappers>
              <org.jenkinsci.plugins.buildnamesetter.BuildNameSetter plugin="build-name-setter@1.6.3">
                <template>#${BUILD_NUMBER}_devp-${ENV,var=&quot;VERSION&quot;}</template>
                <runAtStart>true</runAtStart>
                <runAtEnd>false</runAtEnd>
              </org.jenkinsci.plugins.buildnamesetter.BuildNameSetter>
            </buildWrappers>
            <executionStrategy class="hudson.matrix.DefaultMatrixExecutionStrategyImpl">
              <runSequentially>false</runSequentially>
            </executionStrategy>
            <childCustomWorkspace>.</childCustomWorkspace>
          </matrix-project>
          

          Jeremy Rampon added a comment - Hi Lev, here it is: <?xml version= '1.0' encoding= 'UTF-8' ?> <matrix-project plugin= "matrix-project@1.6" > <actions/> <description> </description> <keepDependencies> false </keepDependencies> <properties> <jenkins.model.BuildDiscarderProperty> <strategy class= "hudson.tasks.LogRotator" > <daysToKeep> 20 </daysToKeep> <numToKeep> -1 </numToKeep> <artifactDaysToKeep> -1 </artifactDaysToKeep> <artifactNumToKeep> -1 </artifactNumToKeep> </strategy> </jenkins.model.BuildDiscarderProperty> <com.sonyericsson.jenkins.plugins.bfa.model.ScannerJobProperty plugin= "build-failure-analyzer@1.14.0" > <doNotScan> false </doNotScan> </com.sonyericsson.jenkins.plugins.bfa.model.ScannerJobProperty> <com.sonyericsson.rebuild.RebuildSettings plugin= "rebuild@1.25" > <autoRebuild> false </autoRebuild> <rebuildDisabled> false </rebuildDisabled> </com.sonyericsson.rebuild.RebuildSettings> <hudson.model.ParametersDefinitionProperty> <parameterDefinitions> <com.seitenbau.jenkins.plugins.dynamicparameter.StringParameterDefinition plugin= "dynamicparameter@0.2.0" > <name> VERSION </name> <description> </description> <__uuid> 86a701b9-58cb-400b-b581-aae0b266f14c </__uuid> <__remote> false </__remote> <__script> new Date().format(&quot;yy.M.d&quot;) </__script> <__localBaseDirectory serialization= "custom" > <hudson.FilePath> <default> <remote> /apps/jenkins/dynamic_parameter/classpath </remote> </default> <boolean> true </boolean> </hudson.FilePath> </__localBaseDirectory> <__remoteBaseDirectory> dynamic_parameter_classpath </__remoteBaseDirectory> <__classPath> </__classPath> <readonlyInputField> false </readonlyInputField> </com.seitenbau.jenkins.plugins.dynamicparameter.StringParameterDefinition> <hudson.model.StringParameterDefinition> <name> COMMIT_ID </name> <description> </description> <defaultValue> refs/heads/devp </defaultValue> </hudson.model.StringParameterDefinition> <hudson.plugins.matrix__configuration__parameter.MatrixCombinationsParameterDefinition plugin= "matrix-combinations-parameter@1.0.9" > <name> PLATFORM </name> <description> </description> <defaultCombinationFilter> (BuildNode==&quot;windows&quot;) || (BuildNode==&quot;linux&quot;) </defaultCombinationFilter> </hudson.plugins.matrix__configuration__parameter.MatrixCombinationsParameterDefinition> </parameterDefinitions> </hudson.model.ParametersDefinitionProperty> </properties> <scm class= "hudson.plugins.git.GitSCM" plugin= "git@2.4.4" > <configVersion> 2 </configVersion> <userRemoteConfigs> <hudson.plugins.git.UserRemoteConfig> <url> some-git-server </url> <credentialsId> some-cred-id </credentialsId> </hudson.plugins.git.UserRemoteConfig> </userRemoteConfigs> <branches> <hudson.plugins.git.BranchSpec> <name> ${COMMIT_ID} </name> </hudson.plugins.git.BranchSpec> </branches> <doGenerateSubmoduleConfigurations> false </doGenerateSubmoduleConfigurations> <submoduleCfg class= "list" /> <extensions> <hudson.plugins.git.extensions.impl.LocalBranch> <localBranch> devp </localBranch> </hudson.plugins.git.extensions.impl.LocalBranch> </extensions> </scm> <quietPeriod> 20 </quietPeriod> <scmCheckoutRetryCount> 3 </scmCheckoutRetryCount> <assignedNode> master </assignedNode> <canRoam> false </canRoam> <disabled> false </disabled> <blockBuildWhenDownstreamBuilding> false </blockBuildWhenDownstreamBuilding> <blockBuildWhenUpstreamBuilding> false </blockBuildWhenUpstreamBuilding> <authToken> some-token </authToken> <triggers/> <concurrentBuild> true </concurrentBuild> <customWorkspace> sandbox </customWorkspace> <axes> <hudson.matrix.LabelExpAxis> <name> BuildType </name> <values> <string> debug </string> <string> release </string> </values> </hudson.matrix.LabelExpAxis> <hudson.matrix.LabelExpAxis> <name> BuildNode </name> <values> <string> windows </string> <string> linux </string> </values> </hudson.matrix.LabelExpAxis> <hudson.matrix.LabelExpAxis> <name> NodeType </name> <values> <string> build </string> </values> </hudson.matrix.LabelExpAxis> </axes> <builders> <hudson.tasks.Shell> <command> #!/bin/bash --login cd ${WORKSPACE} && bash build.sh &quot;${VERSION}&quot; &quot;${BuildType}&quot; </command> </hudson.tasks.Shell> <org.jenkinsci.plugins.buildnameupdater.BuildNameUpdater plugin= "build-name-setter@1.6.3" > <buildName> version.txt </buildName> <macroTemplate> #${BUILD_NUMBER}_${PROPFILE,file=&quot;properties.txt&quot;,property=&quot;BUILD_TAG&quot;} </macroTemplate> <fromFile> false </fromFile> <fromMacro> true </fromMacro> <macroFirst> false </macroFirst> </org.jenkinsci.plugins.buildnameupdater.BuildNameUpdater> </builders> <publishers> <hudson.tasks.Fingerprinter> <targets> *.fingerprint </targets> </hudson.tasks.Fingerprinter> <hudson.tasks.ArtifactArchiver> <artifacts> build/**/logs/*.log </artifacts> <allowEmptyArchive> true </allowEmptyArchive> <onlyIfSuccessful> false </onlyIfSuccessful> <fingerprint> false </fingerprint> <defaultExcludes> true </defaultExcludes> <caseSensitive> true </caseSensitive> </hudson.tasks.ArtifactArchiver> <hudson.tasks.junit.JUnitResultArchiver plugin= "junit@1.11" > <testResults> build/**/test-results/**/*.xml </testResults> <keepLongStdio> false </keepLongStdio> <healthScaleFactor> 1.0 </healthScaleFactor> <allowEmptyResults> false </allowEmptyResults> </hudson.tasks.junit.JUnitResultArchiver> <hudson.plugins.parameterizedtrigger.BuildTrigger plugin= "parameterized-trigger@2.30" > <configs> <hudson.plugins.parameterizedtrigger.BuildTriggerConfig> <configs> <hudson.plugins.parameterizedtrigger.FileBuildParameters> <propertiesFile> properties.txt </propertiesFile> <failTriggerOnMissing> true </failTriggerOnMissing> <useMatrixChild> true </useMatrixChild> <combinationFilter> (BuildNode==&quot;windows&quot;)&amp;&amp;(BuildType==&quot;release&quot;) </combinationFilter> <onlyExactRuns> true </onlyExactRuns> </hudson.plugins.parameterizedtrigger.FileBuildParameters> </configs> <projects> SmokeTesting </projects> <condition> FAILED_OR_BETTER </condition> <triggerWithNoParameters> false </triggerWithNoParameters> </hudson.plugins.parameterizedtrigger.BuildTriggerConfig> </configs> </hudson.plugins.parameterizedtrigger.BuildTrigger> </publishers> <buildWrappers> <org.jenkinsci.plugins.buildnamesetter.BuildNameSetter plugin= "build-name-setter@1.6.3" > <template> #${BUILD_NUMBER}_devp-${ENV,var=&quot;VERSION&quot;} </template> <runAtStart> true </runAtStart> <runAtEnd> false </runAtEnd> </org.jenkinsci.plugins.buildnamesetter.BuildNameSetter> </buildWrappers> <executionStrategy class= "hudson.matrix.DefaultMatrixExecutionStrategyImpl" > <runSequentially> false </runSequentially> </executionStrategy> <childCustomWorkspace> . </childCustomWorkspace> </matrix-project>

            le0 Lev Mishin
            dbrown Douglas Brown
            Votes:
            4 Vote for this issue
            Watchers:
            7 Start watching this issue

              Created:
              Updated: