Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-56064

Matrix project plugin - add a shell script to be run in top-level executor only

    XMLWordPrintable

    Details

    • Similar Issues:

      Description

      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.

        Attachments

          Activity

            People

            Assignee:
            kohsuke Kohsuke Kawaguchi
            Reporter:
            proski Pavel Roskin
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: