@@ -210,7 +210,7 @@ def generateStages(Map args = [:]) {
210210}
211211
212212def cloud (Map args = [:]) {
213- node (args. label) {
213+ withNode (args. label) {
214214 startCloudTestEnv(name : args. directory, dirs : args. dirs)
215215 }
216216 withCloudTestEnv() {
@@ -225,7 +225,7 @@ def cloud(Map args = [:]) {
225225def k8sTest (Map args = [:]) {
226226 def versions = args. versions
227227 versions. each{ v ->
228- node (args. label) {
228+ withNode (args. label) {
229229 stage(" ${ args.context} ${ v} " ){
230230 withEnv([" K8S_VERSION=${ v} " , " KIND_VERSION=v0.7.0" , " KUBECONFIG=${ env.WORKSPACE} /kubecfg" ]){
231231 withGithubNotify(context : " ${ args.context} ${ v} " ) {
@@ -270,7 +270,7 @@ def target(Map args = [:]) {
270270 def directory = args. get(' directory' , ' ' )
271271 def withModule = args. get(' withModule' , false )
272272 def isMage = args. get(' isMage' , false )
273- node (args. label) {
273+ withNode (args. label) {
274274 withGithubNotify(context : " ${ context} " ) {
275275 withBeatsEnv(archive : true , withModule : withModule, directory : directory, id : args. id) {
276276 dumpVariables()
@@ -680,6 +680,18 @@ def notifyBuildReason() {
680680 }
681681}
682682
683+ /**
684+ * Guarantee a specific worker can only be used for a specific build. This was not the case
685+ * with the customise node provisioner that reuses workers when there is peak load.
686+ */
687+ def withNode (def label , Closure body ) {
688+ def uuid = UUID . randomUUID(). toString()
689+ def labels = label?. trim() ? " ${ label} && extra/${ uuid} " : " extra/${ uuid} "
690+ node(" ${ labels} " ) {
691+ body()
692+ }
693+ }
694+
683695/**
684696* This class is the one used for running the parallel stages, therefore
685697* its arguments are passed by the beatsStages step.
0 commit comments