@@ -212,7 +212,7 @@ def generateStages(Map args = [:]) {
212212}
213213
214214def cloud (Map args = [:]) {
215- node (args. label) {
215+ withNode (args. label) {
216216 startCloudTestEnv(name : args. directory, dirs : args. dirs)
217217 }
218218 withCloudTestEnv() {
@@ -227,7 +227,7 @@ def cloud(Map args = [:]) {
227227def k8sTest (Map args = [:]) {
228228 def versions = args. versions
229229 versions. each{ v ->
230- node (args. label) {
230+ withNode (args. label) {
231231 stage(" ${ args.context} ${ v} " ){
232232 withEnv([" K8S_VERSION=${ v} " , " KIND_VERSION=v0.7.0" , " KUBECONFIG=${ env.WORKSPACE} /kubecfg" ]){
233233 withGithubNotify(context : " ${ args.context} ${ v} " ) {
@@ -272,7 +272,7 @@ def target(Map args = [:]) {
272272 def directory = args. get(' directory' , ' ' )
273273 def withModule = args. get(' withModule' , false )
274274 def isMage = args. get(' isMage' , false )
275- node (args. label) {
275+ withNode (args. label) {
276276 withGithubNotify(context : " ${ context} " ) {
277277 withBeatsEnv(archive : true , withModule : withModule, directory : directory, id : args. id) {
278278 dumpVariables()
@@ -682,6 +682,18 @@ def notifyBuildReason() {
682682 }
683683}
684684
685+ /**
686+ * Guarantee a specific worker can only be used for a specific build. This was not the case
687+ * with the customise node provisioner that reuses workers when there is peak load.
688+ */
689+ def withNode (def label , Closure body ) {
690+ def uuid = UUID . randomUUID(). toString()
691+ def labels = label?. trim() ? " ${ label} && extra/${ uuid} " : " extra/${ uuid} "
692+ node(" ${ labels} " ) {
693+ body()
694+ }
695+ }
696+
685697/**
686698* This class is the one used for running the parallel stages, therefore
687699* its arguments are passed by the beatsStages step.
0 commit comments