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

Declarative syntax: ${env.WORKSPACE} not set in environment block

    XMLWordPrintable

    Details

    • Similar Issues:
    • Sprint:
      Pipeline - December

      Description

      I got the following in my jenkins file:

      pipeline {
      agent any

      environment {
      SOURCE = "${env.WORKSPACE}
      mydirectory"
      // The above is not working? WORKSPACE is null as you can see later.
      HTDOCS = "C:\\Apache24\\htdocs
      "
      }

      stages {
      stage('Prepare') {
      steps {
      echo "WORKSPACE ${env.WORKSPACE}" // correct
      echo "SOURCE ${env.SOURCE}" // wrong, is set to null\myDirectoy
      echo "INEW_HTDOCS ${env.INEW_HTDOCS}" // correct
      }
      }

      ....

        Attachments

          Issue Links

            Activity

            p_garstenauer Paul Garstenauer created issue -
            abayer Andrew Bayer made changes -
            Field Original Value New Value
            Component/s pipeline-model-definition-plugin [ 21706 ]
            Component/s pipeline [ 21692 ]
            abayer Andrew Bayer made changes -
            Link This issue duplicates JENKINS-41748 [ JENKINS-41748 ]
            abayer Andrew Bayer made changes -
            Resolution Duplicate [ 3 ]
            Status Open [ 1 ] Resolved [ 5 ]
            Hide
            abayer Andrew Bayer added a comment -

            Reopening - while working on JENKINS-41748, I realized that this will still be a problem there, since we don't actually have a WORKSPACE yet at the time we do environment variable resolution.

            Show
            abayer Andrew Bayer added a comment - Reopening - while working on JENKINS-41748 , I realized that this will still be a problem there, since we don't actually have a WORKSPACE yet at the time we do environment variable resolution.
            abayer Andrew Bayer made changes -
            Assignee Andrew Bayer [ abayer ]
            Resolution Duplicate [ 3 ]
            Status Resolved [ 5 ] Reopened [ 4 ]
            abayer Andrew Bayer made changes -
            Status Reopened [ 4 ] In Progress [ 3 ]
            abayer Andrew Bayer made changes -
            Status In Progress [ 3 ] In Review [ 10005 ]
            Hide
            abayer Andrew Bayer added a comment -

            PR up at https://github.com/jenkinsci/pipeline-model-definition-plugin/pull/110 - decided that this merited a separate commit from JENKINS-41748 but not a separate PR entirely, since it required the JENKINS-41748 change anyway. =)

            Show
            abayer Andrew Bayer added a comment - PR up at https://github.com/jenkinsci/pipeline-model-definition-plugin/pull/110 - decided that this merited a separate commit from JENKINS-41748 but not a separate PR entirely, since it required the JENKINS-41748 change anyway. =)
            abayer Andrew Bayer made changes -
            Remote Link This issue links to "PR #110 (Web Link)" [ 15421 ]
            abayer Andrew Bayer made changes -
            Link This issue is duplicated by JENKINS-41623 [ JENKINS-41623 ]
            abayer Andrew Bayer made changes -
            Resolution Fixed [ 1 ]
            Status In Review [ 10005 ] Resolved [ 5 ]
            cdhkmmaes Jeff Thomas made changes -
            Status Resolved [ 5 ] In Review [ 10005 ]
            jamesdumay James Dumay made changes -
            Sprint Pipeline - December [ 446 ]
            jamesdumay James Dumay made changes -
            Rank Ranked lower
            cloudbees CloudBees Inc. made changes -
            Remote Link This issue links to "CloudBees Internal OSS-1974 (Web Link)" [ 18489 ]
            abayer Andrew Bayer made changes -
            Status In Review [ 10005 ] In Progress [ 3 ]
            abayer Andrew Bayer made changes -
            Resolution Fixed [ 1 ]
            Status In Progress [ 3 ] Open [ 1 ]
            Hide
            abayer Andrew Bayer added a comment -

            This was actually done in 1.2.

            Show
            abayer Andrew Bayer added a comment - This was actually done in 1.2.
            abayer Andrew Bayer made changes -
            Resolution Fixed [ 1 ]
            Status Open [ 1 ] Resolved [ 5 ]
            Hide
            bitwiseman Liam Newman added a comment -

            Bulk closing resolved issues.

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

              People

              Assignee:
              abayer Andrew Bayer
              Reporter:
              p_garstenauer Paul Garstenauer
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: