Skip to content

Commit c75c22c

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 3598423 commit c75c22c

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

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

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

0 commit comments

Comments
 (0)