Skip to content

Commit 1164645

Browse files
committed
ci: build one SDK container per target instead of per architecture
Each target has unique base packages, so SDKs need to be built per target. The first target for each architecture also gets an arch-based tag as a convenience default. Tags use dashes instead of slashes (e.g. ath79-generic not ath79/generic) since Docker tags cannot contain slashes.
1 parent d2a2e97 commit 1164645

1 file changed

Lines changed: 13 additions & 6 deletions

File tree

.github/workflows/containers.yml

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -117,21 +117,28 @@ jobs:
117117
echo -e "\n---- rootfs ----\n"
118118
echo "rootfs=$JSON_ROOTFS" >> "$GITHUB_OUTPUT"
119119
120-
# sdks
120+
# sdks - one per target, first target per arch also gets the arch tag
121+
declare -A ARCH_SEEN
121122
JSON='['
122123
FIRST=1
123124
124125
while read -r line;
125126
do
126-
ARCH=$(echo "$line" | cut -d " " -f 1)
127-
[ -z "$TARGET_FILTER" ] && TARGET=$(echo "$line" | cut -d " " -f 2) || TARGET="$TARGET_FILTER"
128-
TARGETS=$(echo "$line" | cut -d " " -f 2- | sed -e 's/ /\\n/g')
127+
TARGET=$(echo "$line" | cut -d " " -f 1)
128+
ARCH=$(echo "$line" | cut -d " " -f 2)
129+
TARGET_TAG="${TARGET//\//-}"
130+
131+
TAGS="$TARGET_TAG"
132+
if [ -z "${ARCH_SEEN[$ARCH]+x}" ]; then
133+
TAGS="$TARGET_TAG\n$ARCH"
134+
ARCH_SEEN[$ARCH]=1
135+
fi
129136
130137
[[ $FIRST -ne 1 ]] && JSON="$JSON"','
131138
FIRST=0
132139
133-
JSON="$JSON"'{"arch":"'"$ARCH"'","target":"'"$TARGET"'","tags":"'"$ARCH"'\n'"$TARGETS"'"}'
134-
done <<< $(perl ./scripts/dump-target-info.pl architectures 2>/dev/null | ([[ -n "$TARGET_FILTER" ]] && grep -w "$TARGET_FILTER" || cat))
140+
JSON="$JSON"'{"target":"'"$TARGET"'","tags":"'"$TAGS"'"}'
141+
done <<< $(perl ./scripts/dump-target-info.pl targets 2>/dev/null | ([[ -n "$TARGET_FILTER" ]] && grep -w "$TARGET_FILTER" || cat))
135142
136143
JSON='{"include":'"$JSON"']}'
137144
echo -e "\n---- sdks ----\n"

0 commit comments

Comments
 (0)