Skip to content

Commit 84ac077

Browse files
committed
Update generate-stackbrew-library.sh to support BASHBREW_LIBRARY for easier cascading updates
See docker-library/official-images#17640 (comment)
1 parent 04d4b14 commit 84ac077

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

generate-stackbrew-library.sh

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -38,17 +38,19 @@ dirCommit() {
3838

3939
getArches() {
4040
local repo="$1"; shift
41-
local officialImagesUrl='https://github.com/docker-library/official-images/raw/master/library/'
41+
local officialImagesBase="${BASHBREW_LIBRARY:-https://github.com/docker-library/official-images/raw/HEAD/library}/"
4242

43-
eval "declare -g -A parentRepoToArches=( $(
44-
find "$@" -name 'Dockerfile' -exec awk '
43+
local parentRepoToArchesStr
44+
parentRepoToArchesStr="$(
45+
find -name 'Dockerfile' -exec awk -v officialImagesBase="$officialImagesBase" '
4546
toupper($1) == "FROM" && $2 !~ /^('"$repo"'|scratch|.*\/.*)(:|$)/ {
46-
print "'"$officialImagesUrl"'" $2
47+
printf "%s%s\n", officialImagesBase, $2
4748
}
4849
' '{}' + \
4950
| sort -u \
50-
| xargs bashbrew cat --format '[{{ .RepoName }}:{{ .TagName }}]="{{ join " " .TagEntry.Architectures }}"'
51-
) )"
51+
| xargs -r bashbrew cat --format '["{{ .RepoName }}:{{ .TagName }}"]="{{ join " " .TagEntry.Architectures }}"'
52+
)"
53+
eval "declare -g -A parentRepoToArches=( $parentRepoToArchesStr )"
5254
}
5355
getArches 'tomcat' "$@"
5456

@@ -160,7 +162,7 @@ for version; do
160162
GitCommit: $commit
161163
Directory: $dir
162164
EOE
163-
#constraints="$(bashbrew cat --format '{{ .TagEntry.Constraints | join ", " }}' "https://github.com/docker-library/official-images/raw/master/library/$variantParent")"
165+
#constraints="$(bashbrew cat --format '{{ .TagEntry.Constraints | join ", " }}' "https://github.com/docker-library/official-images/raw/HEAD/library/$variantParent")"
164166
#[ -z "$constraints" ] || echo "Constraints: $constraints"
165167
done
166168
done

0 commit comments

Comments
 (0)