CV0-004 Deployment Practice Question
A company uses GitLab CI for its CI/CD pipeline. The pipeline includes a 'deploy' job that runs only when a tag is pushed. Which GitLab CI keyword should be used to control job execution based on tags?
⚠ Common exam trap
CV0-004 often tests the distinction between 'only' and 'except' (inverse conditions) and between 'only' and 'rules' (legacy vs modern syntax) — candidates who pick 'except' or 'needs' misunderstand the direction of the condition.
Answer choices
Why each option matters
Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.
Correct answer & explanation
✓
only
The 'only' keyword in GitLab CI controls when a job runs based on conditions such as tags, branches, or changes. Using 'only: tags' ensures the deploy job executes only when a tag is pushed, which matches the requirement.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
stage
Why it's wrong here
`stage` groups jobs into pipeline phases and controls ordering, not whether a job runs on tags. The deploy job requires `only: tags` (or `rules` with a tag condition) so it executes only when a tag is pushed. `stage` would be correct for sequencing build, test and deploy.
- ✗
except
Why it's wrong here
`except` excludes jobs from running for matching refs; it cannot make a job run only on tags. The deploy job needs `only: tags` (or `rules` with a tag condition) to execute exclusively when a tag is pushed. `except` would be right to skip a job on tags.
- ✓
only
Why this is correct
The only keyword restricts a job to specified conditions, such as only: tags, so the deploy job runs solely when a tag is pushed. This satisfies the stem's requirement to control execution based on tags rather than branches or merge requests.
- ✗
needs
Why it's wrong here
`needs` establishes directed acyclic graph dependencies so a job starts once named jobs finish, regardless of stage. It does not filter by ref. The deploy job needs `only: tags` (or `rules` with a tag condition) to run solely on tag pushes. `needs` suits parallelising jobs across stages.
About these practice questions
Courseiva writes every CV0-004 question from scratch — 834 in total, each with an explanation and a wrong-answer breakdown. None are copied from real exams or dumps. Learn why practice questions differ from exam dumps →
JA
Written and reviewed by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
Last reviewed September 2026 · checked against the official CompTIA exam blueprint
This CV0-004 practice question is part of Courseiva's free CompTIA certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the CV0-004 exam.