Jon Gabrielson commented on issue #35422 at GitLab.org / GitLab FOSS

Jon Gabrielson
2019-03-01T14:10:57Z

I would like something similar to this. Instead of only running a scheduled job if the repository has changed, I would like to only run a scheduled job if that pipeline hasn't ran by any method in the past 30 days. Basically, I want to only run a scheduled job on stale branches.

There are two use cases for this:

The first is to do cleanup/teardown/alerts of stale branches/environments.

The second is to rebuild golden images based on upstream dependencies. Just because a repository hasn't changed doesn't mean that the base os, packages, security updates, etc.. haven't changed.

The only way to currently do this would be to have a daily scheduled job spin up, check the latest pipeline status via API, and then abort if last run was recent. I'm not sure the pipeline API keeps enough history to be able to see when the last successful pipeline run was and it doesn't have details on individual jobs only on the total pipeline.