Skip to content

Check repository status when using pipeline schedules

Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.

Description

Cause our group can not afford too many runners, we are using the pipeline schedules to build the project every 30 minutes.

We found all though the latest version of the code was built already, gitlab will still rebuild it after 30 minutes later.

Proposal

When setting pipeline schedules, there would be a checkbox let the user choose should gitlab skip the job if the latest code is built in previous.

Workaround

Create a job in the .pre stage of the pipeline that uses the Pipeline API and checks if the latest completed pipeline for the same ref had the same sha as the current sha. If so, then the pipeline had already run and the job failed, causing the rest of the jobs in the pipeline to be skipped.

There are downsides

  • CI Minutes usage
  • A failed pipeline

Also see #18868 (comment 1591027477)

Feature checklist

Make sure these are completed before closing the issue, with a link to the relevant commit.

Edited by 🤖 GitLab Bot 🤖