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 a DevOps/SRE/DevSecOps/Cloud Expert passionate about sharing knowledge and experiences. I have worked at <a href="https://www.cotocus.com/">Cotocus</a>. I share tech blog at <a href="https://www.devopsschool.com/">DevOps School</a>, travel stories at <a href="https://www.holidaylandmark.com/">Holiday Landmark</a>, stock market tips at <a href="https://www.stocksmantra.in/">Stocks Mantra</a>, health and fitness guidance at <a href="https://www.mymedicplus.com/">My Medic Plus</a>, product reviews at <a href="https://www.truereviewnow.com/">TrueReviewNow</a> , and SEO strategies at <a href="https://www.wizbrand.com/">Wizbrand.</a> Do you want to learn <a href="https://www.quantumuting.com/">Quantum Computing</a>? <strong>Please find my social handles as below;</strong> <a href="https://www.rajeshkumar.xyz/">Rajesh Kumar Personal Website</a> <a href="https://www.youtube.com/TheDevOpsSchool">Rajesh Kumar at YOUTUBE</a> <a href="https://www.instagram.com/rajeshkumarin">Rajesh Kumar at INSTAGRAM</a> <a href="https://x.com/RajeshKumarIn">Rajesh Kumar at X</a> <a href="https://www.facebook.com/RajeshKumarLog">Rajesh Kumar at FACEBOOK</a> <a href="https://www.linkedin.com/in/rajeshkumarin/">Rajesh Kumar at LINKEDIN</a> <a href="https://www.wizbrand.com/rajeshkumar">Rajesh Kumar at WIZBRAND</a> <a href="https://www.rajeshkumar.xyz/dailylogs">Rajesh Kumar DailyLogs</a>

Related Posts

Top 10 Collaboration Platforms Tools in 2026: Features, Pros, Cons & Comparison

Introduction In 2026, collaboration platforms are more essential than ever. As remote and hybrid work environments continue to thrive, having the right collaboration tool can be the…

Read More

The 5 Most Popular Email APIs Among Developers In 2026

In the modern world, where everything is going digital, email is among the most important means of communication both in personal and business life. As a developer,…

Read More

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

Introduction Construction Management Software (CMS) has become indispensable in 2026 for efficiently handling various aspects of construction projects, ranging from budgeting, scheduling, resource allocation, project tracking, to…

Read More

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

Introduction As the financial services sector continues to evolve, Loan Management Software (LMS) plays a pivotal role in helping businesses streamline their loan operations, from origination to…

Read More

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

Introduction In 2026, AI presentation design tools have become indispensable for professionals, educators, and students aiming to create visually stunning and impactful slide decks with minimal effort….

Read More

Top 10 Web Design Software Tools in 2026: Features, Pros, Cons & Comparison

Introduction Web design software is a vital tool for both professionals and businesses looking to create visually appealing and functional websites. In 2026, with the increase in…

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