Question regarding Jenkins pipeline setup

5,108 views
Skip to first unread message

tomwils...@gmail.com

unread,
Apr 1, 2016, 7:00:18 AM4/1/16
to Jenkins Users
Hello,
   I'm trying to setup Jenkins to run a multibranch pipeline project.  Just to test, I use a very simple Jenkinsfile like this:

node {
checkout scm
bat 'echo > tst1.txt'
}

When I run the build, for each branch, for example the 'master' branch, Jenkins creates 3 directories:
- workspace@script: contains source code.  This is created first even before the node statement is executed.
- workspace: contains source code.  This is created with the node statement
- workspace@tmp: empty.  This is created when running 'bat' command.


- Certainly I do not need 2 copies of the source code so I don't need the workspace@script directories but this is created automatically and I do not know how to turn it off.  The default directory when inside the node command block is 'workspace', not 'workspace@script' so I can't do anything with the source unless I change directory to workspace@script.  Is there anyway so that Jenkins does not check out the workspace@script directory?

- What is the purpose of workspace@tmp? and is there a way not to create it as well?

Thanks

Brian Ray

unread,
Apr 1, 2016, 4:07:41 PM4/1/16
to Jenkins Users
https://issues.jenkins-ci.org/browse/JENKINS-27152

I'm not sure about @script but suspect it's a similar necessity.

tomwils...@gmail.com

unread,
Apr 1, 2016, 7:49:46 PM4/1/16
to Jenkins Users
     Thank you Brian, you're right regarding the @tmp directory.  However the @script directory seems to be different.
     I'm searching in the source code of the workflow cps plugin.  The file CpsScmFlowDefinition.java seems to be the place where the workspace@script behavior is implemented.  It seems that it use this mechanism to checkout and search the entire repository for the Jenkinsfile.  I didn't look very careful at this code yet but it make me concern a little bit about the efficiency of this operation.  If in order to search for the Jenkinsfile, it has to check out the entire repository then it would be quite slow for big repository.  I wonder whether some repository has option to simply search the file inside or not and whether Jenkins actually implements this functionality this way.

Tom

Brian Ray

unread,
Apr 4, 2016, 6:40:24 PM4/4/16
to Jenkins Users
Interesting. We have not got to using the Jenkinsfile "discovery" functionality yet, but this is good to know. I'll keep my eyes open for more on this subdirectory.

Peter Wiseman

unread,
Aug 1, 2016, 11:30:04 PM8/1/16
to Jenkins Users
Likewise, I'm concerned about a full checkout into workspace@script.  Seems to be overkill if it's just to find the Jenkinsfile.  With multiple active branches (each 3GB), that's seemingly quite a lot of unnecessary permanent storage.

jer...@bodycad.com

unread,
Aug 4, 2016, 6:37:09 PM8/4/16
to Jenkins Users
Just realized the same thing, after developing my JenkinsFile inline with sandbox removed, then approved the whole operation into white listing. That @script folder was unexpected for the least I could say

Leon Poon

unread,
Aug 24, 2016, 8:11:07 PM8/24/16
to Jenkins Users
More importantly, what is the best way of cleaning up the @script folders?
Reply all
Reply to author
Forward
0 new messages