Change log group expand behavior on failed jobs

Consider a pipeline like:

steps:
  - commands:
      - echo --- asd
      - echo asd2
      - echo ~~~ zxc
      - echo zxc2
      - exit 1

When this job fails, the zxc log group is automatically expanded in the CI logs. IMO, if I’ve explicitly stated a log group is to be de-emphasized, I intend it to always be that way, even in failures. Rather, I think the last emphasized log group should be expanded.

In my pipelines, I generally have a lot of de-emphasized log groups printing out diagnostic information and running some cleanup code at the end of the job. In the case of most pipeline failures, I generally do not want that stuff expanded bc the useful logs would most likely be in the last emphasized group.

Hey @spark !

Thanks for reaching out to us :wave:

Is this usually from when you generally have multiple commands in the same command step and you attempt to emphasise the logs?

No, these log groups are coming from test scripts which are invoked in the step command.

More realistically, I have something like:

steps:
  - command: run_tests.py

And in my script:

print('~~~ test setup')
...
try:
  print('--- running tests')
  ...
finally:
  print('~~~ cleanup')
  ...

Understood :slight_smile:

In that script case, you’d only want to potentially see the Running tests (emphasised) vs the others - even if they fail the script run?

Hey @spark!

By default, the group that failed will be expanded in the log output.
You can find that logic in the agent agent/bootstrap.go at 573d4bf878378c2fb9f0e37de8ae09345a7e6063 · buildkite/agent · GitHub

Unfortunately, it’s not a behavior we can change at the moment.

Best,