SlideShare une entreprise Scribd logo
1  sur  35
Télécharger pour lire hors ligne
Ondrej Sika
ondrej@sika.io
@ondrejsika
Gitlab CI
Introduction
Agenda
- DevOps
- What is CI/CD
- Setup Gitlab CI
- Configure CI Pipeline
- Live Demo
DevOps
DevOps is a set of software
development practices that combine
software development (Dev) and
information-technology operations
(Ops) to shorten the
systems-development life cycle
while delivering features, fixes, and
updates frequently in close
alignment with business objectives.
DevOps Lifecycle
CI
Continuous Integration
Continuous Integration works to
integrate code from your team in a
shared repository. Developers share
their new code in a Merge (Pull)
Request, which triggers a pipeline to
build, test, and validate the new code
before merging the changes in your
repository.
CD
Continuous Deployment
Continuous Delivery delivers CI
validated code to your application.
Together, CI and CD accelerate how
quickly your team can deliver results
for your customers and
stakeholders. CI helps you catch and
reduce bugs early in the
development cycle, and CD moves
verified to your applications faster.
CI/CD Pipeline
Gitlab CI
Why Gitlab CI
- Integrated: GitLab CI/CD is part of GitLab
- Open source: CI/CD is a part of both the open source GitLab
- Seamless: Part of the single GitLab application
- Scalable: Tests run distributed on separate machines
- Faster results: Each build can be split in multiple jobs that run in parallel on
multiple machines
- Optimized for delivery: multiple stages, manual deploy gates, environments,
and variables
- Easy to learn
Gitlab CI Architecture
Gitlab Runner
- To perform the actual build, you need to install GitLab Runner which is
written in Go.
- It can run on any platform for which you can build Go binaries, including
Linux, OSX, Windows, FreeBSD and Docker.
- It can test any programming language including .Net, Java, Python, C, PHP
and others.
- GitLab Runner has many features, including autoscaling, great Docker
support, and the ability to run multiple jobs concurrently.
Setup Gitlab CI
Setup Gitlab Runners
See my setup scripts https://github.com/ondrejsika/gitlab-ci-runner
# create runner
docker run -d 
--name gitlab-runner 
--restart always 
-v /var/run/docker.sock:/var/run/docker.sock 
-v /builds:/builds 
gitlab/gitlab-runner:latest
Get Runner Registration Token
Go to Admin -> Runners
Setup Gitlab Runners
# register runner to Gitlab
docker exec gitlab-runner gitlab-runner register 
--non-interactive 
--url $GITLABCI_URL 
--registration-token $GITLABCI_TOKEN 
--name $RUNNER_NAME 
--executor docker 
--docker-image docker:git 
--docker-volumes '/var/run/docker.sock:/var/run/docker.sock' 
--docker-volumes '/builds:/builds'
We are ready to use CI
How to use Gitlab CI
- Gitlab CI configuration is stored inside of the repository in file .gitlab-ci.yml
- If repository contains .gitlab-ci.yml, CI run automatically
- You can work on code & CI together and merge them together
- Smallest unit you can run is job, you can group jobs to stages (jobs run in
parallel in stage, stages run in defined order) and stages create pipeline
- You can build binaries, Docker images, deploy to Kubernetes, track
environments and much more.
First Gitlab CI Job
# .gitlab-ci.yml
job:
script: echo Hello World from Gitlab CI!
Stages
# .gitlab-ci.yml
stages:
- build
- deploy
build:
stage: build
script: docker-compose build && docker-compose push
deploy:
stage: deploy
script: helm template --set TAG=$CI_COMMIT_SHA helm/hello-world | kubectl apply -f
Variables
- Secret variables are defined in
Gitlab
- Some variables set CI runtime
- Public variables are defined in
.gitlab-ci.yml
Variables
CI
CI_PROJECT_NAME, CI_PROJECT_PATH_SLUG
CI_COMMIT_REF_NAME, CI_COMMIT_REF_SLUG
CI_COMMIT_SHA, CI_COMMIT_TAG
CI_PIPELINE_ID, CI_JOB_ID
CI_REGISTRY, CI_REGISTRY_USER, CI_REGISTRY_PASSWORD
...
https://docs.gitlab.com/ce/ci/variables/README.html
Artifacts
Artifacts is a list of files and
directories which are attached to a job
after it completes successfully.
Artifacts
job:
script: make build
artifacts:
name: "$CI_JOB_NAME"
paths:
- binaries/
when: on_failure
https://docs.gitlab.com/ce/ci/yaml/README.html#artifacts
Docker
- Fully supported
- Easiest way how to create build
environment
- Easiest way how to run and
distribute your software
Docker Environment
image: ondrejsika/ci
job:
image: ondrejsika/ci-go
script: go build server.go
Docker
job:
script:
- 'docker login $CI_REGISTRY 
-u $CI_REGISTRY_USER 
-p $CI_REGISTRY_PASSWORD'
- docker build -t $CI_REGISTRY_IMAGE .
- docker push $CI_REGISTRY_IMAGE
Environments
Environment is used to define that a
job deploys to a specific environment.
If environment is specified and no
environment under that name exists, a
new one will be created automatically.
Environment
deploy:
script: echo 'Deploy!'
environment:
name: $CI_COMMIT_REF_SLUG
url: https://$CI_COMMIT_REF_SLUG.example.com
Deployments - Automatic
- Manual
Auto vs Manual Deployments
auto_deploy_job:
script: echo Auto Deploy!
environment:
name: deployment-$CI_PIPELINE_ID
manual_deploy_job:
when: manual
script: echo Manual Deploy!
environment:
name: deployment-$CI_PIPELINE_ID
Stop Deployment
deploy_job:
stage: deploy
script: echo Deploy!
environment:
name: deployment-$CI_PIPELINE_ID
on_stop: stop_deploy_job
stop_deploy_job:
stage: deploy
script: echo Stop!
when: manual
environment:
name: deployment-$CI_PIPELINE_ID
action: stop
Demo Time!
https://github.com/ondrejsika/go-server-example
Resources
- Moje Ukazky Gitlab CI
https://ondrej-sika.cz/repozitare/#gitlab-ci
- Moje skoleni Gitlab CI
https://ondrej-sika.cz/skoleni/gitlab-ci/
- https://docs.gitlab.com/ce/ci/
- https://docs.gitlab.com/ce/ci/yaml/
- https://docs.gitlab.com/ce/ci/quick_start/
Thank you & Questions
Ondrej Sika
email: ondrej@sika.io
web: https://ondrej-sika.cz
twitter: @ondrejsika
linkedin: /in/ondrejsika/
Slides: https://sika.link/cncf-sk-ci

