change198
change198

Reputation: 2065

how to display and raise warnings in release pipeline for Azure devops

In my azure devops release pipeline, i'm running a python script, which eventually logs warning or error based on the my custom logger package. So, in my std output of the azuredevops I see it's working fine.

But, I'm wondering is it possible to display the number of warnings or error on the badge like this below image. I think, you have to use command line loggings. But question comes how can I track the warnings or errors from AzDevops standard output using python.

Any idea and suggestions are welcome.

enter image description here

Upvotes: 4

Views: 3419

Answers (2)

mshafer
mshafer

Reputation: 21

You can utilize output the logging commands from python with a print function call (python3 - if using python 2, you can import print function from futures)

print("##[group]Beginning of a group")
print("##[warning]Warning message")
print("##[error]Error message")
print("##[section]Start of a section")
print("##[debug]Debug text")
print("##[command]Command-line being run")
print("##[endgroup]")

Upvotes: 0

change198
change198

Reputation: 2065

I tried using this in my python package and it works the way I wanted to.

subprocess.call(["echo", "##vso[task.logissue type=warning;]some warning"])

May be someone can get help out of this.

Upvotes: 4

Related Questions