SOLVED

Complete pipeline execution with warning?

Brass Contributor

Hello,

 

While running pipeline, it either completes as Success(Green color), Error(Red color) or Cancelled(White circle with borders) as shown below

tanulbhasin_2-1677005810502.png

 

Is it possible complete this with warning(Yellow color) on the basis of some condition inside pipeline.

 

Please help. Thank you.

 

Kind Regards,

Tanul

3 Replies

@tanulbhasin 

  • 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.
best response confirmed by tanulbhasin (Brass Contributor)
Solution

@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 

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;]"

 

1 best response

Accepted Solutions
best response confirmed by tanulbhasin (Brass Contributor)
Solution

@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 

View solution in original post