Skip to content

Add function to get architectures of parent images so each buildpack image has the same set #59

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 6, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions generate-stackbrew-library.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,23 @@ dirCommit() {
)
}

getArches() {
local repo="$1"; shift
local officialImagesUrl='https://github.com/docker-library/official-images/raw/master/library/'

eval "declare -A -g parentRepoToArches=( $(
find -name 'Dockerfile' -exec awk '
toupper($1) == "FROM" && $2 !~ /^('"$repo"'|scratch|microsoft\/[^:]+)(:|$)/ {
print "'"$officialImagesUrl"'" $2
}
' '{}' + \
| sort -u \
| xargs bashbrew cat --format '[{{ .RepoName }}:{{ .TagName }}]="{{ .TagEntry.ArchitecturesString }}"'
) )"
}

getArches 'buildpack-deps'

cat <<-EOH
# this file is generated via https://github.com/docker-library/buildpack-deps/blob/$(fileCommit "$self")/$self

Expand All @@ -50,6 +67,8 @@ join() {

for version in "${versions[@]}"; do
versionAliases=( $version ${aliases[$version]:-} )
parent="$(awk 'toupper($1) == "FROM" { print $2 }' "$version/curl/Dockerfile")"
arches="${parentRepoToArches[$parent]}"

for variant in curl scm; do
commit="$(dirCommit "$version/$variant")"
Expand All @@ -62,6 +81,7 @@ for version in "${versions[@]}"; do
Tags: $(join ', ' "${variantAliases[@]}")
GitCommit: $commit
Directory: $version/$variant
Architectures: $arches
EOE
done

Expand All @@ -72,5 +92,6 @@ for version in "${versions[@]}"; do
Tags: $(join ', ' "${versionAliases[@]}")
GitCommit: $commit
Directory: $version
Architectures: $arches
EOE
done