Maven / GitLab CI Basics Interview Questions
What is the 'needs' keyword in GitLab CI/CD and what problem does it solve?
The needs keyword creates a directed acyclic graph (DAG) of job dependencies, allowing jobs to start as soon as their specific dependencies are complete - rather than waiting for the entire previous stage to finish. This reduces total pipeline time significantly.
stages: - build - test - deploy build-frontend: stage: build script: npm run build artifacts: paths: [dist/] build-backend: stage: build script: go build -o api ./cmd artifacts: paths: [api] # Without needs: test-frontend must wait for BOTH build jobs to finish # With needs: test-frontend starts as soon as build-frontend is done test-frontend: stage: test needs: - build-frontend # only waits for this specific job script: npm test test-backend: stage: test needs: - build-backend # only waits for this specific job script: go test ./... deploy: stage: deploy needs: - test-frontend - test-backend script: ./deploy.sh
Key behaviours with needs:
- Jobs with
needscan run out of stage order -needsoverrides stage sequencing - A job with
needs: [](empty list) starts immediately when the pipeline creates - By default, a job with
needsdownloads artifacts from the listed jobs - Set
artifacts: falsein needs to skip downloading artifacts
Invest now in Acorns!!! 🚀
Join Acorns and get your $5 bonus!
Acorns is a micro-investing app that automatically invests your "spare change" from daily purchases into diversified, expert-built portfolios of ETFs. It is designed for beginners, allowing you to start investing with as little as $5. The service automates saving and investing. Disclosure: I may receive a referral bonus.
Invest now!!! Get Free equity stock (US, UK only)!
Use Robinhood app to invest in stocks. It is safe and secure. Use the Referral link to claim your free stock when you sign up!.
The Robinhood app makes it easy to trade stocks, crypto and more.
Webull! Receive free stock by signing up using the link: Webull signup.
More Related questions...