Contenu connexe

Tendances

GitLab for CI/CD process
GitLab for CI/CD processGitLab for CI/CD process
GitLab for CI/CD processHYS Enterprise
 
Default GitLab CI Pipeline - Auto DevOps
Default GitLab CI Pipeline - Auto DevOpsDefault GitLab CI Pipeline - Auto DevOps
Default GitLab CI Pipeline - Auto DevOpsRajith Bhanuka Mahanama
 
CI with Gitlab & Docker
CI with Gitlab & DockerCI with Gitlab & Docker
CI with Gitlab & DockerJoerg Henning
 
Kubernetes GitOps featuring GitHub, Kustomize and ArgoCD
Kubernetes GitOps featuring GitHub, Kustomize and ArgoCDKubernetes GitOps featuring GitHub, Kustomize and ArgoCD
Kubernetes GitOps featuring GitHub, Kustomize and ArgoCDSunnyvale
 
GitOps with ArgoCD
GitOps with ArgoCDGitOps with ArgoCD
GitOps with ArgoCDCloudOps2005
 
Introduction to Gitlab | Gitlab 101 | Training Session
Introduction to Gitlab | Gitlab 101 | Training SessionIntroduction to Gitlab | Gitlab 101 | Training Session
Introduction to Gitlab | Gitlab 101 | Training SessionAnwarul Islam
 
