This happened after I updated some plugins and added 'blue ocean' to our Jenkins.
Every job we have is using a JenkinsFile to build and package our applications.
But we are loading some groovy files within our git from the workspace@script
folder, so this is what I did :
script {
slack = load WORKSPACE + "@script/jenkins/libs/toto.groovy"
}
But now I have to do this to have the right folder :
script {
// Locate the jenkins folder
// This is done because there is a new sub-folder (like : 17a4ba1ed1ce777b18c5...)
// that appeared out of nowhere (update -> security ??)
git_jenkins_folder = sh (
script: "find " + WORKSPACE + "@script -type d -name 'jenkins' -printf '%T@ %Tc %p\n' | sort -rn | head -1 | cut -d' ' -f9",
returnStdout: true
).trim()
// Load the groovy methods in groovy files
slack = load git_jenkins_folder + "/libs/toto.groovy"
}
And of course, I had to remove previously checked out code from the workspace@script
folder for this to work.
Why did this happened all of a sudden ? I was thinking of a security update maybe ?
What if this number changes in the future and a new folder appear ??
This is really weird IMHO but maybe I missed something. If someone out there has the answer I'll gladly read it :)
EDIT :
Thanks to @1141514admin, this was done to address those issues with the 'Pipeline: Groovy' plugin :
- https://www.jenkins.io/security/advisory/2022-02-15/#SECURITY-2443
- https://www.jenkins.io/security/advisory/2022-02-15/#SECURITY-2463
- https://www.jenkins.io/security/advisory/2022-02-15/#SECURITY-2613
EDIT 2 :
Added retrieval of the last modified folder in case this folder name changes in the future.