SlideShare a Scribd company logo
1 of 19
Download to read offline
GitLab CI
Open Source Continuous Integration made easy
Who am I?
Walter Heck
CTO at OlinData since 2008
Background: Delphi, MySQL, SysOps
Love: Automation, DevOps, FOSS
Who are you?
Anyone using GitLab self hosted?
Github Enterprise
Atlassian Bitbucket / Bamboo?
Jenkins?
What is GitLab
GitLab is a web-based Git repository manager with wiki and
issue tracking features, using an open source license,
developed by GitLab Inc.
What is GitLab CI
Gitlab CI is a Continuous Integration service fully integrated with GitLab. Due to
it’s tight integration many tasks related to CI and CD become much easier to
manage.
GitLab CI is fully open source and included in any GitLab CE installation. Check in
a .gitlab-ci.yaml file to get started :)
GitLab CI Runners
In GitLab CI, Runners run your yaml. A runner is an isolated (virtual) machine that
picks up builds through the coordinator API of GitLab CI.
A runner can be specific to a certain project or serve any project in GitLab CI. A
runner that serves all projects is called a shared runner.
Docker runner
Runs GitLab CI builds inside one or more docker containers
● Easiest to get started (works out of the box)
○ For production usage look into docker in production (in particular storage drivers)
● ‘Abuses’ containers as throw-away VMs
○ Feels strange at first, perfect after you get used to it
Starting .gitlab-ci.yaml
#.gitlab-ci.yaml
image: ruby:2.2
test:
script:
- bundle install
- bundle exec rake lint
- bundle exec rake syntax
● Choose a docker image
(https://hub.docker.com/_/ruby)
● Simple job called test
○ Runs two rake tasks
● Runs on every push + MR on every
branch that contains a .gitlab-ci.yaml
○ May be different between branches
Jobs
Jobs can be run:
● locally
● using Docker containers
● using Docker containers and executing job over
SSH
● using Docker containers with autoscaling on
different clouds and virtualization hypervisors
● connecting to remote SSH server
Why multiple jobs?
● The smaller a job the easier parallelization across
multiple runners is
● Smaller jobs are easier to diagnose when they
break
image: ruby:2.2
before_script:
- bundle install
job:test:syntax:
script:
- bundle exec rake syntax
job:test:lint:
script:
- bundle exec rake lint
Pipeline
Artifacts/dependencies
Allows for transferring data/files from one job to
the next within the same build
● Why run bundle install every time?
● Artifacts are passed between jobs
○ Make sure to set expiration (default = 1
day)
● Dependencies determine a job can only
run after some other job
image: ruby:2.2
job:build:artifacts:
script:
- bundle install --deployment
artifacts:
expire_in: 1 day
paths:
- vendor/
job:test:syntax:
script:
- bundle install --deployment
- bundle exec rake syntax
dependencies:
- job:build:artifacts
job:test:lint:
script:
- bundle install --deployment
- bundle exec rake lint
dependencies:
- job:build:artifacts
Stages
The ordering of elements in stages defines the ordering of
builds' execution:
● Jobs of the same stage are run in parallel.
● Jobs of the next stage are run after the jobs from
the previous stage complete successfully.
image: ruby:2.2
stages:
- build
- test
- deploy
job:build:artifacts:
stage: build
script:
- bundle install --deployment
artifacts:
expire_in: 1 day
paths:
- vendor/
job:test:syntax:
stage: test
script:
- bundle install --deployment
- bundle exec rake syntax
dependencies:
- job:build:artifacts
job:test:lint:
stage: test
script:
- bundle install --deployment
- bundle exec rake lint
dependencies:
- job:build:artifacts
Limiting builds
● Sometimes we don’t want certain jobs to
always run
○ Usually when they take lots of resources
(time, compute)
○ Or when they do things like deploy to
staging/production
● Use only
○ Defines a list of git refs for which build is
created
● Or use except
○ Defines a list of git refs for which build is not
created
job_name:
script:
- rake spec
- coverage
stage: test
only:
- master
except:
- develop
tags:
- ruby
- postgres
allow_failure: true
Selecting specific runners
tags is used to select specific Runners from the list of all Runners that are allowed to run this project.
During the registration of a Runner, you can specify the Runner's tags, for example ruby, postgres, development.
tags allow you to run builds with Runners that have the specified tags assigned to them:
job:
tags:
- ruby
- postgres
The specification above, will make sure that job is built by a Runner that has both ruby AND postgres tags defined.
Manual build
Introduced in GitLab 8.10.
Manual actions are a special type of job that are not executed automatically; they need to be explicitly started by a user. Manual
actions can be started from pipeline, build, environment, and deployment views. You can execute the same manual action multiple
times.
An example usage of manual actions is deployment to production.
Secret variables
GitLab CI allows you to define per-project secret variables that are set in the build environment. The secret variables are stored out of
the repository (.gitlab-ci.yml) and are securely passed to GitLab Runner making them available in the build environment. It's the
recommended method to use for storing things like passwords, secret keys and credentials.
Secret variables can be added by going to your project's Settings ➔ Variables ➔ Add variable.
Once you set them, they will be available for all subsequent builds.
Be aware that secret variables are not masked,
and their values can be shown in the build logs if
explicitly asked to do so. If your project is public
or internal, you can set the pipelines private from
your project's Pipelines settings. Follow the
discussion in issue #13784 for masking the
secret variables.
GitLab currently doesn't have built-in support for managing
SSH keys in a build environment.
The SSH keys can be useful when:
1. You want to checkout internal submodules
2. You want to download private packages using
your package manager (eg. bundler)
3. You want to deploy your application to eg. Heroku
or your own server
4. You want to execute SSH commands from the
build server to the remote server
5. You want to rsync files from your build server to
the remote server
Private repos, deploy servers, SSH Keys
How it works
1. Create a new SSH key pair with ssh-keygen
2. Add the private key as a Secret Variable to the project
3. Run the ssh-agent during build to load the private key.
before_script:
- 'which ssh-agent || ( apt-get update -y && apt-get install openssh-client -y )'
- eval $(ssh-agent -s)
- ssh-add <(echo "$SSH_PRIVATE_KEY")
- mkdir -p ~/.ssh
- '[[ -f /.dockerenv ]] && echo -e "Host *ntStrictHostKeyChecking nonn" >
~/.ssh/config'
Test SSH:
script:
- ssh git@gitlab.com
- git clone git@gitlab.com:gitlab-examples/ssh-private-key.git
YAML anchors
YAML also has a handy feature called 'anchors', which
let you easily duplicate content across your document.
.job_template: &job_definition # Hidden key that defines an anchor
named 'job_definition'
image: ruby:2.1
services:
- postgres
- redis
test1:
<<: *job_definition # Merge the contents of the
'job_definition' alias
script:
- test1 project
test2:
<<: *job_definition # Merge the contents of the
'job_definition' alias
script:
- test2 project
.job_template:
image: ruby:2.1
services:
- postgres
- redis
test1:
image: ruby:2.1
services:
- postgres
- redis
script:
- test1 project
test2:
image: ruby:2.1
services:
- postgres
- redis
script:
- test2 project
Questions?
@olindata / @walterheck
walterheck@olindata.com
www.linkedin.com/in/walterheck

More Related Content

What's hot

Introduction to GitHub Actions
Introduction to GitHub ActionsIntroduction to GitHub Actions
Introduction to GitHub ActionsBo-Yi Wu
 
CI and CD with Jenkins
CI and CD with JenkinsCI and CD with Jenkins
CI and CD with JenkinsMartin Málek
 
Devops Porto - CI/CD at Gitlab
Devops Porto - CI/CD at GitlabDevops Porto - CI/CD at Gitlab
Devops Porto - CI/CD at GitlabFilipa Lacerda
 
Gitlab ci, cncf.sk
Gitlab ci, cncf.skGitlab ci, cncf.sk
Gitlab ci, cncf.skJuraj Hantak
 
Introduction to CICD
Introduction to CICDIntroduction to CICD
Introduction to CICDKnoldus Inc.
 
GitHub Actions in action
GitHub Actions in actionGitHub Actions in action
GitHub Actions in actionOleksii Holub
 
Introduction to Github Actions
Introduction to Github ActionsIntroduction to Github Actions
Introduction to Github ActionsKnoldus Inc.
 
Simply your Jenkins Projects with Docker Multi-Stage Builds
Simply your Jenkins Projects with Docker Multi-Stage BuildsSimply your Jenkins Projects with Docker Multi-Stage Builds
Simply your Jenkins Projects with Docker Multi-Stage BuildsEric Smalling
 
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
 
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
 
Docker and kubernetes
Docker and kubernetesDocker and kubernetes
Docker and kubernetesDongwon Kim
 

What's hot (20)

Jenkins
JenkinsJenkins
Jenkins
 
Introduction to GitHub Actions
Introduction to GitHub ActionsIntroduction to GitHub Actions
Introduction to GitHub Actions
 
Github in Action
Github in ActionGithub in Action
Github in Action
 
CI and CD with Jenkins
CI and CD with JenkinsCI and CD with Jenkins
CI and CD with Jenkins
 
Devops Porto - CI/CD at Gitlab
Devops Porto - CI/CD at GitlabDevops Porto - CI/CD at Gitlab
Devops Porto - CI/CD at Gitlab
 
Gitlab ci, cncf.sk
Gitlab ci, cncf.skGitlab ci, cncf.sk
Gitlab ci, cncf.sk
 
Introduction to CICD
Introduction to CICDIntroduction to CICD
Introduction to CICD
 
Argocd up and running
Argocd up and runningArgocd up and running
Argocd up and running
 
CICD with Jenkins
CICD with JenkinsCICD with Jenkins
CICD with Jenkins
 
GitHub Actions in action
GitHub Actions in actionGitHub Actions in action
GitHub Actions in action
 
Introduction to Github Actions
Introduction to Github ActionsIntroduction to Github Actions
Introduction to Github Actions
 
Introduction to CI/CD
Introduction to CI/CDIntroduction to CI/CD
Introduction to CI/CD
 
Jenkins tutorial
Jenkins tutorialJenkins tutorial
Jenkins tutorial
 
Gitlab ci-cd
Gitlab ci-cdGitlab ci-cd
Gitlab ci-cd
 
Simply your Jenkins Projects with Docker Multi-Stage Builds
Simply your Jenkins Projects with Docker Multi-Stage BuildsSimply your Jenkins Projects with Docker Multi-Stage Builds
Simply your Jenkins Projects with Docker Multi-Stage Builds
 
Default GitLab CI Pipeline - Auto DevOps
Default GitLab CI Pipeline - Auto DevOpsDefault GitLab CI Pipeline - Auto DevOps
Default GitLab CI Pipeline - Auto DevOps
 
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
 
Jenkins
JenkinsJenkins
Jenkins
 
CI/CD with GitHub Actions
CI/CD with GitHub ActionsCI/CD with GitHub Actions
CI/CD with GitHub Actions
 
Docker and kubernetes
Docker and kubernetesDocker and kubernetes
Docker and kubernetes
 

Viewers also liked

Breaking Bad Habits with GitLab CI
Breaking Bad Habits with GitLab CIBreaking Bad Habits with GitLab CI
Breaking Bad Habits with GitLab CIIvan Nemytchenko
 
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
 
CI with Gitlab & Docker
CI with Gitlab & DockerCI with Gitlab & Docker
CI with Gitlab & DockerJoerg Henning
 
Jenkins vs GitLab CI
Jenkins vs GitLab CIJenkins vs GitLab CI
Jenkins vs GitLab CICEE-SEC(R)
 
Gitlab Training with GIT and SourceTree
Gitlab Training with GIT and SourceTreeGitlab Training with GIT and SourceTree
Gitlab Training with GIT and SourceTreeTeerapat Khunpech
 
Why you can't ignore GitLab
Why you can't ignore GitLabWhy you can't ignore GitLab
Why you can't ignore GitLabPivorak MeetUp
 
GitLab as an Alternative Development Platform for Github.com
GitLab as an Alternative Development Platform for Github.comGitLab as an Alternative Development Platform for Github.com
GitLab as an Alternative Development Platform for Github.comB1 Systems GmbH
 
Idea to Production - with Gitlab and Kubernetes
Idea to Production  - with Gitlab and KubernetesIdea to Production  - with Gitlab and Kubernetes
Idea to Production - with Gitlab and KubernetesSimon Dittlmann
 
GitFlow, SourceTree and GitLab
GitFlow, SourceTree and GitLabGitFlow, SourceTree and GitLab
GitFlow, SourceTree and GitLabShinu Suresh
 
Webinar - Continuous Integration with GitLab
Webinar - Continuous Integration with GitLabWebinar - Continuous Integration with GitLab
Webinar - Continuous Integration with GitLabOlinData
 
GitLab 8.5 Highlights and Step-by-step tutorial
GitLab 8.5 Highlights and Step-by-step tutorialGitLab 8.5 Highlights and Step-by-step tutorial
GitLab 8.5 Highlights and Step-by-step tutorialHeather McNamee
 
WordCamp Lyon 2015 - WordPress, Git et l'intégration continue
 WordCamp Lyon 2015 - WordPress, Git et l'intégration continue WordCamp Lyon 2015 - WordPress, Git et l'intégration continue
WordCamp Lyon 2015 - WordPress, Git et l'intégration continueStéphane HULARD
 
Formation autour de git et git lab
Formation autour de git et git labFormation autour de git et git lab
Formation autour de git et git labAbdelghani Azri
 
How we scaled git lab for a 30k employee company
How we scaled git lab for a 30k employee companyHow we scaled git lab for a 30k employee company
How we scaled git lab for a 30k employee companyMinqi Pan
 
Microservices with Docker, Kubernetes, and Jenkins
Microservices with Docker, Kubernetes, and JenkinsMicroservices with Docker, Kubernetes, and Jenkins
Microservices with Docker, Kubernetes, and JenkinsRed Hat Developers
 
Slide: Introducing GitLab by ALMtoolbox
Slide: Introducing GitLab by ALMtoolboxSlide: Introducing GitLab by ALMtoolbox
Slide: Introducing GitLab by ALMtoolboxNoa Harel
 
How to Choose the Right Technology, Framework or Tool to Build Microservices
How to Choose the Right Technology, Framework or Tool to Build MicroservicesHow to Choose the Right Technology, Framework or Tool to Build Microservices
How to Choose the Right Technology, Framework or Tool to Build MicroservicesKai Wähner
 
Kubernetes introduction
Kubernetes introductionKubernetes introduction
Kubernetes introductionDongwon Kim
 

Viewers also liked (20)

Breaking Bad Habits with GitLab CI
Breaking Bad Habits with GitLab CIBreaking Bad Habits with GitLab CI
Breaking Bad Habits with GitLab CI
 
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
 
CI with Gitlab & Docker
CI with Gitlab & DockerCI with Gitlab & Docker
CI with Gitlab & Docker
 
Jenkins vs GitLab CI
Jenkins vs GitLab CIJenkins vs GitLab CI
Jenkins vs GitLab CI
 
Gitlab Training with GIT and SourceTree
Gitlab Training with GIT and SourceTreeGitlab Training with GIT and SourceTree
Gitlab Training with GIT and SourceTree
 
Why you can't ignore GitLab
Why you can't ignore GitLabWhy you can't ignore GitLab
Why you can't ignore GitLab
 
GitLab as an Alternative Development Platform for Github.com
GitLab as an Alternative Development Platform for Github.comGitLab as an Alternative Development Platform for Github.com
GitLab as an Alternative Development Platform for Github.com
 
Idea to Production - with Gitlab and Kubernetes
Idea to Production  - with Gitlab and KubernetesIdea to Production  - with Gitlab and Kubernetes
Idea to Production - with Gitlab and Kubernetes
 
GitFlow, SourceTree and GitLab
GitFlow, SourceTree and GitLabGitFlow, SourceTree and GitLab
GitFlow, SourceTree and GitLab
 
Webinar - Continuous Integration with GitLab
Webinar - Continuous Integration with GitLabWebinar - Continuous Integration with GitLab
Webinar - Continuous Integration with GitLab
 
GitLab 8.5 Highlights and Step-by-step tutorial
GitLab 8.5 Highlights and Step-by-step tutorialGitLab 8.5 Highlights and Step-by-step tutorial
GitLab 8.5 Highlights and Step-by-step tutorial
 
WordCamp Lyon 2015 - WordPress, Git et l'intégration continue
 WordCamp Lyon 2015 - WordPress, Git et l'intégration continue WordCamp Lyon 2015 - WordPress, Git et l'intégration continue
WordCamp Lyon 2015 - WordPress, Git et l'intégration continue
 
Formation autour de git et git lab
Formation autour de git et git labFormation autour de git et git lab
Formation autour de git et git lab
 
Gitlab flow
Gitlab flowGitlab flow
Gitlab flow
 
How we scaled git lab for a 30k employee company
How we scaled git lab for a 30k employee companyHow we scaled git lab for a 30k employee company
How we scaled git lab for a 30k employee company
 
Microservices with Docker, Kubernetes, and Jenkins
Microservices with Docker, Kubernetes, and JenkinsMicroservices with Docker, Kubernetes, and Jenkins
Microservices with Docker, Kubernetes, and Jenkins
 
Slide: Introducing GitLab by ALMtoolbox
Slide: Introducing GitLab by ALMtoolboxSlide: Introducing GitLab by ALMtoolbox
Slide: Introducing GitLab by ALMtoolbox
 
How to Choose the Right Technology, Framework or Tool to Build Microservices
How to Choose the Right Technology, Framework or Tool to Build MicroservicesHow to Choose the Right Technology, Framework or Tool to Build Microservices
How to Choose the Right Technology, Framework or Tool to Build Microservices
 
Kubernetes introduction
Kubernetes introductionKubernetes introduction
Kubernetes introduction
 
Kubernetes Basics
Kubernetes BasicsKubernetes Basics
Kubernetes Basics
 

Similar to GitLab CI: Open Source Continuous Integration made easy

Настройка окружения для кросскомпиляции проектов на основе docker'a
Настройка окружения для кросскомпиляции проектов на основе docker'aНастройка окружения для кросскомпиляции проектов на основе docker'a
Настройка окружения для кросскомпиляции проектов на основе docker'acorehard_by
 
Pragmatic software development in kdb+
Pragmatic software development in kdb+Pragmatic software development in kdb+
Pragmatic software development in kdb+Ajay Rathore
 
GCP - Continuous Integration and Delivery into Kubernetes with GitHub, Travis...
GCP - Continuous Integration and Delivery into Kubernetes with GitHub, Travis...GCP - Continuous Integration and Delivery into Kubernetes with GitHub, Travis...
GCP - Continuous Integration and Delivery into Kubernetes with GitHub, Travis...Oleg Shalygin
 
Dockerizing Ruby Applications - The Best Practices
Dockerizing Ruby Applications - The Best PracticesDockerizing Ruby Applications - The Best Practices
Dockerizing Ruby Applications - The Best PracticesKontena, Inc.
 
DevOps - Interview Question.pdf
DevOps - Interview Question.pdfDevOps - Interview Question.pdf
DevOps - Interview Question.pdfMinhTrnNht7
 
How To Install GitLab As Your Private GitHub Clone
How To Install GitLab As Your Private GitHub CloneHow To Install GitLab As Your Private GitHub Clone
How To Install GitLab As Your Private GitHub CloneVEXXHOST Private Cloud
 
O'Reilly Software Architecture Conference London 2017: Building Resilient Mic...
O'Reilly Software Architecture Conference London 2017: Building Resilient Mic...O'Reilly Software Architecture Conference London 2017: Building Resilient Mic...
O'Reilly Software Architecture Conference London 2017: Building Resilient Mic...Ambassador Labs
 
Devoops: DoJ Annual Cybersecurity Training Symposium Edition 2015
Devoops: DoJ Annual Cybersecurity Training Symposium Edition 2015Devoops: DoJ Annual Cybersecurity Training Symposium Edition 2015
Devoops: DoJ Annual Cybersecurity Training Symposium Edition 2015Chris Gates
 
Velocity NYC 2017: Building Resilient Microservices with Kubernetes, Docker, ...
Velocity NYC 2017: Building Resilient Microservices with Kubernetes, Docker, ...Velocity NYC 2017: Building Resilient Microservices with Kubernetes, Docker, ...
Velocity NYC 2017: Building Resilient Microservices with Kubernetes, Docker, ...Ambassador Labs
 
New Features Webinar-April
New Features Webinar-AprilNew Features Webinar-April
New Features Webinar-AprilCodefresh
 
Enhance Your Kubernetes CI/CD Pipelines With GitLab & Open Source
Enhance Your Kubernetes CI/CD Pipelines With GitLab & Open SourceEnhance Your Kubernetes CI/CD Pipelines With GitLab & Open Source
Enhance Your Kubernetes CI/CD Pipelines With GitLab & Open SourceNico Meisenzahl
 
Lean Drupal Repositories with Composer and Drush
Lean Drupal Repositories with Composer and DrushLean Drupal Repositories with Composer and Drush
Lean Drupal Repositories with Composer and DrushPantheon
 
DCEU 18: Building Your Development Pipeline
DCEU 18: Building Your Development PipelineDCEU 18: Building Your Development Pipeline
DCEU 18: Building Your Development PipelineDocker, Inc.
 
Webinar - Unbox GitLab CI/CD
Webinar - Unbox GitLab CI/CD Webinar - Unbox GitLab CI/CD
Webinar - Unbox GitLab CI/CD Annie Huang
 
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
 
Using a Private Git Server for Packaging Software
Using a Private Git Server for Packaging SoftwareUsing a Private Git Server for Packaging Software
Using a Private Git Server for Packaging SoftwareChris Jean
 
DevAssistant, Docker and You
DevAssistant, Docker and YouDevAssistant, Docker and You
DevAssistant, Docker and YouBalaBit
 
Gitlab and Lingvokot
Gitlab and LingvokotGitlab and Lingvokot
Gitlab and LingvokotLingvokot
 

Similar to GitLab CI: Open Source Continuous Integration made easy (20)

Настройка окружения для кросскомпиляции проектов на основе docker'a
Настройка окружения для кросскомпиляции проектов на основе docker'aНастройка окружения для кросскомпиляции проектов на основе docker'a
Настройка окружения для кросскомпиляции проектов на основе docker'a
 
Pragmatic software development in kdb+
Pragmatic software development in kdb+Pragmatic software development in kdb+
Pragmatic software development in kdb+
 
GCP - Continuous Integration and Delivery into Kubernetes with GitHub, Travis...
GCP - Continuous Integration and Delivery into Kubernetes with GitHub, Travis...GCP - Continuous Integration and Delivery into Kubernetes with GitHub, Travis...
GCP - Continuous Integration and Delivery into Kubernetes with GitHub, Travis...
 
Dockerizing Ruby Applications - The Best Practices
Dockerizing Ruby Applications - The Best PracticesDockerizing Ruby Applications - The Best Practices
Dockerizing Ruby Applications - The Best Practices
 
DevOps - Interview Question.pdf
DevOps - Interview Question.pdfDevOps - Interview Question.pdf
DevOps - Interview Question.pdf
 
How To Install GitLab As Your Private GitHub Clone
How To Install GitLab As Your Private GitHub CloneHow To Install GitLab As Your Private GitHub Clone
How To Install GitLab As Your Private GitHub Clone
 
O'Reilly Software Architecture Conference London 2017: Building Resilient Mic...
O'Reilly Software Architecture Conference London 2017: Building Resilient Mic...O'Reilly Software Architecture Conference London 2017: Building Resilient Mic...
O'Reilly Software Architecture Conference London 2017: Building Resilient Mic...
 
Devoops: DoJ Annual Cybersecurity Training Symposium Edition 2015
Devoops: DoJ Annual Cybersecurity Training Symposium Edition 2015Devoops: DoJ Annual Cybersecurity Training Symposium Edition 2015
Devoops: DoJ Annual Cybersecurity Training Symposium Edition 2015
 
Velocity NYC 2017: Building Resilient Microservices with Kubernetes, Docker, ...
Velocity NYC 2017: Building Resilient Microservices with Kubernetes, Docker, ...Velocity NYC 2017: Building Resilient Microservices with Kubernetes, Docker, ...
Velocity NYC 2017: Building Resilient Microservices with Kubernetes, Docker, ...
 
Git hooks
Git hooksGit hooks
Git hooks
 
New Features Webinar-April
New Features Webinar-AprilNew Features Webinar-April
New Features Webinar-April
 
Enhance Your Kubernetes CI/CD Pipelines With GitLab & Open Source
Enhance Your Kubernetes CI/CD Pipelines With GitLab & Open SourceEnhance Your Kubernetes CI/CD Pipelines With GitLab & Open Source
Enhance Your Kubernetes CI/CD Pipelines With GitLab & Open Source
 
Lean Drupal Repositories with Composer and Drush
Lean Drupal Repositories with Composer and DrushLean Drupal Repositories with Composer and Drush
Lean Drupal Repositories with Composer and Drush
 
DCEU 18: Building Your Development Pipeline
DCEU 18: Building Your Development PipelineDCEU 18: Building Your Development Pipeline
DCEU 18: Building Your Development Pipeline
 
DevOps Workshop Part 1
DevOps Workshop Part 1DevOps Workshop Part 1
DevOps Workshop Part 1
 
Webinar - Unbox GitLab CI/CD
Webinar - Unbox GitLab CI/CD Webinar - Unbox GitLab CI/CD
Webinar - Unbox GitLab CI/CD
 
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
 
Using a Private Git Server for Packaging Software
Using a Private Git Server for Packaging SoftwareUsing a Private Git Server for Packaging Software
Using a Private Git Server for Packaging Software
 
DevAssistant, Docker and You
DevAssistant, Docker and YouDevAssistant, Docker and You
DevAssistant, Docker and You
 
Gitlab and Lingvokot
Gitlab and LingvokotGitlab and Lingvokot
Gitlab and Lingvokot
 

More from OlinData

AWS Cost Control: Cloud Custodian
AWS Cost Control: Cloud CustodianAWS Cost Control: Cloud Custodian
AWS Cost Control: Cloud CustodianOlinData
 
Introduction to 2FA on AWS
Introduction to 2FA on AWSIntroduction to 2FA on AWS
Introduction to 2FA on AWSOlinData
 
AWS Data Migration case study: from tapes to Glacier
AWS Data Migration case study: from tapes to GlacierAWS Data Migration case study: from tapes to Glacier
AWS Data Migration case study: from tapes to GlacierOlinData
 
Issuing temporary credentials for my sql using hashicorp vault
Issuing temporary credentials for my sql using hashicorp vaultIssuing temporary credentials for my sql using hashicorp vault
Issuing temporary credentials for my sql using hashicorp vaultOlinData
 
Log monitoring with Logstash and Icinga
Log monitoring with Logstash and IcingaLog monitoring with Logstash and Icinga
Log monitoring with Logstash and IcingaOlinData
 
Cfgmgmtcamp 2017 docker is the new tarball
Cfgmgmtcamp 2017  docker is the new tarballCfgmgmtcamp 2017  docker is the new tarball
Cfgmgmtcamp 2017 docker is the new tarballOlinData
 
Icinga 2 and Puppet - Automate Monitoring
Icinga 2 and Puppet - Automate MonitoringIcinga 2 and Puppet - Automate Monitoring
Icinga 2 and Puppet - Automate MonitoringOlinData
 
Webinar - Auto-deploy Puppet Enterprise: Vagrant and Oscar
Webinar - Auto-deploy Puppet Enterprise: Vagrant and OscarWebinar - Auto-deploy Puppet Enterprise: Vagrant and Oscar
Webinar - Auto-deploy Puppet Enterprise: Vagrant and OscarOlinData
 
Webinar - High Availability and Distributed Monitoring with Icinga2
Webinar - High Availability and Distributed Monitoring with Icinga2Webinar - High Availability and Distributed Monitoring with Icinga2
Webinar - High Availability and Distributed Monitoring with Icinga2OlinData
 
Webinar - Windows Application Management with Puppet
Webinar - Windows Application Management with PuppetWebinar - Windows Application Management with Puppet
Webinar - Windows Application Management with PuppetOlinData
 
Webinar - Centralising syslogs with the new beats, logstash and elasticsearch
Webinar - Centralising syslogs with the new beats, logstash and elasticsearchWebinar - Centralising syslogs with the new beats, logstash and elasticsearch
Webinar - Centralising syslogs with the new beats, logstash and elasticsearchOlinData
 
Icinga 2 and puppet: automate monitoring
Icinga 2 and puppet: automate monitoringIcinga 2 and puppet: automate monitoring
Icinga 2 and puppet: automate monitoringOlinData
 
Webinar - Project Management for DevOps
Webinar - Project Management for DevOpsWebinar - Project Management for DevOps
Webinar - Project Management for DevOpsOlinData
 
Using puppet in a traditional enterprise
Using puppet in a traditional enterpriseUsing puppet in a traditional enterprise
Using puppet in a traditional enterpriseOlinData
 
Webinar - PuppetDB
Webinar - PuppetDBWebinar - PuppetDB
Webinar - PuppetDBOlinData
 
Webinar - Scaling your Puppet infrastructure
Webinar - Scaling your Puppet infrastructureWebinar - Scaling your Puppet infrastructure
Webinar - Scaling your Puppet infrastructureOlinData
 
Webinar - Managing your Docker containers and AWS cloud with Puppet
Webinar - Managing your Docker containers and AWS cloud with PuppetWebinar - Managing your Docker containers and AWS cloud with Puppet
Webinar - Managing your Docker containers and AWS cloud with PuppetOlinData
 
Webinar - Manage user, groups, packages in windows using puppet
Webinar - Manage user, groups, packages in windows using puppetWebinar - Manage user, groups, packages in windows using puppet
Webinar - Manage user, groups, packages in windows using puppetOlinData
 
1 m+ qps on mysql galera cluster
1 m+ qps on mysql galera cluster1 m+ qps on mysql galera cluster
1 m+ qps on mysql galera clusterOlinData
 
Workshop puppet (dev opsdays ams 2015)
Workshop puppet (dev opsdays ams 2015)Workshop puppet (dev opsdays ams 2015)
Workshop puppet (dev opsdays ams 2015)OlinData
 

More from OlinData (20)

AWS Cost Control: Cloud Custodian
AWS Cost Control: Cloud CustodianAWS Cost Control: Cloud Custodian
AWS Cost Control: Cloud Custodian
 
Introduction to 2FA on AWS
Introduction to 2FA on AWSIntroduction to 2FA on AWS
Introduction to 2FA on AWS
 
AWS Data Migration case study: from tapes to Glacier
AWS Data Migration case study: from tapes to GlacierAWS Data Migration case study: from tapes to Glacier
AWS Data Migration case study: from tapes to Glacier
 
Issuing temporary credentials for my sql using hashicorp vault
Issuing temporary credentials for my sql using hashicorp vaultIssuing temporary credentials for my sql using hashicorp vault
Issuing temporary credentials for my sql using hashicorp vault
 
Log monitoring with Logstash and Icinga
Log monitoring with Logstash and IcingaLog monitoring with Logstash and Icinga
Log monitoring with Logstash and Icinga
 
Cfgmgmtcamp 2017 docker is the new tarball
Cfgmgmtcamp 2017  docker is the new tarballCfgmgmtcamp 2017  docker is the new tarball
Cfgmgmtcamp 2017 docker is the new tarball
 
Icinga 2 and Puppet - Automate Monitoring
Icinga 2 and Puppet - Automate MonitoringIcinga 2 and Puppet - Automate Monitoring
Icinga 2 and Puppet - Automate Monitoring
 
Webinar - Auto-deploy Puppet Enterprise: Vagrant and Oscar
Webinar - Auto-deploy Puppet Enterprise: Vagrant and OscarWebinar - Auto-deploy Puppet Enterprise: Vagrant and Oscar
Webinar - Auto-deploy Puppet Enterprise: Vagrant and Oscar
 
Webinar - High Availability and Distributed Monitoring with Icinga2
Webinar - High Availability and Distributed Monitoring with Icinga2Webinar - High Availability and Distributed Monitoring with Icinga2
Webinar - High Availability and Distributed Monitoring with Icinga2
 
Webinar - Windows Application Management with Puppet
Webinar - Windows Application Management with PuppetWebinar - Windows Application Management with Puppet
Webinar - Windows Application Management with Puppet
 
Webinar - Centralising syslogs with the new beats, logstash and elasticsearch
Webinar - Centralising syslogs with the new beats, logstash and elasticsearchWebinar - Centralising syslogs with the new beats, logstash and elasticsearch
Webinar - Centralising syslogs with the new beats, logstash and elasticsearch
 
Icinga 2 and puppet: automate monitoring
Icinga 2 and puppet: automate monitoringIcinga 2 and puppet: automate monitoring
Icinga 2 and puppet: automate monitoring
 
Webinar - Project Management for DevOps
Webinar - Project Management for DevOpsWebinar - Project Management for DevOps
Webinar - Project Management for DevOps
 
Using puppet in a traditional enterprise
Using puppet in a traditional enterpriseUsing puppet in a traditional enterprise
Using puppet in a traditional enterprise
 
Webinar - PuppetDB
Webinar - PuppetDBWebinar - PuppetDB
Webinar - PuppetDB
 
Webinar - Scaling your Puppet infrastructure
Webinar - Scaling your Puppet infrastructureWebinar - Scaling your Puppet infrastructure
Webinar - Scaling your Puppet infrastructure
 
Webinar - Managing your Docker containers and AWS cloud with Puppet
Webinar - Managing your Docker containers and AWS cloud with PuppetWebinar - Managing your Docker containers and AWS cloud with Puppet
Webinar - Managing your Docker containers and AWS cloud with Puppet
 
Webinar - Manage user, groups, packages in windows using puppet
Webinar - Manage user, groups, packages in windows using puppetWebinar - Manage user, groups, packages in windows using puppet
Webinar - Manage user, groups, packages in windows using puppet
 
1 m+ qps on mysql galera cluster
1 m+ qps on mysql galera cluster1 m+ qps on mysql galera cluster
1 m+ qps on mysql galera cluster
 
Workshop puppet (dev opsdays ams 2015)
Workshop puppet (dev opsdays ams 2015)Workshop puppet (dev opsdays ams 2015)
Workshop puppet (dev opsdays ams 2015)
 

Recently uploaded

GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptxLBM Solutions
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...HostedbyConfluent
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersThousandEyes
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxOnBoard
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 3652toLead Limited
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 

Recently uploaded (20)

GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food Manufacturing
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptx
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptx
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 

GitLab CI: Open Source Continuous Integration made easy

  • 1. GitLab CI Open Source Continuous Integration made easy
  • 2. Who am I? Walter Heck CTO at OlinData since 2008 Background: Delphi, MySQL, SysOps Love: Automation, DevOps, FOSS
  • 3. Who are you? Anyone using GitLab self hosted? Github Enterprise Atlassian Bitbucket / Bamboo? Jenkins?
  • 4. What is GitLab GitLab is a web-based Git repository manager with wiki and issue tracking features, using an open source license, developed by GitLab Inc.
  • 5. What is GitLab CI Gitlab CI is a Continuous Integration service fully integrated with GitLab. Due to it’s tight integration many tasks related to CI and CD become much easier to manage. GitLab CI is fully open source and included in any GitLab CE installation. Check in a .gitlab-ci.yaml file to get started :)
  • 6. GitLab CI Runners In GitLab CI, Runners run your yaml. A runner is an isolated (virtual) machine that picks up builds through the coordinator API of GitLab CI. A runner can be specific to a certain project or serve any project in GitLab CI. A runner that serves all projects is called a shared runner.
  • 7. Docker runner Runs GitLab CI builds inside one or more docker containers ● Easiest to get started (works out of the box) ○ For production usage look into docker in production (in particular storage drivers) ● ‘Abuses’ containers as throw-away VMs ○ Feels strange at first, perfect after you get used to it
  • 8. Starting .gitlab-ci.yaml #.gitlab-ci.yaml image: ruby:2.2 test: script: - bundle install - bundle exec rake lint - bundle exec rake syntax ● Choose a docker image (https://hub.docker.com/_/ruby) ● Simple job called test ○ Runs two rake tasks ● Runs on every push + MR on every branch that contains a .gitlab-ci.yaml ○ May be different between branches
  • 9. Jobs Jobs can be run: ● locally ● using Docker containers ● using Docker containers and executing job over SSH ● using Docker containers with autoscaling on different clouds and virtualization hypervisors ● connecting to remote SSH server Why multiple jobs? ● The smaller a job the easier parallelization across multiple runners is ● Smaller jobs are easier to diagnose when they break image: ruby:2.2 before_script: - bundle install job:test:syntax: script: - bundle exec rake syntax job:test:lint: script: - bundle exec rake lint
  • 11. Artifacts/dependencies Allows for transferring data/files from one job to the next within the same build ● Why run bundle install every time? ● Artifacts are passed between jobs ○ Make sure to set expiration (default = 1 day) ● Dependencies determine a job can only run after some other job image: ruby:2.2 job:build:artifacts: script: - bundle install --deployment artifacts: expire_in: 1 day paths: - vendor/ job:test:syntax: script: - bundle install --deployment - bundle exec rake syntax dependencies: - job:build:artifacts job:test:lint: script: - bundle install --deployment - bundle exec rake lint dependencies: - job:build:artifacts
  • 12. Stages The ordering of elements in stages defines the ordering of builds' execution: ● Jobs of the same stage are run in parallel. ● Jobs of the next stage are run after the jobs from the previous stage complete successfully. image: ruby:2.2 stages: - build - test - deploy job:build:artifacts: stage: build script: - bundle install --deployment artifacts: expire_in: 1 day paths: - vendor/ job:test:syntax: stage: test script: - bundle install --deployment - bundle exec rake syntax dependencies: - job:build:artifacts job:test:lint: stage: test script: - bundle install --deployment - bundle exec rake lint dependencies: - job:build:artifacts
  • 13. Limiting builds ● Sometimes we don’t want certain jobs to always run ○ Usually when they take lots of resources (time, compute) ○ Or when they do things like deploy to staging/production ● Use only ○ Defines a list of git refs for which build is created ● Or use except ○ Defines a list of git refs for which build is not created job_name: script: - rake spec - coverage stage: test only: - master except: - develop tags: - ruby - postgres allow_failure: true
  • 14. Selecting specific runners tags is used to select specific Runners from the list of all Runners that are allowed to run this project. During the registration of a Runner, you can specify the Runner's tags, for example ruby, postgres, development. tags allow you to run builds with Runners that have the specified tags assigned to them: job: tags: - ruby - postgres The specification above, will make sure that job is built by a Runner that has both ruby AND postgres tags defined.
  • 15. Manual build Introduced in GitLab 8.10. Manual actions are a special type of job that are not executed automatically; they need to be explicitly started by a user. Manual actions can be started from pipeline, build, environment, and deployment views. You can execute the same manual action multiple times. An example usage of manual actions is deployment to production.
  • 16. Secret variables GitLab CI allows you to define per-project secret variables that are set in the build environment. The secret variables are stored out of the repository (.gitlab-ci.yml) and are securely passed to GitLab Runner making them available in the build environment. It's the recommended method to use for storing things like passwords, secret keys and credentials. Secret variables can be added by going to your project's Settings ➔ Variables ➔ Add variable. Once you set them, they will be available for all subsequent builds. Be aware that secret variables are not masked, and their values can be shown in the build logs if explicitly asked to do so. If your project is public or internal, you can set the pipelines private from your project's Pipelines settings. Follow the discussion in issue #13784 for masking the secret variables.
  • 17. GitLab currently doesn't have built-in support for managing SSH keys in a build environment. The SSH keys can be useful when: 1. You want to checkout internal submodules 2. You want to download private packages using your package manager (eg. bundler) 3. You want to deploy your application to eg. Heroku or your own server 4. You want to execute SSH commands from the build server to the remote server 5. You want to rsync files from your build server to the remote server Private repos, deploy servers, SSH Keys How it works 1. Create a new SSH key pair with ssh-keygen 2. Add the private key as a Secret Variable to the project 3. Run the ssh-agent during build to load the private key. before_script: - 'which ssh-agent || ( apt-get update -y && apt-get install openssh-client -y )' - eval $(ssh-agent -s) - ssh-add <(echo "$SSH_PRIVATE_KEY") - mkdir -p ~/.ssh - '[[ -f /.dockerenv ]] && echo -e "Host *ntStrictHostKeyChecking nonn" > ~/.ssh/config' Test SSH: script: - ssh git@gitlab.com - git clone git@gitlab.com:gitlab-examples/ssh-private-key.git
  • 18. YAML anchors YAML also has a handy feature called 'anchors', which let you easily duplicate content across your document. .job_template: &job_definition # Hidden key that defines an anchor named 'job_definition' image: ruby:2.1 services: - postgres - redis test1: <<: *job_definition # Merge the contents of the 'job_definition' alias script: - test1 project test2: <<: *job_definition # Merge the contents of the 'job_definition' alias script: - test2 project .job_template: image: ruby:2.1 services: - postgres - redis test1: image: ruby:2.1 services: - postgres - redis script: - test1 project test2: image: ruby:2.1 services: - postgres - redis script: - test2 project