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

Multi-line, concatenated-string values aren't parsed/passed in/to "environment" variable

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: Minor Minor
    • None
    • Jenkins 2.32.2
      Pipeline Model Definition Plugin 1.1.1 (and all associated/dependent plugins, same/greater versions)

      Given the following snippet of a Jenkinsfile:

      environment {
      PYTEST_ADDOPTS =
      "-n=10 " +
      "--color=yes " +
      "--tb=short " +
      "--driver=SauceLabs " +
      "--variables=capabilities.json"
      }

      When trying to run the above, we get:

      Actual Results:

      org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
      WorkflowScript: 19: Environment variable values must either be strings or function calls. @ line 19, column 5.
      PYTEST_ADDOPTS =
      ^

      The workaround is to do:

      environment {
      PYTEST_ADDOPTS = "-n=10 --color=yes --tb=short --driver=SauceLabs --variables=capabilities.json"
      }

            abayer Andrew Bayer
            stephendonner Stephen Donner
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: