GitLab CI/CD: Architecting, Deploying, and Optimizing Pipelines
Architecture Core Concepts
Create and Run a Basic Pipeline
In this guide, you’ll learn how to set up a simple CI/CD pipeline on GitLab. We’ll walk through:
- Creating a GitLab Group
- Initializing a GitLab Project
- Configuring your .gitlab-ci.yml file
- Reviewing pipeline execution
By the end, you’ll have a working pipeline that builds, tests, and deploys automatically.
1. Create a GitLab Group
First, organize your demos under a top-level group called demos-group:
- Go to Groups → Create group.
- Set Group name to
demos-group.
The Group URL will begitlab.com/demos-group. - Choose Visibility Level: Public.
- Click Create group.

Once created, you’ll see the group dashboard:

Note
Group names should avoid special characters (e.g., periods) if you plan to integrate with SCIM or other identity providers.
2. Create a New Project
Inside demos-group, create a project named hello-world:
- Click New project → Create blank project.
- Enter Project name:
hello-world
The Project URL becomesgitlab.com/demos-group/hello-world. - Set Visibility: Public.
- Check Initialize repository with a README.
- Click Create project.

Your project page will display the README and initial instructions:

If you already have local code, push it with:
git remote add origin https://gitlab.com/demos-group/hello-world.git
git branch -M main
git push -uf origin main
3. Set Up CI/CD Pipeline
Click CI/CD → Pipelines → Setup CI/CD (or Configure pipeline) to open the editor. You’ll see a list of templates and an empty .gitlab-ci.yml file:

Browse available templates:

If you leave the file empty, GitLab shows an error:

Define a Minimal Pipeline
Add the following to .gitlab-ci.yml at the repository root:
stages:
- build
- test
- deploy
first_job:
stage: build
script:
- echo "This is our first GitLab CI Job"
- ls
- cat README.md
Commit directly to main. This push triggers a pipeline run automatically.
Pipeline Stages Overview
| Stage | Purpose |
|---|---|
| build | Compile or prepare artifacts |
| test | Run unit tests and code validation |
| deploy | Deploy to staging or production environment |
4. Inspect the Repository and Pipeline
Back in Code → Files, confirm README.md and .gitlab-ci.yml are present:

Then navigate to CI/CD → Pipelines. You’ll see your new pipeline with a Passed status once it finishes:

Click the pipeline ID to drill into stages and jobs. Selecting first_job reveals the full log:

Sample Job Output
$ echo "This is our first GitLab CI Job"
This is our first GitLab CI Job
$ ls
README.md
$ cat README.md
## Hello World
## Getting started
To make it easy for you to get started with GitLab...
GitLab Shared Runners automatically provision a Docker container, fetch your code, run the script commands, then clean up after success.
Next Steps
In the following lessons, we’ll explore:
- Advanced pipeline configurations
- Caching and artifacts
- Parallel and dynamic child pipelines
Links and References
Watch Video
Watch video content