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

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

    XMLWordPrintable

    Details

    • Sprint:
      Pipeline - December
    • Similar Issues:

      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

            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.
            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. =)
            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.

              People

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

                Dates

                • Created:
                  Updated:
                  Resolved: