While creating yml for my build. I am having multiple environments, namely Dev, QA and Production, and have three Git branches acting as base feature branches representing each environment.
I have created their matching variable groups and trying to create a pipeline which runs on merge of Pull Request against each of these branches. Variables’ name in all three of them groups are identical, just their value differs.
Following is my YAML for Azure DevOps pipeline i have created
# specific branch build with batching
trigger:
batch: true
branches:
include:
- master
- DEV
- QA
paths:
exclude:
- README.md
pr: none
jobs:
- job: Deploy
variables:
- ${{ if eq(variables['System.PullRequest.TargetBranch'], 'refs/heads/master') }}:
group: sfdx-org-prod
- ${{ if eq(variables['System.PullRequest.TargetBranch'], 'refs/heads/QA') }}:
group: sfdx-org-qa
- ${{ if eq(variables['System.PullRequest.TargetBranch'], 'refs/heads/DEV') }}:
group: sfdx-org-dev
# Define the pipeline jobs
steps:
- script: |
echo $(System.PullRequest.TargetBranch)
echo $(OrgAlias)
echo $(SalesforceUserName)
displayName: "Selected Variable Group"
When I am running the build, I am getting error saying “OrgAlias: command not found”
Image of Error Output
I have checked all variable groups, their labels, etc. can’t find anything off.
sfdx-org-dev Variable Group
Since I want this build to be automated and free from user inputs, i am not implementing “runtime parameters”.
Any input would be great. Thanking in advance.
I cross checked the varaible labels and matched them against the one in YAML.
Changed bash to script in job.
Ideally i would like it to dynamically fetch the values of variables in variable groups.
Shashank is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.