I have an issue with azure pipelines. I'm trying to create a template so I can push multiple instances like dev and qa. Since Azure doesn't support using variable groups in the template I'm passing them to the template using paramethers. The issue is that I'm getting this error:
##[warning]Unable to expand variable 'TOKEN_QA'. A cyclical reference was detected.
Any ideas how to resolve this issue?
name: ...
trigger: none
variables:
- group: api-mgmt-...-qa
- name: token_qa
value: $(TOKEN_QA)
- name: project_qa
value: $(PROJECT_ID_QA)
- group: api-mgmt-...-dev
- name: token_dev
value: $(TOKEN_DEV)
- name: project_dev
value: $(PROJECT_ID_DEV)
pool:
name: '...'
vmImage: ubuntu-latest
stages:
- stage: "DEV_Deploy"
dependsOn: []
jobs:
- template: ./api-publish_deployment.yml
parameters:
env: "dev"
token: ${{variables.token_dev}}
project: ${{variables.project_dev}}
- stage: "QA_Deploy"
dependsOn:
- "DEV_Deploy"
jobs:
- template: ./api-publish_deployment.yml
parameters:
env: "qa"
token: ${{variables.token_qa}}
project: ${{variables.project_qa}}
parameters:
- name: env
type: string
values:
- dev
- qa
- name: token
type: string
- name: project
type: string
jobs:
- job: Publish_Api
displayName: Publish API on ${{parameters.env}}
steps:
- checkout: self
path: $(Build.Repository.Name)
- task: GoTool@0
displayName: Install Go $(goVersion)
inputs:
version: '1.19'
- task: Bash@3
displayName: Publish API
env:
IDENTIFIER: ...
BASEURL: ...
PROJECT: ${{ parameters.project }}
STAGE: ${{ parameters.env }}
TOKEN: ${{ parameters.token }}
inputs:
targetType: 'inline'
script: |
echo $IDENTIFIER $BASEURL $PROJECT $STAGE
stackit-api-manager project publish \
--identifier $IDENTIFIER \
--baseURL $BASEURL \
--project $PROJECT \
--stage $STAGE \
--token $TOKEN \
--oas config/... .yml
- script: go clean -modcache
displayName: Cleanup Go mod folder
Have just had the same warning message on a pipeline where the resolution was: remove the unused secret variable
This warning message was displayed for every step, but that variable was no longer referenced anywhere in the YAML pipeline.