From: Lott, Christopher (cl778h) Date: Wed, 29 Jan 2020 19:32:49 +0000 (-0500) Subject: Show error if distribution_type is missing X-Git-Tag: v0.51.0~16 X-Git-Url: https://gerrit.linuxfoundation.org/infra/gitweb?a=commitdiff_plain;h=refs%2Fchanges%2F87%2F62987%2F1;p=releng%2Fglobal-jjb.git Show error if distribution_type is missing Extend release-job.sh to detect if distribution_type is missing from the release yaml file and show a meaningful error. The shell option pipefile causes the script to halt silently if niet fails to find that key, which utterly baffles users. Change-Id: I926097a1e9d94bd867879ce6fdc549415a911dbe Signed-off-by: Lott, Christopher (cl778h) --- diff --git a/releasenotes/notes/release-job-check-distr-type-7c81e313676816c9.yaml b/releasenotes/notes/release-job-check-distr-type-7c81e313676816c9.yaml new file mode 100644 index 00000000..6c26c8bf --- /dev/null +++ b/releasenotes/notes/release-job-check-distr-type-7c81e313676816c9.yaml @@ -0,0 +1,7 @@ +--- +fixes: + - | + Extend release-job.sh to detect if distribution_type is missing + from the release yaml file and show a meaningful error. The + shell option pipefile causes the script to halt silently if + niet fails to find that key, which utterly baffles users. diff --git a/shell/release-job.sh b/shell/release-job.sh index ee5ab70a..b10ffb1a 100644 --- a/shell/release-job.sh +++ b/shell/release-job.sh @@ -17,6 +17,9 @@ PATH=/tmp/venv/bin:$PATH pipup="python -m pip install -q --upgrade pip lftools jsonschema niet twine yq" echo "INFO: $pipup" $pipup +# show installed versions +python -m pip --version +python -m pip freeze #Functions. @@ -44,9 +47,14 @@ set_variables_common(){ fi # Jenkins parameter drop-down defaults DISTRIBUTION_TYPE to None + # in the contain/maven release job; get value from release yaml. + # Packagecloud and PyPI jobs set the appropriate value. DISTRIBUTION_TYPE="${DISTRIBUTION_TYPE:-None}" if [[ $DISTRIBUTION_TYPE == "None" ]]; then - DISTRIBUTION_TYPE=$(niet ".distribution_type" "$release_file") + if ! DISTRIBUTION_TYPE=$(niet ".distribution_type" "$release_file"); then + echo "ERROR: Failed to get distribution_type from $release_file" + exit 1 + fi fi PATCH_DIR=$(mktemp -d)