Skip to content

Add initial scripts for image maintainers to use to auto-generate appropriate GitHub Actions #2

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 5 commits into from
Apr 28, 2020
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Account for BASHBREW_NAMESPACE to support non-library use cases too
  • Loading branch information
tianon committed Apr 27, 2020
commit dd71778b05aff1165e69b3e8a07b6ac0a9667654
10 changes: 6 additions & 4 deletions scripts/github-actions/generate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,18 +31,19 @@ order=()
declare -A metas=()
for tag in $tags; do
echo >&2 "Processing $tag ..."
bashbrewImage="${tag##*/}" # account for BASHBREW_NAMESPACE being set
meta="$(
bashbrew cat --format '
{{- $e := .TagEntry -}}
{{- "{" -}}
"name": {{- json ($e.Tags | first) -}},
"tags": {{- json ($.Tags "" false $e) -}},
"tags": {{- json ($.Tags namespace false $e) -}},
"directory": {{- json $e.Directory -}},
"file": {{- json $e.File -}},
"constraints": {{- json $e.Constraints -}},
"froms": {{- json ($.DockerFroms $e) -}}
{{- "}" -}}
' "$tag" | jq -c '
' "$bashbrewImage" | jq -c '
{
name: .name,
os: (
Expand Down Expand Up @@ -86,9 +87,10 @@ for tag in $tags; do
'
)"

parent="$(bashbrew parents "$tag" | tail -1)" # if there ever exists an image with TWO parents in the same repo, this will break :)
parent="$(bashbrew parents "$bashbrewImage" | tail -1)" # if there ever exists an image with TWO parents in the same repo, this will break :)
if [ -n "$parent" ]; then
parent="$(bashbrew list --uniq "$parent")" # normalize
parentBashbrewImage="${parent##*/}" # account for BASHBREW_NAMESPACE being set
parent="$(bashbrew list --uniq "$parentBashbrewImage")" # normalize
parentMeta="${metas["$parent"]}"
parentMeta="$(jq -c --argjson meta "$meta" '
. + {
Expand Down