-
Notifications
You must be signed in to change notification settings - Fork 115
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
Use bashbrew
to gather the canonical list of supported suites
#164
Draft
tianon
wants to merge
1
commit into
docker-library:master
Choose a base branch
from
infosiftr:canonical-suites
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,42 @@ set -Eeuo pipefail | |
|
||
distsSuites=( "$@" ) | ||
if [ "${#distsSuites[@]}" -eq 0 ]; then | ||
distsSuites=( */*/ ) | ||
# when run without arguments, let's use "bashbrew" to get the canonical list of currently supported suites/codenames | ||
bashbrew --version > /dev/null | ||
if [ -z "${BASHBREW_LIBRARY:-}" ] || [ ! -s "$BASHBREW_LIBRARY/debian" ] || [ ! -s "$BASHBREW_LIBRARY/ubuntu" ]; then | ||
tempDir="$(mktemp -d)" | ||
trap 'rm -rf "$tempDir"' EXIT | ||
wget -qO "$tempDir/debian" 'https://github.com/docker-library/official-images/raw/HEAD/library/debian' | ||
wget -qO "$tempDir/ubuntu" 'https://github.com/docker-library/official-images/raw/HEAD/library/ubuntu' | ||
export BASHBREW_LIBRARY="$tempDir" | ||
bashbrew cat debian ubuntu > /dev/null | ||
fi | ||
dists="$( | ||
bashbrew cat debian ubuntu --format ' | ||
{{- range .Entries -}} | ||
{{- $.Tags "" false . | json -}} | ||
{{- "\n" -}} | ||
{{- end -}} | ||
' | jq -r ' | ||
map(select(test(" | ||
# a few tags we explicitly want to ignore in our search for codenames | ||
:( | ||
experimental | rc-buggy # not a release | ||
| | ||
latest | .*stable | devel | rolling | testing # stable/development/rolling aliases | ||
| | ||
.* - .* # anything with a hyphen | ||
| | ||
[0-9].* # likewise with numerics | ||
)$ | ||
"; "x") | not)) | ||
| .[0] // empty # then we filter to the first leftover in each tag group and it should be the codename | ||
| sub(":"; "/") | ||
| @sh | ||
' | ||
)" | ||
# TODO expand this and do our supported architectures detection here too, while we've already done the lookups? Ubuntu version number lookups via this method too? (unfortunately we can't map Debian codenames to aliases like "stable" this way) | ||
eval "distsSuites=( $dists )" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this safer than There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's more reliable in my experience (and certainly no less safe). |
||
json='{}' | ||
else | ||
json="$(< versions.json)" | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know the
"x"
option causes the regular expression engine to ignore whitespace, but is there a reason to not just have.*-.*
or even just-
here?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought
.*-.*
looked a little compressed and this helped it be more obvious, personally, but I don't feel strongly about it (especially with the comment out to the side which makes it pretty obvious 😂) -- we can't do just-
because of the:
+$
anchoring outside the parenthesis here (we're matching the full "tag" portion of the image references explicitly with this).