Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions gocd/templates/bash/run-migrations.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/bash

eval $(regions-project-env-vars --region="${SENTRY_REGION}")
/devinfra/scripts/get-cluster-credentials

k8s-spawn-job \
--label-selector="${LABEL_SELECTOR}" \
--image="us-central1-docker.pkg.dev/sentryio/taskbroker/image:${GO_REVISION_TASKBROKER_REPO}" \
--container-name="taskbroker" \
--name="taskbroker-migrations" \
-- \
/opt/taskbroker \
--run migrations
22 changes: 21 additions & 1 deletion gocd/templates/pipelines/taskbroker.libsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,24 @@ local checks_stage = {
},
};

local run_migrations_stage = {
'run-migrations': {
fetch_materials: true,
jobs: {
'run-migrations': {
timeout: 60,
elastic_profile_id: 'taskbroker',
environment_variables: {
LABEL_SELECTOR: 'service=taskbroker',
},
tasks: [
gocdtasks.script(importstr '../bash/run-migrations.sh'),
],
},
},
},
};

local deploy_canary_stage(region) =
if region == 'us' || region == 'de' then
[
Expand Down Expand Up @@ -73,5 +91,7 @@ function(region) {
},
},
lock_behavior: 'unlockWhenFinished',
stages: [checks_stage] + deploy_canary_stage(region) + [deployPrimaryStage],
stages: [checks_stage, run_migrations_stage]
+ deploy_canary_stage(region)
+ [deployPrimaryStage],
}
Loading
Loading