SlideShare uma empresa Scribd logo
1 de 35
Baixar para ler offline
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

Mais conteúdo relacionado

Mais procurados

Introducing GitLab (September 2018)
Introducing GitLab (September 2018)Introducing GitLab (September 2018)
Introducing GitLab (September 2018)Noa Harel
 
GitLab for CI/CD process
GitLab for CI/CD processGitLab for CI/CD process
GitLab for CI/CD processHYS Enterprise
 
CI with Gitlab & Docker
CI with Gitlab & DockerCI with Gitlab & Docker
CI with Gitlab & DockerJoerg Henning
 
FOSDEM 2017: GitLab CI
FOSDEM 2017:  GitLab CIFOSDEM 2017:  GitLab CI
FOSDEM 2017: GitLab CIOlinData
 
Git Lab Introduction
Git Lab IntroductionGit Lab Introduction
Git Lab IntroductionKrunal Doshi
 
What's New for GitLab CI/CD February 2020
What's New for GitLab CI/CD February 2020What's New for GitLab CI/CD February 2020
What's New for GitLab CI/CD February 2020Noa Harel
 
DevOps with GitHub Actions
DevOps with GitHub ActionsDevOps with GitHub Actions
DevOps with GitHub ActionsNilesh Gule
 
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
 
Jenkins vs GitLab CI
Jenkins vs GitLab CIJenkins vs GitLab CI
Jenkins vs GitLab CICEE-SEC(R)
 
Gitops: the kubernetes way
Gitops: the kubernetes wayGitops: the kubernetes way
Gitops: the kubernetes waysparkfabrik
 
Introduction to Gitlab
Introduction to GitlabIntroduction to Gitlab
Introduction to GitlabJulien Pivotto
 
CICD Pipeline Using Github Actions
CICD Pipeline Using Github ActionsCICD Pipeline Using Github Actions
CICD Pipeline Using Github ActionsKumar Shìvam
 
Introducing GitLab (June 2018)
Introducing GitLab (June 2018)Introducing GitLab (June 2018)
Introducing GitLab (June 2018)Noa Harel
 
GitOps with ArgoCD
GitOps with ArgoCDGitOps with ArgoCD
GitOps with ArgoCDCloudOps2005
 
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
 
Learning git
Learning gitLearning git
Learning gitSid Anand
 

Mais procurados (20)

Introducing GitLab (September 2018)
Introducing GitLab (September 2018)Introducing GitLab (September 2018)
Introducing GitLab (September 2018)
 
GitLab for CI/CD process
GitLab for CI/CD processGitLab for CI/CD process
GitLab for CI/CD process
 
GitLab.pptx
GitLab.pptxGitLab.pptx
GitLab.pptx
 
CI with Gitlab & Docker
CI with Gitlab & DockerCI with Gitlab & Docker
CI with Gitlab & Docker
 
FOSDEM 2017: GitLab CI
FOSDEM 2017:  GitLab CIFOSDEM 2017:  GitLab CI
FOSDEM 2017: GitLab CI
 
Git Lab Introduction
Git Lab IntroductionGit Lab Introduction
Git Lab Introduction
 
What's New for GitLab CI/CD February 2020
What's New for GitLab CI/CD February 2020What's New for GitLab CI/CD February 2020
What's New for GitLab CI/CD February 2020
 
CI-CD WITH GITLAB WORKFLOW
CI-CD WITH GITLAB WORKFLOWCI-CD WITH GITLAB WORKFLOW
CI-CD WITH GITLAB WORKFLOW
 
DevOps with GitHub Actions
DevOps with GitHub ActionsDevOps with GitHub Actions
DevOps 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
 
Jenkins vs GitLab CI
Jenkins vs GitLab CIJenkins vs GitLab CI
Jenkins vs GitLab CI
 
Gitops: the kubernetes way
Gitops: the kubernetes wayGitops: the kubernetes way
Gitops: the kubernetes way
 
Git real slides
Git real slidesGit real slides
Git real slides
 
Introduction to Gitlab
Introduction to GitlabIntroduction to Gitlab
Introduction to Gitlab
 
CICD Pipeline Using Github Actions
CICD Pipeline Using Github ActionsCICD Pipeline Using Github Actions
CICD Pipeline Using Github Actions
 
Introducing GitLab (June 2018)
Introducing GitLab (June 2018)Introducing GitLab (June 2018)
Introducing GitLab (June 2018)
 
CI/CD with GitHub Actions
CI/CD with GitHub ActionsCI/CD with GitHub Actions
CI/CD with GitHub Actions
 
GitOps with ArgoCD
GitOps with ArgoCDGitOps with ArgoCD
GitOps with ArgoCD
 
Default GitLab CI Pipeline - Auto DevOps
Default GitLab CI Pipeline - Auto DevOpsDefault GitLab CI Pipeline - Auto DevOps
Default GitLab CI Pipeline - Auto DevOps
 
Learning git
Learning gitLearning git
Learning git
 

Semelhante a Gitlab CI Setup and Configuration

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
 
Webinar - Unbox GitLab CI/CD
Webinar - Unbox GitLab CI/CD Webinar - Unbox GitLab CI/CD
Webinar - Unbox GitLab CI/CD Annie Huang
 
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
 
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
 
Life of a Chromium Developer
Life of a Chromium DeveloperLife of a Chromium Developer
Life of a Chromium Developermpaproductions
 
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.
 

Semelhante a Gitlab CI Setup and Configuration (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
 
Webinar - Unbox GitLab CI/CD
Webinar - Unbox GitLab CI/CD Webinar - Unbox GitLab CI/CD
Webinar - Unbox GitLab CI/CD
 
CI/CD with Github Actions
CI/CD with Github ActionsCI/CD with Github Actions
CI/CD with Github Actions
 
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
 
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
 
Life of a Chromium Developer
Life of a Chromium DeveloperLife of a Chromium Developer
Life of a Chromium Developer
 
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
 

Mais 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
 

Mais 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
 

Último

Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsMiki Katsuragi
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 
Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfRankYa
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...Fwdays
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Enterprise Knowledge
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Commit University
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr LapshynFwdays
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machinePadma Pradeep
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenHervé Boutemy
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Wonjun Hwang
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 

Último (20)

Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering Tips
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 
Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdf
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machine
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache Maven
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 

Gitlab CI Setup and Configuration

  • 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