I am also experiencing this issue using readProperties, and it's a major blocker for my pipeline jobs:
- Run a pipeline with a readProperties step
- Clearing the workspace containing the file from the Jenkins front-end leaves a zero byte file along with throwing a Jenkins 'access denied' error
- Updating the workspace from SVN, I get an access denied error on that file when syncing
- The workspace is unusable until the Jenkins service is restarted, then the file locks are released
Below are steps to reproduce the SVN update:
- Create a pipeline with an SCM checkout step (use svn update as much as possible option) to check out a property file, and a readProperties step on that file
- Run the pipeline once
- Make a change to the file and commit
- Run the pipeline job again, and the access denied error is thrown (see attached log svn-update-stack-trace.log
)
I am using Jenkins v2.60.1 and the Pipeline Utility Step is v1.3.0.
I've been working on moving a lot of code out of the pipelines themselves and into Groovy libraries – I made a method to return a Properties object given a properties file, and it seems to be working pretty well (no locked files). Not the most graceful solution, but it worked conveniently for me:
@NonCPS
static Properties getPropertiesFromFile(String filepathStr) {
Properties properties = new Properties()
File filepath = new File(filepathStr)
try {
filepath.withInputStream {
properties.load(it)
}
} catch(Exception ex) {
ex.printStackTrace()
}
return properties
}
I'm facing the same issue with readMavenPom
rsandell, have you found a workaround to release the lock?