Gatekeeper to skip redundant builds (in workflows!)

circle.yml
workflow
2.0

#1

We have logic present to determine when builds are redundant that takes into account more than just the SHA. I’m wondering the best way to port this forward into workflows.

What I’d like to do is create a job that tests if the build is redundant or not, then halts the build (with success or skipped status) at that point.

In current workflows, I see two options:

  1. Create a “redundancy checker” job. If build is redundant, exit with error status. Make all other jobs dependent on it, so no others start.
  • This fails to meet my requirement that I’d like to see the job as a pass or skip. Red lights are annoying.
  1. Create a marker file and persist_to_workspace. (e.g. touch .run_tests). In every other workflow stage, restore the workspace, then test this value on each build step. For example:
- run: [ -f .run_tests ] && bundle exec rubocop

Is there any simpler alternative than using option 2, as it’s a lot of boilerplate and makes it harder to see the tests underneath the noise.

One solution would be to provide (and let Circle handle) a special escape code the same way git-bisect does: Returning 125 could halt the build, but leave a skip/successful status. I’d also be happy with a built-in command like halt_build a la checkout, persist_to_workspace and friends.

Tips? Anything I’m missing?


#2

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