Introduction to GitHub Actions
Introduction to GitHub ActionsIntroduction to GitHub Actions
Introduction to GitHub ActionsKnoldus Inc.
 
Using GitLab CI
Using GitLab CIUsing GitLab CI
Using GitLab CIColCh
 
Gitops: the kubernetes way
Gitops: the kubernetes wayGitops: the kubernetes way
Gitops: the kubernetes waysparkfabrik
 
Webinar - Unbox GitLab CI/CD
Webinar - Unbox GitLab CI/CD Webinar - Unbox GitLab CI/CD
Webinar - Unbox GitLab CI/CD Annie Huang
 
Introducing GitLab (September 2018)
Introducing GitLab (September 2018)Introducing GitLab (September 2018)
Introducing GitLab (September 2018)Noa Harel
 
Introduction to Github Actions
Introduction to Github ActionsIntroduction to Github Actions
Introduction to Github ActionsKnoldus Inc.
 
The Power of GitOps with Flux & GitOps Toolkit
The Power of GitOps with Flux & GitOps ToolkitThe Power of GitOps with Flux & GitOps Toolkit
The Power of GitOps with Flux & GitOps ToolkitWeaveworks
 
ArgoCD Meetup PPT final.pdf
ArgoCD Meetup PPT final.pdfArgoCD Meetup PPT final.pdf
ArgoCD Meetup PPT final.pdfamanmakwana3
 

Tendances (20)

GitLab for CI/CD process
GitLab for CI/CD processGitLab for CI/CD process
GitLab for CI/CD process
 
Introducing GitLab
Introducing GitLabIntroducing GitLab
Introducing GitLab
 
Default GitLab CI Pipeline - Auto DevOps
Default GitLab CI Pipeline - Auto DevOpsDefault GitLab CI Pipeline - Auto DevOps
Default GitLab CI Pipeline - Auto DevOps
 
Gitlab ci-cd
Gitlab ci-cdGitlab ci-cd
Gitlab ci-cd
 
CI with Gitlab & Docker
CI with Gitlab & DockerCI with Gitlab & Docker
CI with Gitlab & Docker
 
Kubernetes GitOps featuring GitHub, Kustomize and ArgoCD
Kubernetes GitOps featuring GitHub, Kustomize and ArgoCDKubernetes GitOps featuring GitHub, Kustomize and ArgoCD
Kubernetes GitOps featuring GitHub, Kustomize and ArgoCD
 
GitOps with ArgoCD
GitOps with ArgoCDGitOps with ArgoCD
GitOps with ArgoCD
 
CI/CD with Github Actions
CI/CD with Github ActionsCI/CD with Github Actions
CI/CD with Github Actions
 
Introduction to Gitlab | Gitlab 101 | Training Session
Introduction to Gitlab | Gitlab 101 | Training SessionIntroduction to Gitlab | Gitlab 101 | Training Session
Introduction to Gitlab | Gitlab 101 | Training Session
 
Gitops Hands On
Gitops Hands OnGitops Hands On
Gitops Hands On
 
Introduction to GitHub Actions
Introduction to GitHub ActionsIntroduction to GitHub Actions
Introduction to GitHub Actions
 
Using GitLab CI
Using GitLab CIUsing GitLab CI
Using GitLab CI
 
Gitops: the kubernetes way
Gitops: the kubernetes wayGitops: the kubernetes way
Gitops: the kubernetes way
 
Webinar - Unbox GitLab CI/CD
Webinar - Unbox GitLab CI/CD Webinar - Unbox GitLab CI/CD
Webinar - Unbox GitLab CI/CD
 
Introducing GitLab (September 2018)
Introducing GitLab (September 2018)Introducing GitLab (September 2018)
Introducing GitLab (September 2018)
 
Git & GitLab
Git & GitLabGit & GitLab
Git & GitLab
 
Introduction to Github Actions
Introduction to Github ActionsIntroduction to Github Actions
Introduction to Github Actions
 
Git training v10
Git training v10Git training v10
Git training v10
 
The Power of GitOps with Flux & GitOps Toolkit
The Power of GitOps with Flux & GitOps ToolkitThe Power of GitOps with Flux & GitOps Toolkit
The Power of GitOps with Flux & GitOps Toolkit
 
