Skip to content

Commit dd71778

Browse files
committed
Account for BASHBREW_NAMESPACE to support non-library use cases too
1 parent 3af45bd commit dd71778

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

scripts/github-actions/generate.sh

+6-4
Original file line numberDiff line numberDiff line change
@@ -31,18 +31,19 @@ order=()
3131
declare -A metas=()
3232
for tag in $tags; do
3333
echo >&2 "Processing $tag ..."
34+
bashbrewImage="${tag##*/}" # account for BASHBREW_NAMESPACE being set
3435
meta="$(
3536
bashbrew cat --format '
3637
{{- $e := .TagEntry -}}
3738
{{- "{" -}}
3839
"name": {{- json ($e.Tags | first) -}},
39-
"tags": {{- json ($.Tags "" false $e) -}},
40+
"tags": {{- json ($.Tags namespace false $e) -}},
4041
"directory": {{- json $e.Directory -}},
4142
"file": {{- json $e.File -}},
4243
"constraints": {{- json $e.Constraints -}},
4344
"froms": {{- json ($.DockerFroms $e) -}}
4445
{{- "}" -}}
45-
' "$tag" | jq -c '
46+
' "$bashbrewImage" | jq -c '
4647
{
4748
name: .name,
4849
os: (
@@ -86,9 +87,10 @@ for tag in $tags; do
8687
'
8788
)"
8889

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

0 commit comments

Comments
 (0)