[JIRA] (JENKINS-60511) parameterized project triggered with empty parameters from pipeline's for loop

1 view
Skip to first unread message

jenkins.io@klatt.xyz (JIRA)

unread,
Dec 16, 2019, 4:02:03 PM12/16/19
to jenkinsc...@googlegroups.com
T K created an issue
 
Jenkins / Bug JENKINS-60511
parameterized project triggered with empty parameters from pipeline's for loop
Issue Type: Bug Bug
Assignee: Unassigned
Components: parameterized-trigger-plugin, pipeline-build-step-plugin
Created: 2019-12-16 21:01
Environment: Jenkins 2.190.3 (as Docker container)
Parameterized Trigger plugin 2.36
Pipeline: Build Step 2.10
Labels: Jenkinsfile pipeline parameterized-trigger
Priority: Major Major
Reporter: T K

Scenario

I have two pipeline jobs 'Parent' and 'Child' where 'Child' is parameterized and triggered (fire+forget) from 'Parent' multiple times. The total amount of 'Child' jobs triggered from 'Parent' are variable and depend on external parameters.

 

// Parent.jenkinsfile
pipeline {
  agent any
  stages {
    stage('Trigger Child') {
      steps {
        script {
          for(int i = 0; i < 3; ++i) {
            build(
              job: 'Child',
              parameters: [
                string(name: 'alpha', value: 'test'),
                string(name: 'beta', value: "${i}")
              ],
              wait: false,
              propagate: false)
          }
        }
      }
    }
  }
}
// Child.jenkinsfile
pipeline {
  agent any
  parameters {
    string(name: 'alpha', description: '', trim: true)
    string(name: 'beta', description: '', trim: true)
  }
  stages {
    stage('Hello') {
      steps {
        buildName "${params.alpha} ${params.beta}"
      }
    }
  }
}

Observed Behaviour

From any run of 'Parent', 'Child' is getting triggered for each set of parameter values AND one additional time with all parameters set to empty values (or their defaults).

In the example above, 'Child' is triggered with the following values:

  1. alpha="", beta="null"  <-- should not be there
  2. alpha="test", beta="0"
  3. alpha="test", beta="1"
  4. alpha="test", beta="2"

Import Note

This spurious job without parameter values is not being triggered when 'Parent' waits for the 'Child' to finish, i.e. if I set wait=true in the build step of 'Parent'.

 

Add Comment Add Comment
 
This message was sent by Atlassian Jira (v7.13.6#713006-sha1:cc4451f)
Atlassian logo
Reply all
Reply to author
Forward
0 new messages