Credentials environment variable isn't evaluated/available in the environment directive

This issue is archived. You can view it, but you can't modify it. Learn more

XMLWordPrintable

      We'd like to do:

      pipeline {
       // snip //
       environment {
        VARIABLES = credentials('MOZILLIANS_VARIABLES')
        SAUCELABS_API_KEY = credentials('SAUCELABS_API_KEY')
        PYTEST_ADDOPTS = "--color=yes --driver=SauceLabs --variables=capabilities.json --variables=${VARIABLES}"
       }
       // snip //
      }
      

      But we get:

      WorkflowScript: 25: ""--variables" is not a valid identifier and cannot be used for an environment variable. Identifiers must start with a letter or underscore and can contain only letters, numbers or underscores. @ line 25, column 7.
       "--variables=${VARIABLES}"
      

       The workaround is to currently do:

      pipeline {
       // snip //
       environment {
        VARIABLES = credentials('MOZILLIANS_VARIABLES')
        SAUCELABS_API_KEY = credentials('SAUCELABS_API_KEY')
       }
       stages {
        stage('Test') {
         environment {
          PYTEST_ADDOPTS = "--color=yes --driver=SauceLabs --variables=capabilities.json --variables=${VARIABLES}"
         }
        // snip //
      }

       

       

            Assignee:
            Andrew Bayer
            Reporter:
            Stephen Donner
            Archiver:
            Jenkins Service Account

              Created:
              Updated:
              Resolved:
              Archived: