diff --git a/vars/helper.groovy b/vars/helper.groovy index 1eeaf27730dff5fe4b541a51c1f4766dce6a3037..51fa8398798096c3aa9b71e91bec480682349a60 100644 --- a/vars/helper.groovy +++ b/vars/helper.groovy @@ -6,6 +6,34 @@ /**********************************************************************************************************************/ +// helper function, recursively gather a deep list of dependencies +def gatherDependenciesDeep(ArrayList<String> dependencyList) { + def deepList = dependencyList + dependencyList.each { + node('Docker') { + copyArtifacts filter: "dependencyList.txt", fingerprintArtifacts: true, projectName: "${it}", selector: lastSuccessful(), target: "artefacts" + def myFile = readFile(env.WORKSPACE+"/artefacts/dependencyList.txt") + def dependencyList2 = myFile.split("\n") + deepList.addAll(gatherDependenciesDeep(dependencyList2)) + } + } + return deepList.unique() +} + +/**********************************************************************************************************************/ + +// helper function, recursively wait until all dependencies are not building +def waitForDependencies(ArrayList<String> deepDependencyList) { + if(deepDependencyList.size() == 0) return + lock("build-${deepDependencyList[0]}") { + def deepDependencyListTrunc = deepDependencyList + deepDependencyListTrunc.remove(0) + waitForDependencies(deepDependencyListTrunc) + } +} + +/**********************************************************************************************************************/ + def doBuildTestDeploy(ArrayList<String> dependencyList, String label, String buildType, String gitUrl) { // prepare source directory and dependencies