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

Parameterized trigger passes no parameters from Ivy Project

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Major Major
    • ivy-plugin
    • None
    • Scientic linux (RHEL binary compatible)

      If you use the parameterized trigger plugin with an Ivy Project although the downstream project triggers paramters are not passed. I converted my project to a regular free style software project and it works. I'm trying to pass the build number to a downstream project.

      note: I am used the "predefined paramters" option (2 params) in the parameterized trigger if this makes a difference.

          [JENKINS-15002] Parameterized trigger passes no parameters from Ivy Project

          Not sure if it is related, but someone else added something to the Ivy Plugin related to parameters a while back.

          In the Ivy Project configuration, go to the Ivy Module Configuration section, expand the bottom-most Advanced section, and check the Use parameters from upstream builds. See if that does anything for you and let me know how it goes.

          Timothy Bingaman added a comment - Not sure if it is related, but someone else added something to the Ivy Plugin related to parameters a while back. In the Ivy Project configuration, go to the Ivy Module Configuration section, expand the bottom-most Advanced section, and check the Use parameters from upstream builds . See if that does anything for you and let me know how it goes.

          Darren Rowley added a comment -

          Thanks for the quick response Timothy we tried this still doesn't work, even the hard coded predefined parameters don't get sent through...

          Darren Rowley added a comment - Thanks for the quick response Timothy we tried this still doesn't work, even the hard coded predefined parameters don't get sent through...

          So what is the exact setup that is failing? You have one Ivy Project that is triggering another Ivy Project? Or an Ivy Project that is triggering a Freestyle Project?

          And what exactly do you have in the predefined parameters box?

          Timothy Bingaman added a comment - So what is the exact setup that is failing? You have one Ivy Project that is triggering another Ivy Project? Or an Ivy Project that is triggering a Freestyle Project? And what exactly do you have in the predefined parameters box?

          Darren Rowley added a comment -

          Yes an Ivy project triggering a free style project:

          Exact steps to reproduce (success and failure cases below):
          1. Create a new free style software job called 'target'
          a) add a build stop called execute shell and make it simply execute:
          echo $value1 $value2
          2. Create a new free style software job called 'source'
          a) add a build step that does anything
          b) In post build actions choose "Trigger parameterized builds on other projects"
          projects to build "target"
          trigger when build is "Stable"
          Predefined parameters
          value1=hello
          value2=$BUILD_NUMBER

          3. (success case) Now when you run the job 'source' you should see something like this in the console of the 'target':
          + echo hello 25
          hello 25
          Finished: SUCCESS

          4. Create a new job - "build an Ivy project" - 'ivysource',
          a) add a build.xml etc,
          b) add exact same trigger as 2.b above

          5. (failure case)Now when you run he job 'ivysource' in the console of the 'target', all you see is:
          + echo

          Finished: SUCCESS

          i.e. no variables have been resolved.

          Darren Rowley added a comment - Yes an Ivy project triggering a free style project: Exact steps to reproduce (success and failure cases below): 1. Create a new free style software job called 'target' a) add a build stop called execute shell and make it simply execute: echo $value1 $value2 2. Create a new free style software job called 'source' a) add a build step that does anything b) In post build actions choose "Trigger parameterized builds on other projects" projects to build "target" trigger when build is "Stable" Predefined parameters value1=hello value2=$BUILD_NUMBER 3. (success case) Now when you run the job 'source' you should see something like this in the console of the 'target': + echo hello 25 hello 25 Finished: SUCCESS 4. Create a new job - "build an Ivy project" - 'ivysource', a) add a build.xml etc, b) add exact same trigger as 2.b above 5. (failure case)Now when you run he job 'ivysource' in the console of the 'target', all you see is: + echo Finished: SUCCESS i.e. no variables have been resolved.

          reeve lau added a comment -

          My setup:

          Ivy Plugin : version 1.21
          Jenkins Parameterized Trigger plugin : version 2.16
          Jenkins : version 1.489

          Ivy job triggers a parameterized free-style job => the free-style job get only default param values
          Ivy job triggers a parameterized Ivy job => the Ivy job get only default param values

          Free-style job triggers a parameterized free-style job => the downstream free-style job get all param values
          Free-style job triggers a parameterized Ivy job => the downstream Ivy job get all param values

          I hope this issue could be fixed.

          reeve lau added a comment - My setup: Ivy Plugin : version 1.21 Jenkins Parameterized Trigger plugin : version 2.16 Jenkins : version 1.489 Ivy job triggers a parameterized free-style job => the free-style job get only default param values Ivy job triggers a parameterized Ivy job => the Ivy job get only default param values Free-style job triggers a parameterized free-style job => the downstream free-style job get all param values Free-style job triggers a parameterized Ivy job => the downstream Ivy job get all param values I hope this issue could be fixed.

          cjo9900 added a comment -

          The problem looks to be that the ivy project implements its own triggering of downstream projects rather than letting the default trigger builder do this.
          Which means that the parameterized trigger is not being called from the dependency graph so the parameters are not passed as expected from the ivy project.

          cjo9900 added a comment - The problem looks to be that the ivy project implements its own triggering of downstream projects rather than letting the default trigger builder do this. Which means that the parameterized trigger is not being called from the dependency graph so the parameters are not passed as expected from the ivy project.

          cjo9900 added a comment -

          Digging a bit deeper to the case that reeve lau mentioned.

          Ivy job triggers a parameterized free-style job => the free-style job get only default param values
          In this case the Ivy build calculates and triggers the downstream builds dependant on several conditions, these are:
          do not trigger if downstream is already queued/building,

          do not trigger if a upstream build of the downstream build is queued or already building.
          e.g. at end of build A don't trigger Z if B is queued or building.
          A-\
          B->Z

          do not trigger if a upstream build of the downstream build is also to be triggered from this build.
          e.g. at end of build A don't trigger Z if as we will trigger C which will trigger Z
          A->C-\
          ---->Z

          do not trigger if any of the Ivy upstream projects (of the downstream project) have not completed successfully.
          e.g. at end of build A don't trigger Z if B does not have a successful build.
          A-\
          B->Z

          Once all of those conditions have been met then the downstream build is triggered directly, passing the ParameterizedUpstreamCause() and no other actions. and there is no calls to the dependencies to get their input to the new build.

          Issue is in code at [1]

          Ivy job triggers a parameterized Ivy job => the Ivy job get only default param values

          You need to set the flag "Use parameters from upstream builds" under one of the advanced sections in the "Ivy Module Configuration" section of the ivy Job. The reason for this is that it passes the parameters via a build cause that by default ignores the parameters.

          Free-style job triggers a parameterized free-style job => the downstream free-style job get all param values
          Free-style job triggers a parameterized Ivy job => the downstream Ivy job get all param values

          These work correctly as they are being triggered from the Dependency Graph which populates the parameters correctly from the dependencies, and are passed as straight Parameter Actions. to the downstream builds.

          [1] https://github.com/jenkinsci/ivy-plugin/blob/master/src/main/java/hudson/ivy/AbstractIvyBuild.java#L71

          cjo9900 added a comment - Digging a bit deeper to the case that reeve lau mentioned. Ivy job triggers a parameterized free-style job => the free-style job get only default param values In this case the Ivy build calculates and triggers the downstream builds dependant on several conditions, these are: do not trigger if downstream is already queued/building, do not trigger if a upstream build of the downstream build is queued or already building. e.g. at end of build A don't trigger Z if B is queued or building. A-\ B->Z do not trigger if a upstream build of the downstream build is also to be triggered from this build. e.g. at end of build A don't trigger Z if as we will trigger C which will trigger Z A->C-\ ---->Z do not trigger if any of the Ivy upstream projects (of the downstream project) have not completed successfully. e.g. at end of build A don't trigger Z if B does not have a successful build. A-\ B->Z Once all of those conditions have been met then the downstream build is triggered directly, passing the ParameterizedUpstreamCause() and no other actions. and there is no calls to the dependencies to get their input to the new build. Issue is in code at [1] Ivy job triggers a parameterized Ivy job => the Ivy job get only default param values You need to set the flag "Use parameters from upstream builds" under one of the advanced sections in the "Ivy Module Configuration" section of the ivy Job. The reason for this is that it passes the parameters via a build cause that by default ignores the parameters. Free-style job triggers a parameterized free-style job => the downstream free-style job get all param values Free-style job triggers a parameterized Ivy job => the downstream Ivy job get all param values These work correctly as they are being triggered from the Dependency Graph which populates the parameters correctly from the dependencies, and are passed as straight Parameter Actions. to the downstream builds. [1] https://github.com/jenkinsci/ivy-plugin/blob/master/src/main/java/hudson/ivy/AbstractIvyBuild.java#L71

          cjo9900 added a comment -

          Already identified as JENKINS-7334 as an improvement.

          cjo9900 added a comment - Already identified as JENKINS-7334 as an improvement.

          reeve lau added a comment -

          Thanks cjo9900 for explaining the mechanism of how IVY triggering downstream build.

          Regarding to
          Ivy job triggers a parameterized Ivy job => the Ivy job get only default param values

          Even if I set configure the downstream job to use the option of "Use parameters from upstream builds", it doesn't get the desired param values.

          I guess IVY plugin has it own method to pass parameter to downstream job. That why all param values passed by upstream IVY job will be failed. I rather think that the issue is related to this line of code [1]. But I have no background to know how the IVY job get the param and pass them to the downstream....

          [1] https://github.com/jenkinsci/ivy-plugin/blob/master/src/main/java/hudson/ivy/AbstractIvyBuild.java#L136

          reeve lau added a comment - Thanks cjo9900 for explaining the mechanism of how IVY triggering downstream build. Regarding to Ivy job triggers a parameterized Ivy job => the Ivy job get only default param values Even if I set configure the downstream job to use the option of "Use parameters from upstream builds", it doesn't get the desired param values. I guess IVY plugin has it own method to pass parameter to downstream job. That why all param values passed by upstream IVY job will be failed. I rather think that the issue is related to this line of code [1] . But I have no background to know how the IVY job get the param and pass them to the downstream.... [1] https://github.com/jenkinsci/ivy-plugin/blob/master/src/main/java/hudson/ivy/AbstractIvyBuild.java#L136

          Darren Rowley added a comment -

          I have just tried this again after doing a bunch of updates, and I can confirm this is now working, at least for my setup. Jenkins 1.583 Ivy Plugin 1.24 and parameterized trigger plugin 2.25. It's been a long time since I last tried it so it's possible it was fixed in versions earlier than this.

          Darren Rowley added a comment - I have just tried this again after doing a bunch of updates, and I can confirm this is now working, at least for my setup. Jenkins 1.583 Ivy Plugin 1.24 and parameterized trigger plugin 2.25. It's been a long time since I last tried it so it's possible it was fixed in versions earlier than this.

            tbingaman Timothy Bingaman
            darrenrowley Darren Rowley
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated: