M Yil
M Yil

Reputation: 967

Azure Devops for multiple angular environments

I make use of Azure Devops. I want a test and production environment for my angular project. The test environment should have the artifact deployed based on the command "ng build" and the production environment should have the artifact deployed based on the command "ng build --prod".

What is the best approach for this? I have made for each branch (master/dev) a yaml file, in this file I generate the correct build/artifact. I also have two release pipelines, one listens to builds from dev and one to builds from the production branch. After it is triggered, It deploys the right artifact to the right App Service.

Is this a good solution? Because I can't find good information about this. Should I for example use multi-stage build pipeline in order to create both artifacts whether there are changes to prod or dev branches and have ONE release pipeline with multiple environments which take the correct artifact?

Upvotes: 2

Views: 1636

Answers (1)

Andy Li-MSFT
Andy Li-MSFT

Reputation: 30372

No sure how to deploy based on the commands, however you can try achieving that based on build tags. You can write and run a script by calling the REST API: Tags - Add Build Tags in the build pipeline to add tags for a build.

For example:

For test environment, you can add a tag test for the specific build which is triggered based on the command "ng build".

For production environment, add a tag prod for the specific build which is triggered based on the command "ng build --prod".

Then you can set filters based on the tags in the release pipeline for both Test and Prod environments:

enter image description here

Upvotes: 1

Related Questions