Forum Discussion
tanulbhasin
Feb 21, 2023Brass Contributor
Complete pipeline execution with warning?
Hello, While running pipeline, it either completes as Success(Green color), Error(Red color) or Cancelled(White circle with borders) as shown below Is it possible complete this with...
- Feb 22, 2023
RobinaThank you the details. This is the only algo can work.
If possible, could you please share any msdn url for creating these labels etc. I don't know the procedure to define custom status or labels for pipelines in azure devops portal. I have searched a lot on google but no luck.
Does this work Logging Commands
Robina
Iron Contributor
- To achieve this, you can define custom statuses or labels for your pipeline runs and use them to differentiate between successful runs, runs with errors, and runs with warnings.
How you could implement this in a pipeline using a condition to trigger a warning status:
- Define custom statuses or labels for your pipeline runs. For example, you could define "SUCCESS" as the status for successful runs, "ERROR" as the status for runs with errors, and "WARNING" as the status for runs with warnings.
- Inside your pipeline, include a condition that checks for the warning condition. For example, you could check if a certain task failed, but not critical enough to mark the pipeline as failed. If this condition is met, set the status or label of the pipeline run to "WARNING".
- When the pipeline completes, the status or label of the pipeline run will be set based on the condition you defined. You can use these custom statuses or labels to differentiate between successful, error, and warning runs.
edrandall-blk
Aug 16, 2023Copper Contributor
Achieved this by echoing the following before the task ends, then exit with status 0:
echo "##vso[task.complete result=SucceededWithIssues;]"
The following will make the task fail (or alternatively, exit with non-zero status):
echo "##vso[task.complete result=Failed;]"