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

Jenkins occasionally loses parameters passed downstream

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Open (View Workflow)
    • Priority: Minor
    • Resolution: Unresolved
    • Component/s: pipeline
    • Labels:
      None
    • Environment:
      Jenkins LTS 2.138 deployed from official Docker image
      pipeline-build-step 2.7
      pipeline-model-api 1.2.7
      pipeline-model-declarative-agent 1.1.1
      pipeline-model-definition 1.2.7
      pipeline-model-extensions 1.2.7
    • Similar Issues:

      Description

       We use pipeline jobs retrieved via Git SCM. There are simplified version of how they look like:

      // name: my_upstream_job.groovy
      // just triggers some downstream build
      
      thebuild = build job: 'my_downstream_job',
                  propagate: false,
                  parameters: [
                      string(name: "my_str_param", value: "foo")
                  ]
                 
      
      // name: my_downstream_job.groovy
      // occasionally fails due to java.lang.NullPointerException: Cannot invoke method contains() on null object
      
      properties([
          parameters([
              string(
                  defaultValue: '',
                  description: 'Some parameter for demo',
                  name: 'my_str_param')
          ])
      ])
      
      // if we're using something like this outside of node() step
      // build can occasionally fail
      if (env.my_str_param.contains("foo")) {
          println 'Called from upstream build'
      }
      
      // other steps
      node {
          println "Building and testing"
      }
      

      Sometimes Jenkins can 'lose' parameters passed from upstream build in my configuration. About 1 time per 5 successful executions downstream build will fail with an error like this:

      java.lang.NullPointerException: Cannot invoke method contains() on null object 

      However, in build.xml file for that build on Jenkins master all parameters' values  are in place, and I can click 'Rebuild' and build will pass. But 'Parameters' page for the failed build is empty.

      In Jenkins log there are many entries like this:

       

      Skipped parameter `param_name` as it is undefined on `job_name`. 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 or `-Dhudson.model.ParametersAction.keepUndefinedParameters=false` to no longer show this message.

       

      We've "fixed" this by replacing env.param_name with params.param_name in our pipelines and shared library, but env approach used to work before (I can't be really sure whether upgrade broke it or we somehow).

      Is there's a way I can investigate further? Please let me know if you need additional information.

       

        Attachments

          Activity

          There are no comments yet on this issue.

            People

            • Assignee:
              Unassigned
              Reporter:
              oxygenxo Andrey Babushkin
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated: