Maven / GitLab CI Basics Interview Questions
What are GitLab CI/CD artifacts and how do you use them?
Artifacts are files and directories that a job produces and saves after it finishes. They serve two purposes: downloading results from the GitLab UI, and passing files between jobs in subsequent stages.
build-job: stage: build script: - npm ci - npm run build # creates dist/ directory artifacts: paths: - dist/ # save entire dist directory - coverage/report.html # save a specific file exclude: - dist/**/*.map # exclude sourcemap files expire_in: 1 week # auto-delete after 1 week (default: 30 days) when: always # save artifacts even if job fails test-job: stage: test script: - ls dist/ # artifacts from build-job are available here! - npm test dependencies: - build-job # explicitly specify which artifacts to download # JUnit test reports (display inline in MR UI) test-with-report: stage: test script: - pytest --junitxml=report.xml artifacts: reports: junit: report.xml
| when value | Behaviour |
|---|---|
| on_success (default) | Save artifacts only when job succeeds |
| on_failure | Save artifacts only when job fails (useful for debug files) |
| always | Save artifacts regardless of job result |
Automatic download: by default, jobs automatically download artifacts from all jobs in preceding stages. Use dependencies: [] to opt out, or list specific jobs to download from.
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...
