Skip to content

Commit

Permalink
ci: Filter supported versions of AKS
Browse files Browse the repository at this point in the history
Whenever AKS stopped supporting a particular version of AKS, we had to
manually remove it from all stable branches. Now instead of that, we
will dynamically check if it's supported and only then run the test.

Signed-off-by: Marcel Zieba <marcel.zieba@isovalent.com>
  • Loading branch information
marseel authored and aanm committed May 2, 2024
1 parent 76d6670 commit dbcdd7d
Showing 1 changed file with 25 additions and 2 deletions.
27 changes: 25 additions & 2 deletions .github/workflows/conformance-aks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,6 @@ jobs:
yq -o=json "${work_dir}/k8s-versions.yaml" | jq . > "${destination_directory}/azure.json"
- name: Generate Matrix
id: set-matrix
run: |
cd /tmp/generated/azure
Expand All @@ -112,7 +111,31 @@ jobs:
echo "Generated matrix:"
cat /tmp/matrix.json
echo "matrix=$(jq -c . < /tmp/matrix.json)" >> $GITHUB_OUTPUT
- name: Login to Azure
uses: azure/login@6b2456866fc08b011acb422a92a4aa20e2c4de32 # v2.1.0
with:
creds: ${{ secrets.AZURE_PR_SP_CREDS }}

- name: Filter Matrix
id: set-matrix
run: |
cp /tmp/matrix.json /tmp/result.json
jq -c '.include[]' /tmp/matrix.json | while read i; do
VERSION=$(echo $i | jq -r '.version')
LOCATION=$(echo $i | jq -r '.location')
az aks get-versions --location $LOCATION > /tmp/output
if grep -q -F $VERSION /tmp/output; then
echo "Version $VERSION is valid for location $LOCATION"
else
echo "Removing version $VERSION as it's not valid for location $LOCATION"
jq 'del(.include[] | select(.version == "'$VERSION'"))' /tmp/result.json > /tmp/result.json.tmp
mv /tmp/result.json.tmp /tmp/result.json
fi
done
echo "Filtered matrix:"
cat /tmp/result.json
echo "matrix=$(jq -c . < /tmp/result.json)" >> $GITHUB_OUTPUT
installation-and-connectivity:
name: Installation and Connectivity Test
Expand Down

0 comments on commit dbcdd7d

Please sign in to comment.