Skip to content

Commit 01cfa86

Browse files
committed
docker/ci: Build oci images natively (#40557)
Signed-off-by: Ryan Northey <[email protected]>
1 parent a7e9df8 commit 01cfa86

File tree

12 files changed

+545
-493
lines changed

12 files changed

+545
-493
lines changed

.github/config.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ checks:
8686
name: >-
8787
Envoy/Publish and verify
8888
on-run:
89-
- publish
89+
- release
9090
- verify
9191
required: true
9292

@@ -132,7 +132,7 @@ run:
132132
precheck-publish:
133133
paths:
134134
- "**/*"
135-
publish:
135+
release:
136136
paths:
137137
- .bazelrc
138138
- .bazelversion
@@ -141,6 +141,7 @@ run:
141141
- bazel/**/*
142142
- ci/**/*
143143
- contrib/**/*
144+
- distribution/**/*
144145
- envoy/**/*
145146
- examples/**/*
146147
- source/**/*
@@ -155,6 +156,7 @@ run:
155156
- bazel/**/*
156157
- ci/**/*
157158
- contrib/**/*
159+
- distribution/**/*
158160
- envoy/**/*
159161
- examples/**/*
160162
- source/**/*

.github/workflows/_publish_build.yml

Lines changed: 47 additions & 112 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,16 @@ permissions:
66
on:
77
workflow_call:
88
secrets:
9-
dockerhub-password:
10-
required: false
119
gcs-cache-key:
1210
required: true
1311
gpg-key:
1412
required: true
1513
gpg-key-password:
1614
required: true
1715
inputs:
16+
arch:
17+
type: string
18+
required: true
1819
gcs-cache-bucket:
1920
type: string
2021
required: true
@@ -31,7 +32,7 @@ concurrency:
3132
${{ github.actor != 'trigger-release-envoy[bot]'
3233
&& github.event.inputs.head_ref
3334
|| github.run_id
34-
}}-${{ github.event.workflow.id }}-publish
35+
}}-${{ inputs.arch }}-${{ github.event.workflow.id }}-publish
3536
cancel-in-progress: true
3637

3738

