forked from fluent/fluentd-docker-image
-
Notifications
You must be signed in to change notification settings - Fork 0
/
post_push.erb
30 lines (28 loc) · 1.07 KB
/
post_push.erb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#!/bin/bash
# AUTOMATICALLY GENERATED
# DO NOT EDIT THIS FILE DIRECTLY, USE /post_push.erb
set -e
# Parse image name for repo name
tagStart=$(expr index "$IMAGE_NAME" :)
repoName=${IMAGE_NAME:0:tagStart-1}
<% if image_tags.include?("debian-arm64") || image_tags.include?("debian-amd64") %>
# Download manifest tool
curl -Lo manifest-tool https://github.com/estesp/manifest-tool/releases/download/v1.0.3/manifest-tool-linux-amd64
chmod +x manifest-tool
<% end %>
# Tag and push image for each additional tag
for tag in {<%= image_tags %>}; do
docker tag $IMAGE_NAME ${repoName}:${tag}
docker push ${repoName}:${tag}
<% if image_tags.include?("debian-arm64") || image_tags.include?("debian-amd64") %>
archTag=${tag/amd64/ARCH}
archTag=${archTag/arm64/ARCH}
noArchTag=${tag/-amd64/}
noArchTag=${noArchTag/-arm64/}
# Note: this will fail until three of the amd64 and arm64 images have been pushed
./manifest-tool push from-args \
--platforms linux/amd64,linux/arm64 \
--template ${repoName}:${archTag} \
--target ${repoName}:${noArchTag} || true
<% end %>
done