Regression in `dir` step when wrapping other steps?

22 views
Skip to first unread message

Damien Coraboeuf

unread,
Jun 5, 2019, 6:51:44 AM6/5/19
to Jenkins Users
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

Devin Nusbaum

unread,
Jun 5, 2019, 9:59:17 AM6/5/19
to jenkins...@googlegroups.com
I’m not aware of any intentional changes like this. What versions of Pipeline Groovy and Pipeline Nodes and Processes are you currently running?

--
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 jenkinsci-use...@googlegroups.com.
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.

Devin Nusbaum

unread,
Jun 5, 2019, 10:02:01 AM6/5/19
to jenkins...@googlegroups.com
Also, can you post the exact error message you are getting?

Damien Coraboeuf

unread,
Jun 6, 2019, 8:00:16 AM6/6/19
to Jenkins Users
It seems to have been solved by updating (again) all the plugins, esp. Groovy + Basic Steps. It seems we were in an intermediary situation.


On Wednesday, 5 June 2019 16:02:01 UTC+2, Devin Nusbaum wrote:
Also, can you post the exact error message you are getting?
On Jun 5, 2019, at 09:59, Devin Nusbaum <dnus...@cloudbees.com> wrote:

I’m not aware of any intentional changes like this. What versions of Pipeline Groovy and Pipeline Nodes and Processes are you currently running?
To unsubscribe from this group and stop receiving emails from it, send an email to jenkins...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages