X-Git-Url: https://gerrit.linuxfoundation.org/infra/gitweb?a=blobdiff_plain;f=shell%2Frelease-job.sh;h=7080a4e6385330c8b63bd35ce101fa30379b4b26;hb=718fdb52ab8a23a16e91f80a7d8ae26d116ca6ea;hp=612fa7ea2d9558873b51114d54f46650ace21f72;hpb=c050ff286514ec71f6aff75b71e3f870d7b36966;p=releng%2Fglobal-jjb.git diff --git a/shell/release-job.sh b/shell/release-job.sh index 612fa7ea..7080a4e6 100644 --- a/shell/release-job.sh +++ b/shell/release-job.sh @@ -11,17 +11,12 @@ echo "---> release-job.sh" set -eu -o pipefail -#Python bits. Remove when centos 7.7 builder is avaliable. -if [ -d "/opt/pyenv" ]; then - echo "INFO: Setting up pyenv" - export PYENV_ROOT="/opt/pyenv" - export PATH="$PYENV_ROOT/bin:$PATH" -fi -PYTHONPATH=$(pwd) -export PYTHONPATH -pyenv local 3.6.4 -export PYENV_VERSION="3.6.4" -pip install --user lftools[nexus] jsonschema niet yq +set +u +python3 -m venv /tmp/v/venv/ +# shellcheck disable=SC1091 +source /tmp/v/venv/bin/activate +set -u +python -m pip install lftools[nexus] jsonschema niet yq #Functions. @@ -92,10 +87,10 @@ set_variables_container(){ if [[ $VERSION == "None" ]]; then VERSION="$(niet ".container_release_tag" "$release_file")" fi - if $(grep -q "container_pull_registry" "$release_file") ; then + if grep -q "container_pull_registry" "$release_file" ; then CONTAINER_PULL_REGISTRY="$(niet ".container_pull_registry" "$release_file")" fi - if $(grep -q "container_push_registry" "$release_file") ; then + if grep -q "container_push_registry" "$release_file" ; then CONTAINER_PUSH_REGISTRY="$(niet ".container_push_registry" "$release_file")" fi # Make sure both pull and push registries are defined @@ -130,6 +125,18 @@ verify_version(){ fi } +verify_version_match_release(){ + wget -P /tmp "${LOGS_URL}/"console.log.gz + echo "INFO: Comparing version $VERSION with log snippet from maven-stage:" + if zgrep "Successfully uploaded" /tmp/console.log.gz | grep "$VERSION"; then + echo "INFO: version $VERSION matches maven-stage artifacts" + else + echo "ERROR: Defined version in release file does not match staging repo artifacts version to be released" + echo " Please make sure maven-stage job selected as candidate and release version are correct" + exit 1 + fi +} + tag(){ # Import public signing key gpg --import "$SIGNING_PUBKEY" @@ -187,7 +194,7 @@ container_release_file(){ lfn_umbrella="$(echo "$GERRIT_HOST" | awk -F"." '{print $2}')" for namequoted in $(cat $release_file | yq '.containers[].name'); do - versionquoted=$(cat $release_file | yq ".containers[] |select(.name=="$namequoted") |.version") + versionquoted=$(cat $release_file | yq ".containers[] |select(.name==$namequoted) |.version") #Remove extra yaml quotes name="${namequoted#\"}" @@ -254,6 +261,7 @@ if [[ "$DISTRIBUTION_TYPE" == "maven" ]]; then fi set_variables_maven verify_version + verify_version_match_release maven_release_file elif [[ "$DISTRIBUTION_TYPE" == "container" ]]; then wget -q https://raw.githubusercontent.com/lfit/releng-global-jjb/master/schema/release-container-schema.yaml