Skip to content

Commit 8a82f56

Browse files
committed
feat(ci): support multi-architecture builds and manifest creation
- Updates CI pipeline to support multi-platform builds for both amd64 and arm64 architectures. - Introduces a new job to create and push a multi-architecture Docker manifest. - Replaces hardcoded platform settings with dynamic matrix strategy. - Adds scripts for installing AzCopy and Azure CLI with improved architecture detection and package management. - Removes deprecated installation method for AzCopy and Azure CLI.
1 parent ab509ba commit 8a82f56

File tree

4 files changed

+109
-20
lines changed

4 files changed

+109
-20
lines changed

.claude/settings.local.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@
99
"Bash(docker image inspect:*)",
1010
"Bash(docker inspect:*)",
1111
"WebFetch(domain:github.com)",
12-
"Bash(mv:*)"
12+
"Bash(mv:*)",
13+
"WebFetch(domain:learn.microsoft.com)"
1314
],
1415
"deny": []
1516
}

.github/workflows/pipeline.yaml

Lines changed: 45 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ concurrency:
2626
env:
2727
container_image: "github-actions-runner"
2828
container_image_build_context: "src"
29-
container_image_build_platforms: "linux/amd64,linux/arm64"
3029
container_image_build_dockerfile: "src/Dockerfile"
3130
container_image_repository_dockerhub: "emberstack"
3231
container_image_repository_ghcr: "ghcr.io/emberstack"
@@ -116,7 +115,14 @@ jobs:
116115
name: build
117116
if: ${{ needs.discovery.outputs.build == 'true' }}
118117
needs: [discovery]
119-
runs-on: ubuntu-latest
118+
strategy:
119+
matrix:
120+
include:
121+
- runner: ubuntu-latest
122+
platform: linux/amd64
123+
- runner: ubuntu-24.04-arm
124+
platform: linux/arm64
125+
runs-on: ${{ matrix.runner }}
120126
env:
121127
build: ${{ needs.discovery.outputs.build }}
122128
build_push: ${{ needs.discovery.outputs.build_push }}
@@ -143,14 +149,8 @@ jobs:
143149
username: ${{ secrets.ES_DOCKERHUB_USERNAME }}
144150
password: ${{ secrets.ES_DOCKERHUB_PAT }}
145151

146-
- name: tools - docker - register QEMU
147-
run: |
148-
docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
149-
150152
- name: tools - docker - setup buildx
151153
uses: docker/setup-buildx-action@v3
152-
with:
153-
driver: docker-container # REQUIRED for multi-platform builds
154154

155155
- name: docker - build and push
156156
uses: docker/build-push-action@v6
@@ -161,21 +161,54 @@ jobs:
161161
BUILD_CONFIGURATION=${{ env.build_configuration }}
162162
push: ${{ env.build_push == 'true' }}
163163
provenance: false
164-
platforms: ${{ env.container_image_build_platforms }}
164+
platforms: ${{ matrix.platform }}
165165
labels: |
166166
org.opencontainers.image.source=https://github.com/${{ github.repository }}
167167
org.opencontainers.image.url=https://github.com/${{ github.repository }}
168168
org.opencontainers.image.vendor=https://github.com/${{ github.repository_owner }}
169169
org.opencontainers.image.version=${{ env.gitVersion_SemVer }}
170170
org.opencontainers.image.revision=${{ github.sha }}
171171
tags: |
172-
${{ env.container_image_repository_dockerhub }}/${{ env.container_image }}:${{ env.gitVersion_SemVer }}
173-
${{ env.container_image_repository_ghcr }}/${{ env.container_image }}:${{ env.gitVersion_SemVer }}
172+
${{ env.container_image_repository_dockerhub }}/${{ env.container_image }}:${{ env.gitVersion_SemVer }}-${{ matrix.platform == 'linux/amd64' && 'amd64' || 'arm64' }}
173+
${{ env.container_image_repository_ghcr }}/${{ env.container_image }}:${{ env.gitVersion_SemVer }}-${{ matrix.platform == 'linux/amd64' && 'amd64' || 'arm64' }}
174+
175+
manifest:
176+
name: create multi-arch manifest
177+
if: ${{ needs.discovery.outputs.build_push == 'true' }}
178+
needs: [discovery, build]
179+
runs-on: ubuntu-latest
180+
env:
181+
gitVersion_SemVer: ${{ needs.discovery.outputs.gitVersion_SemVer }}
182+
steps:
183+
- name: tools - docker - login ghcr.io
184+
uses: docker/login-action@v3
185+
with:
186+
registry: ghcr.io
187+
username: ${{ github.actor }}
188+
password: ${{ secrets.ES_GITHUB_PAT }}
189+
190+
- name: tools - docker - login docker.io
191+
uses: docker/login-action@v3
192+
with:
193+
registry: docker.io
194+
username: ${{ secrets.ES_DOCKERHUB_USERNAME }}
195+
password: ${{ secrets.ES_DOCKERHUB_PAT }}
196+
197+
- name: tools - docker - setup buildx
198+
uses: docker/setup-buildx-action@v3
199+
200+
- name: docker - create and push multi-arch manifest
201+
run: |
202+
docker buildx imagetools create \
203+
--tag ${{ env.container_image_repository_dockerhub }}/${{ env.container_image }}:${{ env.gitVersion_SemVer }} \
204+
--tag ${{ env.container_image_repository_ghcr }}/${{ env.container_image }}:${{ env.gitVersion_SemVer }} \
205+
${{ env.container_image_repository_ghcr }}/${{ env.container_image }}:${{ env.gitVersion_SemVer }}-amd64 \
206+
${{ env.container_image_repository_ghcr }}/${{ env.container_image }}:${{ env.gitVersion_SemVer }}-arm64
174207
175208
release:
176209
name: release
177210
if: ${{ needs.discovery.outputs.release == 'true' && github.ref == 'refs/heads/main' }}
178-
needs: [discovery, build]
211+
needs: [discovery, manifest]
179212
runs-on: ubuntu-latest
180213
env:
181214
gitVersion_SemVer: ${{ needs.discovery.outputs.gitVersion_SemVer }}
@@ -203,8 +236,6 @@ jobs:
203236
docker buildx imagetools create \
204237
--tag ${{ env.container_image_repository_dockerhub }}/${{ env.container_image }}:latest \
205238
--tag ${{ env.container_image_repository_ghcr }}/${{ env.container_image }}:latest \
206-
--tag ${{ env.container_image_repository_dockerhub }}/${{ env.container_image }}:${{ env.gitVersion_SemVer }} \
207-
--tag ${{ env.container_image_repository_ghcr }}/${{ env.container_image }}:${{ env.gitVersion_SemVer }} \
208239
${{ env.container_image_repository_ghcr }}/${{ env.container_image }}:${{ env.gitVersion_SemVer }}
209240
210241
- name: github - release - create

