-
Notifications
You must be signed in to change notification settings - Fork 34
/
populate.sh
executable file
·72 lines (63 loc) · 1.53 KB
/
populate.sh
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#!/usr/bin/env bash
set -e
CONFIG='
{
"stable": {
"version": "6.0.13",
"tags": "6.0"
},
"old": {
"version": "7.5.0",
"tags": "7.5"
},
"fresh": {
"version": "7.6.1",
"tags": "7 7.6 latest"
}
}'
update_library(){
version=`echo $CONFIG | jq -r ".[\"$1\"][\"version\"]"`
tags=`echo $CONFIG | jq -r ".[\"$1\"][\"tags\"]"`
tags="$1 $version $tags"
if [ "$2" != "debian" ]; then
tags=`echo "$tags" | sed -e "s/\( \|$\)/-$2\1/g" -e "s/latest-$2/$2/"`
fi
cat >> library.varnish <<- EOF
Tags: `echo $tags | sed 's/ \+/, /g'`
Architectures: amd64, arm32v7, arm64v8, i386, ppc64le, s390x
Directory: $1/$2
GitCommit: `git log -n1 --pretty=oneline $1/$2 | cut -f1 -d" "`
EOF
}
populate_library() {
cat > library.varnish <<- EOF
# this file was generated using https://github.com/varnish/docker-varnish/blob/`git rev-parse HEAD`/populate.sh
Maintainers: Guillaume Quintard <guillaume.quintard@gmail.com> (@gquintard)
GitRepo: https://github.com/varnish/docker-varnish.git
EOF
for i in `echo $CONFIG | jq -r 'keys | .[]'`; do
if [ "$i" = "next" ]; then
continue
fi
update_library $i debian
if [ "$i" != "stable" ]; then
update_library $i alpine
fi
done
}
case "$1" in
library)
populate_library
;;
check)
echo 'checking fresh/*/Dockerfile'
diff <(grep '^ARG' fresh/alpine/Dockerfile) <(grep '^ARG' fresh/debian/Dockerfile)
echo 'checking old/*/Dockerfile'
diff <(grep '^ARG' old/alpine/Dockerfile) <(grep '^ARG' old/debian/Dockerfile)
echo OK
;;
*)
echo invalid choice
exit 1
;;
esac