Skip to content

Fail pipeline early when there is rspec failure related to MR changes

Albert Salim requested to merge caalberts-rspec-short-circuit-pipeline into master

What does this MR do?

Provide faster feedback to MR authors by failing the pipeline early when there is rspec failure related to the MR changes.

This is done by:

  • Adds a rspec fail-fast job that runs in parallel to other rspec * jobs. This job runs test files that have been identified in detect-tests job.
  • Adds a cancel-current-pipeline job that would run if rspec fail-fast job failed. This job will cancel the ongoing pipeline and all its jobs.

The jobs are dependent on the following CI variables:

  • RSPEC_FAIL_FAST_ENABLED=true needs to be explicitly set in order for the 2 jobs to be created. Otherwise, the pipeline will run as per status quo, without failing early
  • RSPEC_FAIL_FAST_TEST_FILE_COUNT_THRESHOLD - this sets the threshold number of test files in order to keep the rspec fail-fast job duration short. The job detect-tests detects a list of test files that may be affected by the MR. If the number of test files is greater than the threshold, the rspec fail-fast job ends without running the tests. All the other rspec jobs in the pipeline runs as per normal. This is to prevent rspec fail-fast taking too long and delaying the entire pipeline.

For MR authors:

  • MR authors may choose to skip the fast feedback by adding [SKIP RSPEC FAIL-FAST] in the MR title.

Test plan

Measurements

Leading indicators:

Lagging indicators:

  • average cost of MR pipeline
  • average cost of MR failed pipeline -- not sure if we have this at the moment?

Does this MR meet the acceptance criteria?

Conformity

Part of #227531 (closed)

Edited by Albert Salim

Merge request reports