Skip to content

Commit 20d7d53

Browse files
authored
build: Make CAREN mindthegap reg multiarch (#730)
This commit makes the CAREN mindthegap registry image a multiarch image by building both amd64 and arm64 variants and pushing a docker multiarch image manifest to the target registry.
1 parent 6365f5e commit 20d7d53

File tree

5 files changed

+60
-5
lines changed

5 files changed

+60
-5
lines changed

.github/workflows/checks.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,12 @@ jobs:
194194
echo "changed=true" >> "$GITHUB_OUTPUT"
195195
fi
196196
197+
- if: steps.list-changed.outputs.changed == 'true'
198+
uses: docker/setup-qemu-action@v3
199+
200+
- if: steps.list-changed.outputs.changed == 'true'
201+
uses: docker/setup-buildx-action@v3
202+
197203
- if: steps.list-changed.outputs.changed == 'true'
198204
name: Run chart-testing (lint)
199205
run: |

.github/workflows/e2e.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,10 @@ jobs:
5555
echo "After removing files:"
5656
df -h
5757
58+
- uses: docker/setup-qemu-action@v3
59+
60+
- uses: docker/setup-buildx-action@v3
61+
5862
- name: Run e2e tests
5963
run: devbox run -- make e2e-test E2E_LABEL='provider:${{ inputs.provider }}' E2E_SKIP='${{ inputs.skip }}' E2E_FOCUS='${{ inputs.focus }}'
6064
env:

.github/workflows/release-tag.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,10 @@ jobs:
2727
ref: ${{ github.ref }}
2828
fetch-depth: 0
2929

30+
- uses: docker/setup-qemu-action@v3
31+
32+
- uses: docker/setup-buildx-action@v3
33+
3034
- name: Install devbox
3135
uses: jetify-com/[email protected]
3236
with:

.goreleaser.yml

Lines changed: 44 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -96,13 +96,54 @@ archives:
9696
- cluster-api-runtime-extensions-nutanix
9797

9898
dockers:
99-
- id: helm-registry-container
99+
- image_templates:
100+
# Specify the image tag including `-amd64` suffix if the build is not a snapshot build or is not being built on
101+
# amd64 machine. This allows for using the snapshot image build without the architecture specific suffix
102+
# consistently on local machines, i.e. can always use `ghcr.io/nutanix-cloud-native/caren-helm-reg:v<VERSION>` on the machine the snapshot
103+
# is built on.
104+
#
105+
# For a release build the `-amd64` suffix will always be included and the `docker_manifests` specification below
106+
# will create the final multiplatform manifest to be pushed to the registry.
107+
- 'ghcr.io/nutanix-cloud-native/caren-helm-reg:v{{ trimprefix .Version "v" }}{{ if or (not .IsSnapshot) (not (eq .Runtime.Goarch "amd64")) }}-amd64{{ end }}'
100108
use: buildx
101109
dockerfile: ./hack/addons/mindthegap-helm-registry/Dockerfile
102110
extra_files:
103111
- hack/addons/mindthegap-helm-registry/repos.yaml
112+
build_flag_templates:
113+
- "--platform=linux/amd64"
114+
- "--pull"
115+
- "--label=org.opencontainers.image.created={{.CommitDate}}"
116+
- "--label=org.opencontainers.image.title=caren-helm-reg"
117+
- "--label=org.opencontainers.image.revision={{.FullCommit}}"
118+
- '--label=org.opencontainers.image.version=v{{ trimprefix .Version "v" }}'
119+
- "--label=org.opencontainers.image.source={{.GitURL}}"
120+
- image_templates:
121+
# Specify the image tag including `-arm64` suffix if the build is not a snapshot build or is not being built on
122+
# arm64 machine. This allows for using the snapshot image build without the architecture specific suffix
123+
# consistently on local machines, i.e. can always use `ghcr.io/nutanix-cloud-native/caren-helm-reg:v<VERSION>` on the machine the snapshot
124+
# is built on.
125+
#
126+
# For a release build the `-arm64` suffix will always be included and the `docker_manifests` specification below
127+
# will create the final multiplatform manifest to be pushed to the registry.
128+
- 'ghcr.io/nutanix-cloud-native/caren-helm-reg:v{{ trimprefix .Version "v" }}{{ if or (not .IsSnapshot) (not (eq .Runtime.Goarch "arm64")) }}-arm64{{ end }}'
129+
use: buildx
130+
dockerfile: ./hack/addons/mindthegap-helm-registry/Dockerfile
131+
extra_files:
132+
- hack/addons/mindthegap-helm-registry/repos.yaml
133+
build_flag_templates:
134+
- "--platform=linux/arm64"
135+
- "--pull"
136+
- "--label=org.opencontainers.image.created={{.CommitDate}}"
137+
- "--label=org.opencontainers.image.title=caren-helm-reg"
138+
- "--label=org.opencontainers.image.revision={{.FullCommit}}"
139+
- '--label=org.opencontainers.image.version=v{{ trimprefix .Version "v" }}'
140+
- "--label=org.opencontainers.image.source={{.GitURL}}"
141+
142+
docker_manifests:
143+
- name_template: ghcr.io/nutanix-cloud-native/caren-helm-reg:v{{ trimprefix .Version "v" }}
104144
image_templates:
105-
- 'ghcr.io/nutanix-cloud-native/caren-helm-reg:{{ .Version }}'
145+
- ghcr.io/nutanix-cloud-native/caren-helm-reg:v{{ trimprefix .Version "v" }}-amd64
146+
- ghcr.io/nutanix-cloud-native/caren-helm-reg:v{{ trimprefix .Version "v" }}-arm64
106147

107148
kos:
108149
- id: cluster-api-runtime-extensions-nutanix
@@ -121,7 +162,7 @@ kos:
121162
org.opencontainers.image.created: "{{ .CommitDate }}"
122163
org.opencontainers.image.title: "{{ .ProjectName }}"
123164
org.opencontainers.image.revision: "{{ .FullCommit }}"
124-
org.opencontainers.image.version: v{{ .Version }}
165+
org.opencontainers.image.version: v{{ trimprefix .Version "v" }}
125166
org.opencontainers.image.source: "{{ .GitURL }}"
126167
platforms:
127168
- linux/amd64
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
FROM ghcr.io/mesosphere/mindthegap:v1.13.4
1+
FROM ghcr.io/mesosphere/mindthegap:v1.14.3
22
# this gets called by goreleaser so the copy source has to be the path relative to the repo root.
3-
RUN --mount=source=./hack/addons/mindthegap-helm-registry/repos.yaml,target=/repos.yaml ["/ko-app/mindthegap", "create", "helm-bundle", "--helm-charts-file=/repos.yaml", "--output-file=/tmp/helm-charts.tar"]
3+
RUN --mount=source=./hack/addons/mindthegap-helm-registry/repos.yaml,target=/repos.yaml ["/ko-app/mindthegap", "create", "bundle", "--helm-charts-file=/repos.yaml", "--output-file=/tmp/helm-charts.tar"]
44
VOLUME /certs
55
CMD ["serve", "bundle", "--bundle=/tmp/helm-charts.tar", "--listen-port=5000", "--listen-address=0.0.0.0", "--tls-private-key-file=/certs/tls.key", "--tls-cert-file=/certs/tls.crt"]

0 commit comments

Comments
 (0)