GitLab
GitLab is an all-in-one DevOps platform. It provides source code management (Git), CI/CD, issue tracking, security, and deployment on a single system, suitable for development and DevOps teams.
- Get started
- Work projects
- Planning work
- Managing code
- CI/CD
- Securing your application
- Deploying and releasing your application
- Managing your infrastructure
- Monitoring your application
- Extending
Get started with Git
Docs → Get started with Git- Git basics you’ll use daily in GitLab.
- Local work → push → merge request.
- Use branches for every change.
- Prefer safe undo (revert) after pushing.
A1Purpose / Outcome
GitLab workflows are built on Git. This tab helps you get comfortable with the Git basics you’ll use every day in GitLab: clone, branch, commit, push, and merge.
- Use Git locally to create changes safely (branches).
- Push changes to GitLab so others can review them.
- Understand the minimum commands you’ll use daily.
- Know when to use merge vs rebase in team settings.
A2Who is this for + When to use
Use this when you’re new to Git or you’ve only used Git through a GUI. It’s also the fastest refresher before you start working with merge requests in GitLab.
- You write code or docs and need to collaborate.
- You frequently see conflicts and want to understand why.
- You want reproducible steps (CLI) for common tasks.
- You plan to use CI/CD and need clean commit history.
A3Where in navigation + Related tabs
This isn’t a single GitLab page—it’s the foundation used everywhere. Pair it with **Managing code** (MRs) and **Projects** (repo settings).
- Git concepts show up in: Repositories, Merge requests, CI pipelines triggers.
- Next: set up SSH keys or access tokens for authentication.
- Cross-link: Managing code → Branches/MRs.
- Cross-link: Projects → default branch protections.
B4Mental model / Flow
Think of Git as a timeline of snapshots (commits). Branches are pointers to commits, and remote branches live on GitLab. You work locally, then sync to GitLab.
- Edit files → `git status` to see changes.
- `git add` stages the exact changes to include.
- `git commit` creates a snapshot with a message.
- `git push` publishes to GitLab.
- Open a Merge Request to merge into the default branch.
B5Objects & Terms
These terms will appear constantly in GitLab UI and docs. Knowing them makes troubleshooting much faster.
- Repository: your project’s version history.
- Commit: a snapshot with author + message.
- Branch: a movable label for a line of work.
- Remote (origin): GitLab’s copy of the repo.
- Merge: combine branches; Conflict: overlapping edits.
- Tag: a named point in history (often releases).
B6State machine / Lifecycle
A typical change moves through a simple lifecycle: draft → review → integrate. Git helps you keep work isolated until it’s ready.
- Working tree: files changed but not staged.
- Staged: selected changes ready to commit.
- Committed: saved locally in Git history.
- Pushed: published to GitLab remote.
- Merged: integrated into the target branch.
C7Core jobs-to-be-done
These are the most common Git jobs you’ll do when working with GitLab.
- Create a feature branch and push it.
- Update your branch with the latest default branch changes.
- Resolve a simple merge conflict.
- Revert a bad commit safely.
- Inspect history to find what changed and why.
D11Do / Don’t & Pitfalls
Do / Don’t & Pitfalls
Do
- Pull (or fetch) before you start a big change.
- Commit small, readable chunks with clear messages.
- Use branches for every change (even small ones).
Don’t
- Don’t commit secrets; use GitLab CI variables or secret managers.
- Don’t force-push to shared branches unless your team expects it.
- Don’t fix conflicts by blindly choosing ‘theirs/ours’ without reading.
D12Permissions & Roles
Not applicable for this tool/tab (Git is local; GitLab permissions apply in Projects/Groups).
D13Data & Integrations
Your main integrations here are authentication methods so Git can talk to GitLab securely.
- Prefer SSH keys for developer machines you control.
- Use Personal Access Tokens when HTTPS auth is required.
- Rotate keys/tokens when a device is lost.
- Store credentials in your OS keychain, not plaintext configs.
Happy path workflow #1: Create a feature branch and open a MR
- Clone the repo from GitLab (HTTPS or SSH).
- Create a branch: `git checkout -b feature/
`. - Make a small change; run tests locally if you can.
- Stage and commit with a clear message.
- Push branch to GitLab: `git push -u origin feature/
`. - In GitLab, create a Merge Request from the new branch.
- Request a reviewer and address comments with follow-up commits.
- Merge when pipeline and review are green.
Happy path workflow #2: Sync your branch with the default branch
- Fetch latest changes: `git fetch origin`.
- Switch to your branch.
- Update using merge: `git merge origin/
`. - Resolve conflicts if needed, then commit the merge.
- Run tests/build locally (or rely on CI).
- Push updated branch to GitLab.
- Confirm the MR shows ‘up to date’ and pipeline re-runs.
Decision points
| Situation | If A… | If B… |
|---|---|---|
| Working solo vs with a team | Solo: rebase for a tidy history (if team allows). | Team/shared branch: use merge to avoid rewriting history. |
| Need to undo a commit | Already pushed: use `git revert` (safe, adds a new commit). | Not pushed: you can reset/amend carefully. |
| Conflict appears | Small conflict: resolve locally and commit. | Large conflict: pair with author / split into smaller MRs. |
| Authentication method | Managed laptop: SSH keys are usually easiest. | Restricted environment: use HTTPS + PAT with least privilege. |
Common mistakes (and how to avoid them)
- Committing secrets — Add a secret scanning step and move secrets to CI variables.
- One giant commit — Commit in small logical steps; reviewers can understand and revert safely.
- Forgetting to push the branch — Always push after your first commit; open a draft MR early.
- Working on default branch — Create a branch first; protect the default branch in GitLab settings.
- Unclear commit messages — Use intent-based messages: “Fix X by doing Y”, include ticket IDs if used.
What good looks like
- Every change happens on a branch and is reviewed via MR.
- Commits are small and messages explain intent.
- Branch stays reasonably up to date with the target branch.
- No secrets committed; credentials handled via secure methods.
- Conflicts are resolved with understanding, not guesswork.
Checklist
Pre-check
- You can authenticate to GitLab (SSH key or token).
- You know the repo’s default branch name.
- You can run basic tests or lint locally.
- You know your team’s rule on rebase vs merge.
- You have a consistent branch naming pattern.
Post-check
- Branch is pushed and MR is created.
- Pipeline is green (or failures are understood).
- Reviewer feedback is addressed.
- MR description links to ticket/context.
- Branch is deleted after merge (if team policy).
Practice lab (5–15 minutes): Make a tiny change safely
Goal: Create a branch, change a README line, and publish it for review.
Steps
- Clone a small repo from GitLab.
- Create a branch `feature/readme-update`.
- Edit README with one clear improvement.
- Commit with message “Docs: clarify setup step”.
- Push and open a draft MR.
- Ask a teammate (or yourself) to review and merge when ready.
Verify you did it right
- MR shows the correct branch and diff.
- Commit message is clear and scoped.
- No unrelated files are changed.
- Pipeline triggers (if configured).
Official docs links
- Docs home → Get started → Get started with Git
- Docs home → SSH keys
- Docs home → Personal access tokens
- Docs home → Common Git commands
Get started organizing work with projects
Docs → Get started organizing work with projects- Projects are the ‘home base’ for repo + planning + CI.
- Start with safe defaults: private + protected default branch.
- Use groups for shared access and standards.
- Templates + labels = less chaos.
A1Purpose / Outcome
Projects are where code, issues, CI/CD, and settings live together. This tab teaches you how to create a project, set it up for a team, and keep it maintainable.
- Create or import a project and understand its structure.
- Set visibility, default branch, and essential settings.
- Connect members with the right access level.
- Set up basic conventions: README, labels, templates.
A2Who is this for + When to use
Use this when you’re starting a new repo, onboarding to an existing project, or standardizing how your org uses GitLab.
- New team repo or a hackathon project.
- Migrating from another Git hosting platform.
- You need consistent issues/labels across repos.
- You want to protect important branches and tags.
A3Where in navigation + Related tabs
In GitLab UI, Projects are a top-level concept. From a project, you’ll navigate to Code, Issues, CI/CD, Security, Deployments, and Settings.
- Related: Managing code (MRs, branches).
- Related: Planning work (issues, boards).
- Related: CI/CD (pipelines, runners).
- Related: Extending GitLab (webhooks, API).
B4Mental model / Flow
A project is a container: repository + collaboration + automation. Most configuration happens in project settings, and many settings inherit from group policies.
- Group → Project: groups can enforce standards and permissions.
- Repo content drives code workflows (branches/MRs).
- Issues/Boards track work tied to commits and MRs.
- CI/CD runs based on repository files and settings.
B5Objects & Terms
Projects connect a few core objects so you can trace work end-to-end.
- Project: top-level workspace for one product/service.
- Group: collection of projects with shared members/settings.
- Visibility: private/internal/public access scope.
- Members & roles: Guest/Reporter/Developer/Maintainer/Owner (varies by context).
- Project settings: repository, merge requests, CI/CD, integrations.
B6State machine / Lifecycle
Projects typically mature from ‘just a repo’ into a governed, automated delivery unit.
- New: repo created/imported, minimal settings.
- Collaborative: members, README, issues, conventions.
- Governed: protected branches, approvals, policies.
- Automated: pipelines, environments, security scans.
- Operational: monitoring, incident response, audit.
C7Core jobs-to-be-done
These are the project-level tasks that unlock a smooth workflow.
- Create/import a project and choose visibility.
- Set default branch and branch protection rules.
- Invite members and assign least-privilege roles.
- Define naming conventions for branches and tags.
- Add templates (issue/MR) for consistent collaboration.
D12Permissions & Roles
GitLab uses role-based access at group and project levels. Start least-privilege and elevate only when needed.
- Guest: limited access (often issues and comments).
- Reporter: read access with more visibility into project content.
- Developer: push to non-protected branches; create MRs.
- Maintainer: manage project settings and protected branches (commonly).
- Owner (group): manage billing/policies; not always per-project.
D11Do / Don’t & Pitfalls
Do / Don’t & Pitfalls
Do
- Create a README and ‘how to run’ notes on day 1.
- Protect the default branch and require MRs.
- Use groups for shared access and standards.
Don’t
- Don’t give everyone Maintainer by default.
- Don’t leave default branch unprotected in a team repo.
- Don’t rely on tribal knowledge—encode it in templates.
D13Data & Integrations
Projects integrate with tools through built-in integrations, webhooks, and CI variables.
- Use webhooks for chatops or deployment notifications.
- Use project/group CI variables for secrets and environment config.
- Connect container/package registries where applicable.
- Standardize integrations at the group level when possible.
Happy path workflow #1: Create a project with safe defaults
- Create a new project (blank, template, or import).
- Set visibility (private for most teams).
- Choose a default branch (often `main`).
- Add a README and basic folder structure.
- Enable/confirm Merge Request workflow (require MRs).
- Protect the default branch (no direct pushes).
- Add an issue template and MR template.
- Invite teammates with appropriate roles.
Happy path workflow #2: Standardize an existing project
- Review current settings and permissions.
- Turn on branch protection for the default branch.
- Add CODEOWNERS or approval rules if your org uses them.
- Create labels/milestones and a basic board.
- Add CONTRIBUTING.md + CODE_OF_CONDUCT if relevant.
- Add CI skeleton (even a lint/test job).
- Set up required status checks (pipeline must pass).
- Document release/versioning approach (tags/releases).
Decision points
| Situation | If A… | If B… |
|---|---|---|
| Personal project vs team project | Personal: lighter governance; keep it simple. | Team: protect branches, require reviews, add templates. |
| Group vs standalone project | If multiple repos: use a group for shared members/settings. | Single repo only: standalone can be fine at first. |
| Visibility choice | Private by default for internal work. | Public only when you’re ready for open collaboration. |
| Default branch name | Use org standard (`main`/`master`) consistently. | If migrating, rename carefully and update CI/docs. |
Common mistakes (and how to avoid them)
- Everyone is Maintainer — Use Developer for most; reserve Maintainer for repo admins.
- No templates — Add issue/MR templates to reduce back-and-forth.
- Unprotected default branch — Protect it and require MRs with passing pipelines.
- Settings drift across repos — Use group-level defaults and document standards.
- Secrets in repo — Move to CI variables; rotate if already leaked.
What good looks like
- New contributors can understand the project from README + templates.
- Default branch is protected; changes merge via MR.
- Roles are least-privilege and reviewed periodically.
- Labels/milestones make planning visible.
- Basic CI runs on every MR.
Checklist
Pre-check
- Project visibility matches your intent (private/internal/public).
- Default branch is chosen and documented.
- You know who should be Maintainer vs Developer.
- Issue/MR templates are drafted.
- Branch naming/release tagging conventions exist.
Post-check
- Users can clone and contribute without guessing.
- MRs require review (if desired) and CI pass.
- Protected branches/tags are configured.
- Core labels exist for triage.
- Docs describe how to run/test/release.
Practice lab (5–15 minutes): Create a ‘starter’ project in 10 minutes
Goal: Make a repo that a teammate can immediately use.
Steps
- Create a blank project.
- Add README + a ‘Local setup’ section.
- Add ISSUE_TEMPLATE and MERGE_REQUEST_TEMPLATE.
- Protect default branch and require MRs.
- Invite one teammate as Developer.
Verify you did it right
- Default branch can’t be pushed to directly.
- Templates appear when creating issues/MRs.
- Teammate can create a branch and open a MR.
Official docs links
- Docs home → Get started → Get started organizing work with projects
- User docs → Projects
- User docs → Project members and permissions
- User docs → Protected branches / tags (Repository settings)
Get started planning work
Docs → Get started planning work- Issues are your source of truth for work.
- Boards visualize status using labels.
- Milestones/iterations timebox delivery.
- Link MRs to issues for traceability.
A1Purpose / Outcome
Planning in GitLab centers on Issues, Boards, Milestones, and Labels. This tab helps you track work from idea → delivery without losing context.
- Create issues with clear acceptance criteria.
- Use labels and boards to visualize flow.
- Group work into milestones/iterations.
- Link code changes back to planning items.
A2Who is this for + When to use
Use this when you need a lightweight backlog, sprint-like planning, or cross-team visibility without switching tools.
- Product/engineering teams managing a backlog.
- Bug triage and prioritization.
- Sprint planning using milestones/iterations.
- Tracking deliverables across multiple repos via groups.
A3Where in navigation + Related tabs
Planning features live in project/group navigation (Issues, Boards, Milestones/Iterations, Epics where available). Connect planning to MRs and CI results.
- Related: Managing code (link MRs to issues).
- Related: CI/CD (pipeline status on MRs).
- Related: Projects (labels/templates conventions).
- Related: Monitoring (incident issues).
B4Mental model / Flow
A useful flow is: capture work as issues → refine → move across a board → implement via MR → close with reference. Keep the issue as the single source of truth.
- Issue is the planning anchor (why/what).
- Labels capture type/priority/status quickly.
- Boards visualize status by label.
- Milestones/iterations group issues by timebox.
- Merge requests implement and close issues.
B5Objects & Terms
These objects are enough for a strong planning workflow.
- Issue: unit of work (feature, bug, task).
- Label: flexible tagging for status/type/priority.
- Board: visual view of issues by labels.
- Milestone/Iteration: time-box grouping.
- Epic (if enabled): high-level work spanning issues.
- Assignee/Weight: ownership and effort signal.
B6State machine / Lifecycle
Keep states simple and enforce them via labels/board columns. Don’t over-model early.
- Backlog → Ready → Doing → Review → Done (example).
- Transitions happen when criteria are met (not by time).
- Use ‘Review’ when code is in MR and waiting on approval.
- Use ‘Done’ when merged + verified.
C7Core jobs-to-be-done
These are the planning moves that keep teams aligned.
- Write a strong issue: context, steps, acceptance criteria.
- Triage: label and prioritize quickly.
- Run a weekly refinement session.
- Move issues across the board as work progresses.
- Close issues automatically from MRs using keywords (where supported).
D12Permissions & Roles
Most planning actions require basic project access. If you can’t move issues or edit labels, ask a Maintainer to adjust permissions.
- Creating issues: typically Developer/Reporter depending on config.
- Editing labels/boards: often Maintainer.
- Group-level boards: require group access.
- Confidential issues: visibility depends on role.
- Audit who can change priority labels in sensitive projects.
D11Do / Don’t & Pitfalls
Do / Don’t & Pitfalls
Do
- Keep a small set of status labels that match your board columns.
- Use templates for bugs/features to standardize info.
- Link issues to MRs early for traceability.
Don’t
- Don’t create dozens of overlapping labels.
- Don’t move issues without updating what ‘Done’ means.
- Don’t track critical work only in comments—summarize in the description.
D13Data & Integrations
Planning data becomes powerful when it connects to code and incidents.
- Use issue links/relationships for dependencies.
- Connect chat or alerting tools to create incident issues.
- Use webhooks/API to sync status if you must—prefer native first.
- Export/report from milestones for progress updates.
Happy path workflow #1: Triage a new bug report
- Create an issue using a bug template (steps to reproduce, expected/actual).
- Add labels: type::bug, priority::?, status::backlog.
- Assign an owner (or set ‘needs-triage’).
- Add severity/impact notes and screenshots/logs.
- If reproducible, add a minimal failing test task.
- Move to Ready when acceptance criteria is clear.
- Link or create a MR when implementation starts.
- Close when merged and verified in the target environment.
Happy path workflow #2: Plan a small sprint with a board
- Review backlog issues and clean up titles/descriptions.
- Estimate/weight issues (lightweight).
- Create a milestone/iteration for the sprint window.
- Select a realistic set of issues into the milestone.
- Use a board with columns (Backlog/Ready/Doing/Review/Done).
- Move issues to Ready only when acceptance criteria is complete.
- During the sprint, move issues as state changes.
- At the end, review Done vs not-Done and capture learnings.
Decision points
| Situation | If A… | If B… |
|---|---|---|
| Need a simple flow vs complex process | Simple: 4–5 columns and a few labels. | Complex: consider epics/roadmaps if enabled. |
| Status representation | Use labels/boards for status (recommended). | Avoid encoding status in titles like “[WIP] …”. |
| Ownership model | Single assignee: clarity for small teams. | Multiple owners: use issue links/checklists to split work. |
| What counts as ‘Done’ | Merged + verified + docs updated (if needed). | Just merged: only if verification is handled elsewhere. |
Common mistakes (and how to avoid them)
- Vague issues — Add acceptance criteria and ‘definition of done’ bullets.
- Label explosion — Limit labels; archive unused; enforce naming conventions.
- Board doesn’t match reality — Update columns/labels so they reflect how you actually work.
- No link between issue and MR — Reference issues from MR description; use closing keywords if supported.
- Work hidden in comments — Summarize decisions in the issue description for newcomers.
What good looks like
- Backlog items are understandable without a meeting.
- Board reflects reality within 24 hours.
- Every in-progress issue links to a MR or explicit task list.
- Milestone scope is stable after sprint starts (few surprises).
- Done items include verification evidence (CI, screenshots, notes).
Checklist
Pre-check
- You have issue templates for bug/feature.
- You have a small set of status labels and priorities.
- Board columns map 1:1 to status labels.
- Milestone/iteration dates are defined.
- Team agrees on ‘Ready’ and ‘Done’ criteria.
Post-check
- Sprint summary is written (what shipped, what didn’t).
- Labels were updated consistently.
- Old ‘needs-triage’ issues were addressed or closed.
- Insights captured for next sprint.
- Metrics (cycle time, throughput) reviewed if available.
Practice lab (5–15 minutes): Set up a lightweight planning board
Goal: Create a board with 5 columns and move one issue through it.
Steps
- Create labels: status::backlog, status::ready, status::doing, status::review, status::done.
- Create a board using these labels as columns.
- Create an issue with acceptance criteria.
- Move it from backlog → ready.
- Create a draft MR and move issue to doing/review accordingly.
Verify you did it right
- Board columns show your labels.
- Issue has clear acceptance criteria.
- Issue links to a MR (even a draft).
Official docs links
- Docs home → Get started → Get started planning work
- User docs → Issues
- User docs → Issue boards
- User docs → Milestones / Iterations (planning timeboxes)
Get started managing code
Docs → Get started managing code- Merge Requests are the core collaboration surface.
- Keep MRs small, with context + test plan.
- Use pipelines + approvals as quality gates.
- Protect default branch to enforce policy.
A1Purpose / Outcome
Code management in GitLab revolves around branches, merge requests (MRs), reviews, and approvals. This tab shows how to deliver code safely with predictable quality checks.
- Create MRs that are easy to review.
- Use diffs, discussions, and approvals effectively.
- Keep branches protected and enforce quality gates.
- Trace changes to issues and releases.
A2Who is this for + When to use
Use this if you’ll collaborate on a repository: feature branches, code review, and release-ready merges.
- Developers creating feature/bugfix branches.
- Reviewers approving changes.
- Maintainers setting merge policies.
- Teams wanting consistent merge strategy.
A3Where in navigation + Related tabs
Inside a project, you’ll use Repository (files/branches), Merge requests, and Settings for merge policies. Code workflows connect tightly to CI/CD and Planning.
- Related: CI/CD (pipeline checks).
- Related: Projects (protected branches/settings).
- Related: Planning work (issues that MRs close).
- Related: Secure (security results on MRs where enabled).
B4Mental model / Flow
Treat every MR as a mini-proposal: why → what changed → how to verify. GitLab then layers automated checks (CI) and human checks (review/approval).
- Branch contains your changes.
- MR describes intent and is the review surface.
- Pipeline validates build/test/security (as configured).
- Approvals enforce review policy.
- Merge strategy integrates changes to target branch.
B5Objects & Terms
These are the building blocks of code collaboration in GitLab.
- Merge Request (MR): proposed change from source → target branch.
- Diff: file-by-file change view.
- Review discussion: threaded comments on diffs.
- Approval rules: who must approve.
- Protected branches: restrict who can push/merge.
- CODEOWNERS: define required reviewers by path (if used).
B6State machine / Lifecycle
A typical MR moves from draft → ready → approved → merged. Use this lifecycle to reduce churn and avoid half-baked reviews.
- Draft: collecting initial feedback; not ready to merge.
- Ready: scope stable; requests formal review.
- Approved: required reviewers signed off.
- Merged: integrated to target branch.
- Closed: abandoned or superseded (with explanation).
C7Core jobs-to-be-done
These are the tasks that keep code review efficient and safe.
- Create a MR from a feature branch.
- Write a reviewable description (context + test plan).
- Respond to review comments with follow-up commits.
- Handle merge conflicts.
- Choose merge method (merge commit/squash/rebase) per team policy.
D12Permissions & Roles
Permissions matter most for protected branches and merge policies.
- Developers: typically create branches + MRs.
- Maintainers: configure MR settings, approvals, protected branches.
- Who can merge may be restricted by policy.
- If you can’t push a branch: check branch protection or role.
- If you can’t approve: ensure you’re in the required approver group.
D11Do / Don’t & Pitfalls
Do / Don’t & Pitfalls
Do
- Open a draft MR early to get direction.
- Keep MRs small; split large work into stacked MRs if possible.
- Add a test plan and screenshots/logs when relevant.
Don’t
- Don’t merge red pipelines unless you explicitly accept the risk.
- Don’t ignore review threads—resolve them visibly.
- Don’t bypass branch protection via direct pushes.
D13Data & Integrations
MRs become stronger when paired with automation and traceability.
- Require pipelines to pass before merge (recommended).
- Connect issues: use references or closing keywords.
- Use webhooks/chat integrations to notify on MR events.
- Link deployments/environments in Deploy tab if you release from GitLab.
Happy path workflow #1: Create a high-quality MR
- Create a feature branch and push it to GitLab.
- Open a MR and write: context, change summary, and test plan.
- Add labels (type, priority) and link the related issue.
- Assign reviewers / CODEOWNERS if used.
- Run pipeline; fix failures until green.
- Address review comments with commits; keep discussion threads resolved.
- Ensure approvals are satisfied.
- Merge using your team’s merge strategy and delete the branch.
Happy path workflow #2: Resolve conflicts and keep review intact
- Fetch latest target branch changes.
- Merge or rebase (per policy) to update your branch.
- Resolve conflicts locally and run tests.
- Push updated branch to GitLab.
- Confirm MR shows conflicts resolved and pipeline is green.
- If review became stale, request re-review on changed files.
- Merge once approvals are still valid (or re-approved if required).
Decision points
| Situation | If A… | If B… |
|---|---|---|
| MR size | Small: quick review; merge frequently. | Large: split into smaller MRs to reduce risk. |
| Merge method | Squash: clean history for feature branches. | Merge commit: preserve branch context; good for complex changes. |
| Pipeline status | Green: proceed with review/merge. | Red: fix first; only override with explicit agreement. |
| Review policy | Lightweight: 1 reviewer for low-risk changes. | Strict: CODEOWNERS + multiple approvals for critical paths. |
Common mistakes (and how to avoid them)
- No test plan in MR — Add steps to verify; include screenshots or logs for UI/behavior changes.
- Too many unrelated changes — Split into separate MRs aligned to one goal.
- Leaving threads unresolved — Resolve discussions or summarize why not changing.
- Merging without updating branch — Sync with target branch to avoid surprise conflicts at merge time.
- Bypassing approval rules — Use protected branches/approval settings to enforce policy consistently.
What good looks like
- MR description answers: why, what, how to verify.
- Diff is small enough to review in one sitting.
- Pipeline is green and relevant checks exist.
- Approvals align with code ownership and risk.
- Branches are cleaned up after merge.
Checklist
Pre-check
- Branch name is meaningful and matches convention.
- MR links to an issue or includes context.
- Test plan is written and realistic.
- Pipeline is configured for the project.
- Reviewers are selected (or CODEOWNERS triggers).
Post-check
- All discussions resolved or summarized.
- Approvals satisfied.
- Pipeline green on latest commit.
- Merge performed with correct method.
- Branch deleted (if policy).
Practice lab (5–15 minutes): Open a ‘gold standard’ MR
Goal: Create a MR that a teammate can review in under 10 minutes.
Steps
- Make a small code change (one file or one function).
- Open a MR and write: Problem → Solution → Test plan.
- Add one label and link an issue (or create one).
- Ask for one review and respond to feedback.
- Merge when green.
Verify you did it right
- MR description is complete (context + test plan).
- Diff is focused and small.
- Reviewer can follow without a meeting.
Official docs links
- Docs home → Get started → Get started managing code
- User docs → Merge requests
- User docs → Protected branches
- User docs → CODEOWNERS and approvals (if used)
Get started with GitLab CI/CD
Docs → Get started with GitLab CI/CD- Pipelines are defined in `.gitlab-ci.yml`.
- Jobs run on runners; stages control order.
- Use variables for config/secrets.
- Gate deploy jobs with rules + protections.
A1Purpose / Outcome
GitLab CI/CD automates building, testing, and deploying your code using pipelines defined in a `.gitlab-ci.yml` file. This tab shows how to create a first pipeline and keep it maintainable.
- Create a pipeline that runs on every push/MR.
- Understand jobs, stages, and artifacts.
- Choose and manage runners.
- Use variables safely for configuration and secrets.
A2Who is this for + When to use
Use this when you want repeatable builds/tests, faster feedback in code review, or automated releases.
- Developers adding tests/build steps.
- DevOps/SRE managing runners and deployment jobs.
- Teams wanting consistent quality checks.
- Projects adopting templates/components for reuse.
A3Where in navigation + Related tabs
CI/CD lives inside each project (Pipelines, Jobs, Schedules, Settings > CI/CD). It ties into code review and deployment environments.
- Related: Managing code (pipelines required for merge).
- Related: Deploying & releasing (environments).
- Related: Managing infrastructure (runners, Kubernetes).
- Related: Extending GitLab (API, triggers, webhooks).
B4Mental model / Flow
A pipeline is a sequence of stages, each containing jobs. Jobs run on runners. The YAML file defines when jobs run and what they do.
- Event triggers pipeline (push, MR, schedule, manual).
- Pipeline runs stages in order (build → test → deploy).
- Jobs run on runners (shared or self-hosted).
- Artifacts/Reports flow between stages.
- Status feeds back into MR as a quality gate.
B5Objects & Terms
These terms appear constantly in CI/CD setup and troubleshooting.
- `.gitlab-ci.yml`: pipeline definition file.
- Pipeline: full run of configured jobs.
- Job: a unit of work executed by a runner.
- Stage: an ordered grouping of jobs.
- Runner: agent that executes jobs.
- Artifacts: files saved from jobs for later stages/download.
- Variables: key-value configuration (including secrets).
B6State machine / Lifecycle
Pipelines and jobs move through predictable states you’ll see in the UI.
- Created/queued: waiting for a runner.
- Running: executing on a runner.
- Success: finished with exit code 0.
- Failed: job or script failed.
- Canceled/skipped: not executed due to rules or manual stop.
C7Core jobs-to-be-done
These are the core CI/CD setup tasks for most repos.
- Add a minimal pipeline with lint + test jobs.
- Select the right runner (shared vs specific).
- Cache dependencies to speed up builds.
- Store secrets in CI/CD variables.
- Use rules to control when jobs run (MR vs main vs tags).
D12Permissions & Roles
CI/CD configuration is usually controlled by project Maintainers, especially runner and variable settings.
- Editing `.gitlab-ci.yml`: anyone who can push to the branch.
- CI/CD settings (variables, protected variables): often Maintainer.
- Runner registration: typically Maintainer/Admin depending on scope.
- Protected branches + protected variables work together for safety.
- If a job can’t access a variable, check variable protection scope.
D11Do / Don’t & Pitfalls
Do / Don’t & Pitfalls
Do
- Start with a small pipeline and expand gradually.
- Use artifacts for test reports and build outputs.
- Use protected variables for production credentials.
Don’t
- Don’t store secrets in the repo or YAML.
- Don’t run expensive jobs on every commit if not needed—use rules/schedules.
- Don’t ignore runner capacity; queued pipelines are a signal to scale runners.
D13Data & Integrations
CI/CD integrates with container registries, package registries, environments, and external deployment targets.
- Publish build artifacts to the Package/Container Registry (if used).
- Trigger downstream pipelines or external deploy tools.
- Send job notifications to chat tools via integrations/webhooks.
- Use API/trigger tokens for programmatic pipeline runs (with least privilege).
Happy path workflow #1: Add your first pipeline
- Create `.gitlab-ci.yml` in the repo root.
- Define stages: build and test (minimum).
- Add a simple job per stage with a script command.
- Commit and push to a feature branch.
- Open a MR and confirm the pipeline runs automatically.
- Fix failures; keep iterating until green.
- Make pipeline required for merge (if desired).
- Merge and confirm pipelines also run on default branch.
Happy path workflow #2: Add a deploy job safely
- Define an environment (staging) and a deploy job in a deploy stage.
- Store deployment credentials as CI/CD variables.
- Restrict the deploy job with rules (only default branch or tags).
- Mark deploy as manual at first to reduce risk.
- Run the pipeline and trigger deploy manually.
- Verify the app/service is updated in staging.
- Add rollback steps or a separate rollback job.
- Only then automate deploys more broadly if appropriate.
Decision points
| Situation | If A… | If B… |
|---|---|---|
| Runner choice | Use shared runners for quick start on GitLab.com. | Use self-managed runners for custom environments, speed, or compliance. |
| Job execution frequency | Run fast tests on every MR commit. | Schedule heavy scans/nightly jobs to reduce cost/time. |
| Secrets management | Use CI/CD variables (protected/masked) for secrets. | Avoid secrets in YAML or repo files. |
| Deploy strategy | Manual deploy first (staging) to validate. | Auto deploy only after confidence and guardrails. |
Common mistakes (and how to avoid them)
- Pipeline runs too slowly — Add caching, reduce job scope, and parallelize where safe.
- Jobs stuck queued — Scale runners or adjust tags/runner selection.
- Secrets leak in logs — Mask variables and avoid echoing secrets; audit job output.
- Deploy jobs run on every branch — Use rules to limit deploys to protected branches/tags.
- YAML duplication — Use includes/templates/components to reuse pipeline logic.
What good looks like
- Pipelines run automatically on MRs and main.
- Key tests are fast (<10 min) and reliable.
- Artifacts/reports are visible for failures.
- Secrets are stored in protected variables, not YAML.
- Deploy jobs are gated and auditable.
Checklist
Pre-check
- You have a minimal `.gitlab-ci.yml` committed.
- Runners are available and match job requirements.
- Your scripts can run non-interactively.
- Variables needed for jobs are defined.
- You know what events should trigger pipelines.
Post-check
- Pipeline is green on latest commits.
- Failures provide actionable logs.
- Deploy jobs are properly restricted.
- Artifacts/reports are collected.
- CI settings align with merge requirements.
Practice lab (5–15 minutes): Create a 2-stage pipeline
Goal: Build a small pipeline that runs a lint and a test command.
Steps
- Add stages: lint, test.
- Create a lint job (run formatter or basic linter).
- Create a test job (unit tests).
- Push a branch and open a MR to see pipeline status.
- Break something intentionally to see a failure, then fix it.
Verify you did it right
- MR shows pipeline status.
- Job logs explain what failed.
- Fix changes pipeline from red to green.
Official docs links
- Docs home → Get started → Get started with GitLab CI/CD
- CI/CD docs → Pipelines
- CI/CD docs → Runners
- Admin docs → CI/CD settings (instance/project)
Get started securing your application
Docs → Get started securing your application- Security is a loop: scan → triage → fix → verify.
- Start with high-signal scans, expand later.
- Treat findings like normal work items.
- Rotate secrets immediately if exposed.
A1Purpose / Outcome
GitLab can help you find and fix vulnerabilities as part of development. This tab focuses on beginner-friendly security habits: scanning in CI and reviewing results alongside code changes.
- Add security scanning jobs where available.
- Triage findings and focus on real risk.
- Fix vulnerabilities with traceability (issues/MRs).
- Keep secrets and dependencies under control.
A2Who is this for + When to use
Use this when you want earlier security feedback (before release) and a clear process to handle findings.
- Teams adding security to CI pipelines.
- Developers owning dependency and code risk.
- Maintainers setting policies for merge gates.
- Anyone responding to vulnerability reports.
A3Where in navigation + Related tabs
Security features often show up in project navigation and in MR widgets (depending on configuration and tier). They rely on CI/CD to run scans.
- Related: CI/CD (where scans execute).
- Related: Managing code (review security results in MRs).
- Related: Planning (create issues for findings).
- Related: Deploying (block releases if critical issues).
B4Mental model / Flow
Security is a loop: scan → review findings → fix → verify → monitor. Keep scans close to the code and treat findings like normal work items.
- Run scans on MRs and on default branch.
- Triage findings (severity, confidence, exploitability).
- Create issues for accepted work; document exceptions.
- Fix via MR and re-run scans to verify.
- Track status over time (trends, recurring issues).
B5Objects & Terms
Security terminology varies, but these concepts recur in GitLab security docs.
- Vulnerability: a weakness with potential impact.
- Finding: a scan result that may be a vulnerability.
- Severity: impact level (high/critical etc.).
- Dependency scanning: checks libraries for known CVEs.
- SAST: checks source code patterns for issues (where supported).
- Secret detection: finds leaked credentials (where supported).
B6State machine / Lifecycle
Treat security findings like tracked work with clear states.
- Detected: scan reports a finding.
- Triaged: validated or marked false positive.
- Planned: issue created with priority and owner.
- Fixed: code change merged and re-scanned.
- Accepted: risk accepted with rationale and review date (if used).
C7Core jobs-to-be-done
Beginner security work in GitLab is about adding feedback loops and acting on them.
- Enable at least one scan in CI (dependency scanning is a common start).
- Review scan output on MRs and prioritize critical items.
- Create issues for fixes and link them to MRs.
- Prevent secret leaks with scanning + good credential practices.
- Regularly update dependencies and base images.
D12Permissions & Roles
Security settings and policies are often restricted; coordinate with a Maintainer or security owner.
- Who can change CI config affects scan coverage.
- Who can dismiss/resolve findings depends on configuration/tier.
- Protect security variables (tokens/keys) like production secrets.
- Keep audit trails for accepted risks/exceptions.
D11Do / Don’t & Pitfalls
Do / Don’t & Pitfalls
Do
- Start with a small set of high-signal scans and expand.
- Prioritize critical/high findings in reachable code paths.
- Document why something is a false positive or accepted risk.
Don’t
- Don’t block every MR on low-signal findings at the start.
- Don’t ignore dependency updates—most fixes are upgrades.
- Don’t paste secrets into issues/MRs or job logs.
D13Data & Integrations
Security often integrates with external tooling, but keep it simple early on.
- Feed scan results into issues/boards for workflow.
- Notify security channels for critical findings.
- Use package/container scanning where you publish artifacts.
- If exporting to SIEM/ticketing, keep a single source of truth.
Happy path workflow #1: Add dependency scanning to CI (starter)
- Identify your project’s package manager (npm, pip, etc.).
- Add/enable a dependency scanning job/template (where available in your GitLab setup).
- Run pipeline on a branch and confirm results appear in job logs or MR widgets.
- Triage the top 3 findings: verify version and affected package.
- Create issues for real vulnerabilities with owners and due dates.
- Fix by upgrading dependencies or applying mitigations.
- Re-run pipeline to confirm findings are reduced/removed.
- Document any accepted risks with rationale and review date.
Happy path workflow #2: Prevent and respond to leaked secrets
- Enable secret detection (where available) or add a basic secret scan job.
- If a secret is detected, immediately rotate it (treat as compromised).
- Remove the secret from code and replace with CI variables or vault refs.
- Add masking/protection to relevant variables.
- Update access controls (least privilege).
- Create an incident issue describing what happened and actions taken.
- Add guardrails: pre-commit hooks or CI checks.
- Educate team with a short ‘never commit secrets’ checklist.
Decision points
| Situation | If A… | If B… |
|---|---|---|
| Scan coverage | Start with dependency scanning (high value for most apps). | Add SAST/container scans when the pipeline is stable. |
| Handling findings | Real vulnerability: create issue + fix via MR. | False positive: document why and how you verified. |
| Merge gating | Gate only on critical/high initially. | Gate on more categories after team matures. |
| Secrets exposure | If exposed: rotate immediately, then clean history if needed. | If not exposed: still rotate and add preventive checks. |
Common mistakes (and how to avoid them)
- Treating findings as ‘noise’ — Triage; focus on severity and exploitability; tune scans later.
- Blocking development early — Start with visibility; enforce gating gradually.
- Not rotating secrets after detection — Always rotate—assume compromise.
- Fixing without verification — Re-run scans and add regression checks.
- No ownership for security work — Assign a security owner or rotation; track in milestones.
What good looks like
- Security scans run on MRs and default branch.
- Critical findings are triaged within agreed SLA.
- Fixes are linked to issues and verified via re-scan.
- Secrets are never stored in repo; variables are protected/masked.
- Accepted risks are documented and reviewed periodically.
Checklist
Pre-check
- At least one scan job runs in CI.
- Security owner/rotation exists.
- Team knows how to create/triage security issues.
- Secrets management approach is defined (variables/vault).
- Dependency update cadence is planned.
Post-check
- Critical findings reduced or tracked with due dates.
- Scan results are visible in MR review.
- Exceptions are documented with rationale.
- Secrets are rotated if any exposure occurred.
- Security changes are included in release notes where needed.
Practice lab (5–15 minutes): Triage one security finding end-to-end
Goal: Pick one real finding and take it from detection → fix → verify.
Steps
- Run a pipeline that includes a security scan.
- Pick one high severity finding.
- Verify if your current version is vulnerable (check package version).
- Create an issue with acceptance criteria (upgrade + tests passing).
- Fix via MR and re-run the pipeline.
- Document the result in the issue and close it.
Verify you did it right
- Issue links to MR.
- Pipeline proves the fix.
- Finding is resolved or reduced in subsequent reports.
Official docs links
- Docs home → Get started → Get started securing your application
- User/CI docs → Security scanning (SAST/Dependency/Secret detection as applicable)
- User docs → Vulnerability management (if available in your tier)
- CI/CD docs → Variables (protect/mask)
Get started deploying and releasing your application
Docs → Get started deploying and releasing your application- Ship safely: staging → verify → promote.
- Use rules + protected refs for deploy control.
- Version with tags/releases for auditability.
- Always have a rollback path.
A1Purpose / Outcome
Deploying and releasing in GitLab typically uses CI/CD jobs, environments, and release tagging. This tab helps you ship safely with staging-first habits and clear verification.
- Define environments (staging/production) and deploy jobs.
- Gate deploys with rules and approvals.
- Use tags/releases for versioning.
- Make rollbacks possible and visible.
A2Who is this for + When to use
Use this when you want GitLab to drive releases: build artifacts, deploy to environments, and track what’s running where.
- Teams doing continuous delivery.
- Services needing staging and production parity.
- Release managers coordinating cutovers.
- Apps deploying to Kubernetes/VMs/cloud.
A3Where in navigation + Related tabs
Deployment features live around CI/CD, Environments, and Releases (project-level). They depend on a solid pipeline and good secrets management.
- Related: CI/CD (deploy jobs).
- Related: Managing infrastructure (clusters, runners).
- Related: Monitoring (verify after deploy).
- Related: Secure (don’t ship critical vulns).
B4Mental model / Flow
A safe release flow is: build → test → deploy to staging → verify → promote to production. GitLab tracks this through pipeline stages and environment history (where configured).
- Build artifacts once; deploy the same artifact to each env.
- Use rules to control which refs can deploy (main/tags).
- Use manual steps for production early on.
- Record release notes and version tags.
- Verify with monitoring/health checks post-deploy.
B5Objects & Terms
These objects help you manage releases without guessing.
- Environment: a target like staging/prod.
- Deployment: a record of a deploy job run.
- Release: versioned package of changes (often tied to tags).
- Tag: a named commit (v1.2.3).
- Rollback: reverting to a previous deployment/version.
- Feature flags: gradual rollout controls (if used).
B6State machine / Lifecycle
Deployments have simple, auditable states you can standardize.
- Pending: pipeline waiting for manual approval.
- Deployed (staging): running for verification.
- Promoted: production deploy executed.
- Rolled back: reverted to a previous version.
- Verified: monitoring confirms stability (your team’s definition).
C7Core jobs-to-be-done
These tasks cover most beginner release setups.
- Add deploy jobs for staging and production.
- Restrict deploy jobs with rules and protected refs.
- Store environment credentials as protected variables.
- Create tags/releases for versioned deployments.
- Add a rollback plan/job (even if manual).
D12Permissions & Roles
Deploys are high-risk operations. Keep them gated by role and by branch/tag protections.
- Only allow Maintainers (or a release group) to deploy to production.
- Use protected environments/variables if available in your setup.
- Lock production credentials to protected branches/tags.
- Use manual ‘play’ jobs initially for production.
- Audit who can create tags/releases if that controls production deploy.
D11Do / Don’t & Pitfalls
Do / Don’t & Pitfalls
Do
- Deploy the same artifact to staging and production.
- Add explicit verification steps (smoke tests/health checks).
- Make production deploys manual until you trust the pipeline.
Don’t
- Don’t deploy from random branches.
- Don’t keep credentials in job scripts or repo files.
- Don’t ship without a rollback path for critical services.
D13Data & Integrations
Deployments frequently integrate with cloud platforms and registries.
- Push images to a container registry then deploy from that tag.
- Use Kubernetes contexts/secrets via CI variables.
- Notify Slack/Teams on deployment events via integrations/webhooks.
- Record deployment metadata for audit (commit SHA, tag, pipeline link).
Happy path workflow #1: Staging-first deployment
- Ensure you have build + test stages working.
- Add a deploy:staging job that runs on default branch (or MR pipeline) with rules.
- Store staging credentials as CI/CD variables.
- Deploy and run automated smoke tests (as a job or external check).
- Confirm environment URL/health manually if needed.
- Add deploy:production as a manual job restricted to tags or protected branch.
- Create a release tag (vX.Y.Z) and run the pipeline.
- Trigger production deploy and verify with monitoring.
Happy path workflow #2: Release via tags and notes
- Adopt semantic versioning (or your org’s standard).
- Create a tag for the release commit.
- Generate release notes (manual or scripted) and publish a release entry.
- Have pipeline build and publish artifacts/images for that tag.
- Deploy the tagged artifact to production (manual gate).
- Record verification evidence (dashboard link, tests).
- If needed, roll back by redeploying the previous tag.
- Close the loop: update changelog and link issues/MRs included.
Decision points
| Situation | If A… | If B… |
|---|---|---|
| Deploy trigger | Default branch pushes deploy to staging. | Only tags deploy to production for tighter control. |
| Promotion style | Manual promotion: safer early stage. | Automated promotion: after strong confidence and guardrails. |
| Artifact strategy | Build once, deploy same artifact to all envs. | Avoid rebuilding per env (reduces drift). |
| Rollback approach | Fast rollback: redeploy previous tag/image. | Complex rollback: requires DB migrations planning. |
Common mistakes (and how to avoid them)
- Deploying from feature branches — Restrict deploy jobs to main/tags with rules.
- Rebuilding for production — Promote the same artifact built in CI.
- No post-deploy verification — Add smoke checks and monitor key metrics.
- Credentials in scripts — Move to protected variables; mask outputs.
- No rollback plan — Document rollback steps; keep previous versions deployable.
What good looks like
- Staging deploy happens before production deploy.
- Production deploy is gated (manual + protected refs).
- Release versions are traceable to commits/MRs.
- Deployments are verified with observable signals.
- Rollback is documented and tested occasionally.
Checklist
Pre-check
- Pipeline builds artifacts/images reliably.
- Staging environment exists and is reachable.
- Credentials are stored as protected/masked variables.
- Rules restrict where deploy jobs run.
- Versioning/release note process is defined.
Post-check
- Staging verification completed.
- Production deploy recorded with version + pipeline link.
- Monitoring confirms stability.
- Rollback path is ready (previous tag/artifact).
- Release notes published and linked.
Practice lab (5–15 minutes): Add a manual production deploy gate
Goal: Create a production deploy job that only runs manually on tags.
Steps
- Add a deploy:production job in `.gitlab-ci.yml`.
- Set `rules` so it only appears for tags (or protected branch).
- Store production credentials as protected variables.
- Run a tagged pipeline and confirm the job is ‘manual’ (play button).
- Trigger it and verify the deployment.
Verify you did it right
- Job does not appear for random branches.
- Credentials are not printed in logs.
- Deployment result is verifiable via URL/health check.
Official docs links
- Docs home → Get started → Get started deploying and releasing your application
- CI/CD docs → Environments and deployments
- User docs → Releases and tags
- CI/CD docs → Rules and variables
Get started managing your infrastructure
Docs → Get started managing your infrastructure- Treat infra as code: MR + plan + review + apply.
- Keep apply manual and restricted.
- Use runner tags to control execution environment.
- Separate credentials per environment.
A1Purpose / Outcome
Infrastructure work in GitLab often means Infrastructure as Code (IaC), runner infrastructure, and cloud/Kubernetes integration. This tab helps you manage infra changes with the same MR + CI discipline.
- Track infra changes like application code (MRs + review).
- Automate plan/apply steps safely in CI.
- Manage runner capacity and execution environments.
- Keep environment credentials secure and scoped.
A2Who is this for + When to use
Use this if your team manages Terraform/Ansible/Kubernetes manifests, or you need to run CI jobs in specific environments.
- Platform/DevOps/SRE teams.
- App teams owning their Kubernetes manifests.
- Anyone managing GitLab runners.
- Teams standardizing environment provisioning.
A3Where in navigation + Related tabs
Infrastructure topics connect across CI/CD (runners, jobs), Deployments (environments), and Integrations (clusters/cloud).
- Related: CI/CD (runners, pipeline jobs).
- Related: Deploying (environments, Kubernetes).
- Related: Secure (secrets and compliance).
- Related: Monitoring (infra health after changes).
B4Mental model / Flow
Treat infra changes as high-risk: propose in MR → run ‘plan’ → review → apply with approvals. Separate read-only checks from write operations.
- MR triggers ‘plan’ jobs (read-only).
- Review outputs (diffs, plans) as part of MR.
- Apply jobs are manual and restricted to protected refs.
- Use environment-specific variables and scopes.
- Audit changes via pipeline/job history.
B5Objects & Terms
Infra work commonly uses these concepts in GitLab.
- Runner tags: route jobs to correct executors.
- Protected variables: restrict secrets to protected refs.
- Environments: map deploy/apply jobs to targets.
- IaC ‘plan’ vs ‘apply’: preview vs change.
- Kubernetes contexts/namespaces: target isolation.
B6State machine / Lifecycle
A stable infra delivery lifecycle reduces outages.
- Change proposed: MR created with plan output.
- Approved: platform owners sign off.
- Applied: manual apply executed from protected pipeline.
- Verified: health checks/monitoring confirm stability.
- Postmortem: for incidents, create an issue and capture actions.
C7Core jobs-to-be-done
These are the minimum infra tasks to automate safely.
- Create a pipeline stage for lint/validate of IaC.
- Add a ‘plan’ job that runs on MRs.
- Add an ‘apply’ job that is manual and protected.
- Set runner tags for special environments (Docker-in-Docker, privileged, etc.).
- Document escalation/rollback procedures.
D12Permissions & Roles
Infra operations should be restricted. Use protected branches/tags, protected variables, and limited deploy rights where available.
- Keep apply jobs manual and only for Maintainers/platform team.
- Use separate credentials per environment (staging vs prod).
- Restrict production credentials to protected refs only.
- Use dedicated runners for privileged jobs.
- Review access to runner registration and admin settings regularly.
D11Do / Don’t & Pitfalls
Do / Don’t & Pitfalls
Do
- Run validation and formatting checks on every MR.
- Make plan output visible in MR for review.
- Separate staging and production credentials and runners.
Don’t
- Don’t allow ‘apply’ on unreviewed branches.
- Don’t share one cloud credential for everything.
- Don’t mix infra and app changes in one MR unless unavoidable.
D13Data & Integrations
Infrastructure usually integrates with cloud providers and Kubernetes. Keep the connection secure and auditable.
- Store kubeconfig/cloud credentials as protected variables.
- Use short-lived credentials where possible.
- Tag runners so only certain jobs can reach prod networks.
- Send change notifications to ops channels via webhooks/integrations.
Happy path workflow #1: IaC plan/apply via MR
- Create a branch for an infra change (e.g., Terraform).
- MR triggers validate + plan jobs (read-only).
- Review plan output with platform owner.
- Adjust change if plan is risky/unexpected.
- Get approvals as required.
- Merge to default branch.
- Run a protected pipeline and trigger manual apply job.
- Verify system health via monitoring dashboards.
Happy path workflow #2: Set up runner tags for infra jobs
- Identify jobs that need special execution (privileged, Docker, network).
- Provision a dedicated runner for that environment.
- Assign runner tags (e.g., `infra`, `k8s`, `privileged`).
- In `.gitlab-ci.yml`, set `tags:` on jobs that require it.
- Test with a safe dry-run job.
- Lock down who can edit pipeline config for protected branches.
- Monitor runner queue time and scale as needed.
Decision points
| Situation | If A… | If B… |
|---|---|---|
| Plan/apply separation | Always separate plan (MR) from apply (protected). | Only combine for toy projects or low-risk environments. |
| Runner placement | Use shared runners for basic linting/validation. | Use dedicated runners for privileged or networked apply jobs. |
| Credential strategy | Per-environment credentials and least privilege. | Avoid a single all-powerful key/token. |
| Change verification | Automate health checks post-apply. | If manual, require evidence in the issue/release notes. |
Common mistakes (and how to avoid them)
- Apply job runs on every push — Make apply manual + restricted by rules/protected refs.
- Plan output not reviewed — Surface plan artifacts and require approval before apply.
- Using shared prod credentials — Split credentials; limit scope; rotate regularly.
- Privileged runner used for everything — Tag and route privileged jobs only; keep others on safer runners.
- No rollback — Define rollback steps; keep previous configs deployable.
What good looks like
- Infra changes are code-reviewed with visible plan outputs.
- Apply is manual and restricted to protected refs.
- Credentials are scoped per environment and protected.
- Runner routing prevents accidental prod access.
- Verification is explicit after each change.
Checklist
Pre-check
- IaC repo has formatting/validate steps.
- Plan job runs on MRs and produces artifacts.
- Apply job is manual and restricted.
- Runner tags are defined and documented.
- Rollback plan exists for critical systems.
Post-check
- Apply executed from protected pipeline only.
- Change recorded (commit/tag/pipeline).
- Monitoring confirms stability.
- Credentials not leaked to logs.
- Post-change notes captured in issue/MR.
Practice lab (5–15 minutes): Create a safe ‘plan only’ pipeline
Goal: Add validate + plan jobs that run on merge requests only.
Steps
- Add a `validate` job (format/lint).
- Add a `plan` job that runs only for MRs (rules).
- Store needed read-only credentials as protected variables (or mock for lab).
- Open a MR and confirm plan output is attached as an artifact.
- Review and merge.
Verify you did it right
- Plan job does not modify infrastructure.
- Artifacts are accessible from the MR.
- No sensitive values appear in logs.
Official docs links
- Docs home → Get started → Get started managing your infrastructure
- CI/CD docs → Runners
- CI/CD docs → Variables and protected variables
- CI/CD docs → Environments (when infra changes map to targets)
Get started with monitoring your application in GitLab
Docs → Get started with monitoring your application in GitLab- Operate in a loop: detect → mitigate → fix → learn.
- Use incident issues as the record of truth.
- Add smoke checks to verify deploys.
- Always track follow-ups as issues.
A1Purpose / Outcome
Monitoring closes the loop after you deploy: you need signals to confirm changes are healthy. This tab helps you set up a basic monitoring workflow that connects incidents to issues and fixes.
- Define what ‘healthy’ means (SLO-lite).
- Create an incident workflow using issues.
- Capture evidence and follow-up actions.
- Verify fixes after deployments.
A2Who is this for + When to use
Use this when your team operates services and needs a repeatable way to detect, respond, and learn from problems.
- On-call developers and SREs.
- Teams shipping frequently and needing quick rollback signals.
- Anyone doing incident reviews/postmortems.
- Projects with staging/production environments.
A3Where in navigation + Related tabs
Monitoring and incident handling connect to Issues (for incidents), CI/CD (for deploy verification), and Projects (for templates and permissions).
- Related: Deploying (verify after deploy).
- Related: Planning (incident issues and follow-ups).
- Related: CI/CD (automated smoke checks).
- Related: Extending (integrate alerting tools via webhooks/API).
B4Mental model / Flow
A simple operating loop is: detect → triage → mitigate → fix → learn. Use GitLab issues to record the incident and track follow-ups as normal work.
- Detect via alerts/dashboards (internal or external).
- Triage: identify severity and owner.
- Mitigate: rollback, feature-flag off, scale, etc.
- Fix via MR + deploy.
- Learn via post-incident review and action items.
B5Objects & Terms
You’ll see these concepts in monitoring and incident workflows.
- Incident: service disruption requiring response.
- Severity: classification of impact/urgency.
- Runbook: documented steps to diagnose/mitigate.
- Postmortem: review of what happened and how to improve.
- Smoke test: fast verification after deploy.
- Alert routing: who gets notified and when.
B6State machine / Lifecycle
Define a minimal incident state model so everyone knows what’s next.
- Open: incident active; mitigation underway.
- Monitoring: mitigated, watching for recurrence.
- Resolved: service stable; root cause identified.
- Follow-up: action items tracked to completion.
- Closed: learnings documented and shared.
C7Core jobs-to-be-done
These are starter monitoring and incident tasks you can implement quickly.
- Create an incident issue template (severity, timeline, actions).
- Define owner/rotation for on-call response.
- Add post-deploy verification (manual checklist or CI job).
- Integrate alerts to create issues automatically (optional).
- Track follow-up tasks in milestones/boards.
D12Permissions & Roles
Incident response needs fast collaboration. Ensure the on-call group has permissions to create/edit incident issues and trigger rollbacks/deploys as defined.
- Ensure responders can create/edit issues in the relevant project/group.
- Restrict production deploy/rollback triggers to a trusted group.
- Keep incident communication channels accessible.
- Use confidential issues for sensitive incidents if needed.
D11Do / Don’t & Pitfalls
Do / Don’t & Pitfalls
Do
- Write a short incident template and use it consistently.
- Timebox investigation and focus on mitigation first.
- Capture a timeline as you go (not afterwards).
Don’t
- Don’t wait for perfect root cause before restoring service.
- Don’t let follow-up actions disappear—track them as issues.
- Don’t run risky changes during an incident without a clear rollback.
D13Data & Integrations
Monitoring often integrates with external tools; keep GitLab as the system of record for incident tasks.
- Use webhooks/API to create issues from alerts (PagerDuty, Opsgenie, etc.).
- Post deployment notifications to chat tools.
- Store runbooks in repo/ Wiki for versioned updates.
- Link dashboards/logs as evidence in issues.
Happy path workflow #1: Handle an incident with an issue
- Create an incident issue using a template.
- Set severity and assign an incident lead.
- Record immediate symptoms and impact.
- Run mitigation steps (rollback/disable feature/scale).
- Update the issue with timeline entries as actions occur.
- When stable, create follow-up issues (root cause, tests, monitoring improvements).
- Fix via MR and deploy; verify with smoke checks.
- Hold a short post-incident review and close the incident issue.
Happy path workflow #2: Add a post-deploy smoke check
- Define 3–5 critical user journeys to verify (login, key API, purchase, etc.).
- Implement a lightweight smoke test (script or external check).
- Add a CI job that runs after deploy (or as a manual checklist step).
- Make the job’s output obvious (pass/fail + link to logs).
- Fail fast: if smoke fails, rollback or halt promotion.
- Record results in deployment notes or the release issue.
- Refine smoke tests over time based on incidents.
Decision points
| Situation | If A… | If B… |
|---|---|---|
| Alert creates issue automatically? | Yes: faster response; needs tuning to avoid noise. | No: start manual; add automation when process is stable. |
| Severity handling | High severity: dedicated incident lead + frequent updates. | Low severity: normal issue workflow may be enough. |
| Mitigation vs investigation | Mitigate first if impact is ongoing. | Investigate deeper once service is stable. |
| Postmortem depth | Lightweight: 15–30 min review for small incidents. | Deep: structured postmortem for major outages. |
Common mistakes (and how to avoid them)
- No timeline captured — Add timestamps as you act; copy logs/links into issue.
- Too many cooks — Assign an incident lead; define roles (comms, mitigation, scribe).
- Skipping follow-ups — Create follow-up issues immediately and assign owners/dates.
- Deploying risky fixes mid-incident — Prefer rollback/feature flag; ship fix after stability.
- No verification after deploy — Add smoke checks and dashboard review steps.
What good looks like
- Incidents are recorded with severity and a timeline.
- Mitigation steps are clear and reversible.
- Follow-up actions are tracked as issues with owners.
- Post-deploy verification exists and is trusted.
- Runbooks improve after incidents.
Checklist
Pre-check
- Incident issue template exists.
- On-call ownership is defined.
- Rollback path exists for major services.
- Smoke checks defined for critical paths.
- Dashboards/logs are accessible to responders.
Post-check
- Incident issue has a complete timeline.
- Root cause and contributing factors documented (as appropriate).
- Follow-up issues created and prioritized.
- Monitoring improvements identified.
- Runbook updated with lessons learned.
Practice lab (5–15 minutes): Create an incident template and run a ‘tabletop’
Goal: Simulate a small outage and practice the workflow.
Steps
- Create an incident issue template.
- Create a fake incident issue and assign roles.
- Write a short timeline of actions (simulate mitigation).
- Create 2 follow-up issues and put them on a board.
- Close the incident and write 3 lessons learned.
Verify you did it right
- Template is easy to use.
- Follow-up issues are actionable and assigned.
- Lessons are captured and visible.
Official docs links
- Docs home → Get started → Get started with monitoring your application in GitLab
- User docs → Incident management (if available in your setup)
- User docs → Issues and templates
- CI/CD docs → Post-deploy jobs / environments
Get started extending GitLab
Docs → Get started extending GitLab- Extend via webhooks (events) and API (actions).
- Use least-privilege tokens and secure storage.
- Make integrations idempotent and monitored.
- Document ownership and rotate credentials.
A1Purpose / Outcome
Extending GitLab means integrating it with your tools and automating workflows via webhooks, APIs, and tokens. This tab helps you start safely with the minimum required access.
- Use personal/project/group access tokens correctly.
- Set up webhooks for events you care about.
- Call the GitLab API for simple automation.
- Build lightweight integrations without compromising security.
A2Who is this for + When to use
Use this when you need to connect GitLab to chat, CI tools, deployment systems, or internal portals, or when you want scripts to manage projects/issues/MRs.
- Engineers automating repetitive admin tasks.
- Teams integrating chat notifications.
- Platform teams building internal tooling.
- Anyone needing to sync data between systems.
A3Where in navigation + Related tabs
Extension points are usually in project/group Settings (Integrations/Webhooks) and in profile settings (tokens).
- Related: Projects (integrations at project or group level).
- Related: CI/CD (pipeline triggers, variables).
- Related: Monitoring (alert → issue automation).
- Related: Security (token scopes, least privilege).
B4Mental model / Flow
Extensions work by either receiving events (webhooks) or making requests (API). Keep integrations minimal: only the events and permissions you actually need.
- Choose the event source (project/group/system).
- Choose the delivery method (webhook to your service).
- Authenticate with the smallest possible token scope.
- Handle retries and signature validation (in your service).
- Log/audit actions and rotate credentials.
B5Objects & Terms
These are the core concepts when integrating with GitLab programmatically.
- Access token: credential to call the API (various types).
- Token scopes: what the token is allowed to do.
- Webhook: GitLab sends event payloads to your endpoint.
- Event types: push, merge request, issue, pipeline, release, etc.
- Rate limits: API usage constraints (varies by offering).
B6State machine / Lifecycle
Treat integrations like production systems with lifecycle management.
- Prototype: minimal scope + test project.
- Production: least privilege, monitoring, alerting.
- Rotation: periodic token rotation and key management.
- Deprecation: remove unused webhooks and tokens.
- Audit: review access and logs regularly.
C7Core jobs-to-be-done
Starter automation that pays off quickly.
- Post MR/pipeline notifications to chat.
- Auto-create issues from external alerts.
- Sync project metadata to an internal dashboard.
- Trigger pipelines from external systems (release tools).
- Bulk-manage labels/members across projects via API.
D12Permissions & Roles
Automation is only as safe as its credentials. Always prefer minimal scope and consider using project/group-level credentials when possible.
- Prefer project/group tokens for scoped automation (when available).
- Use Personal Access Tokens carefully; don’t embed in client apps.
- Limit scopes to read-only unless write access is required.
- Store tokens in secret stores or CI/CD variables (protected/masked).
- Rotate/revoke tokens immediately if leaked.
D11Do / Don’t & Pitfalls
Do / Don’t & Pitfalls
Do
- Validate webhook signatures/tokens in your receiver.
- Use idempotency so retries don’t create duplicates.
- Log actions with correlation IDs (event ID, project ID).
Don’t
- Don’t grant admin-level scopes for simple read tasks.
- Don’t hardcode tokens in mobile/web clients or repos.
- Don’t create many overlapping webhooks—start small and documented.
D13Data & Integrations
GitLab supports many integrations, but the core building blocks remain: webhooks + API + CI triggers.
- Start with one integration endpoint per purpose (chat, alerts, deploy).
- Use environment-specific endpoints (staging vs prod).
- Monitor failures (HTTP 4xx/5xx) from webhook delivery logs.
- Document integration ownership and contact points.
Happy path workflow #1: Add a webhook for merge request events
- Create a small receiver service endpoint (can be a serverless function).
- In GitLab project settings, add a webhook URL.
- Select event type: merge request events.
- Add a secret token/signature validation in your receiver.
- Test delivery from GitLab and confirm payload parsing.
- Post a message to chat or log the event for visibility.
- Add retry-safe behavior (dedupe by event ID).
- Monitor and alert on repeated delivery failures.
Happy path workflow #2: Use the API to automate a routine task
- Pick a task (e.g., add a label to issues, list MRs, create a milestone).
- Create an access token with minimal required scope.
- Write a small script that calls the GitLab API endpoint.
- Test against a sandbox project first.
- Add error handling (rate limits, retries).
- Store the token securely (not in code).
- Run the script manually, then schedule it if needed.
- Document the automation and how to disable it.
Decision points
| Situation | If A… | If B… |
|---|---|---|
| Need push vs pull integration | Push: use webhooks for real-time events. | Pull: use API polling if webhooks aren’t possible. |
| Credential type | Scoped token (project/group) for narrow automation. | Personal token only when no better option exists. |
| Where to store credentials | Server-side secret store / CI variables (protected). | Never in client apps or repos. |
| Automation impact | Low impact: read-only scripts are safest. | High impact: require approvals/logging and limit write scopes. |
Common mistakes (and how to avoid them)
- Webhook receiver accepts any request — Validate secret/signature and restrict IPs if possible.
- No deduping on retries — Use idempotency keys; ignore duplicate event IDs.
- Over-scoped tokens — Create separate tokens per automation with minimal scopes.
- Tokens in code repo — Move to secret storage and rotate immediately.
- No monitoring — Alert on repeated failures and track webhook delivery status.
What good looks like
- Integrations use least-privilege tokens and are rotated regularly.
- Webhook events are validated and retries are idempotent.
- Automation changes are logged and auditable.
- Ownership and documentation are clear.
- Unused tokens/webhooks are removed.
Checklist
Pre-check
- You know exactly what event/action you need.
- Receiver endpoint is ready and secured.
- Token scope is minimal and documented.
- Secrets stored outside code.
- Test project exists for safe experiments.
Post-check
- Webhook deliveries succeed consistently.
- Duplicate deliveries don’t cause duplicates.
- Logs include event IDs and outcomes.
- Token rotation plan exists.
- Integration documented with owner/contact.
Practice lab (5–15 minutes): Build a webhook ‘hello world’
Goal: Receive one GitLab event and log it safely.
Steps
- Create a small endpoint that logs JSON body + headers (but not secrets).
- Add a webhook for ‘push events’ in a sandbox project.
- Add secret token verification.
- Push a commit to trigger the webhook.
- Confirm you logged: project ID, user, ref, commit SHA.
Verify you did it right
- Requests without the secret are rejected.
- Logs show correct project/ref/commit.
- No sensitive values are printed.
Official docs links
- Docs home → Get started → Get started extending GitLab
- User docs → Webhooks / Integrations
- User docs → Personal access tokens
- API docs → GitLab REST API / GraphQL (as applicable)