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

Sequential stages post section does not execute in the expected context

      The following Jenkinsfile fails with

      Error when executing always post condition:
      org.jenkinsci.plugins.workflow.steps.MissingContextVariableException: Required context class hudson.FilePath is missing

      pipeline {
        agent none
      
        stages {
          stage('Hello World') {
            agent any
      
            stages {
              stage('Nested') {
                steps {
                  echo 'Hi!'
                }
              }
            }
      
            post {
              always {
                deleteDir()
              }
            }
          }
        }
      }
      

      I would expect post to run on the node selected for the 'Hello World' stage as it does in the following, working example that does not utilize sequential stages:

      pipeline {
        agent none
      
        stages {
          stage('Hello World') {
            agent any
      
            steps {
              echo 'Hi!'
            }
      
            post {
              always {
                deleteDir()
              }
            }
          }
        }
      }
      

          [JENKINS-52084] Sequential stages post section does not execute in the expected context

          Adam Voss created issue -
          Adam Voss made changes -
          Link New: This issue is related to JENKINS-46809 [ JENKINS-46809 ]
          Andrew Bayer made changes -
          Status Original: Open [ 1 ] New: In Progress [ 3 ]
          Andrew Bayer made changes -
          Status Original: In Progress [ 3 ] New: In Review [ 10005 ]
          Andrew Bayer made changes -
          Remote Link New: This issue links to "PR #272 (Web Link)" [ 21111 ]
          Andrew Bayer made changes -
          Resolution New: Fixed [ 1 ]
          Status Original: In Review [ 10005 ] New: Resolved [ 5 ]
          Liam Newman made changes -
          Status Original: Resolved [ 5 ] New: Closed [ 6 ]

            abayer Andrew Bayer
            adamvoss Adam Voss
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: