forked from carlossg/docker-maven
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgenerate-stackbrew-library.sh
More file actions
executable file
·46 lines (35 loc) · 1.29 KB
/
generate-stackbrew-library.sh
File metadata and controls
executable file
·46 lines (35 loc) · 1.29 KB
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
#!/usr/local/bin/bash -eu
cd "$(dirname "${BASH_SOURCE[0]}")"
url='https://github.com/carlossg/docker-maven.git'
. common.sh
# prints "$2$1$3$1...$N"
join() {
local sep="$1"; shift
local out; printf -v out "${sep//%/%%}%s" "$@"
echo "${out#$sep}"
}
generate-version() {
local version=$1
local branch=$2
local versionAliases=("${@:3}")
commit="$(git log -1 --format='format:%H' "$branch" -- "$version")"
from="$(awk 'toupper($1) == "FROM" { print $2 }' "$version/Dockerfile")"
arches="$(bashbrew cat --format '{{- join ", " .TagEntry.Architectures -}}' "$from")"
constraints="$(bashbrew cat --format '{{ join ", " .TagEntry.Constraints -}}' "$from")"
echo
echo "Tags: $(join ', ' "${versionAliases[@]}")"
echo "Architectures: $arches"
[ "$branch" = 'master' ] || echo "GitFetch: refs/heads/$branch"
echo "GitCommit: $commit"
echo "Directory: $version"
[ -z "$constraints" ] || echo "Constraints: $constraints"
}
echo 'Maintainers: Carlos Sanchez <carlos@apache.org> (@carlossg)'
echo "GitRepo: $url"
versions=( jdk-*/ openjdk-*/ adoptopenjdk-*/ ibmjava-*/ amazoncorretto-*/ )
versions=( "${versions[@]%/}" )
for version in "${versions[@]}"; do
branch=master
mapfile -t versionAliases < <(version-aliases "$version" "$branch")
generate-version "$version" "$branch" "${versionAliases[@]}"
done