A new global library directory is created created on the build node every time a new instance of the job runs. For example 25 executions of the job created:
/var/lib/jenkins/workspace/UseLibrary@libs# ls
0006ba1d137d4dbf008dd8fda6ea05de69f37f8c1d782c24e52ccd0ab17eb593
0006ba1d137d4dbf008dd8fda6ea05de69f37f8c1d782c24e52ccd0ab17eb593-scm-key.txt
16b718c595dd9e1c1fedbcc84da74e8cb78d80eb3ffe0d7337cdcf7999b987fa
16b718c595dd9e1c1fedbcc84da74e8cb78d80eb3ffe0d7337cdcf7999b987fa-scm-key.txt
2a87fa64a8dbf6d680749a26bf2ec9e55c7ba647224de862b96134993270c5d9
2a87fa64a8dbf6d680749a26bf2ec9e55c7ba647224de862b96134993270c5d9-scm-key.txt
2b837f581674386ea1f4d63d4937ba2f3d841a3531398602bf8eb330f3a59aef
2b837f581674386ea1f4d63d4937ba2f3d841a3531398602bf8eb330f3a59aef-scm-key.txt
35fc39a87b13303924c1f894f1e505abe4892ba636740cbccc4fb4b3662d0a13
35fc39a87b13303924c1f894f1e505abe4892ba636740cbccc4fb4b3662d0a13-scm-key.txt
3816c8b05379fdb16b0f3097360c06dc7e5d0495ff05f5d03ebb675720e45564
3816c8b05379fdb16b0f3097360c06dc7e5d0495ff05f5d03ebb675720e45564-scm-key.txt
39f97351b40596950294fc88ba4c19fe46e1ad74cb31948c05c82458ed8ba852
39f97351b40596950294fc88ba4c19fe46e1ad74cb31948c05c82458ed8ba852-scm-key.txt
406aafc3d5ab431ba102863762a90d7ebc03da1943a9373d34e96528def0c14c
406aafc3d5ab431ba102863762a90d7ebc03da1943a9373d34e96528def0c14c-scm-key.txt
4704b89cbdee05bb01a0ee33f891d8443a159e1f4759778e4d0bac4cb1367f5b
4704b89cbdee05bb01a0ee33f891d8443a159e1f4759778e4d0bac4cb1367f5b-scm-key.txt
576282536fe7dd2817cc1fc76b5259764224ee504428f5c1001a64f9f641421d
576282536fe7dd2817cc1fc76b5259764224ee504428f5c1001a64f9f641421d-scm-key.txt
614e83d084d1f3855c76a2f1c43676d13ad68dc096968026d462c1bccb1ae4a5
614e83d084d1f3855c76a2f1c43676d13ad68dc096968026d462c1bccb1ae4a5-scm-key.txt
6a3a835cff1c06cf7aa580bdde3fb745e3ebb2df8274ad06d1a742d6ca9bce40
6a3a835cff1c06cf7aa580bdde3fb745e3ebb2df8274ad06d1a742d6ca9bce40-scm-key.txt
73abd03c87de9b5fdf82a53b75cd4ff378ebfdf925b2771d9a411ea5281802eb
73abd03c87de9b5fdf82a53b75cd4ff378ebfdf925b2771d9a411ea5281802eb-scm-key.txt
752760c9ccce25955ab33bd1ebbc2b6040b17c865b589aa31c8fa8dd7a9d5084
752760c9ccce25955ab33bd1ebbc2b6040b17c865b589aa31c8fa8dd7a9d5084-scm-key.txt
7bd1ab0f0adb7039b49ca1ca55e581427162efa323e96e04019b18594818dfb9
7bd1ab0f0adb7039b49ca1ca55e581427162efa323e96e04019b18594818dfb9-scm-key.txt
7d3006707830204ba96f72a00c75e747168d45b16afb2b6d7b9a41cd07bde7dc
7d3006707830204ba96f72a00c75e747168d45b16afb2b6d7b9a41cd07bde7dc-scm-key.txt
8251dd05b18c6dfc8ac294fc23b18fb1bc50591ebe9376eb7792925dad07f0e3
8251dd05b18c6dfc8ac294fc23b18fb1bc50591ebe9376eb7792925dad07f0e3-scm-key.txt
9440ba27cf7da6d0ca455f384929cf503ef7e02a72c1b6c3347526be603eb679
9440ba27cf7da6d0ca455f384929cf503ef7e02a72c1b6c3347526be603eb679-scm-key.txt
aabe95a2f6815b008fd7d81df79048126b348c3bc4e4f2501facc43f3b2d29d6
aabe95a2f6815b008fd7d81df79048126b348c3bc4e4f2501facc43f3b2d29d6-scm-key.txt
ac265067b398a0eff5676df0e5208ce9407c2a64d30b1cbcfa834abc304c5c5b
ac265067b398a0eff5676df0e5208ce9407c2a64d30b1cbcfa834abc304c5c5b-scm-key.txt
bbbf97e06c27a7e0fe405309770b1f20848304c605808de0a9f48630a7850fa4
bbbf97e06c27a7e0fe405309770b1f20848304c605808de0a9f48630a7850fa4-scm-key.txt
c3770e8f3232616c1ce93cba93e46cfd542128d1b9a93cc8d82681de7d267485
c3770e8f3232616c1ce93cba93e46cfd542128d1b9a93cc8d82681de7d267485-scm-key.txt
cd7516e31a8d628ca675c707e959381ea0fd97f8078305509ea8fb0e432db0d0
cd7516e31a8d628ca675c707e959381ea0fd97f8078305509ea8fb0e432db0d0-scm-key.txt
dfba4fb72c03ece47dd46f87ac47370187c990a08a5acc815162a914f74bb8cb
dfba4fb72c03ece47dd46f87ac47370187c990a08a5acc815162a914f74bb8cb-scm-key.txt
ea4e102279e45dfb50bb1ca80fe1c7ffdd90a151e8bd6a4f69cbb92d2a2c64eb
ea4e102279e45dfb50bb1ca80fe1c7ffdd90a151e8bd6a4f69cbb92d2a2c64eb-scm-key.txt
eb465a320a6498d05047bc7517219eb697c1e55cc544757709d73ba5da6d25c0
eb465a320a6498d05047bc7517219eb697c1e55cc544757709d73ba5da6d25c0-scm-key.txt
Reproduction steps:
(1) Change Manage Jenkins settings to allow Jenkins to have 4 executors.
(2) Add following file to depot as '//depot/myLibrary/src/org/foo/lib.groovy'
package org.foo;def dispEnv () { echo "All Environment Variables" if (isUnix()) { sh 'env' } else { bat 'set' } }def testFunc () { echo "HELLO FROM testFunc version 3." dispEnv() }return this;
(3) Create a Modern SCM library:
(4) Create a job that uses the library and allows concurrent builds.
@Library('my-shared-library') import org.foo.lib.* pipeline { agent any stages { stage("Repro") { steps { script { def z = new org.foo.lib() z.testFunc() sh('sleep 20') } } } } }
(5) Run build 4 times.
(6) Look at 'workspace' directory on build machine to see that @libs for the job now contains 4 text files and 4 folders.
(7) Wait till all jobs complete.
(8) Run build 4 times immediately.
(9) Look at 'workspace' directory on build machine to see that @libs for the job now contains 8 text files and 8 folders.