Maven / GitLab CI Basics Interview Questions
What are GitLab CI/CD components and how do they differ from includes?
CI/CD components (introduced in GitLab 16.0) are a more structured, versioned, and discoverable way to share pipeline configuration across projects compared to simple include: project. They are published to the CI/CD catalog.
# Using a CI/CD component in .gitlab-ci.yml: include: - component: $CI_SERVER_FQDN/myorg/my-components/deploy@1.0.0 inputs: environment: production image_tag: $CI_COMMIT_SHORT_SHA # Use a specific version (tag), branch, or SHA: - component: gitlab.com/gitlab-org/ci-components/secret-detection@main # Creating a component (in its own repository): # File: templates/deploy.yml --- spec: inputs: environment: description: "Deployment environment (staging or production)" image_tag: description: "Docker image tag to deploy" default: "latest" --- deploy-$[[ inputs.environment ]]: stage: deploy script: - ./deploy.sh $[[ inputs.environment ]] $[[ inputs.image_tag ]]
| Aspect | include: project | CI/CD components |
|---|---|---|
| Versioning | Via ref (branch/tag/SHA) | Semantic versioning + catalog |
| Inputs | No input mechanism | Typed, documented inputs (spec: inputs:) |
| Discovery | Manual (know the path) | Searchable CI/CD catalog |
| Validation | None | Input type validation |
| GitLab version | All versions | 16.0+ |
| Recommended for | Internal file reuse | Shareable, published templates |
CI/CD components use the $[[ inputs.variable_name ]] syntax (double square brackets) to reference inputs, which is different from regular CI/CD variable syntax $VARIABLE.
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...
