I have a task that runs Cypress:
-ErrorAction SilentlyContinue
cd $(System.DefaultWorkingDirectory)/_ClientWeb-Build-CI/ShellArtifact/
npx cypress run
And I've set the ErrorActionPreference
to continue
. But when my Cypress fails:
##[error]PowerShell exited with code '1'.
The next task is canceled and the release failed. How do I continue the release even Cypress failed, and is it possible to give a boolean a true/false value based on the Cypress task result?
If you click on your stage box on the main pipeline window, you will see an up and down arrow. Click on this to expand the stage and then there is a button to re-run the stage. You could always grab the requests it sends (f12) if you need to do this programatically.
However, if you pause a running Stream pipeline job, the current state of the job is saved and the job is gracefully stopped at that point. When the resume command is issued, a new job is started to restart the Pipeline Version from the previously saved state.
PRO TIP: No, Azure DevOps is not being deprecated. Second, Microsoft is introducing a new tool called Azure Automation. Azure Automation is a machine learning platform that can automate the deployment of applications and services. Azure Automation is similar to Azure DevOps Services, but it is not a preview program.
If you want to continue the release even the Cypress task failed, just add to the Cypress task this line:
continueOnError: true
you can put a condition on the subsequent tasks to work even if previous tasks failed.
jobs:
- job: Foo
steps:
- powershell: |
your code here
- script: echo Hello!
condition: always() # this step will always run, even if the pipeline is cancelled
- job: Bar
dependsOn: Foo
condition: failed() # this job will only run if Foo fails
https://docs.microsoft.com/en-us/azure/devops/pipelines/process/expressions?view=azure-devops#job-status-functions
https://docs.microsoft.com/en-us/azure/devops/pipelines/process/conditions?view=azure-devops&tabs=yaml
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With