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

Variable resolution in GString fails for docker args

      agent {
        docker {
          image 'maven:3-alpine'
          args "-v ${HOME}/.m2:/root/.m2"
        }
       }

      Fails with compilation error
      groovy.lang.MissingPropertyException: No such property: HOME for class: groovy.lang.Binding
      The HOME env var should technically be there in runtime since we are inside a node block

          [JENKINS-44352] Variable resolution in GString fails for docker args

          rsandell created issue -
          Andrew Bayer made changes -
          Labels New: declarative-variable-and-method-resolution
          James Dumay made changes -
          Epic Link New: JENKINS-45381 [ 183541 ]
          James Dumay made changes -
          Rank New: Ranked higher
          James Dumay made changes -
          Rank New: Ranked lower

          Andrew Bayer added a comment -

          Playing around with this in the post JENKINS-42753 world, and it's still weird. Will revisit later.

          Andrew Bayer added a comment - Playing around with this in the post JENKINS-42753 world, and it's still weird. Will revisit later.

          Andrew Bayer added a comment -

          fwiw, what you probably want here is actually to use single-quotes. $HOME will end up resolving correctly at execution time.

          Andrew Bayer added a comment - fwiw, what you probably want here is actually to use single-quotes. $HOME will end up resolving correctly at execution time.
          Andrew Bayer made changes -
          Link New: This issue duplicates JENKINS-43911 [ JENKINS-43911 ]
          Andrew Bayer made changes -
          Resolution New: Duplicate [ 3 ]
          Status Original: Open [ 1 ] New: Resolved [ 5 ]

          Liam Newman added a comment -

          Bulk closing resolved issues.

          Liam Newman added a comment - Bulk closing resolved issues.
          Liam Newman made changes -
          Status Original: Resolved [ 5 ] New: Closed [ 6 ]

            abayer Andrew Bayer
            rsandell rsandell
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: