SlideShare a Scribd company logo
3
Most read
4
Most read
6
Most read
1
Unbox GitLab CI/CD
2
Agenda
● What is GitLab CI/CD
● Why GitLab CI/CD
● How to benefit from GitLab CI/CD
○ Quick start
○ Advanced workflows
■ Faster pipeline
■ Templating(include)
■ Dynamic child pipeline
■ Manual approval flow
■ K8s deployment
■ Security tests
3
What is GitLab CI/CD
GitLab CI/CD is a capability built into GitLab for software development through the
continuous methodologies:
Continuous Integration (CI)
Automated testing and artifact creation
Continuous Delivery (CD)
Automated deployment to test and staging environments
Manual deployment to Production
Continuous Deployment (CD)
Automated deployment to Production
4
Why consider GitLab CI/CD
● Versioned build & tests: a
.gitlab-ci.yml file contains your tests
and build scripts, ensuring every
branch gets build & tests it needs.
● Build artifacts & test results:
binaries, other build artifacts and
test results can be stored and
explored in GitLab.
● Native Docker support: custom
Docker images, spin up services as
part of testing, build new Docker
images, even run on Kubernetes.
● Multi-language: build scripts are
command line driven and work with
any language.
● Real time logging: a link in the
merge request takes you to the
current log.
● One application: no integrations to
maintain, no extra license costs, no
switching back and forth between
applications
5
Get Started with GitLab CI/CD
6
Run your first GitLab CI/CD pipeline
Step 1: Define what to run
Step 2: Define where to run
Step 3: Give it a go!
7
Basic pipeline definition syntax
Yaml format for pipeline definition (.gitlab-ci.yml by default)
8
GitLab runner/executors brief
GitLab CI Runner is where the task is executed.
Runner types:
● Shared
● Group
● Project specific
GitLab
Server
Runner Runner
Common executor types:
● Shell (not ssh)
● Docker (most common)
● Kubernetes
Runner installations:
● Linux
● Windows
● MacOS
● Container/K8S
9
Ways to trigger GitLab pipeline
● Push your code to GitLab repository*
● Run it manually from the UI
● Schedule it to run at later time
● “Trigger”ed by upstream pipeline
● Use API to launch a pipeline with “trigger”
10
Advanced GitLab CI/CD Workflows
11
How to get my pipeline run faster?
● Parallel
crop_pictures
stage: Prepare
script: crop_pics.sh
enforce_relative_links:
stage: Prepare
script: src/other/code/links.sh
● Directed Acyclic Graph
linux-build:
stage: build
mac-build:
stage: build
linux-rspec:
stage: test
needs: [“linux-build”]
mac-rspec:
stage: test
needs: [“mac-build”]
linux-prod:
stage: deploy
needs: [“linux-build”]
mac-prod:
stage: deploy
needs: [“mac-build”]
12
More ways to make your faster
● Caching
cache:
paths:
- binary/
- .config
● Rules/condition
pseudo-deploy:
stage: deploy
only:
- branches
except:
- master
job:
script: "echo Hello, Rules!"
rules:
- if:
'$CI_MERGE_REQUEST_TARGET_BRANCH_NAME
== "master"'
when: always
- if: '$VAR =~ /pattern/'
when: manual
- when: on_success
13
Bored with writing every code block?
CI file template
14
Use of ‘include’
include: '/templates/.after-script-template.yml'
include:
- project: 'my-group/my-project'
ref: master
file: '/templates/.gitlab-ci-template.yml'
include:
- remote: 'https://gitlab.com/awesome-project/raw/master/.gitlab-ci-template.yml'
include:
- template: Auto-DevOps.gitlab-ci.yml
● Reuse code from the same project with include:local
● Reuse code from the another project with include:file
● Reuse code from arbitrary http(s) location with include:remote
● Reuse code from template with include:template
15
Need to “compute” a pipeline?
An example use case:
A project has 1000+ test cases with in-house test harness and want to run all of them in parallel during CI
process. Authoring and maintaining the pipeline might be tedious.
Example code:
generate-config:
stage: build
script: generate-ci-config > generated-config.yml
artifacts:
paths:
- generated-config.yml
child-pipeline:
stage: test
trigger:
include:
- artifact: generated-config.yml
job: generate-config
16
Want to get the pipeline wait for approval?
● Create a manual step with some environment.
approve:
stage: Approve
script:
- echo Approved!
environment:
name: approval_env
when: manual
allow_failure: false
only:
- master
● Protect the approval_env environment in the protected
environments settings by adding only needed user to
“Allowed to Deploy” list.
17
How can I run the whole pipeline conditionally?
● Workflow:rules controls to the entirety of a pipeline
workflow:
rules:
- if: $CI_COMMIT_REF_NAME =~ /-wip$/
when: never
- if: $CI_COMMIT_TAG
when: never
- when: always
18
Minimal code to build and deploy to k8s?
● Prepare your Dockerfile in the repo
● Enabled Auto DevOps
● Connect to your K8S cluster
● Install Helm, Ingress and Prometheus (optional)
● Deploy your application!
19
Wish to run security tests more frequently?
● Include your security test template in your .gitlab-ci.yml file
include:
- template: SAST.gitlab-ci.yml
● Run your pipeline
20
Review your security test result
● Check the result in your merge request
● View the report via Security Dashboard
● Pipeline level
● Project level
● Group level
21
The Top 10 OWASP vulnerabilities
The Top 10 OWASP vulnerabilities in 2020 are:
1. Injection
2. Broken Authentication
3. Sensitive Data Exposure
4. XML External Entities (XXE)
5. Broken Access Control
6. Security Misconfigurations
7. Cross Site Scripting (XSS)
8. Insecure Deserialization
9. Using Components with known vulnerabilities
10. Insufficient logging and monitoring
https://owasp.org/www-project-top-ten/
https://owasp.org/www-community/Source_Code_Analysis_Tools
https://about.gitlab.com/solutions/pci-compliance/
https://about.gitlab.com/blog/2020/01/21/gitlab-is-now-a-m
ember-of-the-owasp-foundation/
22
Seamlessly test for vulnerabilities within the developer workflow
App sec
tests
23
Q & A

