Skip to content

Commit 973ebe3

Browse files
authored
feat: Add ARM64 image support (#1195)
2 parents 5158d08 + 852a480 commit 973ebe3

File tree

6 files changed

+92
-25
lines changed

6 files changed

+92
-25
lines changed

.github/workflows/build-publish-mcr.yml

Lines changed: 46 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ jobs:
5454
# NOTE: As exporting a variable from a secret is not possible, the shared variable registry obtained
5555
# from AZURE_REGISTRY secret is not exported from here.
5656
57-
publish-images:
57+
publish-images-amd64:
5858
runs-on:
5959
labels: [self-hosted, "1ES.Pool=1es-aks-fleet-pool-ubuntu"]
6060
needs: prepare-variables
@@ -70,25 +70,25 @@ jobs:
7070
run: |
7171
make docker-build-hub-agent
7272
env:
73-
HUB_AGENT_IMAGE_VERSION: ${{ needs.prepare-variables.outputs.release_tag }}
73+
HUB_AGENT_IMAGE_VERSION: ${{ needs.prepare-variables.outputs.release_tag }}-amd64
7474
REGISTRY: ${{ secrets.AZURE_REGISTRY }}/${{ env.REGISTRY_REPO}}
7575
- name: Build and publish member-agent
7676
run: |
7777
make docker-build-member-agent
7878
env:
79-
MEMBER_AGENT_IMAGE_VERSION: ${{ needs.prepare-variables.outputs.release_tag }}
79+
MEMBER_AGENT_IMAGE_VERSION: ${{ needs.prepare-variables.outputs.release_tag }}-amd64
8080
REGISTRY: ${{ secrets.AZURE_REGISTRY }}/${{ env.REGISTRY_REPO}}
8181
- name: Build and publish refresh-token
8282
run: |
8383
make docker-build-refresh-token
8484
env:
85-
REFRESH_TOKEN_IMAGE_VERSION: ${{ needs.prepare-variables.outputs.release_tag }}
85+
REFRESH_TOKEN_IMAGE_VERSION: ${{ needs.prepare-variables.outputs.release_tag }}-amd64
8686
REGISTRY: ${{ secrets.AZURE_REGISTRY }}/${{ env.REGISTRY_REPO}}
8787
- name: Build and publish crd-installer
8888
run: |
8989
make docker-build-crd-installer
9090
env:
91-
CRD_INSTALLER_IMAGE_VERSION: ${{ needs.prepare-variables.outputs.release_tag }}
91+
CRD_INSTALLER_IMAGE_VERSION: ${{ needs.prepare-variables.outputs.release_tag }}-amd64
9292
REGISTRY: ${{ secrets.AZURE_REGISTRY }}/${{ env.REGISTRY_REPO}}
9393
# Build Arc Extension for member clusters
9494
# Arc-connected clusters can join fleets as member clusters through an Arc Extension.
@@ -106,3 +106,44 @@ jobs:
106106
MCS_CONTROLLER_IMAGE_VERSION: ${{ needs.prepare-variables.outputs.fleet_networking_version }}
107107
MEMBER_NET_CONTROLLER_IMAGE_VERSION: ${{ needs.prepare-variables.outputs.fleet_networking_version }}
108108
REGISTRY: ${{ secrets.AZURE_REGISTRY }}/${{ env.ARC_REGISTRY_REPO}}
109+
110+
publish-images-arm64:
111+
runs-on:
112+
labels: [self-hosted, "1ES.Pool=1es-aks-fleet-pool-ubuntu-arm64"]
113+
needs: prepare-variables
114+
steps:
115+
- uses: actions/checkout@v4
116+
with:
117+
ref: ${{ needs.prepare-variables.outputs.release_tag }}
118+
- name: 'Login the ACR'
119+
run: |
120+
az login --identity
121+
az acr login -n ${{ secrets.AZURE_REGISTRY }}
122+
- name: Build and publish hub-agent
123+
run: |
124+
make docker-build-hub-agent
125+
env:
126+
HUB_AGENT_IMAGE_VERSION: ${{ needs.prepare-variables.outputs.release_tag }}-arm64
127+
REGISTRY: ${{ secrets.AZURE_REGISTRY }}/${{ env.REGISTRY_REPO}}
128+
TARGET_ARCH: arm64
129+
- name: Build and publish member-agent
130+
run: |
131+
make docker-build-member-agent
132+
env:
133+
MEMBER_AGENT_IMAGE_VERSION: ${{ needs.prepare-variables.outputs.release_tag }}-arm64
134+
REGISTRY: ${{ secrets.AZURE_REGISTRY }}/${{ env.REGISTRY_REPO}}
135+
TARGET_ARCH: linux/arm64
136+
- name: Build and publish refresh-token
137+
run: |
138+
make docker-build-refresh-token
139+
env:
140+
REFRESH_TOKEN_IMAGE_VERSION: ${{ needs.prepare-variables.outputs.release_tag }}-arm64
141+
REGISTRY: ${{ secrets.AZURE_REGISTRY }}/${{ env.REGISTRY_REPO}}
142+
TARGET_ARCH: arm64
143+
- name: Build and publish crd-installer
144+
run: |
145+
make docker-build-crd-installer
146+
env:
147+
CRD_INSTALLER_IMAGE_VERSION: ${{ needs.prepare-variables.outputs.release_tag }}-arm64
148+
REGISTRY: ${{ secrets.AZURE_REGISTRY }}/${{ env.REGISTRY_REPO}}
149+
TARGET_ARCH: arm64

Makefile

Lines changed: 26 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,12 @@ REFRESH_TOKEN_IMAGE_NAME ?= refresh-token
1414
CRD_INSTALLER_IMAGE_NAME ?= crd-installer
1515
ARC_MEMBER_AGENT_HELMCHART_NAME = arc-member-cluster-agents-helm-chart
1616

17+
TARGET_OS ?= linux
18+
TARGET_ARCH ?= amd64
19+
# Note (chenyu1): switch to the `plain` progress type to see the full outputs in the docker build
20+
# progress.
21+
BUILDKIT_PROGRESS_TYPE ?= auto
22+
1723
KUBECONFIG ?= $(HOME)/.kube/config
1824
HUB_SERVER_URL ?= https://172.19.0.2:6443
1925

@@ -307,36 +313,48 @@ docker-build-hub-agent: docker-buildx-builder
307313
docker buildx build \
308314
--file docker/$(HUB_AGENT_IMAGE_NAME).Dockerfile \
309315
--output=$(OUTPUT_TYPE) \
310-
--platform="linux/amd64" \
316+
--platform=$(TARGET_OS)/$(TARGET_ARCH) \
311317
--pull \
312-
--tag $(REGISTRY)/$(HUB_AGENT_IMAGE_NAME):$(HUB_AGENT_IMAGE_VERSION) .
318+
--tag $(REGISTRY)/$(HUB_AGENT_IMAGE_NAME):$(HUB_AGENT_IMAGE_VERSION) \
319+
--progress=$(BUILDKIT_PROGRESS_TYPE) \
320+
--build-arg GOARCH=$(TARGET_ARCH) \
321+
--build-arg GOOS=$(TARGET_OS) .
313322

314323
.PHONY: docker-build-member-agent
315324
docker-build-member-agent: docker-buildx-builder
316325
docker buildx build \
317326
--file docker/$(MEMBER_AGENT_IMAGE_NAME).Dockerfile \
318327
--output=$(OUTPUT_TYPE) \
319-
--platform="linux/amd64" \
328+
--platform=$(TARGET_OS)/$(TARGET_ARCH) \
320329
--pull \
321-
--tag $(REGISTRY)/$(MEMBER_AGENT_IMAGE_NAME):$(MEMBER_AGENT_IMAGE_VERSION) .
330+
--tag $(REGISTRY)/$(MEMBER_AGENT_IMAGE_NAME):$(MEMBER_AGENT_IMAGE_VERSION) \
331+
--progress=$(BUILDKIT_PROGRESS_TYPE) \
332+
--build-arg GOARCH=$(TARGET_ARCH) \
333+
--build-arg GOOS=$(TARGET_OS) .
322334

323335
.PHONY: docker-build-refresh-token
324336
docker-build-refresh-token: docker-buildx-builder
325337
docker buildx build \
326338
--file docker/$(REFRESH_TOKEN_IMAGE_NAME).Dockerfile \
327339
--output=$(OUTPUT_TYPE) \
328-
--platform="linux/amd64" \
340+
--platform=$(TARGET_OS)/$(TARGET_ARCH) \
329341
--pull \
330-
--tag $(REGISTRY)/$(REFRESH_TOKEN_IMAGE_NAME):$(REFRESH_TOKEN_IMAGE_VERSION) .
342+
--tag $(REGISTRY)/$(REFRESH_TOKEN_IMAGE_NAME):$(REFRESH_TOKEN_IMAGE_VERSION) \
343+
--progress=$(BUILDKIT_PROGRESS_TYPE) \
344+
--build-arg GOARCH=$(TARGET_ARCH) \
345+
--build-arg GOOS=${TARGET_OS} .
331346

332347
.PHONY: docker-build-crd-installer
333348
docker-build-crd-installer: docker-buildx-builder
334349
docker buildx build \
335350
--file docker/crd-installer.Dockerfile \
336351
--output=$(OUTPUT_TYPE) \
337-
--platform="linux/amd64" \
352+
--platform=$(TARGET_OS)/$(TARGET_ARCH) \
338353
--pull \
339-
--tag $(REGISTRY)/$(CRD_INSTALLER_IMAGE_NAME):$(CRD_INSTALLER_IMAGE_VERSION) .
354+
--tag $(REGISTRY)/$(CRD_INSTALLER_IMAGE_NAME):$(CRD_INSTALLER_IMAGE_VERSION) \
355+
--progress=$(BUILDKIT_PROGRESS_TYPE) \
356+
--build-arg GOARCH=$(TARGET_ARCH) \
357+
--build-arg GOOS=${TARGET_OS} .
340358

341359
# Fleet Agents and Networking Agents are packaged and pushed to MCR for Arc Extension.
342360
.PHONY: helm-package-arc-member-cluster-agents

docker/crd-installer.Dockerfile

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
# Build the crdinstaller binary
22
FROM mcr.microsoft.com/oss/go/microsoft/golang:1.24.6 AS builder
33

4+
ARG GOOS=linux
5+
ARG GOARCH=amd64
6+
47
WORKDIR /workspace
58
# Copy the Go Modules manifests
69
COPY go.mod go.mod
@@ -13,10 +16,9 @@ RUN go mod download
1316
COPY cmd/crdinstaller/ cmd/crdinstaller/
1417
COPY pkg pkg
1518

16-
ARG TARGETARCH
17-
1819
# Build with CGO enabled and GOEXPERIMENT=systemcrypto for internal usage
19-
RUN CGO_ENABLED=1 GOOS=linux GOARCH=${TARGETARCH} GOEXPERIMENT=systemcrypto GO111MODULE=on go build -o crdinstaller cmd/crdinstaller/main.go
20+
RUN echo "Building for GOOS=$GOOS GOARCH=$GOARCH"
21+
RUN CGO_ENABLED=1 GOOS=$GOOS GOARCH=$GOARCH GOEXPERIMENT=systemcrypto GO111MODULE=on go build -o crdinstaller cmd/crdinstaller/main.go
2022

2123
# Use Azure Linux distroless base image to package the crdinstaller binary
2224
# Refer to https://mcr.microsoft.com/en-us/artifact/mar/azurelinux/distroless/base/about for more details

docker/hub-agent.Dockerfile

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
# Build the hubagent binary
22
FROM mcr.microsoft.com/oss/go/microsoft/golang:1.24.6 AS builder
33

4+
ARG GOOS=linux
5+
ARG GOARCH=amd64
6+
47
WORKDIR /workspace
58
# Copy the Go Modules manifests
69
COPY go.mod go.mod
@@ -14,10 +17,9 @@ COPY cmd/hubagent/ cmd/hubagent/
1417
COPY apis/ apis/
1518
COPY pkg/ pkg/
1619

17-
ARG TARGETARCH
18-
1920
# Build with CGO enabled and GOEXPERIMENT=systemcrypto for internal usage
20-
RUN CGO_ENABLED=1 GOOS=linux GOARCH=${TARGETARCH} GOEXPERIMENT=systemcrypto GO111MODULE=on go build -o hubagent cmd/hubagent/main.go
21+
RUN echo "Building for GOOS=$GOOS GOARCH=$GOARCH"
22+
RUN CGO_ENABLED=1 GOOS=$GOOS GOARCH=$GOARCH GOEXPERIMENT=systemcrypto GO111MODULE=on go build -o hubagent cmd/hubagent/main.go
2123

2224
# Use Azure Linux distroless base image to package the hubagent binary
2325
# Refer to https://mcr.microsoft.com/en-us/artifact/mar/azurelinux/distroless/base/about for more details

docker/member-agent.Dockerfile

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
# Build the memberagent binary
22
FROM mcr.microsoft.com/oss/go/microsoft/golang:1.24.6 AS builder
33

4+
ARG GOOS=linux
5+
ARG GOARCH=amd64
6+
47
WORKDIR /workspace
58
# Copy the Go Modules manifests
69
COPY go.mod go.mod
@@ -14,10 +17,9 @@ COPY cmd/memberagent/main.go main.go
1417
COPY apis/ apis/
1518
COPY pkg/ pkg/
1619

17-
ARG TARGETARCH
18-
1920
# Build with CGO enabled and GOEXPERIMENT=systemcrypto for internal usage
20-
RUN CGO_ENABLED=1 GOOS=linux GOARCH=${TARGETARCH} GOEXPERIMENT=systemcrypto GO111MODULE=on go build -o memberagent main.go
21+
RUN echo "Building for GOOS=$GOOS GOARCH=$GOARCH"
22+
RUN CGO_ENABLED=1 GOOS=$GOOS GOARCH=$GOARCH GOEXPERIMENT=systemcrypto GO111MODULE=on go build -o memberagent main.go
2123

2224
# Use Azure Linux distroless base image to package the memberagent binary
2325
# Refer to https://mcr.microsoft.com/en-us/artifact/mar/azurelinux/distroless/base/about for more details

docker/refresh-token.Dockerfile

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
# Build the refreshtoken binary
22
FROM mcr.microsoft.com/oss/go/microsoft/golang:1.24.6 AS builder
33

4+
ARG GOOS="linux"
5+
ARG GOARCH="amd64"
6+
47
WORKDIR /workspace
58
# Copy the Go Modules manifests
69
COPY go.mod go.mod
@@ -13,10 +16,9 @@ RUN go mod download
1316
COPY cmd/authtoken/main.go main.go
1417
COPY pkg/authtoken pkg/authtoken
1518

16-
ARG TARGETARCH
17-
1819
# Build with CGO enabled and GOEXPERIMENT=systemcrypto for internal usage
19-
RUN CGO_ENABLED=1 GOOS=linux GOARCH=${TARGETARCH} GOEXPERIMENT=systemcrypto GO111MODULE=on go build -o refreshtoken main.go
20+
RUN echo "Building for GOOS=${GOOS} GOARCH=${GOARCH}"
21+
RUN CGO_ENABLED=1 GOOS=$GOOS GOARCH=$GOARCH GOEXPERIMENT=systemcrypto GO111MODULE=on go build -o refreshtoken main.go
2022

2123
# Use Azure Linux distroless base image to package the refreshtoken binary
2224
# Refer to https://mcr.microsoft.com/en-us/artifact/mar/azurelinux/distroless/base/about for more details

0 commit comments

Comments
 (0)