22
22
strategy :
23
23
matrix :
24
24
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"}
27
29
]
28
30
runs-on : ubuntu-latest
29
31
name : Build and push Docker image
45
47
46
48
- uses : actions/checkout@v3
47
49
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
48
54
49
55
- name : Login to DockerHub
50
56
if : ${{ success() }}
66
72
run : |
67
73
python3 -m pip install semver
68
74
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")
70
76
if [[ $? -ne 0 ]] ; then
71
77
echo "Failed to fetch existing tags"
72
78
exit 1
@@ -82,24 +88,25 @@ jobs:
82
88
echo "Comparing existing tag: $tag with new: ${{steps.set_tag.outputs.TAG_NAME}}"
83
89
if [[ $(pysemver compare $tag ${{steps.set_tag.outputs.TAG_NAME}}) -ge 0 ]] ; then
84
90
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"
86
92
exit 0
87
93
fi
88
94
done
89
95
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"
91
97
92
98
- name : Download agent artifacts
93
99
run : |
94
100
aws s3 cp s3://${{ secrets.RELEASE_ARTIFACTS_BUCKET }}/artifacts/${{ inputs.release_tag }}/${{ matrix.agents.file }} ./lightrun-init-agent/
95
101
96
102
97
- - name : Build and push ${{ matrix.agents.platform }} container
103
+ - name : Build and push ${{ matrix.agents.name }} container
98
104
uses : docker/build-push-action@v4
99
105
with :
100
106
context : .
101
107
file : ./lightrun-init-agent/Dockerfile
102
108
push : true
109
+ platforms : ${{ matrix.agents.platform }}
103
110
tags : ${{steps.set_docker_tags.outputs.DOCKER_TAGS}}
104
111
build-args : |
105
112
FILE=${{ matrix.agents.file }}
@@ -111,6 +118,6 @@ jobs:
111
118
env :
112
119
SLACK_CHANNEL : devops-alerts
113
120
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 }}"
115
122
SLACK_TITLE : Init contianer build status - ${{ job.status }}
116
123
SLACK_WEBHOOK : ${{ secrets.SLACK_WEBHOOK }}
0 commit comments