ArgoCD Meetup PPT final.pdf
ArgoCD Meetup PPT final.pdfArgoCD Meetup PPT final.pdf
ArgoCD Meetup PPT final.pdf
 

Similaire à Gitlab ci, cncf.sk

Gitlab ci e kubernetes, build test and deploy your projects like a pro
Gitlab ci e kubernetes, build test and deploy your projects like a proGitlab ci e kubernetes, build test and deploy your projects like a pro
Gitlab ci e kubernetes, build test and deploy your projects like a prosparkfabrik
 
Gocd – Kubernetes/Nomad Continuous Deployment
Gocd – Kubernetes/Nomad Continuous DeploymentGocd – Kubernetes/Nomad Continuous Deployment
Gocd – Kubernetes/Nomad Continuous DeploymentLeandro Totino Pereira
 
Introduction to git and Github
Introduction to git and GithubIntroduction to git and Github
Introduction to git and GithubWycliff1
 
Life of a Chromium Developer
Life of a Chromium DeveloperLife of a Chromium Developer
Life of a Chromium Developermpaproductions
 
FOSDEM 2017: GitLab CI
FOSDEM 2017:  GitLab CIFOSDEM 2017:  GitLab CI
FOSDEM 2017: GitLab CIOlinData
 
Adopt DevOps philosophy on your Symfony projects (Symfony Live 2011)
Adopt DevOps philosophy on your Symfony projects (Symfony Live 2011)Adopt DevOps philosophy on your Symfony projects (Symfony Live 2011)
Adopt DevOps philosophy on your Symfony projects (Symfony Live 2011)Fabrice Bernhard
 
Continuous Deployment with Kubernetes, Docker and GitLab CI
Continuous Deployment with Kubernetes, Docker and GitLab CIContinuous Deployment with Kubernetes, Docker and GitLab CI
Continuous Deployment with Kubernetes, Docker and GitLab CIalexanderkiel
 
GitOps: Git come unica fonte di verità per applicazioni e infrastruttura
GitOps: Git come unica fonte di verità per applicazioni e infrastrutturaGitOps: Git come unica fonte di verità per applicazioni e infrastruttura
GitOps: Git come unica fonte di verità per applicazioni e infrastrutturasparkfabrik
 
Attacking Pipelines--Security meets Continuous Delivery
Attacking Pipelines--Security meets Continuous DeliveryAttacking Pipelines--Security meets Continuous Delivery
Attacking Pipelines--Security meets Continuous DeliveryJames Wickett
 
Open up your platform with Open Source and GitHub
Open up your platform with Open Source and GitHubOpen up your platform with Open Source and GitHub
Open up your platform with Open Source and GitHubScott Graham
 
2015-ghci-presentation-git_gerritJenkins_final
2015-ghci-presentation-git_gerritJenkins_final2015-ghci-presentation-git_gerritJenkins_final
2015-ghci-presentation-git_gerritJenkins_finalMythri P K
 
HOW TO DRONE.IO IN CI/CD WORLD
HOW TO DRONE.IO IN CI/CD WORLDHOW TO DRONE.IO IN CI/CD WORLD
HOW TO DRONE.IO IN CI/CD WORLDAleksandr Maklakov
 
gitopsthekubernetesway-201026090439.pdf
gitopsthekubernetesway-201026090439.pdfgitopsthekubernetesway-201026090439.pdf
gitopsthekubernetesway-201026090439.pdfsaraichiba2
 
DCEU 18: Building Your Development Pipeline
DCEU 18: Building Your Development PipelineDCEU 18: Building Your Development Pipeline
DCEU 18: Building Your Development PipelineDocker, Inc.
 
DevFest 2022 - Cloud Workstation Introduction TaiChung
DevFest 2022 - Cloud Workstation Introduction TaiChungDevFest 2022 - Cloud Workstation Introduction TaiChung
DevFest 2022 - Cloud Workstation Introduction TaiChungKAI CHU CHUNG
 
