-
Notifications
You must be signed in to change notification settings - Fork 95
/
release-verification.sh
executable file
·94 lines (76 loc) · 3.64 KB
/
release-verification.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
# ------------------------------------------------------------
# Copyright 2023 The Radius Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# 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
if [[ -z "${RELEASE_VERSION_NUMBER}" ]]; then
echo "Error: RELEASE_VERSION_NUMBER is not set."
exit 1
fi
OS=linux
ARCH=amd64
GITHUB_ORG=radius-project
GITHUB_REPO=radius
RADIUS_CLI_ARTIFACT="rad_${OS}_${ARCH}"
DOWNLOAD_BASE="https://github.com/${GITHUB_ORG}/${GITHUB_REPO}/releases/download"
DOWNLOAD_URL="${DOWNLOAD_BASE}/v${RELEASE_VERSION_NUMBER}/${RADIUS_CLI_ARTIFACT}"
# 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}"
echo "Downloading ${DOWNLOAD_URL}"
curl -sSL "${DOWNLOAD_URL}" -o 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}" != "${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${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="ghcr.io/radius-project/applications-rp:${EXPECTED_TAG_VERSION}"
EXPECTED_UCP_IMAGE="ghcr.io/radius-project/ucpd:${EXPECTED_TAG_VERSION}"
EXPECTED_DE_IMAGE="ghcr.io/radius-project/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}')
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
fi
if [[ "${UCP_IMAGE}" != "${EXPECTED_UCP_IMAGE}" ]]; then
echo "Error: UCP image: ${UCP_IMAGE} does not match the desired image: ${EXPECTED_UCP_IMAGE}."
exit 1
fi
if [[ "${DE_IMAGE}" != "${EXPECTED_DE_IMAGE}" ]]; then
echo "Error: DE image: ${DE_IMAGE} does not match the desired image: ${EXPECTED_DE_IMAGE}."
exit 1
fi
echo "Release verification successful."