diff --git a/.pipelines/Modelkit E2E Test.yml b/.pipelines/Modelkit E2E Test.yml index e81743d6a..e13581634 100644 --- a/.pipelines/Modelkit E2E Test.yml +++ b/.pipelines/Modelkit E2E Test.yml @@ -49,19 +49,28 @@ schedules: # check out the same-named release branch from ModelKitArtifacts so the # artifact content matches the modelkit release. For all other branches # (e.g. main scheduled runs, manual queue from main), fall back to main. -# Build.SourceBranch is in the form 'refs/heads/release/' which is a -# valid ref value here. +# +# Azure Pipelines only allows template expressions in the *value* position of +# a repository resource's `ref` (not as a YAML key inside `repositories`), so +# the conditional is resolved here in a top-level compile-time variable and +# the `ref` field simply references that variable. +# Build.SourceBranch is in the form 'refs/heads/release/', which is a +# valid `ref` value for a GitHub repository resource. # See: https://learn.microsoft.com/azure/devops/release-notes/2022/sprint-212-update#template-expressions-in-repository-resource-definition +variables: + - name: artifactsRef + ${{ if startsWith(variables['Build.SourceBranch'], 'refs/heads/release/') }}: + value: ${{ variables['Build.SourceBranch'] }} + ${{ else }}: + value: main + resources: repositories: - repository: ModelKitArtifacts type: github endpoint: github.com_yuesu_microsoft name: gim-home/ModelKitArtifacts - ${{ if startsWith(variables['Build.SourceBranch'], 'refs/heads/release/') }}: - ref: ${{ variables['Build.SourceBranch'] }} - ${{ else }}: - ref: main + ref: ${{ variables.artifactsRef }} parameters: # --------------------------------------------------------------------