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

Provide env vars detailing triggered builds

    XMLWordPrintable

    Details

    • Similar Issues:

      Description

      Providing env vars similar to the Param Trigger Plugin would allow for more complex chains to be build.

      See https://wiki.jenkins-ci.org/display/JENKINS/Parameterized+Trigger+Plugin#ParameterizedTriggerPlugin-UsageasaBuildstep

        Attachments

          Activity

          Hide
          kiall kiall added a comment -
          Show
          kiall kiall added a comment - Pull request @ https://github.com/jenkinsci/tikal-multijob-plugin/pull/22
          Hide
          scm_issue_link SCM/JIRA link daemon added a comment -

          Code changed in jenkins
          User: Kiall Mac Innes
          Path:
          pom.xml
          src/main/java/com/tikal/jenkins/plugins/multijob/MultiJobBuilder.java
          http://jenkins-ci.org/commit/tikal-multijob-plugin/447cdd35d180f70672bc233eabf1de8f5f3aeb38
          Log:
          Provide env vars detailing triggered builds.

          Fixes JENKINS-17535

          Show
          scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Kiall Mac Innes Path: pom.xml src/main/java/com/tikal/jenkins/plugins/multijob/MultiJobBuilder.java http://jenkins-ci.org/commit/tikal-multijob-plugin/447cdd35d180f70672bc233eabf1de8f5f3aeb38 Log: Provide env vars detailing triggered builds. Fixes JENKINS-17535
          Hide
          scm_issue_link SCM/JIRA link daemon added a comment -

          Code changed in jenkins
          User: Haggai Philip Zagury
          Path:
          pom.xml
          src/main/java/com/tikal/jenkins/plugins/multijob/MultiJobBuilder.java
          http://jenkins-ci.org/commit/tikal-multijob-plugin/d6679f5dbdc777bf9aa8e820757252c174b926ed
          Log:
          Merge pull request #22 from moniker-dns/JENKINS-17535

          Provide env vars detailing triggered builds.

          Compare: https://github.com/jenkinsci/tikal-multijob-plugin/compare/b8cde9e3d6c9...d6679f5dbdc7

          Show
          scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Haggai Philip Zagury Path: pom.xml src/main/java/com/tikal/jenkins/plugins/multijob/MultiJobBuilder.java http://jenkins-ci.org/commit/tikal-multijob-plugin/d6679f5dbdc777bf9aa8e820757252c174b926ed Log: Merge pull request #22 from moniker-dns/ JENKINS-17535 Provide env vars detailing triggered builds. Compare: https://github.com/jenkinsci/tikal-multijob-plugin/compare/b8cde9e3d6c9...d6679f5dbdc7
          Hide
          hagzag hagzag added a comment -

          Thanks to Kiall Mac Innes (https://github.com/kiall)

          Show
          hagzag hagzag added a comment - Thanks to Kiall Mac Innes ( https://github.com/kiall )
          Hide
          dvankampen David VanKampen added a comment -

          Note that since this bug has been resolved (Version 1.9), later versions (I'm running 1.13) of the multi-job plugin have changed the format of these environment variable names. For example, it is no longer "TRIGGERED_BUILD_NUMBER_JOBNAME", but "JOBNAME_BUILD_NUMBER." This makes it a bit different than the variable names used by the parameterized trigger plugin.

          Show
          dvankampen David VanKampen added a comment - Note that since this bug has been resolved (Version 1.9), later versions (I'm running 1.13) of the multi-job plugin have changed the format of these environment variable names. For example, it is no longer "TRIGGERED_BUILD_NUMBER_JOBNAME", but "JOBNAME_BUILD_NUMBER." This makes it a bit different than the variable names used by the parameterized trigger plugin.
          Hide
          hagzag hagzag added a comment -

          This is related to the parameterized-trigger-plugin not the multijob plugin - we just "consume" the parameterized-trigger-plugin ... see the changes -> https://github.com/gcummings/parameterized-trigger-plugin/commit/2a276922f90844924b1a32fd1fec7133e1db9311.

          I couldn't find the "JOBNAME_BUILD_NUMBER" you mentioned ... see -> https://github.com/hagzag/parameterized-trigger-plugin/blob/master/src/main/java/hudson/plugins/parameterizedtrigger/BuildInfoExporterAction.java#L41
          If you do find it perhaps a pull request on the parameterized-trigger-plugin could add support for both ?

          10x
          HP

          Show
          hagzag hagzag added a comment - This is related to the parameterized-trigger-plugin not the multijob plugin - we just "consume" the parameterized-trigger-plugin ... see the changes -> https://github.com/gcummings/parameterized-trigger-plugin/commit/2a276922f90844924b1a32fd1fec7133e1db9311 . I couldn't find the "JOBNAME_BUILD_NUMBER" you mentioned ... see -> https://github.com/hagzag/parameterized-trigger-plugin/blob/master/src/main/java/hudson/plugins/parameterizedtrigger/BuildInfoExporterAction.java#L41 If you do find it perhaps a pull request on the parameterized-trigger-plugin could add support for both ? 10x HP
          Hide
          iambaskar Baskaran D added a comment - - edited

          Am running on MultiJob Plugin V1.20 (Jenkins ver. 1.609). I tried both the format of variable. But nothing works..

          JOBNAME_BUILD_NUMBER 
          TRIGGERED_BUILD_NUMBER_JOBNAME
          

          If my Job name is Test_Sanity, both ${Test_Sanity_BUILD_NUMBER} or ${TRIGGERED_BUILD_NUMBER_Test_Sanity} returned EMPTY value.

          Also, if my Job name is 2G_Test_Sanity, then I wont be able to access this variable in shell. ${2G_Test_Sanity_BUILD_NUMBER}

          Any help on this? Thanks in advance.

          TL;DR:
          If my Job name is "Test", nothing returned any result except for the first variable ${LAST_TRIGGERED_JOB_NAME}, which returned "Test"

          #!/usr/bin/env bash
          
          echo "LAST_TRIGGERED_JOB_NAME: ${LAST_TRIGGERED_JOB_NAME}"
          echo "TRIGGERED_BUILD_NUMBERS_Test: ${TRIGGERED_BUILD_NUMBERS_Test}"
          echo "Test_BUILD_NUMBER: ${Test_BUILD_NUMBER}"
          echo "Test_BUILD_RESULT: ${Test_BUILD_RESULT}"
          echo "TRIGGERED_BUILD_NUMBER_Test: ${TRIGGERED_BUILD_NUMBER_Test}"
          echo "TRIGGERED_BUILD_RUN_COUNT_Test: ${TRIGGERED_BUILD_RUN_COUNT_Test}"
          echo "Test_1_BUILD_NUMBER: ${Test_1_BUILD_NUMBER}"
          echo "Test_BUILD_NAME: ${Test_BUILD_NAME}"
          
          Show
          iambaskar Baskaran D added a comment - - edited Am running on MultiJob Plugin V1.20 (Jenkins ver. 1.609). I tried both the format of variable. But nothing works.. JOBNAME_BUILD_NUMBER TRIGGERED_BUILD_NUMBER_JOBNAME If my Job name is Test_Sanity , both ${Test_Sanity_BUILD_NUMBER} or ${TRIGGERED_BUILD_NUMBER_Test_Sanity} returned EMPTY value. Also, if my Job name is 2G_Test_Sanity , then I wont be able to access this variable in shell. ${2G_Test_Sanity_BUILD_NUMBER} Any help on this? Thanks in advance. TL;DR: If my Job name is "Test", nothing returned any result except for the first variable ${LAST_TRIGGERED_JOB_NAME} , which returned "Test" #!/usr/bin/env bash echo "LAST_TRIGGERED_JOB_NAME: ${LAST_TRIGGERED_JOB_NAME}" echo "TRIGGERED_BUILD_NUMBERS_Test: ${TRIGGERED_BUILD_NUMBERS_Test}" echo "Test_BUILD_NUMBER: ${Test_BUILD_NUMBER}" echo "Test_BUILD_RESULT: ${Test_BUILD_RESULT}" echo "TRIGGERED_BUILD_NUMBER_Test: ${TRIGGERED_BUILD_NUMBER_Test}" echo "TRIGGERED_BUILD_RUN_COUNT_Test: ${TRIGGERED_BUILD_RUN_COUNT_Test}" echo "Test_1_BUILD_NUMBER: ${Test_1_BUILD_NUMBER}" echo "Test_BUILD_NAME: ${Test_BUILD_NAME}"

            People

            Assignee:
            Unassigned Unassigned
            Reporter:
            kiall kiall
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: