Pipeline(E2E): align ModelKitArtifacts with release branch at runtime#940
Merged
Conversation
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.
xieofxie
approved these changes
Jun 23, 2026
Contributor
|
please update title |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The E2E Test pipeline is supposed to check out the same-named
release/*branchof
ModelKitArtifactswhen it runs on a release branch, so the artifact contentmatches the modelkit release. This never actually worked:
ref(
ref: ${{ variables.artifactsRef }}, driven by a compile-timevariablesblock). A repository resource
refis resolved before the pipeline startsand only accepts template expressions over
parametersand system predefinedvariables — not YAML/UI-defined variables. So the expression was silently
ignored and ModelKitArtifacts always checked out its default branch (
main),even on
release/*runs.refdirectly atBuild.SourceBranchdoes compile, but then theresource 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:
ModelKitArtifactsresource toref: main(always exists), and removethe unusable
variablesindirection.Build.SourceBranchisrefs/heads/release/*, switches the already-checked-outartifacts repo to the same-named release branch (
git fetch+git checkout+git lfs pull). It falls back tomainwith a warning when no matching branchexists, so non-release runs (main schedule, manual, feature branches) keep
working instead of failing at init.
persistCredentials: trueon the artifacts checkout so the runtimefetch / lfs pull is authenticated.
Result
release/*run → ModelKitArtifacts switches to the same-named release branch ✓main/ manual / feature run → stays onmain, no init failure ✓Verified on a live pipeline run.