@@ -42,152 +43,86 @@ jobs:
4243
permissions:
4344
contents: read
4445
packages: read
45-
name: ${{ matrix.name || matrix.target }}
46+
name: Binary
4647
uses: ./.github/workflows/_run.yml
4748
with:
48-
arch: ${{ matrix.arch }}
49-
bazel-extra: ${{ matrix.bazel-extra }}
50-
target: ${{ matrix.target }}
51-
target-suffix: ${{ matrix.arch }}
52-
cache-build-image: ${{ fromJSON(inputs.request).request.build-image.default }}
53-
cache-build-image-key-suffix: ${{ matrix.arch == 'arm64' && format('-{0}', matrix.arch) || '' }}
54-
concurrency-suffix: -${{ matrix.arch }}
55-
gcs-cache-bucket: ${{ inputs.gcs-cache-bucket }}
56-
rbe: ${{ matrix.rbe }}
57-
request: ${{ inputs.request }}
58-
runs-on: ${{ matrix.runs-on }}
59-
timeout-minutes: 120
60-
trusted: ${{ inputs.trusted }}
61-
upload-name: release.${{ matrix.arch }}
62-
upload-path: envoy/${{ matrix.arch }}/bin/
63-
strategy:
64-
fail-fast: false
65-
matrix:
66-
include:
67-
- target: release.server_only
68-
name: Release (x64)
69-
arch: x64
70-
bazel-extra: >-
71-
--config=remote-envoy-engflow
72-
rbe: true
73-
- target: release.server_only
74-
name: Release (arm64)
75-
arch: arm64
76-
bazel-extra: >-
77-
--config=remote-envoy-engflow
78-
rbe: true
79-
runs-on: ${{ vars.ENVOY_ARM_VM || 'ubuntu-24.04-arm' }}
80-
81-
distribution:
82-
permissions:
83-
contents: read
84-
packages: read
85-
secrets:
86-
gcs-cache-key: ${{ secrets.gcs-cache-key }}
87-
gpg-key: ${{ secrets.gpg-key }}
88-
gpg-key-password: ${{ secrets.gpg-key-password }}
89-
name: ${{ matrix.name || matrix.target }}
90-
needs:
91-
- binary
92-
uses: ./.github/workflows/_run.yml
93-
with:
94-
arch: ${{ matrix.arch }}
49+
arch: ${{ inputs.arch }}
9550
bazel-extra: >-
96-
--config=remote-cache-envoy-engflow
97-
downloads: |
98-
release.${{ matrix.arch }}: release/${{ matrix.arch }}/bin/
99-
target: ${{ matrix.target }}
100-
target-suffix: ${{ matrix.arch }}
51+
--config=remote-envoy-engflow
52+
target: release.server_only
53+
target-suffix: ${{ inputs.arch }}
10154
cache-build-image: ${{ fromJSON(inputs.request).request.build-image.default }}
102-
cache-build-image-key-suffix: ${{ matrix.cache-build-image-key-suffix }}
103-
concurrency-suffix: -${{ matrix.arch }}
55+
cache-build-image-key-suffix: ${{ inputs.arch == 'arm64' && '-arm64' || '' }}
56+
concurrency-suffix: -${{ inputs.arch }}
10457
gcs-cache-bucket: ${{ inputs.gcs-cache-bucket }}
105-
import-gpg: true
106-
rbe: false
58+
rbe: true
10759
request: ${{ inputs.request }}
108-
runs-on: ${{ matrix.runs-on }}
60+
runs-on: ${{ inputs.arch == 'arm64' && (vars.ENVOY_ARM_VM || 'ubuntu-24.04-arm') || null }}
61+
timeout-minutes: 120
10962
trusted: ${{ inputs.trusted }}
110-
upload-name: packages.${{ matrix.arch }}
111-
upload-path: envoy/${{ matrix.arch }}
112-
strategy:
113-
fail-fast: false
114-
matrix:
115-
include:
116-
- target: distribution
117-
name: Package debs (x64)
118-
arch: x64
119-
- target: distribution
120-
name: Package debs (arm64)
121-
arch: arm64
122-
cache-build-image-key-suffix: -arm64
123-
runs-on: ${{ vars.ENVOY_ARM_VM || 'ubuntu-24.04-arm' }}
63+
upload-name: release.${{ inputs.arch }}
64+
upload-path: envoy/${{ inputs.arch }}/bin/
12465

12566
docker:
12667
permissions:
12768
contents: read
12869
packages: read
129-
secrets:
130-
dockerhub-password: ${{ secrets.dockerhub-password }}
131-
name: ${{ matrix.name || matrix.target }}
70+
name: Docker OCI
13271
needs:
13372
- binary
13473
uses: ./.github/workflows/_run.yml
13574
with:
136-
target: ${{ matrix.target }}
75+
arch: ${{ inputs.arch }}
76+
target: docker
77+
target-suffix: ${{ inputs.arch }}
13778
cache-build-image: ${{ fromJSON(inputs.request).request.build-image.default }}
79+
cache-build-image-key-suffix: ${{ inputs.arch == 'arm64' && '-arm64' || '' }}
80+
concurrency-suffix: -${{ inputs.arch }}
13881
downloads: |
139-
release.arm64: envoy/arm64/bin/
140-
release.x64: envoy/x64/bin/
82+
release.${{ inputs.arch }}: envoy/${{ inputs.arch }}/bin/
14183
request: ${{ inputs.request }}
14284
source: |
14385
export NO_BUILD_SETUP=1
14486
export ENVOY_DOCKER_IN_DOCKER=1
87+
export ENVOY_DOCKER_SAVE_IMAGE=true
88+
export ENVOY_OCI_DIR=build_images
89+
90+
# export DOCKER_BUILD_PLATFORM=${{ inputs.arch == 'x64' && 'linux/amd64' || 'linux/arm64' }}
91+
# export DOCKER_LOAD_IMAGES=true
92+
# export DOCKER_FORCE_OCI_OUTPUT=true
14593
trusted: ${{ inputs.trusted }}
146-
upload-name: docker
147-
upload-path: build_images
148-
strategy:
149-
fail-fast: false
150-
matrix:
151-
include:
152-
- target: docker
153-
name: Docker (Linux multiarch)
94+
upload-name: oci.${{ inputs.arch }}
95+
upload-path: envoy/${{ inputs.arch }}/build_images
96+
runs-on: ${{ inputs.arch == 'arm64' && (vars.ENVOY_ARM_VM || 'ubuntu-24.04-arm') || null }}
15497

