fix(ci-test-review): resolve remote cc-ci worktree
This commit is contained in:
@@ -27,16 +27,24 @@ REMOTE_LOGDIR="/root/cc-ci-review-logs/${RUNID}"
|
|||||||
SUMMARY="${OUT}/ci-test-review-${RUNID}.json"
|
SUMMARY="${OUT}/ci-test-review-${RUNID}.json"
|
||||||
mkdir -p "$OUT"
|
mkdir -p "$OUT"
|
||||||
|
|
||||||
|
resolve_remote_root() {
|
||||||
|
ssh "$SSH" "for d in '${REMOTE_ROOT:-/root/builder-clone}' /root/cc-ci; do [ -d \"\$d/tests\" ] && [ -f \"\$d/runner/run_recipe_ci.py\" ] && { printf '%s' \"\$d\"; exit 0; }; done; exit 1"
|
||||||
|
}
|
||||||
|
|
||||||
quick_flag=""; [ "${QUICK:-0}" = "1" ] && quick_flag="--quick"
|
quick_flag=""; [ "${QUICK:-0}" = "1" ] && quick_flag="--quick"
|
||||||
stages_env=""; [ -n "${STAGES:-}" ] && stages_env="STAGES='${STAGES}'"
|
stages_env=""; [ -n "${STAGES:-}" ] && stages_env="STAGES='${STAGES}'"
|
||||||
|
REMOTE_WORKTREE="$(resolve_remote_root)" || {
|
||||||
|
echo "ERROR: could not locate remote cc-ci checkout (tried ${REMOTE_ROOT:-/root/builder-clone} and /root/cc-ci)" >&2
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
echo "ci-test-review sweep ${RUNID} (host=${SSH} quick=${QUICK:-0} stages=${STAGES:-all})" >&2
|
echo "ci-test-review sweep ${RUNID} (host=${SSH} root=${REMOTE_WORKTREE} quick=${QUICK:-0} stages=${STAGES:-all})" >&2
|
||||||
|
|
||||||
# 1. Enumerate enrolled recipes (tests/<recipe>/ dirs, minus harness scaffolding).
|
# 1. Enumerate enrolled recipes (tests/<recipe>/ dirs, minus harness scaffolding).
|
||||||
if [ -n "${RECIPES:-}" ]; then
|
if [ -n "${RECIPES:-}" ]; then
|
||||||
recipes="$RECIPES"
|
recipes="$RECIPES"
|
||||||
else
|
else
|
||||||
recipes="$(ssh "$SSH" 'cd /root/cc-ci/tests 2>/dev/null && ls -d */ 2>/dev/null' \
|
recipes="$(ssh "$SSH" "cd '${REMOTE_WORKTREE}/tests' 2>/dev/null && ls -d */ 2>/dev/null" \
|
||||||
| sed 's#/##' | grep -vE '^(_generic|unit|__pycache__)$' || true)"
|
| sed 's#/##' | grep -vE '^(_generic|unit|__pycache__)$' || true)"
|
||||||
fi
|
fi
|
||||||
[ -n "$recipes" ] || { echo "no enrolled recipes found" >&2; exit 1; }
|
[ -n "$recipes" ] || { echo "no enrolled recipes found" >&2; exit 1; }
|
||||||
@@ -53,7 +61,7 @@ for r in $recipes; do
|
|||||||
log="${REMOTE_LOGDIR}/${r}.log"
|
log="${REMOTE_LOGDIR}/${r}.log"
|
||||||
# Real harness invocation (real abra inside). Tee full log on cc-ci; capture rc.
|
# Real harness invocation (real abra inside). Tee full log on cc-ci; capture rc.
|
||||||
rc=0
|
rc=0
|
||||||
ssh "$SSH" "cd /root/cc-ci && ${stages_env} RECIPE='${r}' cc-ci-run runner/run_recipe_ci.py ${quick_flag} >'${log}' 2>&1" || rc=$?
|
ssh "$SSH" "cd '${REMOTE_WORKTREE}' && ${stages_env} RECIPE='${r}' cc-ci-run runner/run_recipe_ci.py ${quick_flag} >'${log}' 2>&1" || rc=$?
|
||||||
# Pull back the RUN SUMMARY block + the abra-checked-out recipe version, if recorded.
|
# Pull back the RUN SUMMARY block + the abra-checked-out recipe version, if recorded.
|
||||||
summary_block="$(ssh "$SSH" "awk '/===== RUN SUMMARY =====/{f=1} f{print}' '${log}' 2>/dev/null | sed 's/^/ /'" )"
|
summary_block="$(ssh "$SSH" "awk '/===== RUN SUMMARY =====/{f=1} f{print}' '${log}' 2>/dev/null | sed 's/^/ /'" )"
|
||||||
tiers="$(ssh "$SSH" "awk '/===== RUN SUMMARY =====/{f=1} f&&/^ (install|upgrade|backup|restore|custom)/{gsub(/^ /,\"\");print}' '${log}' 2>/dev/null" | tr '\n' ';')"
|
tiers="$(ssh "$SSH" "awk '/===== RUN SUMMARY =====/{f=1} f&&/^ (install|upgrade|backup|restore|custom)/{gsub(/^ /,\"\");print}' '${log}' 2>/dev/null" | tr '\n' ';')"
|
||||||
|
|||||||
@@ -26,18 +26,26 @@ REPEAT="${REPEAT:-1}"
|
|||||||
# published version). Defaults to the recipe's recipe-maintainers mirror.
|
# published version). Defaults to the recipe's recipe-maintainers mirror.
|
||||||
SRC="${SRC:-recipe-maintainers/${RECIPE}}"
|
SRC="${SRC:-recipe-maintainers/${RECIPE}}"
|
||||||
|
|
||||||
|
resolve_remote_root() {
|
||||||
|
ssh "$SSH" "for d in '${REMOTE_ROOT:-/root/builder-clone}' /root/cc-ci; do [ -f \"\$d/runner/run_recipe_ci.py\" ] && { printf '%s' \"\$d\"; exit 0; }; done; exit 1"
|
||||||
|
}
|
||||||
|
|
||||||
RUNID="$(date -u +%Y%m%dT%H%M%SZ)"
|
RUNID="$(date -u +%Y%m%dT%H%M%SZ)"
|
||||||
REMOTE_LOG="/root/cc-ci-review-logs/verify-${RECIPE}-${RUNID}"
|
REMOTE_LOG="/root/cc-ci-review-logs/verify-${RECIPE}-${RUNID}"
|
||||||
ssh "$SSH" "mkdir -p /root/cc-ci-review-logs"
|
ssh "$SSH" "mkdir -p /root/cc-ci-review-logs"
|
||||||
|
REMOTE_WORKTREE="$(resolve_remote_root)" || {
|
||||||
|
echo "ERROR: could not locate remote cc-ci checkout (tried ${REMOTE_ROOT:-/root/builder-clone} and /root/cc-ci)" >&2
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
echo "verify-pr: RECIPE=$RECIPE SRC=$SRC REF=$REF cold full-suite x${REPEAT} on ${SSH}" >&2
|
echo "verify-pr: RECIPE=$RECIPE SRC=$SRC REF=$REF cold full-suite x${REPEAT} on ${SSH} (root=${REMOTE_WORKTREE})" >&2
|
||||||
|
|
||||||
green=1
|
green=1
|
||||||
for i in $(seq 1 "$REPEAT"); do
|
for i in $(seq 1 "$REPEAT"); do
|
||||||
log="${REMOTE_LOG}.${i}.log"
|
log="${REMOTE_LOG}.${i}.log"
|
||||||
rc=0
|
rc=0
|
||||||
# Real harness, cold (no --quick), against the mirror PR head — same path as !testme.
|
# Real harness, cold (no --quick), against the mirror PR head — same path as !testme.
|
||||||
ssh "$SSH" "cd /root/cc-ci && RECIPE='${RECIPE}' SRC='${SRC}' REF='${REF}' cc-ci-run runner/run_recipe_ci.py >'${log}' 2>&1" || rc=$?
|
ssh "$SSH" "cd '${REMOTE_WORKTREE}' && RECIPE='${RECIPE}' SRC='${SRC}' REF='${REF}' cc-ci-run runner/run_recipe_ci.py >'${log}' 2>&1" || rc=$?
|
||||||
echo "--- pass ${i}/${REPEAT}: exit ${rc} (log ${SSH}:${log}) ---" >&2
|
echo "--- pass ${i}/${REPEAT}: exit ${rc} (log ${SSH}:${log}) ---" >&2
|
||||||
ssh "$SSH" "awk '/===== RUN SUMMARY =====/{f=1} f{print}' '${log}'" >&2 || true
|
ssh "$SSH" "awk '/===== RUN SUMMARY =====/{f=1} f{print}' '${log}'" >&2 || true
|
||||||
[ "$rc" = "0" ] || green=0
|
[ "$rc" = "0" ] || green=0
|
||||||
|
|||||||
Reference in New Issue
Block a user