From b8669684d595eed05d900ee2d9daf576ce33db13 Mon Sep 17 00:00:00 2001 From: Prajjwal Bhandari Date: Wed, 2 Sep 2026 15:44:27 -0400 Subject: [PATCH 1/7] fix(gocd): use SaaS deploy scripts for snuba ST primary deploys --- gocd/templates/pipelines/snuba-py.libsonnet | 5 +---- gocd/templates/pipelines/snuba-rs.libsonnet | 6 +----- 2 files changed, 2 insertions(+), 9 deletions(-) diff --git a/gocd/templates/pipelines/snuba-py.libsonnet b/gocd/templates/pipelines/snuba-py.libsonnet index 43b8a3bf9e..e831010084 100644 --- a/gocd/templates/pipelines/snuba-py.libsonnet +++ b/gocd/templates/pipelines/snuba-py.libsonnet @@ -221,10 +221,7 @@ function(region) { LABEL_SELECTOR: 'service=snuba', }, tasks: [ - if getsentry.is_st(region) then - gocdtasks.script(importstr '../bash/deploy-st-py.sh') - else - gocdtasks.script(importstr '../bash/deploy-py.sh'), + gocdtasks.script(importstr '../bash/deploy-py.sh'), ], }, }, diff --git a/gocd/templates/pipelines/snuba-rs.libsonnet b/gocd/templates/pipelines/snuba-rs.libsonnet index 61d7fcd3d7..73b2460971 100644 --- a/gocd/templates/pipelines/snuba-rs.libsonnet +++ b/gocd/templates/pipelines/snuba-rs.libsonnet @@ -1,4 +1,3 @@ -local getsentry = import 'github.com/getsentry/gocd-jsonnet/libs/getsentry.libsonnet'; local gocdtasks = import 'github.com/getsentry/gocd-jsonnet/libs/gocd-tasks.libsonnet'; // The return value of this function is the body of a GoCD pipeline. @@ -202,10 +201,7 @@ function(region) { LABEL_SELECTOR: 'service=snuba', }, tasks: [ - if getsentry.is_st(region) then - gocdtasks.script(importstr '../bash/deploy-st-rs.sh') - else - gocdtasks.script(importstr '../bash/deploy-rs.sh'), + gocdtasks.script(importstr '../bash/deploy-rs.sh'), ], }, }, From 15a7c0743c7821b28ec3956d146d43d16a08a5b7 Mon Sep 17 00:00:00 2001 From: Prajjwal Bhandari Date: Wed, 2 Sep 2026 15:47:07 -0400 Subject: [PATCH 2/7] chore(gocd): drop unused snuba ST deploy scripts --- gocd/templates/bash/deploy-st-py.sh | 13 ------------- gocd/templates/bash/deploy-st-rs.sh | 5 ----- gocd/templates/bash/deploy-st.sh | 19 ------------------- 3 files changed, 37 deletions(-) delete mode 100644 gocd/templates/bash/deploy-st-py.sh delete mode 100644 gocd/templates/bash/deploy-st-rs.sh delete mode 100644 gocd/templates/bash/deploy-st.sh diff --git a/gocd/templates/bash/deploy-st-py.sh b/gocd/templates/bash/deploy-st-py.sh deleted file mode 100644 index 1734b61969..0000000000 --- a/gocd/templates/bash/deploy-st-py.sh +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/bash - -eval $(regions-project-env-vars --region="${SENTRY_REGION}") - -IMAGE_TAG="${GO_REVISION_SNUBA_REPO}" - -/devinfra/scripts/get-cluster-credentials - -k8s-deploy \ - --label-selector="${LABEL_SELECTOR}" \ - --image="us-docker.pkg.dev/sentryio/snuba-mr/image:${IMAGE_TAG}" \ - --container-name="snuba" \ - --container-name="snuba-admin" diff --git a/gocd/templates/bash/deploy-st-rs.sh b/gocd/templates/bash/deploy-st-rs.sh deleted file mode 100644 index 4364cfa33b..0000000000 --- a/gocd/templates/bash/deploy-st-rs.sh +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/bash - -echo "TODO fix" -echo "This is a no-op for single-tenants. deploy-snuba-py handles everything" -echo "(and traffic is low enough that we don't have rebalance issues)" diff --git a/gocd/templates/bash/deploy-st.sh b/gocd/templates/bash/deploy-st.sh deleted file mode 100644 index c5e8d9a0b5..0000000000 --- a/gocd/templates/bash/deploy-st.sh +++ /dev/null @@ -1,19 +0,0 @@ -#!/bin/bash - -eval $(regions-project-env-vars --region="${SENTRY_REGION}") - -IMAGE_TAG="${GO_REVISION_SNUBA_REPO}" - -/devinfra/scripts/get-cluster-credentials - -k8s-deploy \ - --label-selector="${LABEL_SELECTOR}" \ - --image="us-docker.pkg.dev/sentryio/snuba-mr/image:${IMAGE_TAG}" \ - --container-name="snuba" \ - --container-name="snuba-admin" - -k8s-deploy \ - --label-selector="${LABEL_SELECTOR}" \ - --image="us-docker.pkg.dev/sentryio/snuba-mr/image:${IMAGE_TAG}" \ - --type="cronjob" \ - --container-name="cleanup" From a81014fc8d2a69deb14210556110e727210697b2 Mon Sep 17 00:00:00 2001 From: Prajjwal Bhandari Date: Wed, 2 Sep 2026 15:51:45 -0400 Subject: [PATCH 3/7] fix(gocd): deploy ST api container as snuba, not api --- gocd/templates/bash/deploy-py.sh | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/gocd/templates/bash/deploy-py.sh b/gocd/templates/bash/deploy-py.sh index 95ce0caf07..aad39ce045 100644 --- a/gocd/templates/bash/deploy-py.sh +++ b/gocd/templates/bash/deploy-py.sh @@ -4,11 +4,18 @@ eval $(regions-project-env-vars --region="${SENTRY_REGION}") IMAGE_TAG="${GO_REVISION_SNUBA_REPO}" +# ST still names the API container "snuba"; SaaS renamed it to "api". +if [[ "${SENTRY_REGION}" == customer-* ]]; then + API_CONTAINER_NAME="snuba" +else + API_CONTAINER_NAME="api" +fi + /devinfra/scripts/get-cluster-credentials \ && k8s-deploy \ --label-selector="${LABEL_SELECTOR}" \ --image="us-docker.pkg.dev/sentryio/snuba-mr/image:${IMAGE_TAG}" \ - --container-name="api" \ + --container-name="${API_CONTAINER_NAME}" \ --container-name="dlq-consumer" \ --container-name="eap-items-subscriptions-executor" \ --container-name="eap-items-subscriptions-scheduler" \ From 333be2d4b29a28e52c8272dd05c11094e56f3ec8 Mon Sep 17 00:00:00 2001 From: Prajjwal Bhandari Date: Wed, 2 Sep 2026 15:55:40 -0400 Subject: [PATCH 4/7] fix(gocd): pass ST api container name from jsonnet --- gocd/templates/bash/deploy-py.sh | 10 ++-------- gocd/templates/pipelines/snuba-py.libsonnet | 9 ++++++++- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/gocd/templates/bash/deploy-py.sh b/gocd/templates/bash/deploy-py.sh index aad39ce045..82e07e8fe2 100644 --- a/gocd/templates/bash/deploy-py.sh +++ b/gocd/templates/bash/deploy-py.sh @@ -3,19 +3,13 @@ eval $(regions-project-env-vars --region="${SENTRY_REGION}") IMAGE_TAG="${GO_REVISION_SNUBA_REPO}" - -# ST still names the API container "snuba"; SaaS renamed it to "api". -if [[ "${SENTRY_REGION}" == customer-* ]]; then - API_CONTAINER_NAME="snuba" -else - API_CONTAINER_NAME="api" -fi +api_container_id="${1:-api}" /devinfra/scripts/get-cluster-credentials \ && k8s-deploy \ --label-selector="${LABEL_SELECTOR}" \ --image="us-docker.pkg.dev/sentryio/snuba-mr/image:${IMAGE_TAG}" \ - --container-name="${API_CONTAINER_NAME}" \ + --container-name="${api_container_id}" \ --container-name="dlq-consumer" \ --container-name="eap-items-subscriptions-executor" \ --container-name="eap-items-subscriptions-scheduler" \ diff --git a/gocd/templates/pipelines/snuba-py.libsonnet b/gocd/templates/pipelines/snuba-py.libsonnet index e831010084..55ad59bc12 100644 --- a/gocd/templates/pipelines/snuba-py.libsonnet +++ b/gocd/templates/pipelines/snuba-py.libsonnet @@ -1,6 +1,10 @@ local getsentry = import 'github.com/getsentry/gocd-jsonnet/libs/getsentry.libsonnet'; local gocdtasks = import 'github.com/getsentry/gocd-jsonnet/libs/gocd-tasks.libsonnet'; +local deploy_py_script = importstr '../bash/deploy-py.sh'; +local deploy_py_task(api_container_id='api') = + gocdtasks.script('set -- ' + api_container_id + '\n' + deploy_py_script); + // The return value of this function is the body of a GoCD pipeline. // More information on gocd-flavor YAML this is producing can be found here: // - https://github.com/tomzo/gocd-yaml-config-plugin#pipeline @@ -221,7 +225,10 @@ function(region) { LABEL_SELECTOR: 'service=snuba', }, tasks: [ - gocdtasks.script(importstr '../bash/deploy-py.sh'), + if getsentry.is_st(region) then + deploy_py_task('snuba') + else + deploy_py_task(), ], }, }, From 097d3b8a09c5a37bf6c4a371e687637b9366b46a Mon Sep 17 00:00:00 2001 From: Prajjwal Bhandari Date: Wed, 2 Sep 2026 16:00:58 -0400 Subject: [PATCH 5/7] fix(gocd): set ST api container via API_CONTAINER_ID --- gocd/templates/bash/deploy-py.sh | 4 ++-- gocd/templates/pipelines/snuba-py.libsonnet | 11 +++-------- 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/gocd/templates/bash/deploy-py.sh b/gocd/templates/bash/deploy-py.sh index 82e07e8fe2..fa9df45611 100644 --- a/gocd/templates/bash/deploy-py.sh +++ b/gocd/templates/bash/deploy-py.sh @@ -3,13 +3,13 @@ eval $(regions-project-env-vars --region="${SENTRY_REGION}") IMAGE_TAG="${GO_REVISION_SNUBA_REPO}" -api_container_id="${1:-api}" +API_CONTAINER_ID="${API_CONTAINER_ID:-api}" /devinfra/scripts/get-cluster-credentials \ && k8s-deploy \ --label-selector="${LABEL_SELECTOR}" \ --image="us-docker.pkg.dev/sentryio/snuba-mr/image:${IMAGE_TAG}" \ - --container-name="${api_container_id}" \ + --container-name="${API_CONTAINER_ID}" \ --container-name="dlq-consumer" \ --container-name="eap-items-subscriptions-executor" \ --container-name="eap-items-subscriptions-scheduler" \ diff --git a/gocd/templates/pipelines/snuba-py.libsonnet b/gocd/templates/pipelines/snuba-py.libsonnet index 55ad59bc12..111842aa6a 100644 --- a/gocd/templates/pipelines/snuba-py.libsonnet +++ b/gocd/templates/pipelines/snuba-py.libsonnet @@ -1,10 +1,6 @@ local getsentry = import 'github.com/getsentry/gocd-jsonnet/libs/getsentry.libsonnet'; local gocdtasks = import 'github.com/getsentry/gocd-jsonnet/libs/gocd-tasks.libsonnet'; -local deploy_py_script = importstr '../bash/deploy-py.sh'; -local deploy_py_task(api_container_id='api') = - gocdtasks.script('set -- ' + api_container_id + '\n' + deploy_py_script); - // The return value of this function is the body of a GoCD pipeline. // More information on gocd-flavor YAML this is producing can be found here: // - https://github.com/tomzo/gocd-yaml-config-plugin#pipeline @@ -223,12 +219,11 @@ function(region) { elastic_profile_id: 'snuba', environment_variables: { LABEL_SELECTOR: 'service=snuba', + // ST still names the API container "snuba"; SaaS renamed it to "api". + [if getsentry.is_st(region) then 'API_CONTAINER_ID']: 'snuba', }, tasks: [ - if getsentry.is_st(region) then - deploy_py_task('snuba') - else - deploy_py_task(), + gocdtasks.script(importstr '../bash/deploy-py.sh'), ], }, }, From 30f8033d830307045270bded783892aecc02adf0 Mon Sep 17 00:00:00 2001 From: Prajjwal Bhandari Date: Wed, 2 Sep 2026 16:08:55 -0400 Subject: [PATCH 6/7] Simpler approach --- gocd/templates/bash/deploy-py.sh | 5 +++-- gocd/templates/pipelines/snuba-py.libsonnet | 2 -- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/gocd/templates/bash/deploy-py.sh b/gocd/templates/bash/deploy-py.sh index fa9df45611..6a75c635d4 100644 --- a/gocd/templates/bash/deploy-py.sh +++ b/gocd/templates/bash/deploy-py.sh @@ -3,13 +3,14 @@ eval $(regions-project-env-vars --region="${SENTRY_REGION}") IMAGE_TAG="${GO_REVISION_SNUBA_REPO}" -API_CONTAINER_ID="${API_CONTAINER_ID:-api}" /devinfra/scripts/get-cluster-credentials \ && k8s-deploy \ --label-selector="${LABEL_SELECTOR}" \ --image="us-docker.pkg.dev/sentryio/snuba-mr/image:${IMAGE_TAG}" \ - --container-name="${API_CONTAINER_ID}" \ + # some st still name the api container snuba. + --container-name="snuba" \ + --container-name="api" \ --container-name="dlq-consumer" \ --container-name="eap-items-subscriptions-executor" \ --container-name="eap-items-subscriptions-scheduler" \ diff --git a/gocd/templates/pipelines/snuba-py.libsonnet b/gocd/templates/pipelines/snuba-py.libsonnet index 111842aa6a..e831010084 100644 --- a/gocd/templates/pipelines/snuba-py.libsonnet +++ b/gocd/templates/pipelines/snuba-py.libsonnet @@ -219,8 +219,6 @@ function(region) { elastic_profile_id: 'snuba', environment_variables: { LABEL_SELECTOR: 'service=snuba', - // ST still names the API container "snuba"; SaaS renamed it to "api". - [if getsentry.is_st(region) then 'API_CONTAINER_ID']: 'snuba', }, tasks: [ gocdtasks.script(importstr '../bash/deploy-py.sh'), From 233e225328c3ef86bce2f6bfe78fafeed37bf321 Mon Sep 17 00:00:00 2001 From: Praj Bhandari Date: Wed, 2 Sep 2026 13:12:43 -0700 Subject: [PATCH 7/7] Apply suggestion from @pbhandari --- gocd/templates/bash/deploy-py.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/gocd/templates/bash/deploy-py.sh b/gocd/templates/bash/deploy-py.sh index 6a75c635d4..53da3accb3 100644 --- a/gocd/templates/bash/deploy-py.sh +++ b/gocd/templates/bash/deploy-py.sh @@ -8,7 +8,6 @@ IMAGE_TAG="${GO_REVISION_SNUBA_REPO}" && k8s-deploy \ --label-selector="${LABEL_SELECTOR}" \ --image="us-docker.pkg.dev/sentryio/snuba-mr/image:${IMAGE_TAG}" \ - # some st still name the api container snuba. --container-name="snuba" \ --container-name="api" \ --container-name="dlq-consumer" \