Basically, I have 2 Individual Azure Pipelines (CI, CD). And, I have enabled trigger only for the CI pipeline. Once the CI (build) pipeline was completed, it should trigger the CD pipeline. And, I am passing the parameters and variables in the CI pipeline. But, I want to utilize the same CI parameter values in the CD pipeline also.
### CI Pipeline ###
parameters:
- name: environment
displayName: 'Choose Environment'
type: string
default: Dev
values:
- Dev
- Qa
- Stage
- Demo
- Live
variables:
- group: PoC-Web
- group: PoC-Secrets
- name: version
In the CI Pipeline, am using the environment parameter and declaring the version variable. Now, I want to Utilize these values in the CD Pipeline.
### CD Pipeline ###
resources:
pipelines:
- pipeline: web-ci
source: PoC-Web-CI
trigger:
branches:
include:
- cicd/azure-pipelines
- develop
stages:
- stage: 'Package_Deploy'
jobs:
- deployment: 'Deploy_to_Server'
environment: 'PoC-Web.PoC_WEB_SERVER'
strategy:
rolling:
deploy:
steps:
- task: CmdLine@2
inputs:
script: |
echo "Fetching CI Pipeline Environment Variables"
echo "Pipeline-ID: $(resources.pipeline.web-ci.pipelineID)"
echo "Source-Commit: $(resources.pipeline.web-ci.sourceCommit)"
echo "Version: $(resources.pipeline.web-ci.version)"
echo "Version: $(resources.pipeline.web-ci.variables.version)"
echo "environment: $(resources.pipeline.web-ci.parameters.environment)"
echo "environment: $(resources.pipeline.web-ci.templateParameters.environment)"
In the above CD pipeline, am able to get the pipeline-Id & Source-Commit (i.e., predefined variables). But unable to fetch the user-defined variables and parameter values like version and parameter.
An early reply would be appreciated.