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

File credentials can't be used in Declarative environment variables

    Details

    • Similar Issues:

      Description

      Because we don't add credentials requiring a workspace (i.e., file credentials) to the environment at the initial resolution time, and because we actually process credentials for real after we populate the environment at runtime, an attempt to use the path of a file credential inside another environment variable fails. i.e.,

      environment {
        CREDENTIALS_PATH = credentials('MY_SECRET_FILE') // this should result in CREDENTIALS_PATH containing the path to the file
        ARGS = "--path=${CREDENTIALS_PATH}" // this should result in ARGS containing the path within CREDENTIALS_PATH
      }
      

      will result in

      groovy.lang.MissingPropertyException: No such property: CREDENTIALS_PATH for class: groovy.lang.Binding
      

      This is nonoptimal and needs to be fixed somehow.

        Attachments

          Issue Links

            Activity

            Show
            abayer Andrew Bayer added a comment - Incorporated a fix into https://github.com/jenkinsci/pipeline-model-definition-plugin/pull/155
            Hide
            abayer Andrew Bayer added a comment -

            Released in 1.1.4 just now!

            Show
            abayer Andrew Bayer added a comment - Released in 1.1.4 just now!
            Hide
            stephendonner Stephen Donner added a comment -

            Thanks, Andrew!

            Just wanted to confirm and verify that this is indeed now fixed: https://github.com/mozilla/mozillians-tests/pull/315

            Cheers!

            Show
            stephendonner Stephen Donner added a comment - Thanks, Andrew! Just wanted to confirm and verify that this is indeed now fixed: https://github.com/mozilla/mozillians-tests/pull/315 Cheers!
            Hide
            bparsapo Bahram Parsapour added a comment -

            Please can someone also update the documentation too - see: https://jenkins.io/doc/book/pipeline/syntax/#environment

            thanks!

            Show
            bparsapo Bahram Parsapour added a comment - Please can someone also update the documentation too - see: https://jenkins.io/doc/book/pipeline/syntax/#environment thanks!
            Hide
            bitwiseman Liam Newman added a comment -

            Bulk closing resolved issues.

            Show
            bitwiseman Liam Newman added a comment - Bulk closing resolved issues.

              People

              • Assignee:
                abayer Andrew Bayer
                Reporter:
                abayer Andrew Bayer
              • Votes:
                1 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: