From 2a88496b75b5b2315ba8faa14e5a13431b5324de Mon Sep 17 00:00:00 2001 From: willdavsmith Date: Wed, 13 Sep 2023 12:15:35 -0700 Subject: [PATCH 1/5] Exiting on error --- .github/scripts/release-verification.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/scripts/release-verification.sh b/.github/scripts/release-verification.sh index f61b22cd02..5e384010a4 100755 --- a/.github/scripts/release-verification.sh +++ b/.github/scripts/release-verification.sh @@ -14,6 +14,8 @@ # limitations under the License. # ------------------------------------------------------------ +set -ex + # RELEASE_VERSION_NUMBER is the Radius release version number # (e.g. 0.24.0, 0.24.0-rc1) RELEASE_VERSION_NUMBER=$1 @@ -65,7 +67,6 @@ APPCORE_RP_IMAGE=$(kubectl describe pods -n radius-system -l control-plane=appli UCP_IMAGE=$(kubectl describe pods -n radius-system -l control-plane=ucp | awk '/^.*Image:/ {print $2}') DE_IMAGE=$(kubectl describe pods -n radius-system -l control-plane=bicep-de | awk '/^.*Image:/ {print $2}') - if [[ "${APPCORE_RP_IMAGE}" != "${EXPECTED_APPCORE_RP_IMAGE}" ]]; then echo "Error: Applications RP image: ${APPCORE_RP_IMAGE} does not match the desired image: ${EXPECTED_APPCORE_RP_IMAGE}." exit 1 From b836317ab46a636f8666924b040e8a4f261ba11e Mon Sep 17 00:00:00 2001 From: willdavsmith Date: Thu, 14 Sep 2023 12:15:54 -0700 Subject: [PATCH 2/5] Fixing validate-semver --- .github/scripts/release-verification.sh | 29 +++++++------------------ .github/scripts/validate_semver.py | 2 +- 2 files changed, 9 insertions(+), 22 deletions(-) diff --git a/.github/scripts/release-verification.sh b/.github/scripts/release-verification.sh index 5e384010a4..33a113c487 100755 --- a/.github/scripts/release-verification.sh +++ b/.github/scripts/release-verification.sh @@ -17,7 +17,7 @@ set -ex # RELEASE_VERSION_NUMBER is the Radius release version number -# (e.g. 0.24.0, 0.24.0-rc1) +# (e.g. 0.24, 0.24.0, 0.24.0-rc1) RELEASE_VERSION_NUMBER=$1 if [[ -z "${RELEASE_VERSION_NUMBER}" ]]; then @@ -25,20 +25,7 @@ if [[ -z "${RELEASE_VERSION_NUMBER}" ]]; then exit 1 fi -# EXPECTED_CLI_VERSION is the same as the RELEASE_VERSION_NUMBER -EXPECTED_CLI_VERSION=$RELEASE_VERSION_NUMBER - -EXPECTED_TAG_VERSION=$RELEASE_VERSION_NUMBER -# if RELEASE_VERSION_NUMBER doesn't contain -rc, then it is a prerelease. -# In that case, we need to set expected tag version to the major.minor of the -# release version number -if [[ $RELEASE_VERSION_NUMBER != *"rc"* ]]; then - EXPECTED_TAG_VERSION=$(echo $RELEASE_VERSION_NUMBER | cut -d '.' -f 1,2) -fi - echo "RELEASE_VERSION_NUMBER: ${RELEASE_VERSION_NUMBER}" -echo "EXPECTED_CLI_VERSION: ${EXPECTED_CLI_VERSION}" -echo "EXPECTED_TAG_VERSION: ${EXPECTED_TAG_VERSION}" curl https://get.radapp.dev/tools/rad/$RELEASE_VERSION_NUMBER/linux-x64/rad --output rad chmod +x ./rad @@ -46,22 +33,22 @@ chmod +x ./rad RELEASE_FROM_RAD_VERSION=$(./rad version -o json | jq -r '.release') VERSION_FROM_RAD_VERSION=$(./rad version -o json | jq -r '.version') -if [[ "${RELEASE_FROM_RAD_VERSION}" != "${EXPECTED_CLI_VERSION}" ]]; then - echo "Error: Release: ${RELEASE_FROM_RAD_VERSION} from rad version does not match the desired release: ${EXPECTED_CLI_VERSION}." +if [[ "${RELEASE_FROM_RAD_VERSION}" != "${RELEASE_VERSION_NUMBER}" ]]; then + echo "Error: Release: ${RELEASE_FROM_RAD_VERSION} from rad version does not match the desired release: ${RELEASE_VERSION_NUMBER}." exit 1 fi -if [[ "${VERSION_FROM_RAD_VERSION}" != "v${EXPECTED_CLI_VERSION}" ]]; then - echo "Error: Version: ${VERSION_FROM_RAD_VERSION} from rad version does not match the desired version: v${EXPECTED_CLI_VERSION}." +if [[ "${VERSION_FROM_RAD_VERSION}" != "v${RELEASE_VERSION_NUMBER}" ]]; then + echo "Error: Version: ${VERSION_FROM_RAD_VERSION} from rad version does not match the desired version: v${RELEASE_VERSION_NUMBER}." exit 1 fi kind create cluster ./rad install kubernetes -EXPECTED_APPCORE_RP_IMAGE="radius.azurecr.io/applications-rp:${EXPECTED_TAG_VERSION}" -EXPECTED_UCP_IMAGE="radius.azurecr.io/ucpd:${EXPECTED_TAG_VERSION}" -EXPECTED_DE_IMAGE="radius.azurecr.io/deployment-engine:${EXPECTED_TAG_VERSION}" +EXPECTED_APPCORE_RP_IMAGE="radius.azurecr.io/applications-rp:${RELEASE_VERSION_NUMBER}" +EXPECTED_UCP_IMAGE="radius.azurecr.io/ucpd:${RELEASE_VERSION_NUMBER}" +EXPECTED_DE_IMAGE="radius.azurecr.io/deployment-engine:${RELEASE_VERSION_NUMBER}" APPCORE_RP_IMAGE=$(kubectl describe pods -n radius-system -l control-plane=applications-rp | awk '/^.*Image:/ {print $2}') UCP_IMAGE=$(kubectl describe pods -n radius-system -l control-plane=ucp | awk '/^.*Image:/ {print $2}') diff --git a/.github/scripts/validate_semver.py b/.github/scripts/validate_semver.py index 7f182606b4..8eff3b8c92 100755 --- a/.github/scripts/validate_semver.py +++ b/.github/scripts/validate_semver.py @@ -26,7 +26,7 @@ def main(): sys.exit(1) # From https://semver.org/#is-there-a-suggested-regular-expression-regex-to-check-a-semver-string - SEMVER_REGEX = r"^(?P0|[1-9]\d*)\.(?P0|[1-9]\d*)\.(?P0|[1-9]\d*)(?:-(?P(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+(?P[0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$" + SEMVER_REGEX = r"^(?P0|[1-9]\d*)\.(?P0|[1-9]\d*)(\.(?P0|[1-9]\d*))*(?:-(?P(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+(?P[0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$" pattern = re.compile(SEMVER_REGEX) From c9d9afa67f682a5c7a8016e81f13f3a1e0fa0f98 Mon Sep 17 00:00:00 2001 From: willdavsmith Date: Thu, 14 Sep 2023 12:23:46 -0700 Subject: [PATCH 3/5] Redo --- .github/scripts/release-verification.sh | 31 ++++++++++++++++++------- 1 file changed, 22 insertions(+), 9 deletions(-) diff --git a/.github/scripts/release-verification.sh b/.github/scripts/release-verification.sh index 33a113c487..365d33b287 100755 --- a/.github/scripts/release-verification.sh +++ b/.github/scripts/release-verification.sh @@ -17,7 +17,7 @@ set -ex # RELEASE_VERSION_NUMBER is the Radius release version number -# (e.g. 0.24, 0.24.0, 0.24.0-rc1) +# (e.g. 0.24.0, 0.24.0-rc1) RELEASE_VERSION_NUMBER=$1 if [[ -z "${RELEASE_VERSION_NUMBER}" ]]; then @@ -25,30 +25,43 @@ if [[ -z "${RELEASE_VERSION_NUMBER}" ]]; then exit 1 fi +# EXPECTED_CLI_VERSION is the same as the RELEASE_VERSION_NUMBER +EXPECTED_CLI_VERSION=$RELEASE_VERSION_NUMBER + +EXPECTED_TAG_VERSION=$RELEASE_VERSION_NUMBER +# if RELEASE_VERSION_NUMBER contains -rc, then it is a prerelease. +# In that case, we need to set expected tag version to the major.minor of the +# release version number +if [[ $RELEASE_VERSION_NUMBER != *"rc"* ]]; then + EXPECTED_TAG_VERSION=$(echo $RELEASE_VERSION_NUMBER | cut -d '.' -f 1,2) +fi + echo "RELEASE_VERSION_NUMBER: ${RELEASE_VERSION_NUMBER}" +echo "EXPECTED_CLI_VERSION: ${EXPECTED_CLI_VERSION}" +echo "EXPECTED_TAG_VERSION: ${EXPECTED_TAG_VERSION}" -curl https://get.radapp.dev/tools/rad/$RELEASE_VERSION_NUMBER/linux-x64/rad --output rad +curl https://get.radapp.dev/tools/rad/$EXPECTED_TAG_VERSION/linux-x64/rad --output rad chmod +x ./rad RELEASE_FROM_RAD_VERSION=$(./rad version -o json | jq -r '.release') VERSION_FROM_RAD_VERSION=$(./rad version -o json | jq -r '.version') -if [[ "${RELEASE_FROM_RAD_VERSION}" != "${RELEASE_VERSION_NUMBER}" ]]; then - echo "Error: Release: ${RELEASE_FROM_RAD_VERSION} from rad version does not match the desired release: ${RELEASE_VERSION_NUMBER}." +if [[ "${RELEASE_FROM_RAD_VERSION}" != "${EXPECTED_CLI_VERSION}" ]]; then + echo "Error: Release: ${RELEASE_FROM_RAD_VERSION} from rad version does not match the desired release: ${EXPECTED_CLI_VERSION}." exit 1 fi -if [[ "${VERSION_FROM_RAD_VERSION}" != "v${RELEASE_VERSION_NUMBER}" ]]; then - echo "Error: Version: ${VERSION_FROM_RAD_VERSION} from rad version does not match the desired version: v${RELEASE_VERSION_NUMBER}." +if [[ "${VERSION_FROM_RAD_VERSION}" != "v${EXPECTED_CLI_VERSION}" ]]; then + echo "Error: Version: ${VERSION_FROM_RAD_VERSION} from rad version does not match the desired version: v${EXPECTED_CLI_VERSION}." exit 1 fi kind create cluster ./rad install kubernetes -EXPECTED_APPCORE_RP_IMAGE="radius.azurecr.io/applications-rp:${RELEASE_VERSION_NUMBER}" -EXPECTED_UCP_IMAGE="radius.azurecr.io/ucpd:${RELEASE_VERSION_NUMBER}" -EXPECTED_DE_IMAGE="radius.azurecr.io/deployment-engine:${RELEASE_VERSION_NUMBER}" +EXPECTED_APPCORE_RP_IMAGE="radius.azurecr.io/applications-rp:${EXPECTED_TAG_VERSION}" +EXPECTED_UCP_IMAGE="radius.azurecr.io/ucpd:${EXPECTED_TAG_VERSION}" +EXPECTED_DE_IMAGE="radius.azurecr.io/deployment-engine:${EXPECTED_TAG_VERSION}" APPCORE_RP_IMAGE=$(kubectl describe pods -n radius-system -l control-plane=applications-rp | awk '/^.*Image:/ {print $2}') UCP_IMAGE=$(kubectl describe pods -n radius-system -l control-plane=ucp | awk '/^.*Image:/ {print $2}') From 78ff75a9de9fb2c37e830a648c49356ad8a0f084 Mon Sep 17 00:00:00 2001 From: willdavsmith Date: Thu, 14 Sep 2023 12:25:04 -0700 Subject: [PATCH 4/5] making sure the workflow isn't lying --- .github/workflows/release-verification.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release-verification.yaml b/.github/workflows/release-verification.yaml index bd0166e4b0..baa11bd26e 100644 --- a/.github/workflows/release-verification.yaml +++ b/.github/workflows/release-verification.yaml @@ -20,7 +20,7 @@ on: workflow_dispatch: inputs: version: - description: 'Radius version number to use (e.g. 0.24, 0.24.0, 0.24.0-rc1)' + description: 'Radius version number to use (e.g. 0.24.0, 0.24.0-rc1)' required: true default: '' type: string From 484787633c12f925939b4ee72e950b0bd94ffb88 Mon Sep 17 00:00:00 2001 From: willdavsmith Date: Thu, 14 Sep 2023 14:14:40 -0700 Subject: [PATCH 5/5] Consistency --- .github/scripts/validate_semver.py | 2 +- .github/workflows/release-verification.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/scripts/validate_semver.py b/.github/scripts/validate_semver.py index 8eff3b8c92..7f182606b4 100755 --- a/.github/scripts/validate_semver.py +++ b/.github/scripts/validate_semver.py @@ -26,7 +26,7 @@ def main(): sys.exit(1) # From https://semver.org/#is-there-a-suggested-regular-expression-regex-to-check-a-semver-string - SEMVER_REGEX = r"^(?P0|[1-9]\d*)\.(?P0|[1-9]\d*)(\.(?P0|[1-9]\d*))*(?:-(?P(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+(?P[0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$" + SEMVER_REGEX = r"^(?P0|[1-9]\d*)\.(?P0|[1-9]\d*)\.(?P0|[1-9]\d*)(?:-(?P(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+(?P[0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$" pattern = re.compile(SEMVER_REGEX) diff --git a/.github/workflows/release-verification.yaml b/.github/workflows/release-verification.yaml index baa11bd26e..ce589f30a8 100644 --- a/.github/workflows/release-verification.yaml +++ b/.github/workflows/release-verification.yaml @@ -20,7 +20,7 @@ on: workflow_dispatch: inputs: version: - description: 'Radius version number to use (e.g. 0.24.0, 0.24.0-rc1)' + description: 'Radius version number to use (e.g. 0.1.0, 0.1.0-rc1)' required: true default: '' type: string