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

Multi-configuration project ALWAYS triggers parametrized build for ALL childs if a pipeline job in the project list to build

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Critical Critical
    • None
    • Jenkins Version: 2.263.1
      Parametrized trigger Plugin Version : 2.39

      Let's compare behavior of  a pipeline job and a freestyle job when they are triggered as parametrized build in the Post-Build section from a Mutli-configuration job.

      In my example I have a multi-configuration job :

      test-parametrizedPlugin-multi-conf-job that calls 2 jobs one freestyle and one pipeline :

      • test-parametrizedPlugin-called-pipeline-job
      • test-parametrizedPlugin-called-freestyle-job

       

      First test, the 2 jobs are in the same Projects to build list( Note that the Trigger build from child project option is not set ):

      Then the 2 jobs are triggered for each child as we can see as it is reported in the console logs of the 2 called jobs.

      Second test, the 2 jobs are in separate Projects to build list( Note that the Trigger build from child project option is not set ) :

      Then the 2 jobs are triggered but not with the same behavior,

      freestyle job is run as expected :

      but pipeline job is run for each child as we can see as it is reported in the console log:

          [JENKINS-64591] Multi-configuration project ALWAYS triggers parametrized build for ALL childs if a pipeline job in the project list to build

          Philip Steiner added a comment - - edited

          I found a workaround: Create a freestyle job to "bridge" the matrix job to the downstream pipeline job. The matrix job triggers the bridge job at end of run, rather that on every matrix combination. The bridge job in turn triggers the pipeline job. In my case, I did not need to pass parameters to the pipeline, so I used the simpler 'Build other projects" post-build action.

          [EDIT] I had the bright notion to pass the name of the pipeline job as a parameter from the matrix job, so I could reuse the same bridge job for all downstream jobs, unfortunately neither the Parameterized Trigger plugin nor the "Build other projects" post-build action allow a variable in the job name, so to use this workaround, you'd need to create a separate bridge job for every pipeline job downstream from the matrix job. 

          Philip Steiner added a comment - - edited I found a workaround: Create a freestyle job to "bridge" the matrix job to the downstream pipeline job. The matrix job triggers the bridge job at end of run, rather that on every matrix combination. The bridge job in turn triggers the pipeline job. In my case, I did not need to pass parameters to the pipeline, so I used the simpler 'Build other projects" post-build action. [EDIT] I had the bright notion to pass the name of the pipeline job as a parameter from the matrix job, so I could reuse the same bridge job for all downstream jobs, unfortunately neither the Parameterized Trigger plugin nor the "Build other projects" post-build action allow a variable in the job name, so to use this workaround, you'd need to create a separate bridge job for every pipeline job downstream from the matrix job. 

          I was going to open is exact ticket. Well done, and with how to reproduce, I don't need to. Unfortunate there is no fix, but thanks for the workaround I'll try that.

          Samuel Beaulieu added a comment - I was going to open is exact ticket. Well done, and with how to reproduce, I don't need to. Unfortunate there is no fix, but thanks for the workaround I'll try that.

          Just faced today this issue, as we were replacing an old downstream freestyle job by a new implementation using pipeline...
          Tried some tweaks using the Flexible publish plugin, but no luck
          Will use your workaround, thanks for the suggestion

          Geoffroy Jabouley added a comment - Just faced today this issue, as we were replacing an old downstream freestyle job by a new implementation using pipeline... Tried some tweaks using the Flexible publish plugin, but no luck Will use your workaround, thanks for the suggestion

            Unassigned Unassigned
            merlindam Damien Merlin
            Votes:
            3 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated: