exws(ws) { stage() { ...} }
then you have to switch it around to stage() { exws(ws) { ...} }
because the stage appears to reset the workspace path.
withEnv
and withCredentials
.
exws()
and stage()
. Do you think we should do something about it in the plugin? Or just something to be aware of?
node('dockerserver') {
withCredentials([
usernamePassword(
credentialsId: 'svc',
usernameVariable: 'SVC_AUTHENTICATION_USR',
passwordVariable: 'SVC_AUTHENTICATION_PSW'
),
string(
credentialsId: 'bb',
variable: 'BB_PAT'
),
string(
credentialsId: 'nlt',
variable: 'NPM_LOCAL_TOKEN'
)
]) {
withEnv([
"HOME=${workspace}"
]) {
exws(extWorkspace) {
docker.image('node-builder')
.inside('--tmpfs /.config --ipc=host', cl)
}
}
}
}
${workspace}
? I guess that might be part of your question as well. You should try to allocate a workspace first with exwsAllocate
, then you can use it with exws
. Hope this helps...
exws
is there a way to get the computed exws
I would like home to be set to the same value as the exws
path ? If I hardcode HOME = /mount-point/job/path/12
my pipeline works so if I can just get this from exws. I tried extWorkspace.pathOnDisk
but got an error that the method isn't allowed to be called by a script.
Hi @solvingj Yes, the plugin works across multiple agents, as long as all of them mount the same disk (via NFS, for example). Please make sure that you have the prerequisites set-up correctly before running the plugin.
Now, related to potential multithreading issues that many agents may read/write the same resource - I have to say I didn't have any problems with that. The plugin doesn't do anything special to handle these cases, but I guess there is some resource locking and handling at OS level. Moreover, it depends how you use the plugin. The common approach, I think, is to have one master Jenkins job that writes on the shared disk, then it chains other downstream Jenkins job that reuse the same workspace, but don't necessary run in parallel.
Hello.
Why the following doesn't work I can't figure out:
def extWorkspace = exwsAllocate "diskpool1"
node('R584_CrossTests(LSB_x86)_Debian.9.8-i686') {
exws (extWorkspace) {
sh 'ls -la'
sh 'touch test1.txt'
sh 'ls -la'
}
}
node('R584_CrossTests(LSB_LicenseFree_x86)_Debian.9.8-i686') {
exws (extWorkspace) {
sh 'ls -la'
sh 'touch test2.txt'
sh 'ls -la'
}
}
I get:
Disk allocation strategy was not provided as step parameter. Fallback to the strategy defined in the Jenkins global config
Using Disk allocation strategy: 'Select the Disk with the most usable space'
Selected Disk ID 'disk1' from the Disk Pool ID 'diskpool1'
The path on Disk is: folder1/for_test/Fazlyev/upstream/85
[Pipeline] node
Running on R584_CrossTests(LSB_x86)_Debian.9.8-i686 in /home/tester/workspace/for_test/Fazlyev/upstream
[Pipeline] {
[Pipeline] exws
Searching for disk definitions in the External Workspace Templates from Jenkins global config
Searching for disk definitions in the Node config
Running in /mnt/disk1/folder1/for_test/Fazlyev/upstream/85
[Pipeline] {
[Pipeline] sh
Why doesn't the second agent see the file created by the first agent?
Node Properties
: https://github.com/jenkinsci/external-workspace-manager-plugin/blob/master/doc/PREREQUISITES.md#node-properties? And please make sure that the mounts are correctly working. Can you list the same files when accessing the mnt
path on your nodes?