Expose retry status through env var or buildkite-agent

Let’s say we have a step with some automatic retry policy and we have a plugin to do something based on the final exit status (after exhausting the retry policy), e.g. by having the plugin just ignore any non-final step results.

Today, we have these env vars:

  • BUILDKITE_COMMAND_EXIT_STATUS
  • BUILDKITE_RETRY_COUNT

Both of these don’t seem to make possible what we want. Maybe we could add a BUILDKITE_AUTO_RETRY_FINISHED or so?

Hi @koenlek, welcome to the forum and thanks for this question.
I’d like to help but I don’t quite understand the problem. Would you like to be able to use env vars to determine if the current iteration of the step is the last one in the automatic retries? So you could have the BUILDKITE_AUTO_RETRY_FINISHED var or possibly a BUILDKITE_MAX_RETRY_COUNT that you can use to compare against?

And do you have a more specific example of what you are trying to achieve?