DevOps Intermediate
GitLab CI — Advanced Pipelines¶
GitLab CICI/CDDevOpsPipeline 5 min read
GitLab CI advanced techniques: DAG pipelines, child pipelines, includes and review apps.
DAG Pipelines¶
stages:
- build
- test
- deploy
build-frontend:
stage: build
script: npm run build
build-backend:
stage: build
script: go build -o app
test-frontend:
stage: test
needs: [build-frontend]
script: npm test
test-backend:
stage: test
needs: [build-backend]
script: go test ./...
deploy:
stage: deploy
needs: [test-frontend, test-backend]
script: kubectl apply -f k8s/
Child Pipelines & Includes¶
include:
- project: 'devops/ci-templates'
file: '/templates/docker-build.yml'
- local: '.gitlab/security.yml'
trigger-microservices:
trigger:
include:
- local: services/api/.gitlab-ci.yml
- local: services/worker/.gitlab-ci.yml
strategy: depend
Review Apps¶
deploy-review:
stage: deploy
script:
- helm upgrade --install review-$CI_COMMIT_REF_SLUG ./chart
--set image.tag=$CI_COMMIT_SHA
--set ingress.host=$CI_COMMIT_REF_SLUG.review.example.com
environment:
name: review/$CI_COMMIT_REF_SLUG
url: https://$CI_COMMIT_REF_SLUG.review.example.com
on_stop: stop-review
auto_stop_in: 1 week
rules:
- if: $CI_MERGE_REQUEST_IID
Summary¶
GitLab CI with DAG pipelines, child pipelines and review apps enables scalable and fast pipelines.
Need Help with Implementation?¶
Our team has experience designing and implementing modern architectures. We’re happy to help.