src/scripts/install-azcopy.sh

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,36 @@
11
#!/bin/bash
22

3-
wget -O azcopy.tar.gz https://aka.ms/downloadazcopy-v10-linux
4-
tar zxvf azcopy.tar.gz --strip-components=1 -C /usr/local/bin
3+
# Detect architecture and set download URL
4+
ARCH=$(uname -m)
5+
if [ "$ARCH" = "x86_64" ]; then
6+
AZCOPY_ARCH="amd64"
7+
elif [ "$ARCH" = "aarch64" ]; then
8+
AZCOPY_ARCH="arm64"
9+
else
10+
echo "Unsupported architecture: $ARCH"
11+
exit 1
12+
fi
13+
14+
# Get the latest release info from GitHub API
15+
echo "Fetching latest AzCopy release info..."
16+
RELEASE_INFO=$(curl -s https://api.github.com/repos/Azure/azure-storage-azcopy/releases/latest)
17+
DOWNLOAD_URL=$(echo "$RELEASE_INFO" | grep -o "https://[^\"]*azcopy_linux_${AZCOPY_ARCH}_[^\"]*\.tar\.gz" | head -1)
18+
19+
if [ -z "$DOWNLOAD_URL" ]; then
20+
echo "Failed to find download URL for architecture: $AZCOPY_ARCH"
21+
exit 1
22+
fi
23+
24+
echo "Downloading AzCopy from: $DOWNLOAD_URL"
25+
wget -O azcopy.tar.gz "$DOWNLOAD_URL"
26+
27+
# Extract directly to /usr/local/bin
28+
tar zxf azcopy.tar.gz --strip-components=1 -C /usr/local/bin --wildcards "*/azcopy"
29+
chmod +x /usr/local/bin/azcopy
530
ln -sf /usr/local/bin/azcopy /usr/local/bin/azcopy10
631

32+
# Cleanup
33+
rm -f azcopy.tar.gz
34+
735
azcopy10 --version
836
azcopy --version

src/scripts/install-azure-cli.sh

Lines changed: 32 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,35 @@
11
#!/bin/bash
22

3-
curl -fsSL https://aka.ms/InstallAzureCLIDeb | bash
3+
# Install Azure CLI following official documentation
4+
# https://learn.microsoft.com/en-us/cli/azure/install-azure-cli-linux
45

5-
rm -f /etc/apt/sources.list.d/azure-cli.list
6-
rm -f /etc/apt/sources.list.d/azure-cli.list.save
6+
# Update packages and install required dependencies
7+
apt-get update
8+
apt-get install -y --no-install-recommends \
9+
apt-transport-https \
10+
ca-certificates \
11+
curl \
12+
gnupg \
13+
lsb-release
14+
15+
# Download and install Microsoft signing key
16+
mkdir -p /etc/apt/keyrings
17+
curl -sLS https://packages.microsoft.com/keys/microsoft.asc | \
18+
gpg --dearmor | tee /etc/apt/keyrings/microsoft.gpg > /dev/null
19+
chmod go+r /etc/apt/keyrings/microsoft.gpg
20+
21+
# Add Azure CLI repository using the new DEB822 format
22+
AZ_DIST=$(lsb_release -cs)
23+
echo "Types: deb
24+
URIs: https://packages.microsoft.com/repos/azure-cli/
25+
Suites: ${AZ_DIST}
26+
Components: main
27+
Architectures: $(dpkg --print-architecture)
28+
Signed-by: /etc/apt/keyrings/microsoft.gpg" | tee /etc/apt/sources.list.d/azure-cli.sources
29+
30+
# Install Azure CLI
31+
apt-get update
32+
apt-get install -y azure-cli
33+
34+
# Verify installation
35+
az --version

0 commit comments

Comments
 (0)