mirror of
https://github.com/cozystack/cozystack.git
synced 2026-12-02 21:30:46 +09:00
Release-line image builds read only main's build cache, which matches
release-1.6 less with every Dockerfile main changes: the rc Prepare
Release job went from 28 minutes on v1.6.4-rc.1 to 43 on v1.6.5-rc.1
and 45 on v1.6.6-rc.1.
The line now keeps a cache of its own. build-release.yaml writes
buildcache-release-1.6 on every push to the line, and rc builds import
it together with main's buildcache. CACHE_FROM_TAGS lists every cache a
build imports; unset, it is CACHE_TAG (buildcache), as before. This
line's cache-args took an optional per-call cache tag that no caller
passes, so it takes main's form instead. A cache write that fails no
longer fails the build (ignore-error=true).
The units of hack/build-matrix.sh build four at a time (make
build-parallel, hack/build-units.sh), each output line carrying its
unit. On this line packages/core/platform waits for the rest, because
it writes backupstrategy-controller's values.yaml.
Tested with bats: the cache macro, the unit builder against a fake make
and the workflow settings, plus a dry run of hack/build-units.sh over
this line's units with make -n.
Assisted-by: LLM
(cherry picked from commit 12eaa49521)
Signed-off-by: Myasnikov Daniil <myasnikovdaniil2001@gmail.com>
36 lines
1022 B
Bash
Executable File
36 lines
1022 B
Bash
Executable File
#!/usr/bin/env bash
|
|
# Builds the image units hack/build-matrix.sh lists, BUILD_JOBS at a time.
|
|
# Several build at once, so every output line starts with its unit.
|
|
#
|
|
# Run from the repository root. Talos and the installer are not in the list;
|
|
# `make build-parallel` builds them afterwards.
|
|
set -euo pipefail
|
|
|
|
jobs="${BUILD_JOBS:-4}"
|
|
|
|
# It rewrites packages/system/backupstrategy-controller/values.yaml, which the
|
|
# backupstrategy-controller build rewrites too, so it waits until the others
|
|
# are done.
|
|
last=packages/core/platform
|
|
|
|
units="$(hack/build-matrix.sh | jq --raw-output '.[]')"
|
|
[ -n "$units" ]
|
|
|
|
build() {
|
|
set -o pipefail
|
|
if make -C "$1" image 2>&1 | sed --unbuffered "s|^|$1: |"; then
|
|
echo "built $1"
|
|
else
|
|
echo "::error::$1 failed"
|
|
return 1
|
|
fi
|
|
}
|
|
export -f build
|
|
|
|
grep --invert-match --line-regexp --fixed-strings "$last" <<< "$units" |
|
|
xargs --max-procs="$jobs" --max-args=1 bash -c 'build "$1"' _
|
|
|
|
if grep --quiet --line-regexp --fixed-strings "$last" <<< "$units"; then
|
|
build "$last"
|
|
fi
|