You are viewing a free preview of this lesson.
Subscribe to unlock all 10 lessons in this course and every other course on LearningBro.
While GitHub Actions is popular, it is not the only CI/CD platform. This lesson covers GitLab CI/CD, Jenkins, CircleCI, and other platforms, helping you understand the landscape and choose the right tool.
GitLab CI/CD is a built-in CI/CD solution that is part of GitLab — no separate tool or integration needed.
GitLab pipelines are defined in a .gitlab-ci.yml file at the root of the repository:
stages:
- build
- test
- deploy
variables:
NODE_ENV: production
build:
stage: build
image: node:20-alpine
script:
- npm ci
- npm run build
artifacts:
paths:
- dist/
expire_in: 1 hour
test:
stage: test
image: node:20-alpine
script:
- npm ci
- npm run lint
- npm test -- --coverage
coverage: '/All files[^|]*\|[^|]*\s+([\d.]+)/'
deploy:
stage: deploy
image: alpine:latest
script:
- ./deploy.sh
only:
- main
environment:
name: production
url: https://myapp.example.com
GitLab uses runners to execute jobs. Runners can be:
| Type | Description |
|---|---|
| Shared runners | Provided by GitLab (cloud) |
| Group runners | Shared across projects in a group |
| Project runners | Dedicated to a single project |
| Self-hosted | Installed on your own infrastructure |
| Feature | GitLab CI | GitHub Actions |
|---|---|---|
| Config file | .gitlab-ci.yml | .github/workflows/*.yml |
| Runner types | Shared, group, project | GitHub-hosted, self-hosted |
| Container registry | Built-in | GHCR (separate) |
| Auto DevOps | Yes | No (manual config) |
| Review apps | Built-in | Requires setup |
| Marketplace | Fewer templates | Large marketplace |
| Self-hosting | Full GitLab instance | Only runners |
| Free tier | 400 min/month | 2,000 min/month |
Jenkins is the oldest and most widely deployed CI/CD server. It is open-source and highly extensible.
pipeline {
agent any
environment {
NODE_ENV = 'production'
}
stages {
stage('Build') {
steps {
sh 'npm ci'
sh 'npm run build'
}
}
stage('Test') {
steps {
sh 'npm test'
}
}
stage('Deploy') {
when {
branch 'main'
}
steps {
sh './deploy.sh'
}
}
}
post {
always {
junit 'test-results/*.xml'
}
failure {
mail to: 'team@example.com',
subject: "Build Failed: ${env.JOB_NAME}",
body: "Check: ${env.BUILD_URL}"
}
}
}
Subscribe to continue reading
Get full access to this lesson and all 10 lessons in this course.