Azure / devops-governance

Example end-to-end Governance Model from CI/CD to Azure Resource Manager. Use this project to deploy example AAD, ARM and Azure DevOps resources to learn about e2e RBAC.
MIT License
189 stars 93 forks source link

global.yaml environment variables not populated #38

Closed taljundi closed 3 years ago

taljundi commented 3 years ago

This issue is for a: (mark with an x)

- [ ] bug report -> please search issues before submitting
- [ ] feature request
- [x] documentation issue or request

Minimal steps to reproduce

Create the same pipeline structure as the project:

│   cd.yaml
│   ci.yaml
│   main.tf
│   pr-main.yaml
│   pr-production.yaml
│   provider.tf
│   README.md
│   schedule-drift.yaml
│   var.tf
│
├───stages
│       ci.yaml
│       pull-request.yaml
│
├───steps
│       confirm-kv-loaded.yaml
│       debug-vars.yaml
│       terraform-init.yaml
│       terraform-plan.yaml
│
└───vars
global.yaml

Any log messages given by the failure

In Azure DevOps pipeline, running it against the main branch, the isMain is not populated in the Debug - Branch Variables step and I get the following:


Debugging

isMain: isProduction: Build.SourceBranch: refs/heads/main Finishing: Debug - Branch Variables


### Expected/desired behavior
>
I expect the isMain: true

### Versions
>

Task : Bash Description : Run a Bash script on macOS, Linux, or Windows Version : 3.189.0 Author : Microsoft Corporation Help : https://docs.microsoft.com/azure/devops/pipelines/tasks/utility/bash


### Mention any other details that might be useful

> ---------------------------------------------------------------

The pipeline is fails at "Debug - Key Vault loaded?" step

Confirm Key Vault 🔑 Integration

KV_DEBUG_ENV: ***

⛔️ Key Vault not loaded Please double check configuration Variable Groups in Azure Pipelines UI and that the YAML pipeline is running against the 'main' or 'production' branch.

[error]Bash exited with code '1'.

Finishing: Debug - Key Vault loaded?


although $KV_DEBUG_ENV" != '$(kv-debug-env)
taljundi commented 3 years ago

Fix is to change the syntax in debug-vars.yaml from: ${{ variables.isMain }} to $(isMain)