Skip to content

Commit 22a7b7c

Browse files
authored
fix: gtfs validator report update workflow (#1680)
1 parent 123943a commit 22a7b7c

2 files changed

Lines changed: 31 additions & 4 deletions

File tree

.github/workflows/validator-update.yml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,20 +25,22 @@ jobs:
2525
run: |
2626
echo "ENVIRONMENT=${{ vars.PROD_MOBILITY_FEEDS_ENVIRONMENT }}" >> $GITHUB_ENV
2727
echo "PROJECT_ID=${{ vars.PROD_MOBILITY_FEEDS_PROJECT_ID }}" >> $GITHUB_ENV
28+
echo "REGION=${{ vars.MOBILITY_FEEDS_REGION }}" >> $GITHUB_ENV
2829
echo "DEPLOYER_SERVICE_ACCOUNT=${{ vars.PROD_MOBILITY_FEEDS_DEPLOYER_SERVICE_ACCOUNT }}" >> $GITHUB_ENV
30+
echo "TASKS_EXECUTOR_URL=https://${{ vars.MOBILITY_FEEDS_REGION }}-${{ vars.PROD_MOBILITY_FEEDS_PROJECT_ID }}.cloudfunctions.net/tasks_executor-${{ vars.PROD_MOBILITY_FEEDS_ENVIRONMENT }}" >> $GITHUB_ENV
2931
3032
# Schedule a task to update the validation report in 24 hours from now to allow runners of the web validator
3133
# to be properly updated with the new version of the GTFS Validator
3234
- name: Create task to run cloud function
3335
run: |
3436
gcloud tasks create-http-task \
35-
--queue=update-validation-report-task-queue \
36-
--url=https://${{ vars.MOBILITY_FEEDS_REGION }}-${PROJECT_ID}.cloudfunctions.net/update-validation-report \
37+
--queue=validator-update-trigger-queue \
38+
--url=${TASKS_EXECUTOR_URL} \
3739
--schedule-time=$(date -u -d "+24 hours" +%Y-%m-%dT%H:%M:%SZ) \
3840
--oidc-service-account-email=${DEPLOYER_SERVICE_ACCOUNT} \
39-
--location=${{ vars.MOBILITY_FEEDS_REGION }} \
41+
--location=${REGION} \
4042
--header=Content-Type:application/json \
41-
--body-content='{}'
43+
--body-content='{"task": "rebuild_missing_validation_reports", "payload": {"dry_run": false, "force_update": true}}'
4244
notify-slack-on-failure:
4345
needs: [ validator-update ]
4446
if: failure() && (github.event_name != 'workflow_dispatch')

infra/functions-python/main.tf

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1333,6 +1333,10 @@ output "function_tokens_name" {
13331333
value = google_cloudfunctions2_function.tokens.name
13341334
}
13351335

1336+
output "tasks_executor_url" {
1337+
value = google_cloudfunctions2_function.tasks_executor.url
1338+
}
1339+
13361340

13371341
# Task queue to invoke refresh_materialized_view function
13381342
resource "google_cloud_tasks_queue" "refresh_materialized_view_task_queue" {
@@ -1393,6 +1397,27 @@ resource "google_cloud_tasks_queue" "web_revalidation_task_queue" {
13931397
}
13941398
}
13951399

1400+
# Task queue for the validator-update GitHub Action to schedule tasks_executor calls 24h ahead.
1401+
# Static name (new, never previously used) avoids GCP queue-name-reuse restrictions.
1402+
resource "google_cloud_tasks_queue" "validator_update_trigger_queue" {
1403+
project = var.project_id
1404+
location = var.gcp_region
1405+
name = "validator-update-trigger-queue"
1406+
1407+
rate_limits {
1408+
max_concurrent_dispatches = 50
1409+
max_dispatches_per_second = 1
1410+
}
1411+
1412+
retry_config {
1413+
# Retry for ~4 hour: 31 attempts × 120s fixed backoff
1414+
max_attempts = 124
1415+
min_backoff = "120s"
1416+
max_backoff = "120s"
1417+
max_doublings = 0
1418+
}
1419+
}
1420+
13961421
# Task queue to invoke gbfs_validator_batch function for the scheduler
13971422
resource "google_cloudfunctions2_function_iam_member" "gbfs_validator_batch_invoker" {
13981423
project = var.project_id

0 commit comments

Comments
 (0)