155-
sign:
98+
distribution:
15699
permissions:
157100
contents: read
158101
packages: read
159102
secrets:
160103
gcs-cache-key: ${{ secrets.gcs-cache-key }}
161104
gpg-key: ${{ secrets.gpg-key }}
162105
gpg-key-password: ${{ secrets.gpg-key-password }}
163-
name: ${{ matrix.name || matrix.target }}
106+
name: Packages
164107
needs:
165-
- distribution
108+
- binary
166109
uses: ./.github/workflows/_run.yml
167110
with:
168-
target: release.signed
111+
arch: ${{ inputs.arch }}
169112
bazel-extra: >-
170-
--//distribution:x64-packages=//distribution:custom/x64/packages.x64.tar.gz
171-
--//distribution:arm64-packages=//distribution:custom/arm64/packages.arm64.tar.gz
172-
--//distribution:x64-release=//distribution:custom/x64/bin/release.tar.zst
173-
--//distribution:arm64-release=//distribution:custom/arm64/bin/release.tar.zst
174-
cache-build-image: ${{ fromJSON(inputs.request).request.build-image.default }}
175-
diskspace-hack: true
113+
--config=remote-cache-envoy-engflow
176114
downloads: |
177-
packages.arm64: envoy/arm64/
178-
packages.x64: envoy/x64/
179-
release.arm64: envoy/arm64/bin/
180-
release.x64: envoy/x64/bin/
115+
release.${{ inputs.arch }}: release/${{ inputs.arch }}/bin/
116+
target: distribution
117+
target-suffix: ${{ inputs.arch }}
118+
cache-build-image: ${{ fromJSON(inputs.request).request.build-image.default }}
119+
cache-build-image-key-suffix: ${{ inputs.arch == 'arm64' && '-arm64' || '' }}
120+
concurrency-suffix: -${{ inputs.arch }}
181121
gcs-cache-bucket: ${{ inputs.gcs-cache-bucket }}
182122
import-gpg: true
123+
rbe: false
183124
request: ${{ inputs.request }}
184-
source: |
185-
export NO_BUILD_SETUP=1
125+
runs-on: ${{ inputs.arch == 'arm64' && (vars.ENVOY_ARM_VM || 'ubuntu-24.04-arm') || null }}
186126
trusted: ${{ inputs.trusted }}
187-
upload-name: release.signed
188-
upload-path: envoy/release.signed.tar.zst
189-
steps-pre: |
190-
- run: |
191-
mkdir distribution/custom
192-
cp -a %{{ runner.temp }}/envoy/x64 %{{ runner.temp }}/envoy/arm64 distribution/custom
193-
shell: bash
127+
upload-name: packages.${{ inputs.arch }}
128+
upload-path: envoy/${{ inputs.arch }}

.github/workflows/_publish_publish.yml renamed to .github/workflows/_publish_release.yml

Lines changed: 70 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,18 @@ permissions:
66
on:
77
workflow_call:
88
secrets:
9+
dockerhub-password:
10+
dockerhub-username:
911
ENVOY_CI_SYNC_APP_ID:
1012
ENVOY_CI_SYNC_APP_KEY:
1113
ENVOY_CI_PUBLISH_APP_ID:
1214
ENVOY_CI_PUBLISH_APP_KEY:
1315
gcs-cache-key:
1416
required: true
17+
gpg-key:
18+
required: true
19+
gpg-key-password:
20+
required: true
1521
inputs:
1622
gcs-cache-bucket:
1723
type: string
@@ -33,14 +39,75 @@ concurrency:
3339

3440

