I would like to get access to the current build log from a script step in order to analyse the log at the end of the build. Depending on the result, particular actions will be executed. Our main use case for this is the following: We run tests during the build which are likely to fail. If a test fails or if another exception let the build fail, we want to automatically create a ticket in our ticket system with all the available information from the build log:
“normal” build steps where executed as before
the step is the “evaluation” step which takes the build log and searches e.g. for exceptions
if an exception has been found, a ticket containing the build log will be created in a foreign ticket system using e.g. a REST call
We’ll have to discuss this quite a bit, to make sure this is the best solution for the use case you described, or come up with something easier than requiring you to write your own log parser just to find the section of information you’re interested in.
Right now we can’t promise that this feature will be prioritized in the near future, but if it gets enough attention (votes) then of course we’ll prioritize it accordingly.
Just an example why this might be a bit misleading if implemented just as a pure “expose the step logs” feature: what if your team mate changes the output tool of the Xcode Test step for example (xcpretty formatted <-> raw xcode log output)?
That will break your parser immediately most likely, and might do it silently, possibly causing a long debugging / “what happened??” session when you start to see strange logs (either incredibly long or completely empty in this case) in your ticketing system.
Just to be sure: I do love your use case, just not sure if this (exposing the logs) would be the best solution, but I don’t have a better idea right now.
@viktorbenei I don’t have a better idea either. However, I expect this being the most easiest solution which will do for sure. Replacing log output tools does not happen spontaneously, and when they do so, they will have an instant feedback…
For us it would really be enough to just exposing the logs. If it’s not a big deal for you then I would prefer it over a shiny solution, which won’t most likely be implemented…
I guess I have a similar issue. Is this already solved? I want to log the error reason into slack. As this seems to be a pretty important information to the user, I thought this should be super easy. However. Its not! I tried now several different approaches.
How to get the error reason why the build failed and then put it into a slack message?
I tried by
envman add --key LOG_ERROR --value “grep --color 'error:' mybitrise.log”
@hhamm you can’t get the build log that way right now. You can use the API to fetch the logs once the build is finished as well as use the Outgoing Webhooks to hook build events into your own system, but there’s no built in way to get the build log during the build in a step - that’s what this #feature-request is for! Vote on it to bump its priority!
I need to parse error message from build log, and send error info to slack channel before the build is finished. How can I do it?
How to use " Outgoing Webhooks to hook build events into your own system"?