How to prevent build if another build on same branch/tag is in progress

Replace this template with your information

Describe your question in as much detail as possible:
We use a cms called contentful, each time a content is published in cms we need to run a build and deploy the new content to website.

We used to use Jenkins, in jenkins on each branch for the first time a build was started, then next build trigger put the build in queue, then after that any request for new build was ignored (as there was one build in a queue)

We migrated to gitlab cicd, and using build triggers to trigger a build from cms, now the issue is by each change a new build is triggered, so for example last night there were 130 build triggered, Wondering if there is any way (a parameter in the build trigger api call) to prevent starting a build if there is a build already in progress on same branch/tag?

(We trigger the new build by using and passing token)

  • What are you seeing, and how does that differ from what you expect to see?

  • Consider including screenshots, error messages, and/or other helpful visuals

  • What version are you on? Are you using self-managed or

    • GitLab (Hint: /help): 14.10-ee
    • Runner (Hint: /admin/runners):
  • Add the CI configuration from .gitlab-ci.yml and other configuration if relevant (e.g. docker-compose.yml)

  • What troubleshooting steps have you already taken? Can you link to any docs or other resources so we know where you have been?

Thanks for taking the time to be thorough in your request, it really helps! :blush: