Skip to content

Commit

Permalink
CI: Add channel arguments to GKE related workflows
Browse files Browse the repository at this point in the history
This commit adds Ariane extra-args to run all GKE versions with the argument versions=all.
Normally, these run only on scheduled workflow runs.
Also, this commit adds an argument for the GKE channel, if channel=<name> versions given it
is filtered for that channel, and channel=none disables filtering. If no argument is given the default channel REGULAR is used.

Signed-off-by: Birol Bilgin <birol@cilium.io>
  • Loading branch information
brlbil authored and aanm committed Oct 29, 2024
1 parent 3a6336f commit fc4101d
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 6 deletions.
4 changes: 2 additions & 2 deletions .github/ariane-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ triggers:
/ci-eks:
workflows:
- conformance-eks.yaml
/ci-external-workloads:
/ci-external-workloads(?:\s+(versions=(all)|channel=(EXTENDED|REGULAR|STABLE|RAPID|NONE|extended|regular|stable|none)))?:
workflows:
- conformance-externalworkloads.yaml
/ci-gateway-api:
Expand All @@ -56,7 +56,7 @@ triggers:
/ci-ginkgo:
workflows:
- conformance-ginkgo.yaml
/ci-gke:
/ci-gke(?:\s+(versions=(all)|channel=(EXTENDED|REGULAR|STABLE|RAPID|NONE|extended|regular|stable|none)))?:
workflows:
- conformance-gke.yaml
/ci-ingress:
Expand Down
15 changes: 13 additions & 2 deletions .github/workflows/conformance-externalworkloads.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,8 @@ jobs:
# Use complete matrix in case of scheduled run
# main -> event_name = schedule
# other stable branches -> PR-number starting with v (e.g. v1.14)
if [[ "${{ github.event_name }}" == "schedule" || "${{ inputs.PR-number }}" == v* ]];then
VERSIONS=$(echo "${{ inputs.extra-args }}" | awk -F'=' '{print $2}')
if [[ "${{ github.event_name }}" == "schedule" || "${{ inputs.PR-number }}" == v* || "$VERSIONS" == "all" ]];then
jq '{ "include": [ .k8s[] ] }' gke.json > /tmp/matrix.json
else
jq '{ "include": [ .k8s[] | select(.default) ] }' gke.json > /tmp/matrix.json
Expand All @@ -140,12 +141,22 @@ jobs:
- name: Filter Matrix
id: set-matrix
run: |
CHANNEL=$(echo ${{ inputs.extra-args }} | grep "channel" | awk -F'=' '{print $2}' | tr '[:lower:]' '[:upper:]')
if [ "$CHANNEL" == "" ];then
FILTER="channels.channel=REGULAR"
elif [ "$CHANNEL" == "NONE" ];then
FILTER=""
else
FILTER="channels.channel=$CHANNEL"
fi
echo $CHANNEL
echo $FILTER
cp /tmp/matrix.json /tmp/result.json
jq -c '.include[]' /tmp/matrix.json | while read i; do
VERSION=$(echo $i | jq -r '.version')
ZONE=$(echo $i | jq -r '.zone')
gcloud --quiet container get-server-config \
--flatten="channels" \
--flatten="channels" --filter="$FILTER" \
--format="yaml(channels.validVersions)" --zone $ZONE > /tmp/output
if grep -q -F $VERSION /tmp/output; then
echo "Version $VERSION is valid for zone $ZONE"
Expand Down
13 changes: 11 additions & 2 deletions .github/workflows/conformance-gke.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,8 @@ jobs:
# Use complete matrix in case of scheduled run
# main -> event_name = schedule
# other stable branches -> PR-number starting with v (e.g. v1.14)
if [[ "${{ github.event_name }}" == "schedule" || "${{ inputs.PR-number }}" == v* ]];then
VERSIONS=$(echo ${{ inputs.extra-args }} | awk -F'=' '{print $2}')
if [[ "${{ github.event_name }}" == "schedule" || "${{ inputs.PR-number }}" == v* || "$VERSIONS" == "all" ]];then
cp gke.json /tmp/matrix.json
else
jq '{ "k8s": [ .k8s[] | select(.default) ], "config": .config}' gke.json > /tmp/matrix.json
Expand All @@ -145,12 +146,20 @@ jobs:
- name: Filter Matrix
id: set-matrix
run: |
CHANNEL=$(echo ${{ inputs.extra-args }} | grep "channel" | awk -F'=' '{print $2}' | tr '[:lower:]' '[:upper:]')
if [ "$CHANNEL" == "" ];then
FILTER="channels.channel=REGULAR"
elif [ "$CHANNEL" == "NONE" ];then
FILTER=""
else
FILTER="channels.channel=$CHANNEL"
fi
cp /tmp/matrix.json /tmp/result.json
jq -c '.k8s[]' /tmp/matrix.json | while read i; do
VERSION=$(echo $i | jq -r '.version')
ZONE=$(echo $i | jq -r '.zone')
gcloud --quiet container get-server-config \
--flatten="channels" \
--flatten="channels" --filter="$FILTER" \
--format="yaml(channels.validVersions)" --zone $ZONE > /tmp/output
if grep -q -F $VERSION /tmp/output; then
echo "Version $VERSION is valid for zone $ZONE"
Expand Down

0 comments on commit fc4101d

Please sign in to comment.