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

Cannot use Env Var in Task Name

    XMLWordPrintable

    Details

    • Similar Issues:

      Description

      I'm not sure if this is a bug or not, but I tried putting an environment variable in the Task Name, and it's not consuming it.

      The reason is that we have 1 job (deploy) that deploys based on a parameter (env var), but the pipeline does not expand that environment variable.

        Attachments

          Issue Links

            Activity

            Hide
            patbos Patrik Boström added a comment -

            Do you mean setting stage name or task name value from a global property?
            Manage Jenkins > Configure System > Global properties.

            Show
            patbos Patrik Boström added a comment - Do you mean setting stage name or task name value from a global property? Manage Jenkins > Configure System > Global properties.
            Hide
            grayaii Alex Gray added a comment -

            Setting Task Name from an environment variable, not a global property.
            Thanks for the quick reply!

            Show
            grayaii Alex Gray added a comment - Setting Task Name from an environment variable, not a global property. Thanks for the quick reply!
            Hide
            gposton1040 Glenn Poston added a comment -

            I'd also like to see this implemented. Just to be clear I'd like to use a build parameter as the value for the task name.

            Show
            gposton1040 Glenn Poston added a comment - I'd also like to see this implemented. Just to be clear I'd like to use a build parameter as the value for the task name.
            Hide
            patbos Patrik Boström added a comment -

            I can look in to it.
            I have one question:
            What should be the taskname value be if the build parameter is not set?

            Show
            patbos Patrik Boström added a comment - I can look in to it. I have one question: What should be the taskname value be if the build parameter is not set?
            Hide
            grayaii Alex Gray added a comment -

            Good question! Either "" or maybe even "NONE|NOT_SET|NULL|". Thanks for looking into this, Patrik.

            Show
            grayaii Alex Gray added a comment - Good question! Either "" or maybe even "NONE|NOT_SET|NULL|". Thanks for looking into this, Patrik.
            Hide
            gposton1040 Glenn Poston added a comment -

            Hey Patrik,

            I have a particular build scenario would make what I'm trying to do work (Note that my example is fictitious just to get my idea accross).

            I have a matrix job with a 'User Defined Axis' named 'arguments.' Arguments has two values ('arg1' 'arg2'). The matrix job triggers a parameterized job (let's call this 'param_job') for each value of 'arguments' and passes the AXIS value as a parameter. 'param_job' has it's 'stage' set to 'deploy' and it's 'task' set to '$arguments'.

            Right now when I look at the dashboard with the matrix job as the starting job it looks like this:

            (matrix_job) -> param_job(stage: deploy, task: $arguments)

            The issue here is that this doesn't show that matrix_job kicked of two builds of param_job.

            Once this fix is in, should I expect the dashboard to show this:

            (matrix_job) -> param_job(stage: deploy, task: arg1)
            -> param_job(stage: deploy, task: arg2)

            Show
            gposton1040 Glenn Poston added a comment - Hey Patrik, I have a particular build scenario would make what I'm trying to do work (Note that my example is fictitious just to get my idea accross). I have a matrix job with a 'User Defined Axis' named 'arguments.' Arguments has two values ('arg1' 'arg2'). The matrix job triggers a parameterized job (let's call this 'param_job') for each value of 'arguments' and passes the AXIS value as a parameter. 'param_job' has it's 'stage' set to 'deploy' and it's 'task' set to '$arguments'. Right now when I look at the dashboard with the matrix job as the starting job it looks like this: (matrix_job) -> param_job(stage: deploy, task: $arguments) The issue here is that this doesn't show that matrix_job kicked of two builds of param_job. Once this fix is in, should I expect the dashboard to show this: (matrix_job) -> param_job(stage: deploy, task: arg1) -> param_job(stage: deploy, task: arg2)
            Hide
            gposton1040 Glenn Poston added a comment -

            In response to your question about what to do if the param is not set... I would expect the value of task and stage to act as if the field itself was empty in the case that the param is not set.
            Right now, I believe that task and stage default to the build name (not 100% sure) if the user leaves these fields blank.

            Show
            gposton1040 Glenn Poston added a comment - In response to your question about what to do if the param is not set... I would expect the value of task and stage to act as if the field itself was empty in the case that the param is not set. Right now, I believe that task and stage default to the build name (not 100% sure) if the user leaves these fields blank.
            Hide
            cadsuara Carlos Adsuara added a comment -

            Is there any possibility of implementing something like JENKINS-25377 (Ability to add variables to stage and task name) soon?

            Show
            cadsuara Carlos Adsuara added a comment - Is there any possibility of implementing something like JENKINS-25377 (Ability to add variables to stage and task name) soon?
            Show
            patbos Patrik Boström added a comment - Fixed in: https://github.com/Diabol/delivery-pipeline-plugin/pull/138
            Hide
            patbos Patrik Boström added a comment -

            Released in 0.9.6

            Show
            patbos Patrik Boström added a comment - Released in 0.9.6

              People

              • Assignee:
                Unassigned
                Reporter:
                grayaii Alex Gray
              • Votes:
                8 Vote for this issue
                Watchers:
                10 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: