Preparing for a DevOps interview that covers GitLab CI/CD? These questions come up again and again - here are strong, concrete answers.
Q: What is GitLab CI/CD and why use it?
GitLab CI/CD runs pipelines defined in .gitlab-ci.yml on GitLab Runners, with stages, jobs, environments and built-in DevSecOps scanning - all in one platform next to the repo.
- One platform for SCM, CI/CD, registry and security scanning
- Pipelines-as-code with reusable includes and templates
- Built-in environments, review apps and manual deploy gates
Q: What are the best practices you follow?
- Use stages and needs: for a fast DAG pipeline
- Cache dependencies and pass build output as artifacts
- Store secrets as masked, protected CI/CD variables
Q: What mistakes have you seen?
- Everything in one stage, so nothing runs in parallel
- No cache/artifacts config, re-downloading dependencies every job
- Secrets in .gitlab-ci.yml instead of masked/protected CI variables
Q: Show a basic configuration
Stages, caching and a manual production gate.
stages: [build, test, deploy]
cache: { paths: [node_modules/] }
build:
stage: build
image: node:20
script: [npm ci, npm run build]
test:
stage: test
image: node:20
script: [npm test]
deploy:prod:
stage: deploy
script: [./deploy.sh]
environment: { name: production }
when: manual
rules: [{ if: '$CI_COMMIT_BRANCH == "main"' }]Want senior help putting GitLab CI/CD to work - or a team bootcamp on it? CodeWizard runs Israel's largest DevOps community and embeds named senior engineers with a transparent hours log. Book a free consult or explore the Academy.