Skip to content

Commit 3d37b6b

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 e8eda6b commit 3d37b6b

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
@@ -53,17 +53,19 @@ dirCommit() {
5353

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

58-
eval "declare -g -A parentRepoToArches=( $(
59-
find -name 'Dockerfile' -exec awk '
58+
local parentRepoToArchesStr
59+
parentRepoToArchesStr="$(
60+
find -name 'Dockerfile' -exec awk -v officialImagesBase="$officialImagesBase" '
6061
toupper($1) == "FROM" && $2 !~ /^('"$repo"'|scratch|.*\/.*)(:|$)/ {
61-
print "'"$officialImagesUrl"'" $2
62+
printf "%s%s\n", officialImagesBase, $2
6263
}
6364
' '{}' + \
6465
| sort -u \
65-
| xargs bashbrew cat --format '[{{ .RepoName }}:{{ .TagName }}]="{{ join " " .TagEntry.Architectures }}"'
66-
) )"
66+
| xargs -r bashbrew cat --format '["{{ .RepoName }}:{{ .TagName }}"]="{{ join " " .TagEntry.Architectures }}"'
67+
)"
68+
eval "declare -g -A parentRepoToArches=( $parentRepoToArchesStr )"
6769
}
6870
getArches 'openjdk'
6971

0 commit comments

Comments
 (0)