From 6cc598002f78ceea7fd911597d10bf0a5b78b12f Mon Sep 17 00:00:00 2001 From: jiasli <4003950+jiasli@users.noreply.github.com> Date: Tue, 8 Feb 2022 13:57:33 +0800 Subject: [PATCH] {CI} Move verify_rpm_in_docker.sh to upstream repo --- scripts/release/rpm/verify_rpm_in_docker.sh | 36 +++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 scripts/release/rpm/verify_rpm_in_docker.sh diff --git a/scripts/release/rpm/verify_rpm_in_docker.sh b/scripts/release/rpm/verify_rpm_in_docker.sh new file mode 100644 index 00000000000..ae0a349c0a2 --- /dev/null +++ b/scripts/release/rpm/verify_rpm_in_docker.sh @@ -0,0 +1,36 @@ +#!/usr/bin/env bash + +# This script should be run in a docker to verify installing rpm package from the yum repository. + +rpm --import https://packages.microsoft.com/keys/microsoft.asc +sh -c 'echo -e "[azure-cli] +name=Azure CLI +baseurl=https://packages.microsoft.com/yumrepos/azure-cli +enabled=1 +gpgcheck=1 +gpgkey=https://packages.microsoft.com/keys/microsoft.asc" > /etc/yum.repos.d/azure-cli.repo' + +counter=4 + +while [ $counter -gt 0 ] +do + yum install azure-cli -y + ACTUAL_VERSION=$(az version | sed -n 's|"azure-cli": "\(.*\)",|\1|p' | sed 's|[[:space:]]||g') + echo "actual version:${ACTUAL_VERSION}" + echo "expected version:${CLI_VERSION}" + + if [ "$ACTUAL_VERSION" != "$CLI_VERSION" ]; then + if [ ! -z "$ACTUAL_VERSION" ]; then + echo "Latest package is not in the repo." + exit 1 + fi + echo "wait 5m" + sleep 300 + counter=$(( $counter - 1 )) + else + echo "Latest package is verified." + exit 0 + fi +done +echo "Timeout!" +exit 1