More Related Content

PPTX
Gitlab CI/CD
PDF
Continuous Integration/Deployment with Gitlab CI
PDF
Gitlab, GitOps & ArgoCD
PDF
Gitlab ci-cd
PDF
ArgoCD Meetup PPT final.pdf
PDF
Introduction to GitHub Actions
PDF
Using GitLab CI
Gitlab CI/CD
Continuous Integration/Deployment with Gitlab CI
Gitlab, GitOps & ArgoCD
Gitlab ci-cd
ArgoCD Meetup PPT final.pdf
Introduction to GitHub Actions
Using GitLab CI

What's hot (20)

PPT
Jenkins Overview
PDF
Intro to Github Actions @likecoin
PDF
The Power of GitOps with Flux & GitOps Toolkit
PDF
Introduction to GitHub Actions
ODP
An Introduction To Jenkins
PDF
Jenkins
PDF
What is Jenkins | Jenkins Tutorial for Beginners | Edureka
PDF
GITS Class #16: CI/CD (Continuous Integration & Continuous Deployment) with G...
PDF
GitOps with ArgoCD
PDF
Gitops: the kubernetes way
PDF
Kubernetes Introduction
PDF
CI:CD in Lightspeed with kubernetes and argo cd
PPT
CI and CD with Jenkins
ODP
Introduction to Ansible
PDF
Devops Porto - CI/CD at Gitlab
PDF
Google Kubernetes Engine (GKE) deep dive
PPTX
Introduction to jenkins
PDF
Introduction to Kubernetes and Google Container Engine (GKE)
KEY
Git with bitbucket
PPSX
CI-CD Jenkins, GitHub Actions, Tekton
Jenkins Overview
Intro to Github Actions @likecoin
The Power of GitOps with Flux & GitOps Toolkit
Introduction to GitHub Actions
An Introduction To Jenkins
Jenkins
What is Jenkins | Jenkins Tutorial for Beginners | Edureka
GITS Class #16: CI/CD (Continuous Integration & Continuous Deployment) with G...
GitOps with ArgoCD
Gitops: the kubernetes way
Kubernetes Introduction
CI:CD in Lightspeed with kubernetes and argo cd
CI and CD with Jenkins
Introduction to Ansible
Devops Porto - CI/CD at Gitlab
Google Kubernetes Engine (GKE) deep dive
Introduction to jenkins
Introduction to Kubernetes and Google Container Engine (GKE)
Git with bitbucket
CI-CD Jenkins, GitHub Actions, Tekton
Ad

Similar to Webinar - Unbox GitLab CI/CD (20)

PDF
Gitlab ci e kubernetes, build test and deploy your projects like a pro
PDF
Working with the AOSP - Linaro Connect Asia 2013
PDF
Gitlab ci, cncf.sk
PDF
Continuous Deployment with Kubernetes, Docker and GitLab CI
PDF
CI/CD Pipeline mit Gitlab CI und Kubernetes
PPTX
Continuous testing
PDF
CI/CD with Github Actions
PPTX
Gocd – Kubernetes/Nomad Continuous Deployment
PPTX
GCP - Continuous Integration and Delivery into Kubernetes with GitHub, Travis...
PPTX
Build optimization mechanisms in GitLab and Docker
PDF
DCEU 18: Building Your Development Pipeline
ODP
Advanced Code Flow, Notes From the Field
PDF
Enhance Your Kubernetes CI/CD Pipelines With GitLab & Open Source
PDF
Infrastructure = Code
PPTX
Настройка окружения для кросскомпиляции проектов на основе docker'a
PDF
Docker based-Pipelines with Codefresh
PDF
Making your app soar without a container manifest
PDF
Automate Your Automation | DrupalCon Vienna
PDF
Deploy Multinode GitLab Runner in openSUSE 15.1 Instances with Ansible Automa...
PPT
Life of a Chromium Developer
Gitlab ci e kubernetes, build test and deploy your projects like a pro
Working with the AOSP - Linaro Connect Asia 2013
Gitlab ci, cncf.sk
Continuous Deployment with Kubernetes, Docker and GitLab CI
CI/CD Pipeline mit Gitlab CI und Kubernetes
Continuous testing
CI/CD with Github Actions
Gocd – Kubernetes/Nomad Continuous Deployment
GCP - Continuous Integration and Delivery into Kubernetes with GitHub, Travis...
Build optimization mechanisms in GitLab and Docker
DCEU 18: Building Your Development Pipeline
Advanced Code Flow, Notes From the Field
Enhance Your Kubernetes CI/CD Pipelines With GitLab & Open Source
Infrastructure = Code
Настройка окружения для кросскомпиляции проектов на основе docker'a
Docker based-Pipelines with Codefresh
Making your app soar without a container manifest
Automate Your Automation | DrupalCon Vienna
Deploy Multinode GitLab Runner in openSUSE 15.1 Instances with Ansible Automa...
Life of a Chromium Developer
Ad

Recently uploaded (20)

PDF
cuic standard and advanced reporting.pdf
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PDF
Modernizing your data center with Dell and AMD
PDF
CIFDAQ's Market Insight: SEC Turns Pro Crypto
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PPTX
MYSQL Presentation for SQL database connectivity
PPTX
A Presentation on Artificial Intelligence
PDF
Approach and Philosophy of On baking technology
PDF
Bridging biosciences and deep learning for revolutionary discoveries: a compr...
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
DOCX
The AUB Centre for AI in Media Proposal.docx
PDF
Encapsulation_ Review paper, used for researhc scholars
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PDF
Machine learning based COVID-19 study performance prediction
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PDF
Chapter 3 Spatial Domain Image Processing.pdf
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PDF
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
cuic standard and advanced reporting.pdf
Digital-Transformation-Roadmap-for-Companies.pptx
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
Modernizing your data center with Dell and AMD
CIFDAQ's Market Insight: SEC Turns Pro Crypto
Agricultural_Statistics_at_a_Glance_2022_0.pdf
MYSQL Presentation for SQL database connectivity
A Presentation on Artificial Intelligence
Approach and Philosophy of On baking technology
Bridging biosciences and deep learning for revolutionary discoveries: a compr...
Diabetes mellitus diagnosis method based random forest with bat algorithm
The AUB Centre for AI in Media Proposal.docx
Encapsulation_ Review paper, used for researhc scholars
20250228 LYD VKU AI Blended-Learning.pptx
Machine learning based COVID-19 study performance prediction
Advanced methodologies resolving dimensionality complications for autism neur...
Chapter 3 Spatial Domain Image Processing.pdf
“AI and Expert System Decision Support & Business Intelligence Systems”
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
Mobile App Security Testing_ A Comprehensive Guide.pdf