Trending pipelines of using CI-CD
Trending pipelines of using CI-CDTrending pipelines of using CI-CD
Trending pipelines of using CI-CDAdarshMathuri
 

Similaire à Gitlab ci, cncf.sk (20)

Gitlab ci e kubernetes, build test and deploy your projects like a pro
Gitlab ci e kubernetes, build test and deploy your projects like a proGitlab ci e kubernetes, build test and deploy your projects like a pro
Gitlab ci e kubernetes, build test and deploy your projects like a pro
 
Gocd – Kubernetes/Nomad Continuous Deployment
Gocd – Kubernetes/Nomad Continuous DeploymentGocd – Kubernetes/Nomad Continuous Deployment
Gocd – Kubernetes/Nomad Continuous Deployment
 
Optimizing Your CI Pipelines
Optimizing Your CI PipelinesOptimizing Your CI Pipelines
Optimizing Your CI Pipelines
 
Introduction to git and Github
Introduction to git and GithubIntroduction to git and Github
Introduction to git and Github
 
CICD_1670665418.pdf
CICD_1670665418.pdfCICD_1670665418.pdf
CICD_1670665418.pdf
 
Life of a Chromium Developer
Life of a Chromium DeveloperLife of a Chromium Developer
Life of a Chromium Developer
 
FOSDEM 2017: GitLab CI
FOSDEM 2017:  GitLab CIFOSDEM 2017:  GitLab CI
FOSDEM 2017: GitLab CI
 
Adopt DevOps philosophy on your Symfony projects (Symfony Live 2011)
Adopt DevOps philosophy on your Symfony projects (Symfony Live 2011)Adopt DevOps philosophy on your Symfony projects (Symfony Live 2011)
Adopt DevOps philosophy on your Symfony projects (Symfony Live 2011)
 
Continuous Deployment with Kubernetes, Docker and GitLab CI
Continuous Deployment with Kubernetes, Docker and GitLab CIContinuous Deployment with Kubernetes, Docker and GitLab CI
Continuous Deployment with Kubernetes, Docker and GitLab CI
 
GitOps: Git come unica fonte di verità per applicazioni e infrastruttura
GitOps: Git come unica fonte di verità per applicazioni e infrastrutturaGitOps: Git come unica fonte di verità per applicazioni e infrastruttura
GitOps: Git come unica fonte di verità per applicazioni e infrastruttura
 
Introduction to git & github
Introduction to git & githubIntroduction to git & github
Introduction to git & github
 
Attacking Pipelines--Security meets Continuous Delivery
Attacking Pipelines--Security meets Continuous DeliveryAttacking Pipelines--Security meets Continuous Delivery
Attacking Pipelines--Security meets Continuous Delivery
 
Open up your platform with Open Source and GitHub
Open up your platform with Open Source and GitHubOpen up your platform with Open Source and GitHub
Open up your platform with Open Source and GitHub
 
Docker e git lab
Docker e git labDocker e git lab
Docker e git lab
 
2015-ghci-presentation-git_gerritJenkins_final
2015-ghci-presentation-git_gerritJenkins_final2015-ghci-presentation-git_gerritJenkins_final
2015-ghci-presentation-git_gerritJenkins_final
 
HOW TO DRONE.IO IN CI/CD WORLD
HOW TO DRONE.IO IN CI/CD WORLDHOW TO DRONE.IO IN CI/CD WORLD
HOW TO DRONE.IO IN CI/CD WORLD
 
gitopsthekubernetesway-201026090439.pdf
gitopsthekubernetesway-201026090439.pdfgitopsthekubernetesway-201026090439.pdf
gitopsthekubernetesway-201026090439.pdf
 
DCEU 18: Building Your Development Pipeline
DCEU 18: Building Your Development PipelineDCEU 18: Building Your Development Pipeline
DCEU 18: Building Your Development Pipeline
 
DevFest 2022 - Cloud Workstation Introduction TaiChung
DevFest 2022 - Cloud Workstation Introduction TaiChungDevFest 2022 - Cloud Workstation Introduction TaiChung
DevFest 2022 - Cloud Workstation Introduction TaiChung
 
Trending pipelines of using CI-CD
Trending pipelines of using CI-CDTrending pipelines of using CI-CD
Trending pipelines of using CI-CD
 

Plus de Juraj Hantak

Kubernetes day 2_jozef_halgas_pf
Kubernetes day 2_jozef_halgas_pfKubernetes day 2_jozef_halgas_pf
Kubernetes day 2_jozef_halgas_pfJuraj Hantak
 
Kubernetes day 2 @ zse energia
Kubernetes day 2 @ zse energiaKubernetes day 2 @ zse energia
Kubernetes day 2 @ zse energiaJuraj Hantak
 
Dev ops culture_final
Dev ops culture_finalDev ops culture_final
Dev ops culture_finalJuraj Hantak
 
Integracia security do ci cd pipelines
Integracia security do ci cd pipelinesIntegracia security do ci cd pipelines
Integracia security do ci cd pipelinesJuraj Hantak
 
Secrets management vault cncf meetup
Secrets management vault cncf meetupSecrets management vault cncf meetup
Secrets management vault cncf meetupJuraj Hantak
 
Introductiontohelmcharts2021
Introductiontohelmcharts2021Introductiontohelmcharts2021
Introductiontohelmcharts2021Juraj Hantak
 
Intro to creating kubernetes operators
Intro to creating kubernetes operators Intro to creating kubernetes operators
Intro to creating kubernetes operators Juraj Hantak
 
19. stretnutie komunity kubernetes
19. stretnutie komunity kubernetes19. stretnutie komunity kubernetes
19. stretnutie komunity kubernetesJuraj Hantak
 
16. Cncf meetup-docker
16. Cncf meetup-docker16. Cncf meetup-docker
16. Cncf meetup-dockerJuraj Hantak
 
16. meetup sietovy model v kubernetes
16. meetup sietovy model v kubernetes16. meetup sietovy model v kubernetes
16. meetup sietovy model v kubernetesJuraj Hantak
 
Terraform a gitlab ci
Terraform a gitlab ciTerraform a gitlab ci
Terraform a gitlab ciJuraj Hantak
 
Monitoring with prometheus at scale
Monitoring with prometheus at scaleMonitoring with prometheus at scale
Monitoring with prometheus at scaleJuraj Hantak
 
Kubernetes monitoring using prometheus stack
Kubernetes monitoring using prometheus stackKubernetes monitoring using prometheus stack
Kubernetes monitoring using prometheus stackJuraj Hantak
 
12.cncfsk meetup observability and analysis
12.cncfsk meetup observability and analysis12.cncfsk meetup observability and analysis
12.cncfsk meetup observability and analysisJuraj Hantak
 

Plus de Juraj Hantak (20)

Kubernetes day 2_jozef_halgas_pf
Kubernetes day 2_jozef_halgas_pfKubernetes day 2_jozef_halgas_pf
Kubernetes day 2_jozef_halgas_pf
 
Kubernetes day 2 @ zse energia
Kubernetes day 2 @ zse energiaKubernetes day 2 @ zse energia
Kubernetes day 2 @ zse energia
 
Dev ops culture_final
Dev ops culture_finalDev ops culture_final
Dev ops culture_final
 
Promise of DevOps
Promise of DevOpsPromise of DevOps
Promise of DevOps
 
23 meetup rancher
23 meetup rancher23 meetup rancher
23 meetup rancher
 
Integracia security do ci cd pipelines
Integracia security do ci cd pipelinesIntegracia security do ci cd pipelines
Integracia security do ci cd pipelines
 
CNCF opa
CNCF opaCNCF opa
CNCF opa
 
Secrets management vault cncf meetup
Secrets management vault cncf meetupSecrets management vault cncf meetup
Secrets management vault cncf meetup
 
Introductiontohelmcharts2021
Introductiontohelmcharts2021Introductiontohelmcharts2021
Introductiontohelmcharts2021
 
Intro to creating kubernetes operators
Intro to creating kubernetes operators Intro to creating kubernetes operators
Intro to creating kubernetes operators
 
