What makes a step "complete"?

It seems like steps “complete” (pass or fail) only once all processes invoked by the command the step represents return an exit code, or the step hits the timeout. I can’t find any docs to back this up however, and I’m curious if there are other cases that can cause a step to “complete”.

Well, I’ve proven my assumption to be partially false. Processes sent to the background in a run step with the & operator do not seem to factor into a step “completion”.

Under normal circumstances, a step completes when a command returns a non-zero exit code or if all commands return zero. As long as the background process starts successfully, it will then not factor in.

1 Like

Thanks for the info, Feliciano! Is this mentioned anywhere in the docs, for future reference?

Edit: What violates “normal circumstances”?

There’s a when attribute that can change how the step(s) run or don’t run: https://circleci.com/docs/2.0/configuration-reference/#the-when-attribute

I’m familiar with the when attribute, but that doesn’t change how a step “completes”, right? Just when the step is run?

True. I was thinking about it from the perspective of, a command with an exit code other than zero, which would typically end the job, would not and let the step continue to the step when a when attribute that allows this.

There’s also when you change the default shell options where the behavior can be different: https://circleci.com/docs/2.0/configuration-reference/#default-shell-options

2 Likes

Excellent, thanks again for enlightening me Feliciano!

1 Like

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.