Skip to content

Commit a3aa22a

Browse files
authored
Merge pull request #373 from PolicyEngine/chore/bill
Modify tagger cleanup to use Python scripts
2 parents 8289ad4 + 76eb7d9 commit a3aa22a

File tree

11 files changed

+986
-1255
lines changed

11 files changed

+986
-1255
lines changed

.github/workflows/gcp-deploy.reusable.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -191,11 +191,11 @@ jobs:
191191
id_token_audience: ${{ steps.deploy_infra.outputs.tagger_api_url }}
192192
id_token_include_email: true
193193

194-
- name: Cleanup old revisions
194+
- name: Cleanup old traffic tags
195195
working-directory: deployment/terraform/infra
196196
run: |
197197
TAGGER_URL=$(terraform output -raw tagger_api_url)
198-
bash ../../../scripts/cleanup-old-revisions.sh \
198+
python ../../../scripts/cleanup_old_revisions.py \
199199
"$TAGGER_URL" \
200200
"${{ steps.tagger-token.outputs.id_token }}" \
201201
40

deployment/terraform/infra/main.tf

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -71,13 +71,12 @@ module "cloud_run_tagger_api" {
7171
slack_notification_channel_name=var.slack_notification_channel_name
7272
commit_url = var.commit_url
7373

74+
# Allow up to 120s for cleanup operations (cold start + Cloud Run API calls)
75+
timeout = "120s"
7476
uptime_timeout = "1s"
7577
min_instance_count = var.is_prod ? 1: 0
7678
max_instance_count = 1
77-
#guessing. Need to tune.
7879
max_instance_request_concurrency = var.is_prod ? 20: 1
79-
#this service should return basically immediately to all requests.
80-
timeout = "1s"
8180

8281
enable_uptime_check = var.is_prod ? true : false
8382
}
@@ -89,14 +88,15 @@ resource "google_storage_bucket_iam_member" "bucket_iam_tagger_member" {
8988
member = "serviceAccount:${module.cloud_run_tagger_api.sa_email}"
9089
}
9190

92-
# Give permission to get/update cloudrun services (for tagging and cleanup)
91+
# Give permission to get/update cloudrun services and list revisions (for tagging and cleanup)
9392
resource "google_project_iam_custom_role" "cloudrun_service_updater" {
9493
role_id = "cloudRunServiceUpdater"
9594
title = "Cloud Run Service Updater"
96-
description = "Can get and update Cloud Run services"
95+
description = "Can get and update Cloud Run services and list revisions"
9796
permissions = [
9897
"run.services.get",
99-
"run.services.update"
98+
"run.services.update",
99+
"run.revisions.list"
100100
]
101101
}
102102

0 commit comments

Comments
 (0)