Azure DevOps deployment environment name variable not resolved

Carlin Scott March 29, 2024

I'm deploying using an azure-pipelines.yml file and the environment name is not getting resolved in Jira:


The yaml looks like this:

- ${{ if eq(variables['Build.SourceBranch'], 'refs/heads/UAT') }}:
- name: environment
value: UAT

- deployment: Deploy
  environment: $(environment)
That variable is resolved properly by Azure DevOps (ADO) as part of the build, but from looking at the webhook call ADO made to the Jira app, it wasn't included. I'm guessing the app looked at my azure-pipelines.yml file and extracted the value directly. But maybe something else happened?
The environment name is UAT and I haven't explicitly mapped it to an environment type; I kind of hoped UAT would already be mapped to Staging. Regardless, I expected the name to still show in Jira correctly.

2 answers

1 accepted

0 votes
Answer accepted
Carlin Scott April 4, 2024

You need to use a conditional insertion or template expression for the environment name to resolve in Jira.

Example only using conditional insertion:

- deployment: Deploy
${{ if eq(variables['Build.SourceBranch'], 'refs/heads/main') }}:
name: Production
${{ else }}:
name: Development

Example using template expression and conditional insertion:

- ${{ if eq(variables['Build.SourceBranch'], 'refs/heads/main') }}:
- name: environment
value: Production
- ${{ else }}:
- name: environment
value: Development

- deployment: Deploy
  environment: ${{ variables.environment }}


0 votes
Carlin Scott March 29, 2024

I'm going to try using the template expression to set the environment parameter directly to see if that resolves my issue. I suspect it will, because azure devops provides an azure-pipelines-expanded.yaml file with each build, and it has already resolved all the template expressions.

Carlin Scott April 1, 2024

This did not work. The App is using the pre-rendered pipeline.yml. This is a bug.

Carlin Scott April 2, 2024

I reported the issue to Atlassian using the product feedback button. We'll see if they fix it.

Carlin Scott April 4, 2024

They fixed it.

Suggest an answer

Log in or Sign up to answer
AUG Leaders

Atlassian Community Events