diff --git a/pipelines/monolithic.Jenkinsfile b/pipelines/monolithic.Jenkinsfile index 600125f..d17cd06 100644 --- a/pipelines/monolithic.Jenkinsfile +++ b/pipelines/monolithic.Jenkinsfile @@ -202,6 +202,7 @@ pipeline { ) text ( name: 'PATCH_LIST', + defaultValue: '-', description: '''\
List of Gerrit URLs to apply before running the build, one per line "[PATH] URL REF", eg:
 
diff --git a/pipelines/parts/clone-source.Jenkinsfile b/pipelines/parts/clone-source.Jenkinsfile
index cd4b6ac..bf4396c 100644
--- a/pipelines/parts/clone-source.Jenkinsfile
+++ b/pipelines/parts/clone-source.Jenkinsfile
@@ -44,7 +44,8 @@ pipeline {
             name: 'REFRESH_SOURCE'
         )
         text (
-            name: 'PATCH_LIST'
+            name: 'PATCH_LIST',
+            defaultValue: '-'
         )
     }
     stages {
diff --git a/scripts/clone-source.sh b/scripts/clone-source.sh
index b956019..3859479 100755
--- a/scripts/clone-source.sh
+++ b/scripts/clone-source.sh
@@ -13,6 +13,15 @@ source $(dirname "$0")/lib/retries.sh
 require_job_env BUILD_HOME
 require_job_env DRY_RUN
 require_job_env REFRESH_SOURCE
+declare_job_env PATCH_LIST
+
+# Some jenkins versions have a bug that causes misbehavior
+# when a multi-line parameter is empty. Treat "-" as empty
+# as a workaround.
+PATCH_LIST="$(echo "$PATCH_LIST" | grep -v -E '^\s*(#.*)?$' | sed -r -e 's/^\s+//g' -e 's/\s+$//g')"
+if [[ "$PATCH_LIST" == "-" ]] ; then
+    PATCH_LIST=
+fi
 
 load_build_env