2222 strategy :
2323 matrix :
2424 agents : [
25- {file: "agent.zip", platform: "linux"},
26- {file: "agent-alpine.zip", platform: "alpine"}
25+ {name: "linux", file: "agent.zip", platform: "linux/amd64"},
26+ {name: "alpine", file: "agent-alpine.zip", platform: "linux/amd64"},
27+ {name: "linux-arm64", file: "agent-arm64.zip", platform: "linux/arm64"},
28+ {name: "alpine-arm64", file: "agent-alpine-arm64.zip", platform: "linux/arm64"}
2729 ]
2830 runs-on : ubuntu-latest
2931 name : Build and push Docker image
4547
4648 - uses : actions/checkout@v3
4749
50+ - name : Set up QEMU
51+ uses : docker/setup-qemu-action@v3
52+ - name : Set up Docker Buildx
53+ uses : docker/setup-buildx-action@v3
4854
4955 - name : Login to DockerHub
5056 if : ${{ success() }}
6672 run : |
6773 python3 -m pip install semver
6874 existing_tags=()
69- dockerhub_tags=$(curl -s "https://hub.docker.com/v2/namespaces/lightruncom/repositories/k8s-operator-init-java-agent-${{ matrix.agents.platform }}/tags?page_size=50" | jq -r ".results[].name")
75+ dockerhub_tags=$(curl -s "https://hub.docker.com/v2/namespaces/lightruncom/repositories/k8s-operator-init-java-agent-${{ matrix.agents.name }}/tags?page_size=50" | jq -r ".results[].name")
7076 if [[ $? -ne 0 ]] ; then
7177 echo "Failed to fetch existing tags"
7278 exit 1
@@ -82,24 +88,25 @@ jobs:
8288 echo "Comparing existing tag: $tag with new: ${{steps.set_tag.outputs.TAG_NAME}}"
8389 if [[ $(pysemver compare $tag ${{steps.set_tag.outputs.TAG_NAME}}) -ge 0 ]] ; then
8490 echo "Existing tag: $tag is greater or equal than new: ${{ inputs.release_tag }}. Skip adding latest tag"
85- echo "DOCKER_TAGS=lightruncom/k8s-operator-init-java-agent-${{ matrix.agents.platform }}:${{steps.set_tag.outputs.TAG_NAME}}" >> "$GITHUB_OUTPUT"
91+ echo "DOCKER_TAGS=lightruncom/k8s-operator-init-java-agent-${{ matrix.agents.name }}:${{steps.set_tag.outputs.TAG_NAME}}" >> "$GITHUB_OUTPUT"
8692 exit 0
8793 fi
8894 done
8995 echo "Adding latest tag to ${{steps.set_tag.outputs.TAG_NAME}}"
90- echo "DOCKER_TAGS=lightruncom/k8s-operator-init-java-agent-${{ matrix.agents.platform }}:${{steps.set_tag.outputs.TAG_NAME}},lightruncom/k8s-operator-init-java-agent-${{ matrix.agents.platform }}:latest" >> "$GITHUB_OUTPUT"
96+ echo "DOCKER_TAGS=lightruncom/k8s-operator-init-java-agent-${{ matrix.agents.name }}:${{steps.set_tag.outputs.TAG_NAME}},lightruncom/k8s-operator-init-java-agent-${{ matrix.agents.name }}:latest" >> "$GITHUB_OUTPUT"
9197
9298 - name : Download agent artifacts
9399 run : |
94100 aws s3 cp s3://${{ secrets.RELEASE_ARTIFACTS_BUCKET }}/artifacts/${{ inputs.release_tag }}/${{ matrix.agents.file }} ./lightrun-init-agent/
95101
96102
97- - name : Build and push ${{ matrix.agents.platform }} container
103+ - name : Build and push ${{ matrix.agents.name }} container
98104 uses : docker/build-push-action@v4
99105 with :
100106 context : .
101107 file : ./lightrun-init-agent/Dockerfile
102108 push : true
109+ platforms : ${{ matrix.agents.platform }}
103110 tags : ${{steps.set_docker_tags.outputs.DOCKER_TAGS}}
104111 build-args : |
105112 FILE=${{ matrix.agents.file }}
@@ -111,6 +118,6 @@ jobs:
111118 env :
112119 SLACK_CHANNEL : devops-alerts
113120 SLACK_COLOR : ${{ job.status }} # or a specific color like 'good' or '#ff00ff'
114- SLACK_MESSAGE : " Tag ${{ inputs.release_tag }} | Platform ${{ matrix.agents.platform }}"
121+ SLACK_MESSAGE : " Tag ${{ inputs.release_tag }} | Platform ${{ matrix.agents.name }}"
115122 SLACK_TITLE : Init contianer build status - ${{ job.status }}
116123 SLACK_WEBHOOK : ${{ secrets.SLACK_WEBHOOK }}
0 commit comments