Skip to content

Commit 823b00e

Browse files
authored
ci: publish vroom to GHCR and provide a tagged release on GHCR (#576)
Similar work with these PRs: - getsentry/relay#4532 - getsentry/symbolicator#1635 - getsentry/snuba#6997 - getsentry/sentry#88181 While also trying to provide a solution (or at least an alternative) for this issue: getsentry/self-hosted#3593 ### Legal Boilerplate Look, I get it. The entity doing business as "Sentry" was incorporated in the State of Delaware in 2015 as Functional Software, Inc. and is gonna need some rights from me in order to utilize my contributions in this here PR. So here's the deal: I retain all rights, title and interest in and to my contributions, and by keeping this boilerplate intact I confirm that Sentry can use, modify, copy, and redistribute my contributions, under Sentry's choice of terms.
1 parent a0bbd50 commit 823b00e

File tree

4 files changed

+118
-6
lines changed

4 files changed

+118
-6
lines changed

.github/workflows/ci.yaml

Lines changed: 94 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ jobs:
2323
lint:
2424
runs-on: ubuntu-latest
2525
steps:
26-
- uses: actions/checkout@v4
26+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
2727
with:
2828
fetch-depth: 0
2929
- uses: actions/setup-go@v5
@@ -40,7 +40,7 @@ jobs:
4040
test-vroom:
4141
runs-on: ubuntu-latest
4242
steps:
43-
- uses: actions/checkout@v4
43+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
4444
with:
4545
fetch-depth: 0
4646
- uses: actions/setup-go@v5
@@ -49,18 +49,107 @@ jobs:
4949
cache: false
5050
- run: make test
5151

52+
build-image:
53+
runs-on: ${{ matrix.os }}
54+
strategy:
55+
matrix:
56+
include:
57+
- os: ubuntu-24.04
58+
platform: amd64
59+
- os: ubuntu-24.04-arm
60+
platform: arm64
61+
needs:
62+
- lint
63+
- test-vroom
64+
if: github.repository_owner == 'getsentry'
65+
steps:
66+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
67+
68+
- name: Set up Docker Buildx
69+
uses: docker/setup-buildx-action@b5ca514318bd6ebac0fb2aedd5d36ec1b5c232a2 # v3.10.0
70+
71+
- name: Build
72+
uses: docker/build-push-action@32945a339266b759abcbdc89316275140b0fc960 # v6.8.10
73+
with:
74+
context: .
75+
cache-from: ghcr.io/getsentry/vroom:nightly
76+
cache-to: type=inline
77+
platforms: linux/${{ matrix.platform }}
78+
tags: vroom:${{ matrix.platform }}
79+
outputs: type=docker,dest=/tmp/vroom-${{ matrix.platform }}.tar
80+
push: false
81+
82+
# NOTE(aldy505): Rather than pushing the individual architecture-specific image to GHCR,
83+
# we're uploading the tarball into GHA's artifact store and assemble it later
84+
# to create a multiplatform image. This way, we won't be polluting the GHCR image tags
85+
# with a bunch of images that are only being used for CI purposes.
86+
#
87+
# For posterity: If at any chance you need the individual architecture-specific images,
88+
# you can set `push: true` and `tags: ghcr.io/getsentry/vroom:${{ github.sha }}-${{ matrix.platform }}` in the above step.
89+
- name: Upload Image
90+
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
91+
with:
92+
name: vroom-${{ matrix.platform }}
93+
path: /tmp/vroom-${{ matrix.platform }}.tar
94+
95+
assemble-image:
96+
runs-on: ubuntu-latest
97+
needs:
98+
- build-image
99+
if: ${{ github.event_name != 'pull_request' }}
100+
steps:
101+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
102+
- run: docker login --username '${{ github.actor }}' --password-stdin ghcr.io <<< "$GHCR_TOKEN"
103+
env:
104+
GHCR_TOKEN: ${{ secrets.GITHUB_TOKEN }}
105+
106+
- name: Set up Docker Buildx
107+
uses: docker/setup-buildx-action@b5ca514318bd6ebac0fb2aedd5d36ec1b5c232a2 # v3.10.0
108+
109+
- name: Download amd64 Image
110+
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.2
111+
with:
112+
name: vroom-amd64
113+
path: /tmp
114+
115+
- name: Load amd64 Image
116+
run: docker load --input /tmp/vroom-amd64.tar
117+
118+
- name: Download arm64 Image
119+
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.2
120+
with:
121+
name: vroom-arm64
122+
path: /tmp
123+
124+
- name: Load arm64 Image
125+
run: docker load --input /tmp/vroom-arm64.tar
126+
127+
- name: Push to GitHub Container Registry
128+
run: |
129+
docker tag vroom:amd64 ghcr.io/getsentry/vroom:${{ github.sha }}-amd64
130+
docker push ghcr.io/getsentry/vroom:${{ github.sha }}-amd64
131+
docker tag vroom:arm64 ghcr.io/getsentry/vroom:${{ github.sha }}-arm64
132+
docker push ghcr.io/getsentry/vroom:${{ github.sha }}-arm64
133+
docker manifest create \
134+
ghcr.io/getsentry/vroom:${{ github.sha }} \
135+
ghcr.io/getsentry/vroom:nightly \
136+
--amend ghcr.io/getsentry/vroom:${{ github.sha }}-amd64 \
137+
--amend ghcr.io/getsentry/vroom:${{ github.sha }}-arm64
138+
docker manifest push ghcr.io/getsentry/vroom:${{ github.sha }}
139+
52140
publish-to-dockerhub:
53141
name: Publish Vroom to DockerHub
54142
runs-on: ubuntu-latest
55143
if: ${{ (github.ref_name == 'main') }}
144+
needs:
145+
- assemble-image
56146
steps:
57147
- uses: actions/checkout@v4
58-
- timeout-minutes: 20
59-
run: until docker pull "us-central1-docker.pkg.dev/sentryio/vroom/vroom:${{ github.sha }}" 2>/dev/null; do sleep 10; done
60148
- name: Push built docker image
61149
shell: bash
62150
run: |
63-
IMAGE_URL="us-central1-docker.pkg.dev/sentryio/vroom/vroom:${{ github.sha }}"
151+
IMAGE_URL="ghcr.io/getsentry/vroom:${{ github.sha }}"
152+
docker pull "$IMAGE_URL"
64153
docker login --username=sentrybuilder --password ${{ secrets.DOCKER_HUB_RW_TOKEN }}
65154
# We push 3 tags to Dockerhub:
66155
# first, the full sha of the commit
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
name: Release GHCR Versioned Image
2+
3+
on:
4+
release:
5+
types: [prereleased, released]
6+
7+
jobs:
8+
release-ghcr-version-tag:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- name: Log in to GitHub Container Registry
12+
uses: docker/login-action@v3
13+
with:
14+
registry: ghcr.io
15+
username: ${{ github.actor }}
16+
password: ${{ secrets.GITHUB_TOKEN }}
17+
18+
- name: Tag release version
19+
run: |
20+
docker buildx imagetools create --tag \
21+
ghcr.io/getsentry/vroom:${{ github.ref_name }} \
22+
ghcr.io/getsentry/vroom:${{ github.sha }}

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,7 @@
134134
- Bump x/net package to fix security issue (high severity) ([#555](https://github.com/getsentry/vroom/pull/555))
135135
- Enforce shorter timeout for chunks download in flamegraph generation ([#557](https://github.com/getsentry/vroom/pull/557))
136136
- Bump actions/create-github-app-token from 1.11.2 to 1.11.3 ([#559](https://github.com/getsentry/vroom/pull/559))
137+
- Publish vroom to GHCR and provide a tagged release on GHCR. ([#576](https://github.com/getsentry/vroom/pull/576))
137138
- Buffer flamegraph candidates to reduce memory usage. ([#583](https://github.com/getsentry/vroom/pull/583))
138139
- Reduce read jobs buffer to reduce memory usage. ([#584](https://github.com/getsentry/vroom/pull/584))
139140

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ FROM golang:$GOVERSION AS builder
44
WORKDIR /src
55
COPY . .
66

7-
RUN GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -o . -ldflags="-s -w -X main.release=$(git rev-parse HEAD)" ./cmd/vroom
7+
RUN CGO_ENABLED=0 go build -o . -ldflags="-s -w -X main.release=$(git rev-parse HEAD)" ./cmd/vroom
88

99
FROM debian:bookworm-slim
1010

0 commit comments

Comments
 (0)