forked from zabbix/zabbix-docker
-
Notifications
You must be signed in to change notification settings - Fork 0
/
generate-stackbrew-library.sh
executable file
·49 lines (38 loc) · 1.19 KB
/
generate-stackbrew-library.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
#!/usr/bin/env bash
set -eu
declare -a -r versions=( 3.0.28 4.0.11 4.2.5 )
self="${BASH_SOURCE##*/}"
# get the most recent commit which modified any of "$@"
fileCommit() {
git log -1 --format='format:%H' HEAD -- "$@"
}
# prints "$2$1$3$1...$N"
join() {
local sep="$1"; shift
local out; printf -v out "${sep//%/%%}%s" "$@"
echo "${out#$sep}"
}
cat <<-EOH
# this file is generated via https://github.com/zabbix/zabbix-docker/blob/$(fileCommit "$self")/$self
Maintainers: Alexey Pustovalov <[email protected]> (@dotneft)
GitRepo: https://github.com/zabbix/zabbix-docker.git
EOH
for version in "${versions[@]}"; do
major_version=${version%.*}
commit=`git rev-list -n 1 "$version"`
for component in agent java-gateway proxy-{mysql,sqlite3} server-{mysql,pgsql} web-{apache,nginx}-{mysql,pgsql}; do
for variant in alpine; do
dir="${component}/${variant}"
[ -f "$dir/Dockerfile" ] || continue
variantArches=( amd64 )
echo
cat <<-EOE
Tags: $version-$component, $major_version-$component
Architectures: $(join ', ' "${variantArches[@]}")
GitCommit: $commit
GitFetch: refs/heads/$major_version
Directory: $dir
EOE
done
done
done