From c63514511de7ce5b4caa43e45944e8680782e381 Mon Sep 17 00:00:00 2001 From: hypherionmc Date: Tue, 11 Jun 2024 21:45:44 +0200 Subject: [PATCH] Jenkins oh jenkins. Why does thou hate me so'th --- Jenkinsfile | 46 +++++++++++++++++++++++----------------------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 58108c0..ba48919 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -6,33 +6,33 @@ pipeline { stages { stage("Build LTS Folders") { steps { - script { - def subfolderNames = ["1.18.2", "1.19.2", "1.19.3", "1.20", "1.20.2", "1.20.4"] - boolean hasFailure = false + script { + def subfolderNames = ["1.18.2", "1.19.2", "1.19.3", "1.20", "1.20.2", "1.20.4"] + boolean hasFailure = false - for (def subfolderName in subfolderNames) { - def subfolderPath = "${WORKSPACE}/${subfolderName}" + for (def subfolderName : subfolderNames) { + def subfolderPath = "${WORKSPACE}/${subfolderName}/.jenkins/Jenkinsfile.snapshot" - if (dir(subfolderPath).exists()) { - try { - dir("${WORKSPACE}/${subfolderName}") { - def subfolderJob = load ".jenkins/Jenkinsfile.snapshot" - subfolderJob() + if (fileExists(subfolderPath)) { + try { + dir("${WORKSPACE}/${subfolderName}") { + def subfolderJob = load ".jenkins/Jenkinsfile.snapshot" + subfolderJob() + } + } catch (Exception e) { + echo "Error running pipeline for ${subfolderPath}: ${e.message}" + hasFailure = true + } + } else { + echo "Skipping non-existent Jenkinsfile: ${subfolderPath}" + } } - } catch (Exception e) { - echo "Error running pipeline for ${subfolderPath}: ${e.message}" - hasFailure = true - } - } else { - echo "Skipping non-existent folder: ${subfolderPath}" - } - } - if (hasFailure) { - error "One or more subfolder pipelines failed." - } + if (hasFailure) { + error "One or more subfolder pipelines failed." + } + } } - } } } -} \ No newline at end of file +}