How can I set ENVIRONMENT status in Azure DevOps yaml pipeline

0 votes

I am creating a CICD pipeline in Azure DevOps. I have a pipeline that has a name set dynamically.

name: 'Set dynamically below in a task' 

Then in BUILD stage I update it

[string] $date = (Get-Date -Format 'yyyyMMdd')
[string] $projectVersion = (Get-Content 'version.json') -join "`n" | ConvertFrom-Json | Select -ExpandProperty "version"      
[string] $buildName = "$projectVersion.$(Build.BuildId)+$date.API"     
Write-Host "##vso[build.updatebuildnumber]$buildName"

I have currently 3 stages

  1. Build
    • builds up
    • set build name via VSO command
    • publish artifact
  2. Deploy to DEV
    • download artifact and deploy to the dev environment
  3. Deploy to TEST
    • download artifact and deploy to test environment

I am actually using ENVIRONMENT within Azure DevOps to track all deployments and here is the problem. While pipeline build number is updated properly in Pipelines view

Pipelines view

when I go to Environments tab the not so updated build name is being displayed.

Pipeline view

How can I change that?

Mar 21, 2022 in Other DevOps Questions by Kichu
• 19,040 points
2,010 views

No answer to this question. Be the first to respond.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
0 votes
FIRSTENVIRONMENT
echo "##vso[task.setvariable variable=VAR1;isOutput=true;]$VALUE";

SECONDENVIRONEMENT
- job: ‘JOBNAME’
       variables:
         var2: $[ dependencies.Build.outputs[Firstenvironment.VAR1] ]


This will help you to set between two environments.
answered Mar 22, 2022 by narikkadan
• 63,600 points

edited 5 days ago

Related Questions In Other DevOps Questions

0 votes
1 answer

How can I preview PowerPoint files in Azure DevOps (VSTS)?

No, there are no viewers for attachments ...READ MORE

answered Feb 9, 2022 in Other DevOps Questions by Bhavitha
• 1,000 points
720 views
0 votes
0 answers

How to set environment variables in Dockerfile via Azure DevOps

My  environment variables look like this: ENV ACCEPT_EULA=Y ENV ...READ MORE

Apr 12, 2022 in Other DevOps Questions by Kichu
• 19,040 points
4,199 views
0 votes
0 answers
0 votes
1 answer

How to configure and execute Azure Devops classic editor pipeline after commit in Github?

If you're looking for CI/CD triggers, all ...READ MORE

answered Feb 10, 2022 in Other DevOps Questions by Bhavitha
• 1,000 points
1,195 views
0 votes
0 answers
0 votes
0 answers

How to set WIP limit in Azure DevOps Board - Sprint View

Is it possible to set WIP limits ...READ MORE

Mar 23, 2022 in Other DevOps Questions by Kichu
• 19,040 points
678 views
0 votes
0 answers

Multiple YAML build pipelines in Azure DevOps

Using the new YAML way I want ...READ MORE

Mar 15, 2022 in DevOps Tools by Kichu
• 19,040 points
1,266 views
0 votes
0 answers
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP