Find the Best Cosmetic Hospitals

Explore trusted cosmetic hospitals and make a confident choice for your transformation.

โ€œInvest in yourself โ€” your confidence is always worth it.โ€

Explore Cosmetic Hospitals

Start your journey today โ€” compare options in one place.

GitLab CI/CD Execution Hierarchy

Understanding the hierarchy, precedence, sequencing, and parallelism in GitLab CI/CD pipelines is crucial to mastering how your jobs run, how to optimize them, and how GitLab decides what to execute and when.

Hereโ€™s a complete and up-to-date (GitLab 18.0, May 2026) breakdown of the GitLab pipeline execution model:


๐Ÿงฑ 1. ๐Ÿ”„ GitLab CI/CD Execution Hierarchy

โžค Pipeline (Top-Level Entity)

A single run of your .gitlab-ci.yml file. Triggered by:

  • Push/merge/tag
  • Schedule
  • Manual trigger
  • API call

โžค Stages (Sequential Execution Layer)

Defines the order of execution โ€” each stage completes fully before the next begins.

stages:
  - lint
  - test
  - build
  - deploy

โžค Jobs (Inside Each Stage)

All jobs within a stage run in parallel, provided runners are available.

lint:
  stage: lint
  script: npm run lint

unit_test:
  stage: test
  script: npm test

โžค Steps inside a Job

Each jobโ€™s script: section contains commands that run sequentially inside the job’s shell or container.


๐Ÿ”ƒ 2. Pipeline Execution Flow

Pipeline
 โ”œโ”€โ”€ Stage 1: lint
 โ”‚    โ”œโ”€โ”€ job: lint_a  (parallel)
 โ”‚    โ””โ”€โ”€ job: lint_b  (parallel)
 โ”œโ”€โ”€ Stage 2: test
 โ”‚    โ”œโ”€โ”€ job: unit_tests
 โ”‚    โ””โ”€โ”€ job: integration_tests
 โ”œโ”€โ”€ Stage 3: build
 โ”‚    โ””โ”€โ”€ docker_build
 โ””โ”€โ”€ Stage 4: deploy
      โ”œโ”€โ”€ job: staging_deploy
      โ””โ”€โ”€ job: prod_deploy (manual)

โฑ๏ธ 3. Job Precedence & Order of Execution

โœ… Within a Stage:

  • Jobs run in parallel
  • No strict order unless using needs: (see below)

โœ… Between Stages:

  • Sequential: Stage 2 starts only if all Stage 1 jobs succeed

โšก 4. How to Run Jobs in Parallel or Control Order

๐Ÿ”น Parallel Jobs

Jobs in the same stage naturally run in parallel. Example:

test_backend:
  stage: test
  script: run backend tests

test_frontend:
  stage: test
  script: run frontend tests

๐Ÿ”น Needs: (Run jobs out-of-order / faster)

Allows stage-skipping and job-level dependency. Ideal for reducing pipeline time.

unit_test:
  stage: test
  script: run tests

docker_build:
  stage: build
  script: build docker
  needs: [unit_test]   # Doesn't wait for whole test stage
Code language: PHP (php)

๐Ÿ”น Dependencies (Job artifact consumption, older method)

Specify jobs that must complete before current job can use their artifacts.

deploy:
  stage: deploy
  dependencies: [build]
Code language: CSS (css)

๐Ÿ” Use needs: for parallel dependency-based optimization
๐Ÿ“ฆ Use dependencies: to pass artifacts


๐Ÿงช 5. Conditional Execution (Job-Level Control)

๐Ÿ”ธ Rules

Recommended way to control job execution with complex conditions.

job_a:
  rules:
    - if: '$CI_COMMIT_BRANCH == "main"'
Code language: JavaScript (javascript)

๐Ÿ”ธ only/except (Deprecated in favor of rules)

job_b:
  only:
    - branches
    - tags

๐ŸŽฏ 6. Extended Structures

StructurePurposeNotes
Parent-Child PipelinesModularize pipelines (include from other .yml)Ideal for monorepos
Multi-project PipelinesTrigger another projectโ€™s pipelineGood for microservice chaining
IncludesReuse YAML templatesFrom same repo or remote

๐Ÿ“‹ 7. Visual: GitLab CI/CD Execution Hierarchy

Pipeline
โ”œโ”€โ”€ Stages (sequential)
โ”‚   โ”œโ”€โ”€ Jobs (parallel unless controlled)
โ”‚   โ”‚   โ”œโ”€โ”€ Scripts (sequential commands)
โ”‚   โ”‚   โ””โ”€โ”€ Artifacts/Needs/Dependencies
โ”œโ”€โ”€ Includes / Child Pipelines (optional)
โ””โ”€โ”€ Triggered Pipelines (optional)

โœ… Summary: Controlling Flow & Parallelism

Control MechanismUsed For
stages:Define sequential job groupings
needs:Define parallel dependencies
rules:Fine-grained control of job triggers
when:Delay, manual, or conditional jobs
only/exceptBasic conditions (legacy)
dependencies:Artifact-based job dependencies
trigger:Trigger child or multi-project pipelines

Find Trusted Cardiac Hospitals

Compare heart hospitals by city and services โ€” all in one place.

Explore Hospitals
I'm Rajesh Kumar, a DevOps, SRE, DevSecOps, Cloud, and Platform Engineering expert passionate about sharing practical knowledge, real-world experiences, and industry best practices. I have worked at Cotocus and regularly write about technology, travel, investing, health, product reviews, and digital marketing through my various platforms. I publish technical articles at DevOps School, travel stories at Holiday Landmark, stock market insights at Stocks Mantra, health and fitness guidance at My Medic Plus, product reviews at TrueReviewNow, and SEO and digital marketing strategies at Wizbrand.

Related Posts

Top 10 AI SEO Tools in 2026: Features, Pros, Cons & Comparison

Introduction In 2026, AI SEO tools have become indispensable for digital marketers, businesses, and content creators aiming to dominate search engine rankings. These tools leverage artificial intelligence…

Read More

Top 10 Product Lifecycle Management (PLM) Tools in 2026: Features, Pros, Cons & Comparison

Introduction Product Lifecycle Management (PLM) is a strategic approach to managing a productโ€™s journey from conception through design, manufacturing, and end-of-life. In 2026, PLM software has evolved…

Read More

Top 10 Patch Management Tools in 2026: Features, Pros, Cons & Comparison

Introduction: The Importance of Patch Management in 2026 In 2026, as cyber threats evolve and technology becomes more complex, patch management tools are critical for maintaining cybersecurity…

Read More

Top 10 Headless CMS Tools in 2026: Features, Pros, Cons & Comparison

Introduction In 2026, Headless Content Management Systems (CMS) have become the go-to solution for businesses seeking flexibility, scalability, and a modern approach to content management. Unlike traditional…

Read More

Top 10 AI Lead Scoring Tools in 2026: Features, Pros, Cons & Comparison

Introduction In 2026, AI lead scoring tools have become indispensable for B2B and B2C businesses aiming to optimize their sales pipelines. These tools leverage artificial intelligence to…

Read More

Top 10 AI Portfolio Optimization Tools in 2026: Features, Pros, Cons & Comparison

Introduction Investment management has always been about making smart choices at the right time. Traditionally, this required endless hours of research, manual calculations, and intuition. But in…

Read More
Subscribe
Notify of
guest
0 Comments
Newest
Oldest Most Voted
0
Would love your thoughts, please comment.x
()
x