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(pipeline): load kv based on branch in scheduled drift detection #31

Merged
merged 1 commit into from
Jun 29, 2021

Conversation

julie-ng
Copy link
Collaborator

@julie-ng julie-ng commented Jun 29, 2021

Problem

Scheduled Drift Detection Builds were failing because the key vaults with the credentials were not being loaded.

Error Message

***** Confirm Key Vault Integration *****
Fail pipeline if no key vault is loaded before Terraform tries and fails.
KV_DEBUG_ENV: $(kv-debug-env)

Key Vault not loaded. If loaded properly, debug env value would be 'dev' or 'production'.
##[error]Bash exited with code '1'.

Cause

The - template: vars/global.yaml is loaded but its values, e.g. variables.isMain do not seem to be immediately available in the same global variables: scope.

Solution

Use Built-In variables instead of my preferred cleaner version:

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

@azure-pipelines
Copy link

🟢  No configuration drift detected

Source Version: b987772

@julie-ng julie-ng changed the title fix pipeline branch name targets as variables fix(pipeline): load kv based on branch in scheduled drift detection Jun 29, 2021
@julie-ng julie-ng merged commit 65f7bb4 into main Jun 29, 2021
@julie-ng julie-ng deleted the fix/cd-pipeline branch June 29, 2021 06:38
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.

None yet

1 participant