Show error if distribution_type is missing 87/62987/1
authorLott, Christopher (cl778h) <cl778h@att.com>
Wed, 29 Jan 2020 19:32:49 +0000 (14:32 -0500)
committerLott, Christopher (cl778h) <cl778h@att.com>
Wed, 29 Jan 2020 19:32:49 +0000 (14:32 -0500)
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) <cl778h@att.com>
releasenotes/notes/release-job-check-distr-type-7c81e313676816c9.yaml [new file with mode: 0644]
shell/release-job.sh

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 (file)
index 0000000..6c26c8b
--- /dev/null
@@ -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.
index ee5ab70..b10ffb1 100644 (file)
@@ -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)