From 1591cbc2cf8a6cd9591cf95ef7460ff1d17feffd Mon Sep 17 00:00:00 2001 From: "Lott, Christopher (cl778h)" Date: Wed, 29 Jan 2020 14:32:49 -0500 Subject: [PATCH] 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) --- .../notes/release-job-check-distr-type-7c81e313676816c9.yaml | 7 +++++++ shell/release-job.sh | 10 +++++++++- 2 files changed, 16 insertions(+), 1 deletion(-) create mode 100644 releasenotes/notes/release-job-check-distr-type-7c81e313676816c9.yaml 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) -- 2.16.6