Skip to content

Commit

Permalink
Update deps, fix docs, and support multiple regions (#504)
Browse files Browse the repository at this point in the history
Fixes
#503
  • Loading branch information
sethvargo committed Apr 15, 2024
1 parent 35f794c commit ff7cbf6
Show file tree
Hide file tree
Showing 10 changed files with 542 additions and 424 deletions.
46 changes: 24 additions & 22 deletions .github/workflows/cleanup.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,25 +14,27 @@ jobs:
runs-on: 'ubuntu-latest'

steps:
- uses: 'actions/checkout@v4'

- uses: 'google-github-actions/auth@v2'
with:
workload_identity_provider: '${{ vars.WIF_PROVIDER_NAME }}'
service_account: '${{ vars.SERVICE_ACCOUNT_EMAIL }}'

- uses: 'google-github-actions/setup-gcloud@v2'

- name: Delete services
run: |-
gcloud config set core/project "${{ vars.PROJECT_ID }}"
gcloud config set run/region "us-central1"
# List and delete all services that were deployed 30 minutes ago or
# earlier. The date math here is a little weird, but we're looking for
# deployments "earlier than" 30 minutes ago, so it's less than since
# time increases.
(IFS=$'\n'; for NAME in $(gcloud run services list --format="value(name)" --filter="metadata.creationTimestamp < '-pt30m'"); do
echo "Deleting ${NAME}..."
gcloud run services delete ${NAME} --quiet --async
done)
- uses: 'actions/checkout@v4'

- uses: 'google-github-actions/auth@v2'
with:
workload_identity_provider: '${{ vars.WIF_PROVIDER_NAME }}'
service_account: '${{ vars.SERVICE_ACCOUNT_EMAIL }}'

- uses: 'google-github-actions/setup-gcloud@v2'
with:
version: 'latest'

- name: 'Delete services'
run: |-
gcloud config set core/project "${{ vars.PROJECT_ID }}"
gcloud config set run/region "us-central1"
# List and delete all services that were deployed 30 minutes ago or
# earlier. The date math here is a little weird, but we're looking for
# deployments "earlier than" 30 minutes ago, so it's less than since
# time increases.
(IFS=$'\n'; for NAME in $(gcloud run services list --format="value(name)" --filter="metadata.creationTimestamp < '-pt30m'"); do
echo "Deleting ${NAME}..."
gcloud run services delete ${NAME} --quiet --async
done)

0 comments on commit ff7cbf6

Please sign in to comment.