It would be very convenient for me to have an option to run a shell command in the top-level executor before the matrix jobs are run.
I want to use it to run style checks on a pull request before compilers are started. Failing the sanity check should fail the job without wasting time compiling non-conforming code.
What I considered:
- Running style check on all executors - suboptimal and confusing. The checker does not depend on any axis parameters.
- Pre-SCM plugin - not good, as I need to run the checker after the code checkout, obviously.
- Existing code checker plugins - they all run known checkers (like cppcheck), I want to run a custom script).
- Multiple jobs in parallel - doesn't address the issue of time saving. Also, I want a single PR builder to talk to Stash and to post one single result at the end to prevent confusion.
- Chained jobs - Stash pull request builder is not flexible enough to chain pull request builders. It expects to poll Stash and post the result in the same job.
What I'm using now:
- One axis has a value "StyleCheck" in addition to other, legitimate values.
- For the "StyleCheck" build, the combination filter selects one value for every other axis.
- The "StyleCheck" build is the touchstone build, i.e. it runs first and makes the job fail if it fails.
- The execute command has a special case for the "StyleCheck" build.
Needless to say, it's quite convoluted. Having an extra box for a pre-fork script would make it trivial.