1
votes

In my build pipeline I am running Pester tests and reporting to the output folder. During release I want to run these and only go to the next stage (deploy) if all tests pass. I am not concerned about the results, I just want to make sure that they all pass. I have tried to 'copy' my existing yaml file using the GUI however not sure of the best way to do this and variable scope. Is it possible to translate a build pipeline directly to an Azure release pipeline in Azure Devops and if so, what is the best approach for doing this?

I tried to translate it to json however i had an undefined error when I tried to import the json pipeline. I should also add that I can't see a solution by looking at the preview features for this.

1
Are you looking to fail the build if any of your tests fail? Also, my recommendation would be to keep both your build and release within your YAML pipeline. You will be able to easily stop your pipeline from proceeding by using dependsOn and condition parameters within your release stage.Max Morrow
Yes I am looking to fail the release if any of the tests fail. I've managed to get it running however as a powershell script so not through a test runner, so I don't know how to fail the release if any of the tests fail.i'i'i'i'i'i'i'i'i'i
Got it, that makes sense, can you share the script you're using to run the tests?Max Morrow

1 Answers

1
votes

I am afraid it is not possible to translate a build pipeline directly to an Azure release pipeline.

You need to manually add the same tasks which are in the build pipeline to the release stage. I believe it is not a complex work to create a stage with the same tasks in the release pipeline. You just need to add each tasks with the same configurations(copy and paste mostly). And create the same variables in Variables tab. Check document about classic CD release pipeline.

There is another workaround using multiple stages yaml pipeline instead of classic release pipepline.

With multiple stage yaml pipeline. You can just easily move your build yaml content in a stage. Check here for more information. See below:

trigger: none

stages:
- stage: Test
  jobs: 
  - job: Pester tests
    pool:
      vmImage: windows-latest
    steps:
    ..

- stage: Deploy
  jobs: 
  - job: DeployJob
    pool:
      vmImage: windows-latest
    steps:
    ..