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

Variables used as node labes are not expanded in parameterized builds

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Critical Critical
    • core, multijob-plugin
    • None

      Our build process is split into several parameterized jobs. To make sure that these build steps are executed on a specific node, we defined a parameter with the node name the job should be executed on. Unfortunately the variable doesn't get expanded.

      Proposed solution:

      Values entered as labels should be expanded.

          [JENKINS-9665] Variables used as node labes are not expanded in parameterized builds

          Maik Richey created issue -

          Maik Richey added a comment -

          I would like to give some more details. Given are the projects A, B, C, D, E and F.

          1. A checks out the workspace, builds it and does an install to the local repository.
          2. B gets then triggered n times, using parts of the workspace of A using the Clone Workspace SCM Plugin and generate large parts of our software. B gets executed in parallel on different nodes and copy what's generated back to the workspace of the node where A got executed on.
          3. When all jobs are finished the joining job C gets triggered. C then triggers D, E and F.
          4. D, E and F are executed sequentially using the workspace of A (including whats generated during the execution of B). To not set the node in each job to a specific one directly it is necessary to define the node to run on as a variable and pass it from one job to another.

          Problem:
          Problem is, that variables used as label for a node do not get expanded to the value given as parameter.

          Maik Richey added a comment - I would like to give some more details. Given are the projects A, B, C, D, E and F. 1. A checks out the workspace, builds it and does an install to the local repository. 2. B gets then triggered n times, using parts of the workspace of A using the Clone Workspace SCM Plugin and generate large parts of our software. B gets executed in parallel on different nodes and copy what's generated back to the workspace of the node where A got executed on. 3. When all jobs are finished the joining job C gets triggered. C then triggers D, E and F. 4. D, E and F are executed sequentially using the workspace of A (including whats generated during the execution of B). To not set the node in each job to a specific one directly it is necessary to define the node to run on as a variable and pass it from one job to another. Problem: Problem is, that variables used as label for a node do not get expanded to the value given as parameter.

          Maik Richey added a comment -

          Solution:
          Values entered as labels should be expanded for parameterized builds to keep track of the needs mentioned above.

          Alternative solution:
          If downstream jobs would get executed on the same node the upstream job was executed on when you leave the field "Label Expression" empty (instead of using the Master) then it should work as well. In that case you do not have the chance to define anything as "Label Expression" indeed.

          Maik Richey added a comment - Solution: Values entered as labels should be expanded for parameterized builds to keep track of the needs mentioned above. Alternative solution: If downstream jobs would get executed on the same node the upstream job was executed on when you leave the field "Label Expression" empty (instead of using the Master) then it should work as well. In that case you do not have the chance to define anything as "Label Expression" indeed.

          I would like to second the Alternative Solution. I have several jobs that would benefit from this change. It would greatly simplify creating generic steps for multiple jobs.

          Zephirin Broussard added a comment - I would like to second the Alternative Solution. I have several jobs that would benefit from this change. It would greatly simplify creating generic steps for multiple jobs.

          Maik Richey added a comment -

          Have a look at the Parameterized Trigger Plugin and the NodeLabel Parameter Plugin. Using both can give what you are looking for. Notice that you need at least Jenkins 1.417 in order to use the NodeLabel Parameter Plugin.

          Maik Richey added a comment - Have a look at the Parameterized Trigger Plugin and the NodeLabel Parameter Plugin . Using both can give what you are looking for. Notice that you need at least Jenkins 1.417 in order to use the NodeLabel Parameter Plugin.

          Oleg Nenashev added a comment -

          Maik confirmed that "new" plugins resolved his issue

          Oleg Nenashev added a comment - Maik confirmed that "new" plugins resolved his issue
          Oleg Nenashev made changes -
          Resolution New: Fixed [ 1 ]
          Status Original: Open [ 1 ] New: Resolved [ 5 ]
          Oleg Nenashev made changes -
          Status Original: Resolved [ 5 ] New: Closed [ 6 ]

          ggi added a comment -

          Hi,

          I think that the proposals are workarounds for specific situations, but I think the issue is still not resolved, since can not be used variables in label parameters.

          In my case I don't found the way to with those workarounds, I have to send the job to a label (not node) depending of the parameters which are called the job.

          I have solved it with another workaround:

          • using the "Parameterized Trigger Plugin"
          • inside this call, using the option of pass parameters from a properties file
          • and inside this option, use the option "Don't trigger if any files are missing"
          • So depending the the properties files that I create or delete in a previous shell script, I control which jobs runs, and each job has a fixed label.

          Still all of these are complex workarounds because can not be used variables in label parameters.

          So if this can be fixed would the good solution.

          Regards,
          Gorka

          ggi added a comment - Hi, I think that the proposals are workarounds for specific situations, but I think the issue is still not resolved, since can not be used variables in label parameters. In my case I don't found the way to with those workarounds, I have to send the job to a label (not node) depending of the parameters which are called the job. I have solved it with another workaround: using the "Parameterized Trigger Plugin" inside this call, using the option of pass parameters from a properties file and inside this option, use the option "Don't trigger if any files are missing" So depending the the properties files that I create or delete in a previous shell script, I control which jobs runs, and each job has a fixed label. Still all of these are complex workarounds because can not be used variables in label parameters. So if this can be fixed would the good solution. Regards, Gorka
          ggi made changes -
          Resolution Original: Fixed [ 1 ]
          Status Original: Closed [ 6 ] New: Reopened [ 4 ]

            Unassigned Unassigned
            compi Maik Richey
            Votes:
            13 Vote for this issue
            Watchers:
            19 Start watching this issue

              Created:
              Updated: