From f8bdfeb03d343a71ca3b83b26281ecd97ee26284 Mon Sep 17 00:00:00 2001 From: zontreck Date: Sun, 6 Oct 2024 21:25:44 +0000 Subject: [PATCH] Update Jenkinsfile --- Jenkinsfile | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index a3cccf1..b0dd9ab 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -54,10 +54,21 @@ pipeline { #!/bin/bash cd patches - for i in *.patch; do - echo "Applying patch: $i" - patch -Np1 -i "$i" -d ../phoenix-firestorm/ - done + # Enable nullglob so the pattern returns an empty list if no matches are found + shopt -s nullglob + patch_files=(*.patch) + + # Only proceed if there are patch files + if [ ${#patch_files[@]} -ne 0 ]; then + # Loop over all patch files and apply them + for patch_file in "${patch_files[@]}"; do + echo "Applying $patch_file to ../phoenix-firestorm/" + patch -d ../phoenix-firestorm/ -Np1 -i "$patch_file" + done + echo "All patches applied." + else + echo "No patch files found." + fi ''' } }