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

Support for implicit variable WORKSPACE in Pipeline stages

XMLWordPrintable

    • Icon: New Feature New Feature
    • Resolution: Duplicate
    • Icon: Major Major
    • pipeline

      I've migrated a sequence of build steps to the new Pi Pipeline item in Jenkins ver. 2.0-beta-1. What has worked before (as a part of a Execute Shell build step) does not work now, since I cannot access the Workspace. Simplified example:

      node {
         stage 'Checkout'
         git url: 'git@github.com:abc/sandbox.git'
      
         stage 'Stage 1'
         sh 'echo $WORKSPACE'
         
         stage 'Stage 2'
         sh '''#!/bin/sh
         echo hi
         echo $WORKSPACE'''
      }
      

      In the inline documentation, I read that variable WORKSPACE is not supported currently. On the other hand, looking on the console, the Pipeline job has a workspace where the Git sources were checked out to, according to my first Pipeline stage.

      A workaround could be to have a variable that just holds the current working directory as absolute path, but I do not know the recommended way to get that.

            jglick Jesse Glick
            michaelhuettermann Michael Hüttermann
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: