Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(pipelines): var group conditional must use compile time syntax #40

Merged
merged 1 commit into from
Nov 4, 2021

Conversation

julie-ng
Copy link
Collaborator

@julie-ng julie-ng commented Nov 4, 2021

Not 100% sure why this doesn't work

variables:
- template: vars/global.yaml
- ${{ if eq(variables.isMain, 'True') }}:
  - group: e2e-gov-demo-dev-kv
- ${{ if eq(variables.isProduction, 'True') }}:
  - group: e2e-gov-demo-kv

but my guess is that variables.isMain etc. isn't immediately available because they are defined in vars/global.yaml and may not be able at compile time in the next line of code. Switching back to variables['Build.SourceBranch'] which is a predefined system variable and available from beginning.

So hoping this syntax works:

- ${{ if eq(variables['Build.SourceBranch'], 'refs/heads/main') }}:
  - group: e2e-gov-demo-dev-kv

@azure-pipelines
Copy link

🟢  No configuration drift detected

Source Version: ad22a76

@julie-ng julie-ng merged commit 8045ea4 into main Nov 4, 2021
@julie-ng julie-ng deleted the fix/pipeline-conditional branch November 4, 2021 11:33
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.

1 participant