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

Parameters are not passed to child jobs in multi-configuration projects

    XMLWordPrintable

Details

    Description

      Parameters passed to a multi-configuration job are, apparently, filtered out before being passed through to child builds. This problem does not exhibit on freestyle jobs.

      Steps to reproduce:

      1. Create a multi-configuration job
      2. Add a single parameter named SERIAL
      3. Add a single axis (of any name)
      4. Add an "Execute shell" task with "set -eux; echo $SERIAL"
      5. Run the job, setting a SERIAL
      6. Observe failure

      This appears to have been introduced in 1.651.2 (presumably as part of the parameter filtering changes).

      Attachments

        Issue Links

          Activity

            Indeed, this seems to be specific to matrix jobs. From the Jenkins log:

            May 12, 2016 12:13:23 PM hudson.model.ParametersAction filter
            WARNING: Skipped parameter `MY_PARAM` as it is undefined on `some-matrix-job/SOME_AXIS=foo`
            
            orrc Christopher Orr added a comment - Indeed, this seems to be specific to matrix jobs. From the Jenkins log: May 12, 2016 12:13:23 PM hudson.model.ParametersAction filter WARNING: Skipped parameter `MY_PARAM` as it is undefined on `some-matrix-job/SOME_AXIS=foo`
            owenmehegan Owen Mehegan added a comment -

            You sunk my battleship! Er, I mean, broke all my matrix jobs!

            owenmehegan Owen Mehegan added a comment - You sunk my battleship! Er, I mean, broke all my matrix jobs!
            inb Ian Norton added a comment -

            I notice freestyle jobs still work

            inb Ian Norton added a comment - I notice freestyle jobs still work
            inb Ian Norton added a comment - - edited

            Yes, I confirm exactly the same log entries for me:

            May 13, 2016 8:30:12 AM WARNING hudson.model.ParametersAction filter
            Skipped parameter `TRIFFID_FILE` as it is undefined on `MatrixParamsTest/platforms=linux-libc6.11-amd64`. Set `-Dhudson.model.ParametersAction.keepUndefinedParameters`=true to allow undefined parameters to be injected as environment variables or `-Dhudson.model.ParametersAction.safeParameters=[comma-separated list]` to whitelist specific parameter names, even though it represents a security breach
            

            Adding -Dhudson.model.ParametersAction.keepUndefinedParameters=true to my JAVA_ARGS lets my matrix job see the parameters!

            inb Ian Norton added a comment - - edited Yes, I confirm exactly the same log entries for me: May 13, 2016 8:30:12 AM WARNING hudson.model.ParametersAction filter Skipped parameter `TRIFFID_FILE` as it is undefined on `MatrixParamsTest/platforms=linux-libc6.11-amd64`. Set `-Dhudson.model.ParametersAction.keepUndefinedParameters`= true to allow undefined parameters to be injected as environment variables or `-Dhudson.model.ParametersAction.safeParameters=[comma-separated list]` to whitelist specific parameter names, even though it represents a security breach Adding -Dhudson.model.ParametersAction.keepUndefinedParameters=true to my JAVA_ARGS lets my matrix job see the parameters!
            jamoore Josh Moore added a comment -

            Just to add 2cents on the severity of this:

            rm -rf $OMERO_DATA_DIR/*

            reduced to:

            rm -rf /*

            And removed all files that the Jenkins users had access to.

            jamoore Josh Moore added a comment - Just to add 2cents on the severity of this: rm -rf $OMERO_DATA_DIR/* reduced to: rm -rf /* And removed all files that the Jenkins users had access to.
            inb Ian Norton added a comment -

            jamoore yikes! my condolences!

            inb Ian Norton added a comment - jamoore yikes! my condolences!
            danielbeck Daniel Beck added a comment -

            jamoore Oh shit. I'm sorry that happened.

            danielbeck Daniel Beck added a comment - jamoore Oh shit. I'm sorry that happened.
            danielbeck Daniel Beck added a comment -

            To everyone experiencing this issue: No need to downgrade, use the system properties mentioned in the warning quoted in an earlier comment to disable this new behavior, at least for a time, while plugins are adapted.

            danielbeck Daniel Beck added a comment - To everyone experiencing this issue: No need to downgrade, use the system properties mentioned in the warning quoted in an earlier comment to disable this new behavior, at least for a time, while plugins are adapted.

            hiddenmaverick: This is a bug report for the matrix plugin (multi-configuration project type); if you're having an issue with another plugin, please file a separate issue.

            orrc Christopher Orr added a comment - hiddenmaverick : This is a bug report for the matrix plugin (multi-configuration project type); if you're having an issue with another plugin, please file a separate issue.
            liya Liya Katz added a comment -

            I upgraded to Jenkins 2.4 and my matrix jobs just stopped working!

            liya Liya Katz added a comment - I upgraded to Jenkins 2.4 and my matrix jobs just stopped working!
            abayer Andrew Bayer added a comment -

            So trying to look into fixing this - I guess it would make sense to have a child build-specific EnviromentContributor look at getAllParameters() in the child build, see which ones (a) aren't also in getParameters() for the child build and (b) are in the parent's getParameters(), and then add any that satisfy both criteria to the environment. Does that seem reasonable?

            abayer Andrew Bayer added a comment - So trying to look into fixing this - I guess it would make sense to have a child build-specific EnviromentContributor look at getAllParameters() in the child build, see which ones (a) aren't also in getParameters() for the child build and (b) are in the parent's getParameters() , and then add any that satisfy both criteria to the environment. Does that seem reasonable?
            jamoore Josh Moore added a comment -

            I don't know anything about feasbility but based on our experience most safe would be to fail if there are any parameters not satisfying both criteria as if `set -u` were set in bash:

            /tmp $ cat test.sh
            set -u
            ls $OMERO_DATA_DIR/*
            /tmp $ bash test.sh
            test.sh: line 2: OMERO_DATA_DIR: unbound variable
            
            jamoore Josh Moore added a comment - I don't know anything about feasbility but based on our experience most safe would be to fail if there are any parameters not satisfying both criteria as if `set -u` were set in bash: /tmp $ cat test.sh set -u ls $OMERO_DATA_DIR/* /tmp $ bash test.sh test.sh: line 2: OMERO_DATA_DIR: unbound variable
            amuniz Antonio Muñiz added a comment - Proposed fix: https://github.com/jenkinsci/matrix-project-plugin/pull/36

            Code changed in jenkins
            User: Antonio Muñiz
            Path:
            src/main/java/hudson/matrix/MatrixChildParametersAction.java
            src/main/java/hudson/matrix/MatrixConfiguration.java
            http://jenkins-ci.org/commit/matrix-project-plugin/c684cc64bc16f37d45b3b704eab1324c46dd2868
            Log:
            JENKINS-34758 Parameters visibility in child builds (SECURITY-170)

            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Antonio Muñiz Path: src/main/java/hudson/matrix/MatrixChildParametersAction.java src/main/java/hudson/matrix/MatrixConfiguration.java http://jenkins-ci.org/commit/matrix-project-plugin/c684cc64bc16f37d45b3b704eab1324c46dd2868 Log: JENKINS-34758 Parameters visibility in child builds (SECURITY-170)

            Code changed in jenkins
            User: Antonio Muñiz
            Path:
            src/test/java/hudson/matrix/MatrixProjectTest.java
            http://jenkins-ci.org/commit/matrix-project-plugin/d3478a4e052c2385f3b3a32953cfa5f22eb187ce
            Log:
            JENKINS-34758 Test for SECURITY-170

            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Antonio Muñiz Path: src/test/java/hudson/matrix/MatrixProjectTest.java http://jenkins-ci.org/commit/matrix-project-plugin/d3478a4e052c2385f3b3a32953cfa5f22eb187ce Log: JENKINS-34758 Test for SECURITY-170

            Code changed in jenkins
            User: Antonio Muñiz
            Path:
            src/main/java/hudson/matrix/MatrixChildParametersAction.java
            src/main/java/hudson/matrix/MatrixConfiguration.java
            src/main/resources/hudson/matrix/MatrixChildParametersAction/index.jelly
            http://jenkins-ci.org/commit/matrix-project-plugin/55d2a6cdb62601ec51dbeff8d7ad20f6bb726455
            Log:
            JENKINS-34758 Parameters must be shown in the child build page

            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Antonio Muñiz Path: src/main/java/hudson/matrix/MatrixChildParametersAction.java src/main/java/hudson/matrix/MatrixConfiguration.java src/main/resources/hudson/matrix/MatrixChildParametersAction/index.jelly http://jenkins-ci.org/commit/matrix-project-plugin/55d2a6cdb62601ec51dbeff8d7ad20f6bb726455 Log: JENKINS-34758 Parameters must be shown in the child build page

            Code changed in jenkins
            User: Oliver Gondža
            Path:
            src/main/java/hudson/matrix/MatrixChildParametersAction.java
            src/main/java/hudson/matrix/MatrixConfiguration.java
            src/test/java/hudson/matrix/MatrixProjectTest.java
            http://jenkins-ci.org/commit/matrix-project-plugin/d9e5c847afef3928441bdb91df37f764ea6617fd
            Log:
            Merge pull request #36 from amuniz/JENKINS-34758-fix

            JENKINS-34758 Parameters visibility in child builds

            Compare: https://github.com/jenkinsci/matrix-project-plugin/compare/510aa05c7909...d9e5c847afef

            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Oliver Gondža Path: src/main/java/hudson/matrix/MatrixChildParametersAction.java src/main/java/hudson/matrix/MatrixConfiguration.java src/test/java/hudson/matrix/MatrixProjectTest.java http://jenkins-ci.org/commit/matrix-project-plugin/d9e5c847afef3928441bdb91df37f764ea6617fd Log: Merge pull request #36 from amuniz/ JENKINS-34758 -fix JENKINS-34758 Parameters visibility in child builds Compare: https://github.com/jenkinsci/matrix-project-plugin/compare/510aa05c7909...d9e5c847afef

            Released as 1.7

            amuniz Antonio Muñiz added a comment - Released as 1.7

            Issue JENKINS-35330 describes that the content of "List subversion tags and more" and branch parameters of the Git plugin are not passed to the child jobs (I.e., as "null"). I think, the the applied fix should be revised for this types of parameters. Therefore, I've setup a link between these two issues and re-opened this issue ...

            Best regards from Salzburg,
            Markus

            gmc_devel GMC Software Development B&R Corporate added a comment - - edited Issue JENKINS-35330 describes that the content of "List subversion tags and more" and branch parameters of the Git plugin are not passed to the child jobs (I.e., as "null"). I think, the the applied fix should be revised for this types of parameters. Therefore, I've setup a link between these two issues and re-opened this issue ... Best regards from Salzburg, Markus

            Reassigning, after it got assigned to me by mistake.

            mj_manish Manish Jawarilal added a comment - Reassigning, after it got assigned to me by mistake.

            Hi Team,

            Any update on this issue. Am stuck with the same problem. Jenkins version: Jenkins ver. 1.651.3

            mj_manish Manish Jawarilal added a comment - Hi Team, Any update on this issue. Am stuck with the same problem. Jenkins version:  Jenkins ver. 1.651.3

            I believe this is still the case on 2.176.2.

            javydreamercsw javydreamercsw added a comment - I believe this is still the case on 2.176.2.
            owenmehegan Owen Mehegan added a comment -

            This bug was fixed and released in matrix-project 1.7 back in 2016. If you are seeing a similar issue, please open a new jira.

            owenmehegan Owen Mehegan added a comment - This bug was fixed and released in matrix-project 1.7 back in 2016. If you are seeing a similar issue, please open a new jira.

            People

              amuniz Antonio Muñiz
              odd_bloke Daniel Watkins
              Votes:
              29 Vote for this issue
              Watchers:
              43 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: