Skip to content

Commit 96ed294

Browse files
committed
feat: add multi-architecture support for rollouts-demo images
1 parent f528fdd commit 96ed294

2 files changed

Lines changed: 98 additions & 0 deletions

File tree

.github/workflows/ci-cd.yaml

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
name: Build and Push Multi-Arch Rollouts Demo Images
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
branches: [ main ]
8+
workflow_dispatch:
9+
10+
env:
11+
IMAGE_NAME: rollouts-demo-ambrosia
12+
REGISTRY_USER: ambrosiaaaaa
13+
REGISTRY: docker.io
14+
15+
jobs:
16+
build-and-push:
17+
runs-on: ubuntu-latest
18+
permissions:
19+
contents: read
20+
packages: write
21+
22+
steps:
23+
- name: Checkout repository
24+
uses: actions/checkout@v4
25+
26+
- name: Set up QEMU
27+
uses: docker/setup-qemu-action@v3
28+
29+
- name: Set up Docker Buildx
30+
uses: docker/setup-buildx-action@v3
31+
32+
- name: Login to Docker Hub
33+
if: github.event_name != 'pull_request'
34+
uses: docker/login-action@v3
35+
with:
36+
username: ${{ env.REGISTRY_USER }}
37+
password: ${{ secrets.DOCKERHUB_TOKEN }}
38+
39+
- name: Make build script executable
40+
run: chmod +x build-multiarch.sh
41+
42+
- name: Build and push images
43+
run: |
44+
SHOULD_PUSH=${{ github.event_name != 'pull_request' && 'true' || 'false' }}
45+
IMAGE_PATH="${{ env.REGISTRY_USER }}/${{ env.IMAGE_NAME }}"
46+
./build-multiarch.sh ${{ env.REGISTRY }} $IMAGE_PATH $SHOULD_PUSH
47+
48+
- name: Check images (PR only)
49+
if: github.event_name == 'pull_request'
50+
run: |
51+
for TAG in blue green purple yellow; do
52+
docker buildx imagetools inspect ${{ env.REGISTRY }}/${{ env.REGISTRY_USER }}/${{ env.IMAGE_NAME }}:$TAG
53+
done

build-multiarch.sh

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
#!/bin/bash
2+
3+
REGISTRY=$1
4+
IMAGE_NAME=$2
5+
PUSH=$3 # true/false
6+
REGISTRY_USER=$4
7+
8+
# Debug
9+
echo "Debug info:"
10+
echo "REGISTRY: ${REGISTRY}"
11+
echo "IMAGE_NAME: ${IMAGE_NAME}"
12+
echo "PUSH: ${PUSH}"
13+
14+
TAGS=("slow-purple" "bad-purple" "purple" "slow-blue" "bad-blue" "blue" "slow-green" "bad-green" "green" "slow-yellow")
15+
16+
for TAG in "${TAGS[@]}"; do
17+
# Extract color and params
18+
if [[ $TAG == slow-* ]]; then
19+
COLOR=${TAG#slow-}
20+
LATENCY="5000"
21+
ERROR_RATE="0"
22+
elif [[ $TAG == bad-* ]]; then
23+
COLOR=${TAG#bad-}
24+
LATENCY="0"
25+
ERROR_RATE="50"
26+
else
27+
COLOR=$TAG
28+
LATENCY="0"
29+
ERROR_RATE="0"
30+
fi
31+
32+
# Debug
33+
FULL_TAG="${REGISTRY}/${IMAGE_NAME}:${TAG}"
34+
echo "Building tag: ${FULL_TAG}"
35+
36+
# Build and push
37+
docker buildx build \
38+
--platform linux/amd64,linux/arm64 \
39+
--build-arg COLOR=$COLOR \
40+
--build-arg LATENCY=$LATENCY \
41+
--build-arg ERROR_RATE=$ERROR_RATE \
42+
-t ${FULL_TAG} \
43+
${PUSH:+"--push"} \
44+
.
45+
done

0 commit comments

Comments
 (0)