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 Integration Platform as a Service (iPaaS) Tools in 2026: Features, Pros, Cons & Comparison

Introduction In todayโ€™s fast-paced digital world, businesses are leveraging multiple software applications, cloud services, and data sources to streamline operations. However, the challenge lies in integrating these…

Read More

IReviewed Blog’s Post List

truereviewnow.com is a portal for product review and rating. truereviewnow.com is having very in-depth analysis of review and testimony of Mobiles, Laptop, Electronics Gadgets, Airports, Boradbands, Movies…

Read More

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

Introduction In 2026, social media continues to be a cornerstone of digital marketing strategies, shaping how businesses connect with their audiences. With millions of users interacting on…

Read More

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

Introduction In 2026, drones are not only revolutionizing industries like agriculture, logistics, filmmaking, and construction, but also the way we collect and process data. Drone software is…

Read More

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

Introduction In 2026, AI Survey Automation Tools are transforming the way businesses, researchers, and organizations gather and analyze feedback. Traditional survey platforms often relied on static questions…

Read More

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

Introduction In 2026, AI animation tools are revolutionizing how creators, businesses, and educators bring stories to life, making animation accessible to all skill levels. These tools leverage…

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