Skip to content

Commit 2895a67

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 04175a1 commit 2895a67

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

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

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

0 commit comments

Comments
 (0)