Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

programatically parse bitbucket pipeline log file of previous step

Magnus Kriel September 13, 2021

I was wondering if Bitbucket pipelines has a mechanism to parse the log file of the previous step?

I have situations where the log file generated from my build step contains warning messages which is not a hard fail but would like the catch the warning messages by searching for known specific warning messages and fail the build step if found.

Is this possible?

1 answer

0 votes
Eduardo Asenjo September 14, 2021

As workaround. If you're the one running specific commands, you can always prepare the ground for that.

 

In your own commands with warnings you can store that information in a log file or similar, in a particular folder. Then in that particular step use `artifacts` to keep those files available to download or any step that is coming after.

 

Reuse those artifact files to read them and identify if inside them you've any of those 'warning' or the flag that you used.

 

Would that work for you?

Magnus Kriel September 15, 2021

Almost. The commands used is the python coverage command which runs unit tests etc. If I can somehow pipe the stdout to a file while the command is running, I can then use the log file as an artifact as you mentioned.

Is it possible to pipe (split) the output of a command to a file without disrupting the standard flow of stdout/stderror?  

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
TAGS
AUG Leaders

Atlassian Community Events