Skip to content

Commit 4d91135

Browse files
authored
feat: add GoCD pipeline for auto-deploy on push to master (#16)
Adds GoCD pipeline templates following the seer pattern: - orbital.jsonnet: pipedream config with auto_deploy: true, materials watching sentry-orbital master, US-only regions - pipelines/orbital.libsonnet: check GH Actions build → k8s-deploy - bash/check-github.sh: verify 'Build and smoke test' passed - bash/deploy.sh: k8s-deploy with GHCR image tagged by commit SHA On push to master, GoCD will: 1. Wait for GH Actions build to pass 2. Deploy ghcr.io/getsentry/sentry-orbital:<sha> to US k8s Requires companion changes: - devinfra-deployment-service: update orbital-k8s deploy-config to point at sentry-orbital repo - ops: remove the old orbital-k8s.jsonnet (now lives here)
1 parent 7a78dcf commit 4d91135

File tree

6 files changed

+127
-0
lines changed

6 files changed

+127
-0
lines changed
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#!/bin/bash
2+
3+
checks-githubactions-checkruns \
4+
getsentry/sentry-orbital \
5+
"${GO_REVISION_ORBITAL_REPO}" \
6+
"Build and smoke test"

gocd/templates/bash/deploy.sh

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#!/bin/bash
2+
3+
eval "$(regions-project-env-vars --region="${SENTRY_REGION}")"
4+
5+
/devinfra/scripts/get-cluster-credentials \
6+
&& k8s-deploy \
7+
--label-selector="service=orbital" \
8+
--image="ghcr.io/getsentry/sentry-orbital:${GO_REVISION_ORBITAL_REPO}" \
9+
--container-name="orbital"

gocd/templates/jsonnetfile.json

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"version": 1,
3+
"dependencies": [
4+
{
5+
"source": {
6+
"git": {
7+
"remote": "https://github.com/getsentry/gocd-jsonnet.git",
8+
"subdir": "libs"
9+
}
10+
},
11+
"version": "v2.19.0"
12+
}
13+
],
14+
"legacyImports": true
15+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"version": 1,
3+
"dependencies": [
4+
{
5+
"source": {
6+
"git": {
7+
"remote": "https://github.com/getsentry/gocd-jsonnet.git",
8+
"subdir": "libs"
9+
}
10+
},
11+
"version": "56cc4d91cbaac4569b37b4911998b48c2f9c2ac4",
12+
"sum": "J0D//go/146qfReWFTTL5xWWCVlkTjqhnALYPH4Z9rE="
13+
}
14+
],
15+
"legacyImports": false
16+
}

gocd/templates/orbital.jsonnet

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
local orbital = import './pipelines/orbital.libsonnet';
2+
local pipedream = import 'github.com/getsentry/gocd-jsonnet/libs/pipedream.libsonnet';
3+
4+
local pipedream_config = {
5+
name: 'orbital',
6+
auto_deploy: true,
7+
// US-only
8+
exclude_regions: [
9+
's4s',
10+
's4s2',
11+
'de',
12+
'customer-1',
13+
'customer-2',
14+
'customer-4',
15+
'customer-7',
16+
],
17+
materials: {
18+
orbital_repo: {
19+
git: 'git@github.com:getsentry/sentry-orbital.git',
20+
shallow_clone: false,
21+
branch: 'master',
22+
destination: 'orbital',
23+
},
24+
},
25+
rollback: {
26+
material_name: 'orbital_repo',
27+
stage: 'deploy-primary',
28+
elastic_profile_id: 'orbital',
29+
},
30+
};
31+
32+
pipedream.render(pipedream_config, orbital)
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
local gocdtasks = import 'github.com/getsentry/gocd-jsonnet/libs/gocd-tasks.libsonnet';
2+
3+
function(region) {
4+
materials: {
5+
orbital_repo: {
6+
git: 'git@github.com:getsentry/sentry-orbital.git',
7+
shallow_clone: false,
8+
branch: 'master',
9+
destination: 'orbital',
10+
},
11+
},
12+
lock_behavior: 'unlockWhenFinished',
13+
stages: [
14+
{
15+
checks: {
16+
fetch_materials: true,
17+
environment_variables: {
18+
GITHUB_TOKEN: '{{SECRET:[devinfra-github][token]}}',
19+
},
20+
jobs: {
21+
check: {
22+
timeout: 1200,
23+
elastic_profile_id: 'orbital',
24+
tasks: [
25+
gocdtasks.script(importstr '../bash/check-github.sh'),
26+
],
27+
},
28+
},
29+
},
30+
},
31+
{
32+
'deploy-primary': {
33+
fetch_materials: true,
34+
environment_variables: {
35+
SENTRY_REGION: region,
36+
},
37+
jobs: {
38+
deploy: {
39+
timeout: 1200,
40+
elastic_profile_id: 'orbital',
41+
tasks: [
42+
gocdtasks.script(importstr '../bash/deploy.sh'),
43+
],
44+
},
45+
},
46+
},
47+
},
48+
],
49+
}

0 commit comments

Comments
 (0)