Ravindra BagaleCourses & study guides मराठी

Chapter 92: GitLab CI Deep Dive

DevOps

92.16 Interview questions, revision and chapter quiz

Interview cards

Interview card: stages vs needs in GitLab CI
Interview card: stages vs needs in GitLab CI
Interview card: cache vs artifacts in GitLab CI
Interview card: cache vs artifacts in GitLab CI
Interview card: protected and masked variables
Interview card: protected and masked variables
Interview card: how to deploy safely with GitLab CI
Interview card: how to deploy safely with GitLab CI

Interview questions

  1. Pipeline vs stage vs job? — One full run; a group of jobs that run together; one named script.
  2. What is a runner and an executor? — The program that runs jobs; the way it runs them (docker, shell, kubernetes).
  3. Why protected runners? — So only jobs from protected branches or tags can use runners that reach production.
  4. How do you stop duplicate MR and branch pipelines? — workflow:rules using CI_OPEN_MERGE_REQUESTS, as in the GitLab docs.
  5. stages vs needs? — Stages wait for the whole previous stage; needs starts a job when its listed jobs finish.
  6. cache vs artifacts? — Cache speeds up and may be missing; artifacts are results later jobs must get.
  7. Protected vs masked variables? — Protected limits which refs receive it; masked hides it in logs, but is not a guarantee.
  8. How do jobs push images without personal passwords? — Predefined CI_REGISTRY_* variables with the short-lived job token.
  9. How do you make production safe? — Environment, manual job, protected environment, and resource_group.
  10. How do you reuse CI config? — include plus extends hidden jobs, or CI/CD components, pinned to a tag.

Revision checklist

Revision card: GitLab CI deep dive checklist
Revision card: GitLab CI deep dive checklist
  • [ ] I can explain pipeline, stage, job and runner.
  • [ ] I can write default, image, before_script and script.
  • [ ] I know shared vs self-managed runners, tags and protected runners.
  • [ ] I can write workflow:rules that stop duplicate pipelines.
  • [ ] I can use needs, artifacts, expire_in and dependencies.
  • [ ] I keep secrets in protected, masked variables and never echo them.
  • [ ] I know when to use cache and when to use artifacts.
  • [ ] I can add a database service for tests.
  • [ ] I can upload JUnit reports with when: always.
  • [ ] I can push to the built-in registry with predefined variables.
  • [ ] I can make a manual, protected production deploy with resource_group.
  • [ ] I can reuse config with include and extends.

Quick quiz

Q1. Jobs in the same stage run how?

At the same time (in parallel), if runners are free.

Q2. What does needs: [] do?

The job waits for nothing and can start as soon as the pipeline starts.

Q3. Which variable helps stop duplicate pipelines when an MR is open?

CI_OPEN_MERGE_REQUESTS, used in workflow:rules.

Q4. What does a protected variable do?

It is only given to pipelines on protected branches or tags.

Q5. Is masking a guaranteed way to hide a secret?

No. GitLab's docs say masking is not guaranteed; review CI changes and never print secrets.

Q6. Cache or artifact for build output that the deploy job needs?

Artifact.

Q7. What does resource_group do?

Makes jobs in the same group run one at a time.

Q8. How does a job log in to the project registry without a personal password?

With CI_REGISTRY_USER and CI_REGISTRY_PASSWORD, which use the short-lived job token.

Q9. A job stays pending forever. First thing to check?

Whether any online runner has the tags the job asks for.

Q10. Why add when: always to a JUnit report artifact?

So the report is uploaded even when tests fail.

Ravindra Bagale's Tip

In interviews, walk through one pipeline: workflow rules, test jobs with reports, build with artifacts, manual protected deploy with resource_group.

In short

  • A pipeline has stages; stages have jobs; runners run jobs.
  • rules and workflow:rules control what runs; stop duplicate pipelines on day one.
  • needs speeds pipelines; artifacts pass results; cache speeds installs.
  • Secrets live in protected, masked variables, and CI changes still need review.
  • Production deploys: environment, manual, protected, resource_group.
  • Reuse with include and extends, pinned to a tag.

Did you understand? Let us try it once more.