|
1 | 1 | local utils = import '../libs/utils.libsonnet'; |
2 | 2 | local gocdtasks = import 'github.com/getsentry/gocd-jsonnet/libs/gocd-tasks.libsonnet'; |
3 | 3 |
|
4 | | -local deploy_canary(region) = [ |
5 | | - { |
6 | | - 'deploy-canary': { |
7 | | - fetch_materials: true, |
8 | | - jobs: { |
9 | | - create_sentry_release: { |
10 | | - environment_variables: { |
11 | | - SENTRY_ORG: 'sentry', |
12 | | - SENTRY_PROJECT: 'objectstore', |
13 | | - SENTRY_AUTH_TOKEN: '{{SECRET:[devinfra-sentryio][token]}}', |
14 | | - SENTRY_ENVIRONMENT: region + '-canary', |
15 | | - }, |
16 | | - timeout: 60, |
17 | | - elastic_profile_id: 'objectstore', |
18 | | - tasks: [ |
19 | | - gocdtasks.script(importstr '../bash/create-sentry-release.sh'), |
20 | | - ], |
21 | | - }, |
22 | | - deploy: { |
23 | | - timeout: 300, |
24 | | - elastic_profile_id: 'objectstore', |
25 | | - environment_variables: { |
26 | | - K8S_ENVIRONMENT: 'canary', |
27 | | - PAUSE_MESSAGE: 'Pausing pipeline due to canary failure.', |
| 4 | +// NOTE: Sync with objectstore-k8s in getsentry/ops. |
| 5 | +local region_has_canary(region) = |
| 6 | + region == 'de' || region == 'us'; |
| 7 | + |
| 8 | +local deploy_canary(region) = |
| 9 | + if region_has_canary(region) then |
| 10 | + [ |
| 11 | + { |
| 12 | + 'deploy-canary': { |
| 13 | + fetch_materials: true, |
| 14 | + jobs: { |
| 15 | + create_sentry_release: { |
| 16 | + environment_variables: { |
| 17 | + SENTRY_ORG: 'sentry', |
| 18 | + SENTRY_PROJECT: 'objectstore', |
| 19 | + SENTRY_AUTH_TOKEN: '{{SECRET:[devinfra-sentryio][token]}}', |
| 20 | + SENTRY_ENVIRONMENT: region + '-canary', |
| 21 | + }, |
| 22 | + timeout: 60, |
| 23 | + elastic_profile_id: 'objectstore', |
| 24 | + tasks: [ |
| 25 | + gocdtasks.script(importstr '../bash/create-sentry-release.sh'), |
| 26 | + ], |
| 27 | + }, |
| 28 | + deploy: { |
| 29 | + timeout: 300, |
| 30 | + elastic_profile_id: 'objectstore', |
| 31 | + environment_variables: { |
| 32 | + K8S_ENVIRONMENT: 'canary', |
| 33 | + PAUSE_MESSAGE: 'Pausing pipeline due to canary failure.', |
| 34 | + }, |
| 35 | + tasks: [ |
| 36 | + gocdtasks.script(importstr '../bash/deploy.sh'), |
| 37 | + gocdtasks.script(importstr '../bash/wait-canary.sh'), |
| 38 | + // TODO: Add sentry error checks |
| 39 | + // TODO: Add datadog monitors |
| 40 | + utils.pause_on_failure(), |
| 41 | + ], |
| 42 | + }, |
28 | 43 | }, |
29 | | - tasks: [ |
30 | | - gocdtasks.script(importstr '../bash/deploy.sh'), |
31 | | - gocdtasks.script(importstr '../bash/wait-canary.sh'), |
32 | | - // TODO: Add sentry error checks |
33 | | - // TODO: Add datadog monitors |
34 | | - utils.pause_on_failure(), |
35 | | - ], |
36 | 44 | }, |
37 | 45 | }, |
38 | | - }, |
39 | | - }, |
40 | | -]; |
| 46 | + ] |
| 47 | + else |
| 48 | + []; |
41 | 49 |
|
42 | 50 | local deploy_primary(region) = [ |
43 | 51 | { |
|
0 commit comments