Skip to content

Commit 30dfd20

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 43e0f19 commit 30dfd20

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

generate-stackbrew-library.sh

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,17 +41,19 @@ dirCommit() {
4141

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

46-
eval "declare -g -A parentRepoToArches=( $(
47-
find -name 'Dockerfile' -exec awk '
46+
local parentRepoToArchesStr
47+
parentRepoToArchesStr="$(
48+
find -name 'Dockerfile' -exec awk -v officialImagesBase="$officialImagesBase" '
4849
toupper($1) == "FROM" && $2 !~ /^('"$repo"'|scratch|.*\/.*)(:|$)/ {
49-
print "'"$officialImagesUrl"'" $2
50+
printf "%s%s\n", officialImagesBase, $2
5051
}
5152
' '{}' + \
5253
| sort -u \
53-
| xargs bashbrew cat --format '[{{ .RepoName }}:{{ .TagName }}]="{{ join " " .TagEntry.Architectures }}"'
54-
) )"
54+
| xargs -r bashbrew cat --format '["{{ .RepoName }}:{{ .TagName }}"]="{{ join " " .TagEntry.Architectures }}"'
55+
)"
56+
eval "declare -g -A parentRepoToArches=( $parentRepoToArchesStr )"
5557
}
5658
getArches 'haproxy'
5759

0 commit comments

Comments
 (0)