-
-
Notifications
You must be signed in to change notification settings - Fork 61
200 lines (185 loc) · 6.79 KB
/
image.yml
File metadata and controls
200 lines (185 loc) · 6.79 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
on:
pull_request:
push:
branches:
- master
- release/**
- test/nightly-distroless
jobs:
build-multiplatform:
strategy:
matrix:
include:
- os: ubuntu-24.04
platform: amd64
- os: ubuntu-24.04-arm
platform: arm64
runs-on: ${{ matrix.os }}
name: build-${{ matrix.platform }}
permissions:
contents: read
packages: write
if: github.repository_owner == 'getsentry'
steps:
- uses: actions/checkout@v6.0.2
- uses: getsentry/action-build-and-push-images@8fc75e483c09a68721f2c8951292ee17f8821766
with:
image_name: 'snuba'
platforms: linux/${{ matrix.platform }}
dockerfile_path: 'Dockerfile'
tag_suffix: -${{ matrix.platform }}
ghcr: true
tag_nightly: false
tag_latest: false
build-production:
runs-on: ubuntu-24.04
name: Build and push production image
permissions:
contents: read
id-token: write
if: ${{ github.ref_name == 'master' }}
steps:
- uses: actions/checkout@v6.0.2
- uses: getsentry/action-build-and-push-images@8fc75e483c09a68721f2c8951292ee17f8821766
with:
image_name: 'snuba'
platforms: linux/amd64
dockerfile_path: './Dockerfile'
ghcr: false
tag_nightly: false
tag_latest: false
google_ar: true
google_ar_image_name: us-docker.pkg.dev/sentryio/snuba-mr/image
google_workload_identity_provider: projects/868781662168/locations/global/workloadIdentityPools/prod-github/providers/github-oidc-pool
google_service_account: gha-gcr-push@sac-prod-sa.iam.gserviceaccount.com
# Distroless image — for testing before switching production
build-distroless-multiplatform:
strategy:
matrix:
include:
- os: ubuntu-24.04
platform: amd64
- os: ubuntu-24.04-arm
platform: arm64
runs-on: ${{ matrix.os }}
name: build-distroless-${{ matrix.platform }}
permissions:
contents: read
packages: write
if: github.repository_owner == 'getsentry'
steps:
- uses: actions/checkout@v6.0.2
- uses: getsentry/action-build-and-push-images@8fc75e483c09a68721f2c8951292ee17f8821766
with:
image_name: 'snuba'
platforms: linux/${{ matrix.platform }}
dockerfile_path: 'Dockerfile'
build_target: 'application-distroless'
tag_suffix: -distroless-${{ matrix.platform }}
ghcr: true
tag_nightly: false
tag_latest: false
publish_on_pr: ${{ github.head_ref == 'test/nightly-distroless' }}
# Debug distroless image — with busybox for troubleshooting
build-debug-multiplatform:
strategy:
matrix:
include:
- os: ubuntu-24.04
platform: amd64
- os: ubuntu-24.04-arm
platform: arm64
runs-on: ${{ matrix.os }}
name: build-debug-${{ matrix.platform }}
permissions:
contents: read
packages: write
if: github.repository_owner == 'getsentry'
steps:
- uses: actions/checkout@v6.0.2
- uses: getsentry/action-build-and-push-images@8fc75e483c09a68721f2c8951292ee17f8821766
with:
image_name: 'snuba'
platforms: linux/${{ matrix.platform }}
dockerfile_path: 'Dockerfile'
build_target: 'application-distroless-debug'
tag_suffix: -debug-${{ matrix.platform }}
ghcr: true
tag_nightly: false
tag_latest: false
assemble:
needs: [build-multiplatform]
if: ${{ (github.ref_name == 'master' || startsWith(github.ref_name, 'release/')) && github.event_name != 'pull_request' }}
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Docker Login
run: docker login --username '${{ github.actor }}' --password-stdin ghcr.io <<< "$GHCR_TOKEN"
env:
GHCR_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Create multiplatform manifests
run: |
docker buildx imagetools create \
--tag ghcr.io/getsentry/snuba:${{ github.sha }} \
--tag ghcr.io/getsentry/snuba:nightly \
ghcr.io/getsentry/snuba:${{ github.sha }}-amd64 \
ghcr.io/getsentry/snuba:${{ github.sha }}-arm64
assemble-distroless:
needs: [build-distroless-multiplatform]
if: ${{ needs.build-distroless-multiplatform.result == 'success' && github.repository_owner == 'getsentry' && (github.ref_name == 'master' || startsWith(github.ref_name, 'release/') || github.ref_name == 'test/nightly-distroless' || github.head_ref == 'test/nightly-distroless') }}
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Docker Login
run: docker login --username '${{ github.actor }}' --password-stdin ghcr.io <<< "$GHCR_TOKEN"
env:
GHCR_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Create distroless multiplatform manifests
env:
IMAGE_SHA: ${{ github.event.pull_request.head.sha || github.sha }}
run: |
docker buildx imagetools create \
--tag ghcr.io/getsentry/snuba:${IMAGE_SHA}-distroless \
--tag ghcr.io/getsentry/snuba:nightly-distroless \
ghcr.io/getsentry/snuba:${IMAGE_SHA}-distroless-amd64 \
ghcr.io/getsentry/snuba:${IMAGE_SHA}-distroless-arm64
assemble-debug:
needs: [build-debug-multiplatform]
if: ${{ (github.ref_name == 'master' || startsWith(github.ref_name, 'release/')) && github.event_name != 'pull_request' }}
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Docker Login
run: docker login --username '${{ github.actor }}' --password-stdin ghcr.io <<< "$GHCR_TOKEN"
env:
GHCR_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Create debug multiplatform manifests
run: |
docker buildx imagetools create \
--tag ghcr.io/getsentry/snuba:${{ github.sha }}-debug \
--tag ghcr.io/getsentry/snuba:nightly-debug \
ghcr.io/getsentry/snuba:${{ github.sha }}-debug-amd64 \
ghcr.io/getsentry/snuba:${{ github.sha }}-debug-arm64
self-hosted-end-to-end:
needs: [build-multiplatform, assemble]
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Run Sentry self-hosted e2e CI
uses: getsentry/self-hosted@master
with:
project_name: snuba
image_url: ghcr.io/getsentry/snuba:${{ github.sha }}
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}