PATCH_LIST: workaround for Jenkins bugs

Some versions of Jenkins crash when a multi-line parameter is empty.
Solution: set PATCH_LIST to "-" by default, and treat it as empty.

Signed-off-by: Davlet Panech <davlet.panech@windriver.com>
Change-Id: I7bd8f994debbfe86bc914ce469b81518ca13ea4a
This commit is contained in:
Davlet Panech 2022-10-06 10:21:50 -04:00
parent 4790af343d
commit 5fdfe8c26e
3 changed files with 12 additions and 1 deletions

View File

@ -202,6 +202,7 @@ pipeline {
)
text (
name: 'PATCH_LIST',
defaultValue: '-',
description: '''\
<pre><code>List of Gerrit URLs to apply before running the build, one per line "[PATH] URL REF", eg:

View File

@ -44,7 +44,8 @@ pipeline {
name: 'REFRESH_SOURCE'
)
text (
name: 'PATCH_LIST'
name: 'PATCH_LIST',
defaultValue: '-'
)
}
stages {

View File

@ -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