Pipeline Triggers: The 'If This, Then That' of CI/CD

Pipeline triggers are the "if this, then that" for automation. They kick off builds on a code push (CI), run tests for a pull request (PR), or execute jobs on a schedule. The footgun: many systems enable triggers on all branches by default, causing unwanted.
Why it exists
Without triggers, CI/CD pipelines would need to be run manually. This defeats the purpose of automation, which is to provide fast, consistent feedback. Triggers connect events in your development lifecycle, like pushing code, directly to the automated processes that build, test, and deploy it.
The mental model
Think of a pipeline trigger as a sensor with a specific instruction. A "push to main branch" sensor detects that event and says "run the deployment pipeline." A "new pull request" sensor detects its event and says "run the validation build." Each trigger is a rule that connects a cause (a repository event) to an effect (a pipeline run).
How it works
You define triggers in your pipeline configuration file, typically a YAML file. The syntax specifies the event type (CI, PR, schedule) and any filters. For example, a CI trigger might watch only the main and develop branches. When your CI/CD platform detects an event that matches a trigger's definition, it executes the pipeline. Common trigger types are Continuous Integration (on push), Pull Request (on PR creation/update), scheduled (on a timer), and pipeline completion (when another pipeline finishes).
When to use it
Use triggers to automate any repetitive task tied to your codebase. Use CI triggers to build and run unit tests on every push to a feature branch. Use PR triggers to run extensive integration tests and code quality checks before a merge. Use scheduled triggers for tasks like nightly builds, security scans, or generating daily reports.
When not to use it
Avoid overly broad or sensitive triggers. Don't set up a trigger that automatically deploys every push from any branch to production. Also, be mindful of "trigger storms" where one action can set off a cascade of many pipeline runs, especially with pipeline completion triggers. For pipelines with high cost or significant impact, consider making the trigger manual or adding a human approval step.
One canonical example
In a YAML pipeline file, a Continuous Integration (CI) trigger that only runs for pushes to the main branch would look like this: trigger: - main. To disable CI triggers entirely and only run the pipeline manually or via other triggers, you would use: trigger: none. To run a pipeline for any pull request targeting the main branch, you would specify: pr: - main.
Interview question
Which scenario represents a common pitfall or 'footgun' when configuring pipeline triggers?
- a.Disabling CI triggers for a pipeline that requires manual approval for deployment.
- b.Automatically deploying every code push from any branch directly to production.Correct
- c.Running nightly security scans on the main branch using a scheduled trigger.
- d.Executing extensive integration tests on every pull request before merging.
Why? this is the answer
The card explicitly warns against "overly broad or sensitive triggers" such as automatically deploying every push from any branch to production. The other options describe recommended and safe uses of pipeline triggers.
Just read this? Test yourself on what you have been reading.
Read the original → learn.microsoft.com
- #ci/cd
- #automation
- #devops
- #pipelines
You just looked this up. Could you explain it out loud?
That is the part interviews actually test. Tezvyn takes questions like this one and gives you what the interviewer is really checking, the answer that lands, and the mistake that ends the conversation, in the four minutes before your next meeting.
The iPhone app is on the way
We are building it. Until it lands, nothing here is held back from you: every interview card, your saved cards, streaks and the job board all work in Safari, plus hundreds of free practice quizzes of thirty questions each. Sign in and it all carries over to the app the day it arrives.
Want it as an icon? Tap Share at the bottom of Safari, then Add to Home Screen. It opens full screen and the cards you have read stay available offline.
We are hiring for this. Open roles that interview on ci/cd — each one lists the topics its interview covers.
See open roles