1

I have several Maven artifacts building in Jenkins.

They are all set to poll SCM to build, and are co-dependant.

If the interface between two are changed, they will both build simultaneously and the child will fail because the updated parent hasn't been built yet.

To avoid annoying failing builds, I've used the Lockable Resources Jenkins plugin to stop this from happening, by having a shared lock for all Maven builds.

But I've now made a pipeline which builds all of these artifacts in a non-problematic manner, I'm not able to parallelise this as they are blocked.

What I'd like to do is skip the lock if the build is triggered from a pipeline.

I found this snippet that will determine if the build is triggered manually:

currentBuild.rawBuild.getCauses()[0].toString().contains('UserIdCause')

But when I put this in the Groovy script section of the lockable resources plugin configuration for the respective jobs, I get:

No such property: currentBuild for class: Script1

What am I missing? Is there another way to solve my problem?

Jakg
  • 922
  • 12
  • 39

0 Answers0