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

Don't rename job names in TRIGGERED_JOB_NAMES

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Major Major
    • None
    • jenkins LTS 1.651.1, parameterized-trigger-plugin 2.30
      master on redhat 6.4 server, slaves on redhat 7.2

      I'm using parameterized-trigger-plugin like this :

      • job A runs on master , triggers job trigA on slave
      • trigA once finised publishes some output back to master
      • then job A goes on ...and tries to find the files published by trigA

      TRIGGERED_JOB_NAMES could be helpful, but why the hell replace characters from original names ? By doing so, it's impossible to use these names to build the path to trhe triggered jobs workspace.

      If you want to stick to this behaviour, would it be possible to have variables set to triggered_jobs_master_workspace for instance ?

          [JENKINS-34340] Don't rename job names in TRIGGERED_JOB_NAMES

          Jan Dohl added a comment - - edited

          I would have worded this differently, but I, too, stumbled across this problem. We trigger a parameterized job called "param-builder" and the environment variable turns this into:

          • TRIGGERED_JOB_NAMES=param_builder

          essentially replacing all "-" with "_". While I can work around that it's still quite annoying to do so.

          Also, having a variable with a link to the parameterized build would be nice.

          Jan Dohl added a comment - - edited I would have worded this differently, but I, too, stumbled across this problem. We trigger a parameterized job called "param-builder" and the environment variable turns this into: TRIGGERED_JOB_NAMES=param_builder essentially replacing all "-" with "_". While I can work around that it's still quite annoying to do so. Also, having a variable with a link to the parameterized build would be nice.

          Paul Walter added a comment -

          I am also in favor of not renaming job names to underscores as I faced the same issue as Jan.

          using Jenkins 2.42 and plugin version 2.32
          However there are 2 different behaviors though usage of LAST_TRIGGERED_JOB_NAME (as having BUILD_NAME=job-tmp for example):

          • when using LAST_TRIGGERED_JOB_NAME in shell script, job name will be returned from echo $LAST_TRIGGERED_JOB_NAME as job-tmp which is correct
          • when using directly in other plugins such as copy artifacts from another job, LAST_TRIGGERED_JOB_NAME will return renamed JOB_NAME as job_tmp

          Therefore there is inconsistency and,which is worse, renaming which breaks functionality of returning last triggered jobs

          Paul Walter added a comment - I am also in favor of not renaming job names to underscores as I faced the same issue as Jan. using Jenkins 2.42 and plugin version 2.32 However there are 2 different behaviors though usage of LAST_TRIGGERED_JOB_NAME (as having BUILD_NAME=job-tmp for example): when using LAST_TRIGGERED_JOB_NAME in shell script, job name will be returned from echo $LAST_TRIGGERED_JOB_NAME as job-tmp which is correct when using directly in other plugins such as copy artifacts from another job, LAST_TRIGGERED_JOB_NAME will return renamed JOB_NAME as job_tmp Therefore there is inconsistency and,which is worse, renaming which breaks functionality of returning last triggered jobs

          Stumbled into this by chance:

          Sigh. Just an advice: this is not how you want to report things, if you want to have a single chance that people spend their free time fixing your issue...
          *Because* of this phrasing, if I was the maintainer, I would fix everything else but this if I'm not hitting it too.

          Be polite, be respectful. You're talking to humans, and humans that helps for nothing else than pleasure, and can choose whatever they work on.

          My 2 cents.

          Baptiste Mathus added a comment - Stumbled into this by chance: Sigh. Just an advice: this is not how you want to report things, if you want to have a single chance that people spend their free time fixing your issue... * Because * of this phrasing, if I was the maintainer, I would fix everything else but this if I'm not hitting it too. Be polite, be respectful. You're talking to humans, and humans that helps for nothing else than pleasure, and can choose whatever they work on. My 2 cents.

          D Pasto added a comment - - edited

          This also conflicts with jobs using the Cloudbees Folders plugin.  For example, I am using this plugin to trigger a job in another folder.  I expect to be able to use $LAST_TRIGGERED_JOB_NAME in the following copyArtifacts plugin to collect artifacts, but this replaces all '/' with underscore, so fails.

          D Pasto added a comment - - edited This also conflicts with jobs using the Cloudbees Folders plugin.  For example, I am using this plugin to trigger a job in another folder.  I expect to be able to use $LAST_TRIGGERED_JOB_NAME in the following copyArtifacts plugin to collect artifacts, but this replaces all '/' with underscore, so fails.

          D Pasto added a comment -

          This issue was caused by the resolution for JENKINS-14545, but we need a fix that will work in both cases.

          D Pasto added a comment - This issue was caused by the resolution for JENKINS-14545 , but we need a fix that will work in both cases.

          From JENKINS-14545:
          "Example: my job is named project-builder, then the exported variable will be TRIGGERED_BUILD_NUMBER_project-builder=123. Because of the - character, this variable is unusable."

          Work-around proposal:
          Avoid any dashes in your names!

          Alexander Stohr added a comment - From JENKINS-14545 : "Example: my job is named project-builder, then the exported variable will be TRIGGERED_BUILD_NUMBER_project-builder=123. Because of the - character, this variable is unusable." Work-around proposal: Avoid any dashes in your names!

            huybrechts huybrechts
            squalou squalou jenkins
            Votes:
            1 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated: