Hi,

We're using Jenkins LTS 2.164.3 and Pipeline Basic Steps 2.16, and the 
behaviour of the `dir` step has started to change, impacting most of our 
pipelines.

I could reproduce this on a small pipeline:

node {
    stage("Test") {
        sh '''
            mkdir -p parent/child
            echo test > parent/child/file
        '''
        
        dir('parent') {
             withCredentials([
                            usernamePassword(credentialsId: 
'docker-repository', usernameVariable: 'DOCKER_REPOSITORY_USR', 
passwordVariable: 'DOCKER_REPOSITORY_PSW'),
                    ]) {
                        sh 'ls -l child'
                    }
        }
    }
}

The last sh step would fail - the dir context is lost.

If I put `dir` closer to its context, it works:

node {
    stage("Test") {
        sh '''
            mkdir -p parent/child
            echo test > parent/child/file
        '''
        
        withCredentials([
                            usernamePassword(credentialsId: 
'docker-repository', usernameVariable: 'DOCKER_REPOSITORY_USR', 
passwordVariable: 'DOCKER_REPOSITORY_PSW'),
                    ]) {
                    dir('parent') {
                        sh 'ls -l child'
                    }
        }
    }
}

Since this impacts many many pipelines, it is a big regression for us?

Does anybody know if this is known regression? I could not find any post 
nor ticket about this.

Thanks,
Damien

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/d57326a1-a342-4836-9d11-b3abf7e5ca4d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to