23
23
lint :
24
24
runs-on : ubuntu-latest
25
25
steps :
26
- - uses : actions/checkout@v4
26
+ - uses : actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
27
27
with :
28
28
fetch-depth : 0
29
29
- uses : actions/setup-go@v5
40
40
test-vroom :
41
41
runs-on : ubuntu-latest
42
42
steps :
43
- - uses : actions/checkout@v4
43
+ - uses : actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
44
44
with :
45
45
fetch-depth : 0
46
46
- uses : actions/setup-go@v5
@@ -49,18 +49,107 @@ jobs:
49
49
cache : false
50
50
- run : make test
51
51
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
+
52
140
publish-to-dockerhub :
53
141
name : Publish Vroom to DockerHub
54
142
runs-on : ubuntu-latest
55
143
if : ${{ (github.ref_name == 'main') }}
144
+ needs :
145
+ - assemble-image
56
146
steps :
57
147
- 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
60
148
- name : Push built docker image
61
149
shell : bash
62
150
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"
64
153
docker login --username=sentrybuilder --password ${{ secrets.DOCKER_HUB_RW_TOKEN }}
65
154
# We push 3 tags to Dockerhub:
66
155
# first, the full sha of the commit
0 commit comments