19. stretnutie komunity kubernetes
19. stretnutie komunity kubernetes19. stretnutie komunity kubernetes
19. stretnutie komunity kubernetes
 
16. Cncf meetup-docker
16. Cncf meetup-docker16. Cncf meetup-docker
16. Cncf meetup-docker
 
16. meetup sietovy model v kubernetes
16. meetup sietovy model v kubernetes16. meetup sietovy model v kubernetes
16. meetup sietovy model v kubernetes
 
16.meetup uvod
16.meetup uvod16.meetup uvod
16.meetup uvod
 
14. meetup
14. meetup14. meetup
14. meetup
 
Terraform a gitlab ci
Terraform a gitlab ciTerraform a gitlab ci
Terraform a gitlab ci
 
Monitoring with prometheus at scale
Monitoring with prometheus at scaleMonitoring with prometheus at scale
Monitoring with prometheus at scale
 
Kubernetes monitoring using prometheus stack
Kubernetes monitoring using prometheus stackKubernetes monitoring using prometheus stack
Kubernetes monitoring using prometheus stack
 
12.cncfsk meetup observability and analysis
12.cncfsk meetup observability and analysis12.cncfsk meetup observability and analysis
12.cncfsk meetup observability and analysis
 
Grafana 7.0
Grafana 7.0Grafana 7.0
Grafana 7.0
 

Dernier

Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Victor Rentea
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...Zilliz
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsNanddeep Nachan
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodJuan lago vázquez
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistandanishmna97
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWERMadyBayot
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businesspanagenda
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoffsammart93
 
Platformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityPlatformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityWSO2
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobeapidays
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Orbitshub
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...apidays
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDropbox
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxRustici Software
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native ApplicationsWSO2
 
Vector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxVector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxRemote DBA Services
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamUiPathCommunity
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 

Dernier (20)

Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistan
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Platformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityPlatformless Horizons for Digital Adaptability
Platformless Horizons for Digital Adaptability
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
Vector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxVector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptx
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 

