[JIRA] (JENKINS-54110) Pipeline's dir() does not work with symlinks

1 view
Skip to first unread message

monitorjbl@gmail.com (JIRA)

unread,
Oct 16, 2018, 2:39:01 PM10/16/18
to jenkinsc...@googlegroups.com
Taylor Jones created an issue
 
Jenkins / Bug JENKINS-54110
Pipeline's dir() does not work with symlinks
Issue Type: Bug Bug
Assignee: Unassigned
Components: pipeline
Created: 2018-10-16 18:38
Priority: Major Major
Reporter: Taylor Jones

I'm currently trying to do this as a way of getting around bash's interpreter path length restrictions. Since Jenkins Pipeline generates an obscenely long workspace name, I figured the easiest solution would be to create a symlink in /tmp and just change directory into it. Unfortunately, this does not work.

This is easy to reproduce, just run the following Pipeline job:

node {
    def id = UUID.randomUUID().toString()
    def symlink = "/tmp/${id}"
    sh("ln -s ${pwd()} ${symlink}")
    sh("ls -lah /tmp")
    dir(symlink) {
        println("Jenkins thinks we are in ${pwd()}")
        sh('echo "But we are actually in `pwd`"')
        sh("ls -lah /tmp")
    }
    sh("rm -fr /tmp/${id}")
} 

 

If you run that, you'll also see that Jenkins generates this odd directory when you try to change into the symlink:

 

+ ls -lah /tmp
total 3.0M
drwxrwxrwt 43 root     root     4.0K Oct 16 18:36 .
dr-xr-xr-x 27 root     root     4.0K Oct 16 18:10 ..
lrwxrwxrwx  1 jenkins  jenkins    40 Oct 16 18:36 136ef826-e9a1-479e-9074-1de076349252 -> /var/build/workspace/jenkinsfile-sandbox
drwxr-xr-x  3 jenkins  jenkins  4.0K Oct 16 18:36 136ef826-e9a1-479e-9074-1de076349252@tmp 

 

Add Comment Add Comment
 
This message was sent by Atlassian Jira (v7.11.2#711002-sha1:fdc329d)

andrew.bayer@gmail.com (JIRA)

unread,
Nov 5, 2018, 2:57:01 PM11/5/18
to jenkinsc...@googlegroups.com
Andrew Bayer updated an issue
Change By: Andrew Bayer
Component/s: workflow-basic-steps-plugin
Component/s: pipeline

seflue@web.de (JIRA)

unread,
Apr 14, 2020, 3:28:03 AM4/14/20
to jenkinsc...@googlegroups.com
Sebastian Flügge commented on Bug JENKINS-54110
 
Re: Pipeline's dir() does not work with symlinks

I can confirm this bug because I ran into it with the same motivation as Taylor Jones. Would be nice if it can be fixed.

This message was sent by Atlassian Jira (v7.13.12#713012-sha1:6e07c38)
Atlassian logo
Reply all
Reply to author
Forward
0 new messages