mirror of
https://github.com/garrytan/gstack.git
synced 2026-11-23 08:31:44 +01:00
feat(release-gate): gate main every 8 hours and feed the stable release (inert until adopted)
Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
This commit is contained in:
1 parent
923fc0a6b8
commit
2dcbe9dbbd
20 files changed
+1415
-30
No files matched your search
@@ -17,6 +17,12 @@
|
||||
# checkout it prints `gstack: ok not-needed for=none (...)` and exits 0; with
|
||||
# one it prints the same trailer with the checkout's version, running nothing
|
||||
# from the checkout. That ok admits no workflow (no verdict is written).
|
||||
# From revision 4 the clone and the floor fast-forward follow the update
|
||||
# channel (docs/releases.md#channels): GSTACK_UPDATE_CHANNEL=stable|main, else
|
||||
# the checkout's bin/gstack-update-channel.sh (auto: stable in team mode),
|
||||
# else main. On stable, a fresh clone checks out origin's stable branch and
|
||||
# the floor fast-forward goes to stable, each only when stable exists and
|
||||
# meets the supported minimum; otherwise main, as before. --revision wins.
|
||||
# Everything else (Bun, setup, the doctor, the verdict, the launch line) is
|
||||
# the checkout's. The last line is the `gstack:` trailer; exit 0 only on
|
||||
# `gstack: ok`. Contract: docs/capy-install.md; tests:
|
||||
@@ -27,9 +33,10 @@
|
||||
# bash install.sh --check --for none this machine runs no workflow: ok not-needed, nothing installed
|
||||
# bash install.sh [--for <skill> | --require <id,id>] [--with-browser] [--revision <ref>] [--project <path>]
|
||||
# Environment: GSTACK_CAPY_ROOT (default ~/.local/share/gstack), GSTACK_CAPY_REPO,
|
||||
# GSTACK_CAPY_AUTO_UPGRADE=0 (never fast-forward), GSTACK_CAPY_FETCH_TIMEOUT (s).
|
||||
# GSTACK_CAPY_AUTO_UPGRADE=0 (never fast-forward), GSTACK_CAPY_FETCH_TIMEOUT (s),
|
||||
# GSTACK_UPDATE_CHANNEL=main (follow every merge even in team mode) or stable.
|
||||
set -u
|
||||
GSTACK_CAPY_WRAPPER=3
|
||||
GSTACK_CAPY_WRAPPER=4
|
||||
|
||||
self="$(cd "$(dirname "$0")" && pwd -P)/$(basename "$0")"
|
||||
root="${GSTACK_CAPY_ROOT:-$HOME/.local/share/gstack}"
|
||||
@@ -74,6 +81,24 @@ below() {
|
||||
return 1
|
||||
}
|
||||
support_get() { printf '%s\n' "$1" | sed -n "s/^$2=\([0-9][0-9.]*\)[[:space:]]*\$/\1/p" | head -1; }
|
||||
# channel_stable ROOT MIN [FETCH_FLAG] — true, with origin's stable commit in $stable_sha, when
|
||||
# this install follows stable and origin's stable exists and meets MIN; says why not otherwise.
|
||||
# FETCH_FLAG is --depth=1 for a fresh clone only (never --depth into an existing checkout).
|
||||
channel_stable() {
|
||||
local ch="${GSTACK_UPDATE_CHANNEL:-}" ver
|
||||
case "$ch" in stable|main) ;; *) ch=$(bash "$1/bin/gstack-update-channel.sh" "$1" 2>/dev/null | head -1) ;; esac
|
||||
[ "$ch" = stable ] || return 1
|
||||
if ! bounded git -C "$1" fetch --quiet ${3:+"$3"} origin stable 2>/dev/null; then
|
||||
echo "gstack-capy-skill: channel stable, but origin has no stable branch yet (or the fetch failed); following main"
|
||||
return 1
|
||||
fi
|
||||
stable_sha=$(git -C "$1" rev-parse FETCH_HEAD) ver=$(git -C "$1" show FETCH_HEAD:VERSION 2>/dev/null | head -1)
|
||||
if [ -n "$2" ] && below "${ver:-0}" "$2"; then
|
||||
echo "gstack-capy-skill: channel stable is at ${ver:-unknown}, below the supported minimum $2; following main"
|
||||
return 1
|
||||
fi
|
||||
echo "gstack-capy-skill: channel stable ${ver:-unknown} (GSTACK_UPDATE_CHANNEL=main follows every merge)"
|
||||
}
|
||||
|
||||
mkdir -p "$(dirname "$root")"
|
||||
if [ "$check" -eq 0 ]; then
|
||||
@@ -100,6 +125,10 @@ if [ ! -f "$root/setup" ]; then
|
||||
fi
|
||||
remote_min=$(support_get "$(cat "$root/capy/support.env" 2>/dev/null)" GSTACK_MIN_REVISION)
|
||||
remote_version=$(head -1 "$root/VERSION" 2>/dev/null)
|
||||
if [ -z "$revision" ] && channel_stable "$root" "$remote_min" --depth=1; then
|
||||
git -C "$root" reset --quiet --hard "$stable_sha" \
|
||||
|| { echo "gstack: fail installer — could not check out origin/stable in $root; fix: GSTACK_UPDATE_CHANNEL=main $fix_cmd"; exit 1; }
|
||||
fi
|
||||
export GSTACK_CAPY_CLONED="$repo"
|
||||
else
|
||||
# The remote's rules: fetch the default branch into FETCH_HEAD (never --depth
|
||||
@@ -140,9 +169,11 @@ else
|
||||
echo "gstack: fail revision — installed $installed is below the supported minimum $remote_min ($cause); fix: $fix (REVISION_BELOW_MINIMUM)"
|
||||
exit 1
|
||||
fi
|
||||
if ! git -C "$root" merge --ff-only -q FETCH_HEAD 2>/dev/null; then
|
||||
target=$(git -C "$root" rev-parse FETCH_HEAD)
|
||||
if channel_stable "$root" "$remote_min" && git -C "$root" merge-base --is-ancestor HEAD "$stable_sha" 2>/dev/null; then target=$stable_sha; fi
|
||||
if ! git -C "$root" merge --ff-only -q "$target" 2>/dev/null; then
|
||||
git -C "$root" fetch --quiet --unshallow origin "$default" 2>/dev/null
|
||||
git -C "$root" merge --ff-only -q FETCH_HEAD 2>/dev/null \
|
||||
git -C "$root" merge --ff-only -q "$target" 2>/dev/null \
|
||||
|| { echo "gstack: fail revision — installed $installed is below the supported minimum $remote_min (fast-forward failed); fix: git -C $root status, then $fix_cmd (REVISION_BELOW_MINIMUM)"; exit 1; }
|
||||
fi
|
||||
echo "gstack-capy-skill: upgraded $installed -> $(head -1 "$root/VERSION")"
|
||||
|
||||
Reference in new issue
Block a user