fix(pipeline): load kv based on branch in scheduled drift detection (#31)

This commit is contained in:
Julie Ng 2021-06-29 08:38:38 +02:00 коммит произвёл GitHub
Родитель 3b29b3e0ba
Коммит 65f7bb4495
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
5 изменённых файлов: 20 добавлений и 18 удалений

Просмотреть файл

@ -19,19 +19,16 @@ pool:
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
stages:
- template: stages/ci.yaml
- stage: cd_stage
displayName: CD Stage
variables:
- ${{ if eq(variables.isMain, 'True') }}:
- group: e2e-gov-demo-dev-kv
- ${{ if eq(variables.isProduction, 'True') }}:
- group: e2e-gov-demo-kv
displayName: CD - Deployment
jobs:
- job: deploy
displayName: Terraform Plan and Apply

Просмотреть файл

@ -17,9 +17,9 @@ schedules:
variables:
- template: vars/global.yaml
- ${{ if eq(variables.isMain, 'True') }}:
- ${{ if eq(variables['Build.SourceBranch'], 'refs/heads/main') }}:
- group: e2e-gov-demo-dev-kv
- ${{ if eq(variables.isProduction, 'True') }}:
- ${{ if eq(variables['Build.SourceBranch'], 'refs/heads/production') }}:
- group: e2e-gov-demo-kv
steps:

Просмотреть файл

@ -1,6 +1,6 @@
stages:
- stage: CIStage
displayName: CI
displayName: CI - Integration
jobs:
- job: CIJob
displayName: Terraform - Lint and Validate

Просмотреть файл

@ -1,18 +1,19 @@
steps:
- bash: |
echo ""
echo ""
echo "***** Confirm Key Vault Integration *****"
echo "Fail pipeline if no key vault is loaded before Terraform tries and fails."
echo "--------------------------------"
echo "Confirm Key Vault 🔑 Integration"
echo "--------------------------------"
echo "KV_DEBUG_ENV: $KV_DEBUG_ENV"
echo ""
if [ "$KV_DEBUG_ENV" = '$(kv-debug-env)' ]; then
echo "Key Vault not loaded. If loaded properly, debug env value would be 'dev' or 'production'."
echo "⛔️ Key Vault not loaded"
echo "Please double check configuration Variable Groups in Azure Pipelines UI and that the YAML pipeline is running against the `main` or `production` branch."
exit 1
else
echo "Key Vault loaded for: $KV_DEBUG_ENV"
echo "Key Vault loaded"
fi
displayName: Debug - Key Vault loaded?
env:
KV_DEBUG_ENV: $(kv-debug-env)
KV_DEBUG_ENV: $(kv-debug-env)

Просмотреть файл

@ -1,5 +1,9 @@
steps:
- bash: |
echo ""
echo "---------"
echo "Debugging"
echo "---------"
echo "isMain: ${{ variables.isMain }}"
echo "isProduction: ${{ variables.isProduction }}"
echo "Build.SourceBranch: ${{ variables['Build.SourceBranch'] }}"