mirror of
https://github.com/cozystack/cozystack.git
synced 2026-11-30 04:06:34 +09:00
A pull request whose base is another feature branch listed its changes against that base, so one that changed only tests built no images. The overlay then filled every package from main's or a release line's artifact, which has none of the stack's changes, and the stack's charts ran on images that did not match them: in one stacked run cozystack-controller crash-looped on "flag provided but not defined: -enable-gpu". The overlay's choice of artifact moves into hack/pr-artifact-ref.sh, unchanged. The plan step now takes its path lists from hack/pr-changed-paths.sh, which uses the same choice: on main and the release lines, which read their own artifact, it is the pull request's own diff as before; on any other base it is the diff from the fork point with the line whose artifact the base reads, so the images of the pull requests below are built too, and a stack on a release line does not rebuild everything for the line's own commits. When the fork point cannot be found nothing may trust the lists: the step warns, builds every image, Talos included, runs the backport-batch tests and keeps every package's committed refs out of the overlay. Closes: #5444 Assisted-by: LLM Signed-off-by: Aleksei Sviridkin <f@lex.la>
37 lines
1.3 KiB
Bash
Executable File
37 lines
1.3 KiB
Bash
Executable File
#!/bin/sh
|
|
# Write the list of paths a pull request changes, as its build decisions read
|
|
# it. Every package the pull request does not build is filled from the
|
|
# packages artifact hack/pr-artifact-ref.sh picks for its base. Main and the
|
|
# release lines read their own, so the pull request's own diff is the whole
|
|
# question there. A pull request stacked on another one reads the artifact of
|
|
# main or a release line, which has none of the stack's changes, so the list
|
|
# is taken against the fork point from that artifact's line and the images of
|
|
# the lower pull requests are built too. A fork point that cannot be found
|
|
# fails, and the caller builds everything.
|
|
#
|
|
# Usage: pr-changed-paths.sh [--renames] <base-ref> <output-file>
|
|
# The list is rename-blind, both sides of a rename, unless --renames asks for
|
|
# git's rename detection.
|
|
set -eu
|
|
|
|
renames=--no-renames
|
|
if [ "${1:-}" = --renames ]; then
|
|
renames=
|
|
shift
|
|
fi
|
|
if [ "$#" -ne 2 ]; then
|
|
echo "usage: pr-changed-paths.sh [--renames] <base-ref> <output-file>" >&2
|
|
exit 2
|
|
fi
|
|
base=$1
|
|
out=$2
|
|
|
|
artifact="$("$(dirname "$0")/pr-artifact-ref.sh" "$base")"
|
|
if [ "$artifact" = "$base" ]; then
|
|
range="origin/${base}...HEAD"
|
|
else
|
|
range="$(git merge-base "origin/${artifact}" HEAD)..HEAD"
|
|
fi
|
|
# shellcheck disable=SC2086 # an empty $renames is no argument
|
|
git diff --name-only $renames "$range" > "$out"
|