Disable Auto DevOps pipelines when user pushes several branches and tags to project

This is a follow-up issue from Enable AutoDevOps by default and Automatically disable Auto DevOps for project upon first pipeline failure

After #39923 (closed) Auto DevOps is automatically turned off if project has:

  • Auto DevOps implicitly enabled
  • No successful Auto DevOps pipeline
  • and the first Auto DevOps pipeline failed

But we're not handling the scenario when a user pushes a several amount of branches and tags to project. For example, per @ayufan comment https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/21172#note_98548637

What happens if?

  1. User creates a new empty repo,
  2. Do mirror push with 1000 branches and 2000 tags? Will we create 3000 pipelines till auto-devops disabler kicks-in?

Currently, we're going to create 3,000 pipelines, disable ADO when the first one fails, but we'll still have 2,999 ADO pending pipelines running. A possible solution will be to cancel all pending pipelines after ADO has been disabled.

Edited by Dylan Griffith