3541
jobs:
36-
publish:
42+
sign:
43+
permissions:
44+
contents: read
45+
packages: read
46+
secrets:
47+
gcs-cache-key: ${{ secrets.gcs-cache-key }}
48+
gpg-key: ${{ secrets.gpg-key }}
49+
gpg-key-password: ${{ secrets.gpg-key-password }}
50+
if: ${{ github.repository == 'envoyproxy/envoy-ci-staging' }}
51+
name: Sign packages
52+
uses: ./.github/workflows/_run.yml
53+
with:
54+
target: release.signed
55+
bazel-extra: >-
56+
--//distribution:x64-packages=//distribution:custom/x64/packages.x64.tar.gz
57+
--//distribution:arm64-packages=//distribution:custom/arm64/packages.arm64.tar.gz
58+
--//distribution:x64-release=//distribution:custom/x64/bin/release.tar.zst
59+
--//distribution:arm64-release=//distribution:custom/arm64/bin/release.tar.zst
60+
cache-build-image: ${{ fromJSON(inputs.request).request.build-image.default }}
61+
diskspace-hack: true
62+
downloads: |
63+
packages.arm64: envoy/arm64/
64+
packages.x64: envoy/x64/
65+
release.arm64: envoy/arm64/bin/
66+
release.x64: envoy/x64/bin/
67+
gcs-cache-bucket: ${{ inputs.gcs-cache-bucket }}
68+
import-gpg: true
69+
request: ${{ inputs.request }}
70+
source: |
71+
export NO_BUILD_SETUP=1
72+
trusted: ${{ inputs.trusted }}
73+
upload-name: release.signed
74+
upload-path: envoy/release.signed.tar.zst
75+
steps-pre: |
76+
- run: |
77+
mkdir distribution/custom
78+
cp -a %{{ runner.temp }}/envoy/x64 %{{ runner.temp }}/envoy/arm64 distribution/custom
79+
shell: bash
80+
81+
container:
82+
secrets:
83+
dockerhub-username: ${{ secrets.dockerhub-username }}
84+
dockerhub-password: ${{ secrets.dockerhub-password }}
85+
permissions:
86+
contents: read
87+
packages: read
88+
name: Publish container images
89+
uses: ./.github/workflows/_publish_release_container.yml
90+
with:
91+
dockerhub-repo: ${{ vars.DOCKERHUB_REPO || 'envoy' }}
92+
dev: ${{ fromJSON(inputs.request).request.version.dev }}
93+
sha: ${{ fromJSON(inputs.request).request.sha }}
94+
target-branch: ${{ fromJSON(inputs.request).request.target-branch }}
95+
trusted: ${{ inputs.trusted }}
96+
version-major: ${{ fromJSON(inputs.request).request.version.major }}
97+
version-minor: ${{ fromJSON(inputs.request).request.version.minor }}
98+
version-patch: ${{ fromJSON(inputs.request).request.version.patch }}
99+
100+
release:
37101
secrets:
38102
app-id: ${{ inputs.trusted && secrets.ENVOY_CI_PUBLISH_APP_ID || '' }}
39103
app-key: ${{ inputs.trusted && secrets.ENVOY_CI_PUBLISH_APP_KEY || '' }}
40104
gcs-cache-key: ${{ secrets.gcs-cache-key }}
41105
permissions:
42106
contents: read
43107
packages: read
108+
needs:
109+
- container
110+
- sign
44111
name: ${{ matrix.name || matrix.target }}
45112
uses: ./.github/workflows/_run.yml
46113
with:
@@ -65,7 +132,7 @@ jobs:
65132
export ENVOY_REPO=${{ github.repository }}
66133
export ENVOY_PUBLISH_DRY_RUN=${{ (fromJSON(inputs.request).request.version.dev || ! inputs.trusted) && 1 || '' }}
67134
68-
publish_docs:
135+
docs:
69136
# For normal commits to Envoy main this will trigger an update in the website repo,
70137
# which will update its envoy dep shas, and rebuild the website for the latest docs
71138
#
@@ -76,7 +143,7 @@ jobs:
76143
if: ${{ inputs.trusted && github.repository == 'envoyproxy/envoy' }}
77144
runs-on: ${{ fromJSON(inputs.request).config.ci.agent-ubuntu }}
78145
needs:
79-
- publish
146+
- release
80147
steps:
81148
- uses: envoyproxy/toolshed/gh-actions/[email protected]
82149
id: appauth

0 commit comments

Comments
 (0)