You need a pipeline to build a branch automatically on push without polling. How do you wire it?
BeginnerScenarioJenkins Pipelines and Agents
Answer
Situation read → Polling SCM wastes load and adds delay.
What I'd do →
- Use a Multibranch or Organization folder job with the GitHub Branch Source plugin.
- Add a webhook in the repo to
https://jenkins.example.com/github-webhook/(or/multibranch-webhook-trigger/invoke?token=...). - Keep a long periodic scan (for example 1 day) only as a safety net.
Why → Push events trigger within seconds, and the controller does not poll hundreds of repos.
Interview tip → Mention that the webhook endpoint must be reachable from the SCM, so check ingress and firewall.
More on Jenkins Pipelines and Agents
Your team still builds jobs by clicking through Freestyle jobs in the Jenkins UI. A new service is starting. What do you set up instead?BeginnerA Jenkins build takes 40 minutes because unit tests, linting and security scans run one after another. How do you speed it up?BeginnerBuilds queue for 20 minutes during the morning rush, but the Jenkins nodes are mostly idle at night. What do you do?IntermediateA build works on agent A but fails on agent B with "command not found: mvn". How do you stop this class of problem?BeginnerOnly the main branch should deploy; feature branches and PRs should only build and test. How do you express this?BeginnerA pipeline sometimes hangs forever on a flaky network call and holds an executor. How do you protect the system?Beginner