Skip to content

Commit

Permalink
Use same script for manual start stop (#177)
Browse files Browse the repository at this point in the history
  • Loading branch information
adusumillipraveen authored Oct 18, 2023
1 parent 5674426 commit 4ac41a8
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 82 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/aks-manual-shutdown.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,4 @@ jobs:
tenant-id: 531ff96d-0ae9-462a-8d2d-bec7c0b42082 # HMCTS.NET
allow-no-subscriptions: true
- name: AKS Manual Stop
run: ./scripts/aks/manual-shutdown.sh
run: ./scripts/aks/manual-start-stop.sh stop
2 changes: 1 addition & 1 deletion .github/workflows/aks-manual-start.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,4 @@ jobs:
tenant-id: 531ff96d-0ae9-462a-8d2d-bec7c0b42082 # HMCTS.NET
allow-no-subscriptions: true
- name: AKS Manual Start
run: ./scripts/aks/manual-start.sh ${{ secrets.REGISTRYSLACKWEBHOOK }}
run: ./scripts/aks/manual-start-stop.sh start
2 changes: 1 addition & 1 deletion .github/workflows/manual-start.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ jobs:
tenant-id: 531ff96d-0ae9-462a-8d2d-bec7c0b42082 # HMCTS.NET
allow-no-subscriptions: true
- name: AKS Manual Start in ${{ inputs.PROJECT }} ${{ inputs.SELECTED_ENV }} Environment
run: ./scripts/aks/manual-start.sh
run: ./scripts/aks/manual-start-stop.sh start
appgateway:
runs-on: ubuntu-latest
steps:
Expand Down
76 changes: 0 additions & 76 deletions scripts/aks/manual-shutdown.sh

This file was deleted.

13 changes: 10 additions & 3 deletions scripts/aks/manual-start.sh → scripts/aks/manual-start-stop.sh
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,13 @@ function ts_echo() {
date +"%H:%M:%S $(printf "%s " "$@")"
}

MODE=${1:-start}

if [[ "$MODE" != "start" && "$MODE" != "stop" ]]; then
echo "Invalid MODE. Please use 'start' or 'stop'."
exit 1
fi

subscription
for INSTANCE in ${INSTANCES[@]}; do
CLUSTERS=$(az resource list \
Expand All @@ -51,10 +58,10 @@ for INSTANCE in ${INSTANCES[@]}; do
jq -c '.[]' <<<$CLUSTERS | while read cluster; do
cluster

ts_echo "About to start cluster $NAME (rg:$RESOURCE_GROUP)"
az aks start --resource-group $RESOURCE_GROUP --name $NAME --no-wait || ts_echo Ignoring any errors starting cluster $NAME
ts_echo "About to $MODE cluster $NAME (rg:$RESOURCE_GROUP)"
az aks $MODE --resource-group $RESOURCE_GROUP --name $NAME --no-wait || ts_echo Ignoring any errors while doing $MODE operation on cluster $NAME

ts_echo "Waiting 2 mins to give clusters time to start before testing pods"
ts_echo "Waiting 2 mins to give clusters time to $MODE before testing pods"
sleep 120
ts_echo $NAME
RESULT=$(az aks show --name $NAME -g $RESOURCE_GROUP | jq -r .powerState.code)
Expand Down

0 comments on commit 4ac41a8

Please sign in to comment.