Skip to content

Commit

Permalink
Selectively start self-hosted runner
Browse files Browse the repository at this point in the history
  • Loading branch information
wdbasson committed Sep 26, 2023
1 parent 9ca4eb9 commit 7a71eb0
Showing 1 changed file with 7 additions and 10 deletions.
17 changes: 7 additions & 10 deletions .github/workflows/continuous-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ jobs:
start-runner:
permissions:
id-token: write # This is required for requesting the JWT
if: github.event.inputs.run-tests == 'true'
name: Start self-hosted EC2 runner
runs-on: ubuntu-latest
outputs:
Expand Down Expand Up @@ -260,8 +261,8 @@ jobs:
if: github.event.review.state == 'approved' || github.event_name == 'push' || github.event.inputs.run-update-deployments
run: |
while true; do
not_terminated_count=$(kubectl -n dev-cloudapi get pods -o jsonpath='{.items[*].status.containerStatuses[*].ready}' | grep -o 'false' | wc -l)
if [ "$not_terminated_count" -eq 0 ]; then
terminating_pods_count=$(kubectl -n dev-cloudapi get pods --field-selector=status.phase!=Running,status.phase!=Succeeded -o jsonpath='{.items[*].metadata.name}')
if [ -z "$terminating_pods_count" ]; then
echo "All pods terminated"
break
else
Expand All @@ -281,9 +282,12 @@ jobs:
DB_EXCLUDE: ${{ secrets.DB_EXCLUDE }}
GA_ACAPY_WALLET_NAME: ${{ secrets.GA_ACAPY_WALLET_NAME }}
MT_ACAPY_WALLET_NAME: ${{ secrets.MT_ACAPY_WALLET_NAME }}
TRUST_REGISTRY_DB_OWNER: ${{ secrets.TRUST_REGISTRY_DB_OWNER }}
run: |
bash ./scripts/aurora-delete.sh -o $GA_ACAPY_WALLET_NAME -d
bash ./scripts/aurora-delete.sh -o $MT_ACAPY_WALLET_NAME -d
bash ./scripts/aurora-delete.sh -o $TRUST_REGISTRY_DB_OWNER -d
bash ./scripts/aurora-delete.sh -o $TRUST_REGISTRY_DB_OWNER -c
- name: List Elasticache Redis
if: github.event.review.state == 'approved' || github.event_name == 'push' || github.event.inputs.run-update-deployments
Expand All @@ -299,14 +303,6 @@ jobs:
REDIS_PORT: ${{ secrets.REDIS_PORT }}
run: redis-cli -h $REDIS_HOST -p $REDIS_PORT FLUSHALL

- name: Re-create Trust Registry DB
if: github.event.review.state == 'approved' || github.event_name == 'push' || github.event.inputs.run-update-deployments
env:
REDIS_HOST: ${{ secrets.TRUST_REGISTRY_DB_OWNER }}
run: |
bash ./scripts/aurora-delete.sh -o TRUST_REGISTRY_DB_OWNER -d
bash ./scripts/aurora-create.sh -o TRUST_REGISTRY_DB_OWNER -c
- name: Helmfile Apply
id: update_deployments
if: github.event.review.state == 'approved' || github.event_name == 'push' || github.event.inputs.run-update-deployments
Expand Down Expand Up @@ -412,6 +408,7 @@ jobs:
role-session-name: github-cicd
- name: Stop EC2 runner
uses: machulav/ec2-github-runner@v2
if: github.event.inputs.run-tests == 'true'
with:
mode: stop
github-token: ${{ secrets.PAT }}
Expand Down

0 comments on commit 7a71eb0

Please sign in to comment.