Webinar - Unbox GitLab CI/CD

  • 2. 2 Agenda ● What is GitLab CI/CD ● Why GitLab CI/CD ● How to benefit from GitLab CI/CD ○ Quick start ○ Advanced workflows ■ Faster pipeline ■ Templating(include) ■ Dynamic child pipeline ■ Manual approval flow ■ K8s deployment ■ Security tests
  • 3. 3 What is GitLab CI/CD GitLab CI/CD is a capability built into GitLab for software development through the continuous methodologies: Continuous Integration (CI) Automated testing and artifact creation Continuous Delivery (CD) Automated deployment to test and staging environments Manual deployment to Production Continuous Deployment (CD) Automated deployment to Production
  • 4. 4 Why consider GitLab CI/CD ● Versioned build & tests: a .gitlab-ci.yml file contains your tests and build scripts, ensuring every branch gets build & tests it needs. ● Build artifacts & test results: binaries, other build artifacts and test results can be stored and explored in GitLab. ● Native Docker support: custom Docker images, spin up services as part of testing, build new Docker images, even run on Kubernetes. ● Multi-language: build scripts are command line driven and work with any language. ● Real time logging: a link in the merge request takes you to the current log. ● One application: no integrations to maintain, no extra license costs, no switching back and forth between applications
  • 5. 5 Get Started with GitLab CI/CD
  • 6. 6 Run your first GitLab CI/CD pipeline Step 1: Define what to run Step 2: Define where to run Step 3: Give it a go!
  • 7. 7 Basic pipeline definition syntax Yaml format for pipeline definition (.gitlab-ci.yml by default)
  • 8. 8 GitLab runner/executors brief GitLab CI Runner is where the task is executed. Runner types: ● Shared ● Group ● Project specific GitLab Server Runner Runner Common executor types: ● Shell (not ssh) ● Docker (most common) ● Kubernetes Runner installations: ● Linux ● Windows ● MacOS ● Container/K8S
  • 9. 9 Ways to trigger GitLab pipeline ● Push your code to GitLab repository* ● Run it manually from the UI ● Schedule it to run at later time ● “Trigger”ed by upstream pipeline ● Use API to launch a pipeline with “trigger”
  • 11. 11 How to get my pipeline run faster? ● Parallel crop_pictures stage: Prepare script: crop_pics.sh enforce_relative_links: stage: Prepare script: src/other/code/links.sh ● Directed Acyclic Graph linux-build: stage: build mac-build: stage: build linux-rspec: stage: test needs: [“linux-build”] mac-rspec: stage: test needs: [“mac-build”] linux-prod: stage: deploy needs: [“linux-build”] mac-prod: stage: deploy needs: [“mac-build”]
  • 12. 12 More ways to make your faster ● Caching cache: paths: - binary/ - .config ● Rules/condition pseudo-deploy: stage: deploy only: - branches except: - master job: script: "echo Hello, Rules!" rules: - if: '$CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "master"' when: always - if: '$VAR =~ /pattern/' when: manual - when: on_success
  • 13. 13 Bored with writing every code block? CI file template
  • 14. 14 Use of ‘include’ include: '/templates/.after-script-template.yml' include: - project: 'my-group/my-project' ref: master file: '/templates/.gitlab-ci-template.yml' include: - remote: 'https://gitlab.com/awesome-project/raw/master/.gitlab-ci-template.yml' include: - template: Auto-DevOps.gitlab-ci.yml ● Reuse code from the same project with include:local ● Reuse code from the another project with include:file ● Reuse code from arbitrary http(s) location with include:remote ● Reuse code from template with include:template
  • 15. 15 Need to “compute” a pipeline? An example use case: A project has 1000+ test cases with in-house test harness and want to run all of them in parallel during CI process. Authoring and maintaining the pipeline might be tedious. Example code: generate-config: stage: build script: generate-ci-config > generated-config.yml artifacts: paths: - generated-config.yml child-pipeline: stage: test trigger: include: - artifact: generated-config.yml job: generate-config
  • 16. 16 Want to get the pipeline wait for approval? ● Create a manual step with some environment. approve: stage: Approve script: - echo Approved! environment: name: approval_env when: manual allow_failure: false only: - master ● Protect the approval_env environment in the protected environments settings by adding only needed user to “Allowed to Deploy” list.
  • 17. 17 How can I run the whole pipeline conditionally? ● Workflow:rules controls to the entirety of a pipeline workflow: rules: - if: $CI_COMMIT_REF_NAME =~ /-wip$/ when: never - if: $CI_COMMIT_TAG when: never - when: always
  • 18. 18 Minimal code to build and deploy to k8s? ● Prepare your Dockerfile in the repo ● Enabled Auto DevOps ● Connect to your K8S cluster ● Install Helm, Ingress and Prometheus (optional) ● Deploy your application!
  • 19. 19 Wish to run security tests more frequently? ● Include your security test template in your .gitlab-ci.yml file include: - template: SAST.gitlab-ci.yml ● Run your pipeline
  • 20. 20 Review your security test result ● Check the result in your merge request ● View the report via Security Dashboard ● Pipeline level ● Project level ● Group level
  • 21. 21 The Top 10 OWASP vulnerabilities The Top 10 OWASP vulnerabilities in 2020 are: 1. Injection 2. Broken Authentication 3. Sensitive Data Exposure 4. XML External Entities (XXE) 5. Broken Access Control 6. Security Misconfigurations 7. Cross Site Scripting (XSS) 8. Insecure Deserialization 9. Using Components with known vulnerabilities 10. Insufficient logging and monitoring https://owasp.org/www-project-top-ten/ https://owasp.org/www-community/Source_Code_Analysis_Tools https://about.gitlab.com/solutions/pci-compliance/ https://about.gitlab.com/blog/2020/01/21/gitlab-is-now-a-m ember-of-the-owasp-foundation/
  • 22. 22 Seamlessly test for vulnerabilities within the developer workflow App sec tests