Skip to content

Pipeline(E2E): align ModelKitArtifacts with release branch at runtime#940

Merged
KayMKM merged 2 commits into
mainfrom
yuesu/fix_pipeline_release_trigger
Jun 23, 2026
Merged

Pipeline(E2E): align ModelKitArtifacts with release branch at runtime#940
KayMKM merged 2 commits into
mainfrom
yuesu/fix_pipeline_release_trigger

Conversation

@KayMKM

@KayMKM KayMKM commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

Problem

The E2E Test pipeline is supposed to check out the same-named release/* branch
of ModelKitArtifacts when it runs on a release branch, so the artifact content
matches the modelkit release. This never actually worked:

  • The artifacts repo was selected via the repository resource's ref
    (ref: ${{ variables.artifactsRef }}, driven by a compile-time variables
    block). A repository resource ref is resolved before the pipeline starts
    and only accepts template expressions over parameters and system predefined
    variables — not YAML/UI-defined variables. So the expression was silently
    ignored and ModelKitArtifacts always checked out its default branch (main),
    even on release/* runs.
  • Pointing ref directly at Build.SourceBranch does compile, but then the
    resource tries to check out whatever branch the pipeline runs on, which fails
    outright when ModelKitArtifacts has no matching branch (feature/ad-hoc runs):
    No commit found for SHA: refs/heads/<branch>.

In short, the branch of a repository resource cannot be conditionally chosen at
resource-resolution time.

Fix

Select the artifacts branch at runtime instead:

  • Pin the ModelKitArtifacts resource to ref: main (always exists), and remove
    the unusable variables indirection.
  • Add a job step "Align ModelKitArtifacts with release branch" that, when
    Build.SourceBranch is refs/heads/release/*, switches the already-checked-out
    artifacts repo to the same-named release branch (git fetch + git checkout +
    git lfs pull). It falls back to main with a warning when no matching branch
    exists, so non-release runs (main schedule, manual, feature branches) keep
    working instead of failing at init.
  • Enable persistCredentials: true on the artifacts checkout so the runtime
    fetch / lfs pull is authenticated.

Result

  • release/* run → ModelKitArtifacts switches to the same-named release branch ✓
  • main / manual / feature run → stays on main, no init failure ✓

Verified on a live pipeline run.

KayMKM added 2 commits June 23, 2026 11:46
A repository resource's 
ef only accepts template expressions over
parameters and system predefined variables, not YAML-defined variables.
The prior 
ef: ${{ variables.artifactsRef }} was silently ignored, so
ModelKitArtifacts always checked out main even on release/* runs.

Reference Build.SourceBranch directly so the artifact repo follows the
pipeline's own branch (release/* -> same release branch, main -> main).
Resolving the artifacts branch on the repository resource is impossible:
a repository resource ref is resolved before the pipeline starts and only
accepts parameters/system predefined variables (no YAML vars, no
conditional keys). Pointing ref at Build.SourceBranch compiles but checks
out whatever branch the pipeline runs on, which fails when ModelKitArtifacts
has no matching branch (feature/ad-hoc runs):
  No commit found for SHA: refs/heads/<branch>.

Pin the resource to main (always exists) and switch the checked-out
artifacts repo to the same-named release/* branch at runtime, falling back
to main with a warning when no such branch exists. persistCredentials is
enabled on the checkout so the runtime fetch/lfs pull is authenticated.
@KayMKM KayMKM requested a review from a team as a code owner June 23, 2026 05:37
@xieofxie

Copy link
Copy Markdown
Contributor

please update title

@KayMKM KayMKM changed the title Yuesu/fix pipeline release trigger Pipeline(E2E): align ModelKitArtifacts with release branch at runtime Jun 23, 2026
@KayMKM KayMKM merged commit ae5d188 into main Jun 23, 2026
9 checks passed
@KayMKM KayMKM deleted the yuesu/fix_pipeline_release_trigger branch June 23, 2026 06:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants