DevOps / 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.
More Related questions...