Skip to content

Commit 81c3b37

Browse files
authored
[CI] Fix Main2Main fresh-mode upstream reference (vllm-project#12988)
### What this PR does / why we need it? Fix a Main2Main regression introduced by: - vllm-project#12279 PR moved `upstream` setup into the incremental-only `FIXED_BASE_SHA` condition. When a baseline rebase conflicts, the workflow falls back to fresh mode with an empty `FIXED_BASE_SHA`, so `upstream/main` is not created: https://github.com/vllm-project/vllm-ascend/actions/runs/30284552529/job/90040429009. `main2main_flow` then fails during initialization: ```text fatal: Not a valid object name upstream/main ``` This change: - derives the fixed upstream base from `base_sha` or `source_ref`; - configures `upstream` in both fresh and incremental modes; - pins `upstream/main` to the resolved SHA instead of fetching a moving main; - preserves the existing incremental rebase behavior. ### Does this PR introduce _any_ user-facing change? ### How was this patch tested? - vLLM version: v0.25.1 - vLLM main: vllm-project/vllm@fe784ff --------- Signed-off-by: MrZ20 <2609716663@qq.com>
1 parent 60cba93 commit 81c3b37

1 file changed

Lines changed: 20 additions & 8 deletions

File tree

.github/workflows/schedule_main2main.yaml

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,8 @@ jobs:
8181
UPSTREAM_SHA=$(git rev-parse origin/main)
8282
USE_BASELINE=false
8383
84+
# Attempt incremental mode: carry forward previous adaptation commits
85+
# by rebasing main2main_baseline onto this run's fixed upstream SHA.
8486
if git fetch "https://github.com/${HEAD_FORK}.git" \
8587
"refs/heads/main2main_baseline:refs/remotes/main2main/main2main_baseline" 2>/dev/null; then
8688
BASELINE_SHA=$(git rev-parse refs/remotes/main2main/main2main_baseline)
@@ -101,6 +103,9 @@ jobs:
101103
fi
102104
fi
103105
106+
# Fresh mode starts directly from the fixed upstream SHA when no
107+
# baseline exists, the target vLLM commit predates the baseline's
108+
# verified vLLM commit, or the rebase conflicts.
104109
if [ "$USE_BASELINE" = true ]; then
105110
{
106111
echo "source_repository=$HEAD_FORK"
@@ -329,19 +334,26 @@ jobs:
329334
id: branch
330335
working-directory: ${{ github.workspace }}
331336
env:
332-
FIXED_BASE_REF: ${{ needs.resolve-source.outputs.base_ref }}
333-
FIXED_BASE_SHA: ${{ needs.resolve-source.outputs.base_sha }}
337+
# The ref identifies what to fetch; the SHA fixes the exact commit
338+
# used as the incremental-mode rebase base.
339+
UPSTREAM_FETCH_REF: ${{ needs.resolve-source.outputs.base_ref }}
340+
UPSTREAM_REBASE_SHA: ${{ needs.resolve-source.outputs.base_sha }}
341+
CHECKOUT_SOURCE_SHA: ${{ needs.resolve-source.outputs.source_ref }}
334342
run: |
335343
set -eu
336344
BRANCH="main2main_auto_$(date +%Y-%m-%d_%H-%M)"
345+
UPSTREAM_BASE_SHA="${UPSTREAM_REBASE_SHA:-$CHECKOUT_SOURCE_SHA}"
346+
git remote add upstream "https://github.com/${UPSTREAM_REPO}.git" || \
347+
git remote set-url upstream "https://github.com/${UPSTREAM_REPO}.git"
337348
git checkout -B "$BRANCH"
338-
if [ -n "$FIXED_BASE_SHA" ]; then
339-
git remote add upstream "https://github.com/${UPSTREAM_REPO}.git" || \
340-
git remote set-url upstream "https://github.com/${UPSTREAM_REPO}.git"
341-
git fetch upstream "$FIXED_BASE_REF"
342-
git cat-file -e "${FIXED_BASE_SHA}^{commit}"
343-
git rebase "$FIXED_BASE_SHA"
349+
if [ -n "$UPSTREAM_REBASE_SHA" ]; then
350+
git fetch upstream "$UPSTREAM_FETCH_REF"
351+
git rebase "$UPSTREAM_REBASE_SHA"
344352
fi
353+
git cat-file -e "${UPSTREAM_BASE_SHA}^{commit}"
354+
# main2main_flow uses upstream/main as its squash baseline. Keep the
355+
# ref on the resolved snapshot instead of fetching a moving main.
356+
git update-ref refs/remotes/upstream/main "$UPSTREAM_BASE_SHA"
345357
BASE_SHA=$(git rev-parse HEAD)
346358
echo "name=${BRANCH}" >> "$GITHUB_OUTPUT"
347359
echo "base_sha=${BASE_SHA}" >> "$GITHUB_OUTPUT"

0 commit comments

Comments
 (0)