Skip to content

Commit 9e96b44

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 d6690c7 commit 9e96b44

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

generate-stackbrew-library.sh

+8-6
Original file line numberDiff line numberDiff line change
@@ -43,17 +43,19 @@ dirCommit() {
4343

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

48-
eval "declare -g -A parentRepoToArches=( $(
49-
find -name 'Dockerfile' -exec awk '
48+
local parentRepoToArchesStr
49+
parentRepoToArchesStr="$(
50+
find -name 'Dockerfile' -exec awk -v officialImagesBase="$officialImagesBase" '
5051
toupper($1) == "FROM" && $2 !~ /^('"$repo"'|scratch|.*\/.*)(:|$)/ {
51-
print "'"$officialImagesUrl"'" $2
52+
printf "%s%s\n", officialImagesBase, $2
5253
}
5354
' '{}' + \
5455
| sort -u \
55-
| xargs bashbrew cat --format '[{{ .RepoName }}:{{ .TagName }}]="{{ join " " .TagEntry.Architectures }}"'
56-
) )"
56+
| xargs -r bashbrew cat --format '["{{ .RepoName }}:{{ .TagName }}"]="{{ join " " .TagEntry.Architectures }}"'
57+
)"
58+
eval "declare -g -A parentRepoToArches=( $parentRepoToArchesStr )"
5759
}
5860
getArches 'wordpress'
5961

0 commit comments

Comments
 (0)