forked from moby/buildkit
-
Notifications
You must be signed in to change notification settings - Fork 0
252 lines (240 loc) · 8.26 KB
/
frontend.yml
File metadata and controls
252 lines (240 loc) · 8.26 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
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
name: frontend
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: read
on:
workflow_dispatch:
push:
branches:
- 'master'
- 'v[0-9]+.[0-9]+'
tags:
- 'dockerfile/*'
pull_request:
paths-ignore:
- 'README.md'
- 'docs/**'
- 'frontend/dockerfile/docs/**'
env:
GO_VERSION: "1.26"
SETUP_BUILDX_VERSION: "edge"
SETUP_BUILDKIT_TAG: "moby/buildkit:latest"
SCOUT_VERSION: "1.20.2"
IMAGE_NAME: "docker/dockerfile-upstream"
jobs:
test:
uses: ./.github/workflows/.test.yml
with:
cache_scope: frontend-integration-tests
pkgs: ./frontend/dockerfile
kinds: |
integration
dockerfile
codecov_flags: dockerfile-frontend
secrets:
codecov_token: ${{ secrets.CODECOV_TOKEN }}
prepare:
runs-on: ubuntu-24.04
outputs:
includes: ${{ steps.set.outputs.includes }}
tag: ${{ steps.set.outputs.tag }}
steps:
-
name: Set outputs
id: set
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0
env:
INPUT_REF: ${{ github.ref }}
INPUT_CHANNELS: |
mainline
labs
INPUT_IMAGE-NAME: ${{ env.IMAGE_NAME }}
with:
script: |
const ref = core.getInput('ref');
const channels = core.getMultilineInput('channels');
const imageName = core.getInput('image-name');
function getTags(channel) {
let tagSuffix = '';
if (channel !== 'mainline') {
tagSuffix = `-${channel}`;
}
let tagLatest = '';
let tagVersion = '';
if (ref.startsWith('refs/tags/dockerfile/')) {
const version = ref.replace('refs/tags/dockerfile/', '').replace(new RegExp(`-${channel}$`), '');
if (/^[0-9]+\.[0-9]+\.[0-9]+$/.test(version)) {
tagLatest = channel === 'mainline' ? 'latest' : channel;
}
tagVersion = version;
}
return { tagSuffix, tagLatest, tagVersion };
}
const matrix = [];
if (ref.startsWith('refs/tags/dockerfile/')) {
const version = ref.replace('refs/tags/dockerfile/', '');
for (const channel of channels) {
if (version.endsWith(`-${channel}`)) {
const { tagSuffix, tagLatest, tagVersion } = getTags(channel);
matrix.push({
channel: channel,
imageName: imageName,
tagSuffix: tagSuffix,
tagLatest: tagLatest,
tagVersion: tagVersion
});
break;
}
}
if (matrix.length === 0) {
// default to mainline if no channel suffix
const { tagSuffix, tagLatest, tagVersion } = getTags('mainline');
matrix.push({
channel: 'mainline',
imageName: imageName,
tagSuffix: tagSuffix,
tagLatest: tagLatest,
tagVersion: tagVersion
});
}
core.setOutput('tag', ref.replace('refs/tags/', ''));
} else {
for (const channel of channels) {
const { tagSuffix, tagLatest, tagVersion } = getTags(channel);
matrix.push({
channel: channel,
imageName: imageName,
tagSuffix: tagSuffix,
tagLatest: tagLatest,
tagVersion: tagVersion
});
}
}
core.info(JSON.stringify(matrix, null, 2));
core.setOutput('includes', JSON.stringify(matrix));
image:
uses: docker/github-builder/.github/workflows/bake.yml@70313223e2665c3211b454b3fea6534624e78d64 # v1.4.0
needs:
- prepare
- test
strategy:
fail-fast: false
matrix:
include: ${{ fromJson(needs.prepare.outputs.includes) }}
permissions:
contents: read # same as global permission
id-token: write # for signing attestation(s) with GitHub OIDC Token
with:
runner: amd64
setup-qemu: true
target: frontend-image-cross
cache: true
cache-scope: frontend-${{ matrix.channel }}
output: image
push: ${{ github.repository == 'moby/buildkit' && (github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/dockerfile/')) }}
sbom: true
vars: |
FRONTEND_CHANNEL=${{ matrix.channel }}
set-meta-annotations: true
meta-images: |
${{ matrix.imageName }}
# versioning strategy
## push tag dockerfile/1.17.0
### docker/dockerfile-upstream:1.17.0
### docker/dockerfile-upstream:1.17
### docker/dockerfile-upstream:1
### docker/dockerfile-upstream:latest
## push tag dockerfile/1.17.0-labs
### docker/dockerfile-upstream:1.17.0-labs
### docker/dockerfile-upstream:1.17-labs
### docker/dockerfile-upstream:1-labs
### docker/dockerfile-upstream:labs
## push prerelease tag dockerfile/1.17.0-rc1
### docker/dockerfile-upstream:1.17.0-rc1
## push prerelease tag dockerfile/1.17.0-rc1-labs
### docker/dockerfile-upstream:1.17.0-rc1-labs
## push on master
### docker/dockerfile-upstream:master
### docker/dockerfile-upstream:master-labs
meta-tags: |
type=ref,event=branch,suffix=${{ matrix.tagSuffix }}
type=ref,event=pr,suffix=${{ matrix.tagSuffix }}
type=semver,pattern={{version}},value=${{ matrix.tagVersion }},suffix=${{ matrix.tagSuffix }}
type=semver,pattern={{major}}.{{minor}},value=${{ matrix.tagVersion }},suffix=${{ matrix.tagSuffix }}
type=semver,pattern={{major}},value=${{ matrix.tagVersion }},suffix=${{ matrix.tagSuffix }}
type=raw,value=${{ matrix.tagLatest }}
meta-flavor: |
latest=false
meta-annotations: |
org.opencontainers.image.title=Dockerfile Frontend
org.opencontainers.image.vendor=Moby
meta-bake-target: frontend-meta-helper
secrets:
registry-auths: |
- registry: docker.io
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
scout:
runs-on: ubuntu-24.04
if: ${{ github.repository == 'moby/buildkit' && github.ref == 'refs/heads/master' }}
permissions:
# same as global permission
contents: read
# required to write sarif report
security-events: write
needs:
- image
strategy:
fail-fast: false
matrix:
tag:
- master
- master-labs
steps:
-
name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
-
name: Login to DockerHub
uses: docker/login-action@b45d80f862d83dbcd57f89517bcf500b2ab88fb2 # v4.0.0
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
-
name: Scout
id: scout
uses: crazy-max/.github/.github/actions/docker-scout@bb328ea508cd6a89d0865555ddbeb148e5724aed # v1.3.0
with:
version: ${{ env.SCOUT_VERSION }}
format: sarif
image: registry://${{ env.IMAGE_NAME }}:${{ matrix.tag }}
-
name: Result output
run: |
jq . ${{ steps.scout.outputs.result-file }}
-
name: Upload SARIF report
uses: github/codeql-action/upload-sarif@c10b8064de6f491fea524254123dbe5e09572f13 # v4.35.1
with:
sarif_file: ${{ steps.scout.outputs.result-file }}
release:
runs-on: ubuntu-24.04
if: startsWith(github.ref, 'refs/tags/dockerfile')
permissions:
# required to create GitHub release
contents: write
needs:
- prepare
- test
- image
steps:
-
name: GitHub Release
uses: softprops/action-gh-release@153bb8e04406b158c6c84fc1615b65b24149a1fe # v2.6.1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
draft: true
name: ${{ needs.prepare.outputs.tag }}