Gitlab ci, cncf.sk

  • 2. Agenda - DevOps - What is CI/CD - Setup Gitlab CI - Configure CI Pipeline - Live Demo
  • 3. DevOps DevOps is a set of software development practices that combine software development (Dev) and information-technology operations (Ops) to shorten the systems-development life cycle while delivering features, fixes, and updates frequently in close alignment with business objectives.
  • 5. CI Continuous Integration Continuous Integration works to integrate code from your team in a shared repository. Developers share their new code in a Merge (Pull) Request, which triggers a pipeline to build, test, and validate the new code before merging the changes in your repository.
  • 6. CD Continuous Deployment Continuous Delivery delivers CI validated code to your application. Together, CI and CD accelerate how quickly your team can deliver results for your customers and stakeholders. CI helps you catch and reduce bugs early in the development cycle, and CD moves verified to your applications faster.
  • 9. Why Gitlab CI - Integrated: GitLab CI/CD is part of GitLab - Open source: CI/CD is a part of both the open source GitLab - Seamless: Part of the single GitLab application - Scalable: Tests run distributed on separate machines - Faster results: Each build can be split in multiple jobs that run in parallel on multiple machines - Optimized for delivery: multiple stages, manual deploy gates, environments, and variables - Easy to learn
  • 11. Gitlab Runner - To perform the actual build, you need to install GitLab Runner which is written in Go. - It can run on any platform for which you can build Go binaries, including Linux, OSX, Windows, FreeBSD and Docker. - It can test any programming language including .Net, Java, Python, C, PHP and others. - GitLab Runner has many features, including autoscaling, great Docker support, and the ability to run multiple jobs concurrently.
  • 13. Setup Gitlab Runners See my setup scripts https://github.com/ondrejsika/gitlab-ci-runner # create runner docker run -d --name gitlab-runner --restart always -v /var/run/docker.sock:/var/run/docker.sock -v /builds:/builds gitlab/gitlab-runner:latest
  • 14. Get Runner Registration Token Go to Admin -> Runners
  • 15. Setup Gitlab Runners # register runner to Gitlab docker exec gitlab-runner gitlab-runner register --non-interactive --url $GITLABCI_URL --registration-token $GITLABCI_TOKEN --name $RUNNER_NAME --executor docker --docker-image docker:git --docker-volumes '/var/run/docker.sock:/var/run/docker.sock' --docker-volumes '/builds:/builds'
  • 16. We are ready to use CI
  • 17. How to use Gitlab CI - Gitlab CI configuration is stored inside of the repository in file .gitlab-ci.yml - If repository contains .gitlab-ci.yml, CI run automatically - You can work on code & CI together and merge them together - Smallest unit you can run is job, you can group jobs to stages (jobs run in parallel in stage, stages run in defined order) and stages create pipeline - You can build binaries, Docker images, deploy to Kubernetes, track environments and much more.
  • 18. First Gitlab CI Job # .gitlab-ci.yml job: script: echo Hello World from Gitlab CI!
  • 19. Stages # .gitlab-ci.yml stages: - build - deploy build: stage: build script: docker-compose build && docker-compose push deploy: stage: deploy script: helm template --set TAG=$CI_COMMIT_SHA helm/hello-world | kubectl apply -f
  • 20. Variables - Secret variables are defined in Gitlab - Some variables set CI runtime - Public variables are defined in .gitlab-ci.yml
  • 21. Variables CI CI_PROJECT_NAME, CI_PROJECT_PATH_SLUG CI_COMMIT_REF_NAME, CI_COMMIT_REF_SLUG CI_COMMIT_SHA, CI_COMMIT_TAG CI_PIPELINE_ID, CI_JOB_ID CI_REGISTRY, CI_REGISTRY_USER, CI_REGISTRY_PASSWORD ... https://docs.gitlab.com/ce/ci/variables/README.html
  • 22. Artifacts Artifacts is a list of files and directories which are attached to a job after it completes successfully.
  • 23. Artifacts job: script: make build artifacts: name: "$CI_JOB_NAME" paths: - binaries/ when: on_failure https://docs.gitlab.com/ce/ci/yaml/README.html#artifacts
  • 24. Docker - Fully supported - Easiest way how to create build environment - Easiest way how to run and distribute your software
  • 25. Docker Environment image: ondrejsika/ci job: image: ondrejsika/ci-go script: go build server.go
  • 26. Docker job: script: - 'docker login $CI_REGISTRY -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD' - docker build -t $CI_REGISTRY_IMAGE . - docker push $CI_REGISTRY_IMAGE
  • 27. Environments Environment is used to define that a job deploys to a specific environment. If environment is specified and no environment under that name exists, a new one will be created automatically.
  • 28. Environment deploy: script: echo 'Deploy!' environment: name: $CI_COMMIT_REF_SLUG url: https://$CI_COMMIT_REF_SLUG.example.com
  • 30. Auto vs Manual Deployments auto_deploy_job: script: echo Auto Deploy! environment: name: deployment-$CI_PIPELINE_ID manual_deploy_job: when: manual script: echo Manual Deploy! environment: name: deployment-$CI_PIPELINE_ID
  • 31. Stop Deployment deploy_job: stage: deploy script: echo Deploy! environment: name: deployment-$CI_PIPELINE_ID on_stop: stop_deploy_job stop_deploy_job: stage: deploy script: echo Stop! when: manual environment: name: deployment-$CI_PIPELINE_ID action: stop
  • 34. Resources - Moje Ukazky Gitlab CI https://ondrej-sika.cz/repozitare/#gitlab-ci - Moje skoleni Gitlab CI https://ondrej-sika.cz/skoleni/gitlab-ci/ - https://docs.gitlab.com/ce/ci/ - https://docs.gitlab.com/ce/ci/yaml/ - https://docs.gitlab.com/ce/ci/quick_start/
  • 35. Thank you & Questions Ondrej Sika email: ondrej@sika.io web: https://ondrej-sika.cz twitter: @ondrejsika linkedin: /in/ondrejsika/ Slides: https://sika.link/cncf-sk-ci