Why and how we moved from Jenkins to Gitlab CI
Romain Chivot & Alain Vagner
Intro
CI? CD? CDE?
code within the development environment.
Benefits:
Possibility of many production deployments every day
Jenkins, what's the hell?
Jenkins: what it is?
Jenkins: what we did with it?
Jenkins: what were the pain points?
From Kohsuke Kawaguchi, creator of Jenkins in 2018:
So he launched 2 initiatives to revamp completely Jenkins (“Jenkins X”)
Source: https://jenkins.io/blog/2018/08/31/shifting-gears/
Jenkins: what were the pain points?
From James Rawlings, contributor of Jenkins X:
Jenkins: what were the pain points?
From our experience:
Jenkins: what were the pain points?
From our experience:
Different generations
Sounds familiar...
"Why Abstruse?
We saw many projects relying on outdated open source continuous integration (CI) solutions that were widely adopted in the past, but unfortunately cannot answer new requirements from the industry. On the other hand, commercial CI solutions have all these great features (i.e. Travis CI), but they cost money. Hence, numerous organizations decide to cut costs and go with legacy open source CI solutions or not use CI solutions at all. This kills the code quality and increases software maintenance costs."
Let's choose another tool!
Various CI solutions
https://en.wikipedia.org/wiki/Comparison_of_continuous_integration_software
Some selection criterias
The "developer acceptance factor"
Say Hello to Gitlab CI!
Gitlab: what it is?
Gitlab CI
Gitlab CI architecture (AWS)
docker-machine
gitlab-runner configuration (1)
concurrent = 12
check_interval = 0
[[runners]]
name = "ip-xxx"
limit = 6
url = "https://your-gitlab-instance"
token = "your_token"
executor = "docker+machine"
[runners.docker]
tls_verify = false
image = "dockerhub_account/gitlab"
privileged = true
disable_cache = false
volumes = [
"/cache",
"/var/run/docker.sock:/var/run/docker.sock"
]
[runners.cache]
Type = "s3"
ServerAddress = "s3.amazonaws.com"
AccessKey = "your_accesskey"
SecretKey = "your_secret_key"
BucketName = "s3-gitlab-cache"
BucketLocation = "eu-west-1"
Shared = true
Docker-runner configuration (2)
[runners.machine]
IdleCount = 0
IdleTime = 1800
MachineDriver = "amazonec2"
MachineName = "gitlab-%s"
MachineOptions = [
"amazonec2-access-key=your_access_key", � "amazonec2-secret-key=your_secret_key",
"amazonec2-ssh-user=ubuntu",
"amazonec2-region=eu-west-1",
"amazonec2-instance-type=c4.2xlarge",
"amazonec2-vpc-id=your_vpc_id",
"amazonec2-subnet-id=your_subnet",
"amazonec2-use-private-address=true",� "amazonec2-security-group=gitlab-runner-docker-machine",
"amazonec2-zone=c",
"amazonec2-root-size=32",
"amazonec2-request-spot-instance=true",
"amazonec2-spot-price=0.3"
]
OffPeakTimezone = ""
OffPeakIdleCount = 0
OffPeakIdleTime = 0
Gitlab pipelines
STAGES
JOBS
PIPELINE
gitlab-ci.yml
stages:
- build-frontends
- build-backend
- deploy
dev-build-frontend-1:
stage: build-frontends
environment:
name: dev
only:
- dev
cache:
key: "some_unique_key"
paths:
- $WORKSPACE/node_modules/
script: # build frontend script
artifacts:
paths:
- $WORKSPACE/build
dev-build-backend:
stage: build-backend
environment:
name: dev
only:
- dev
cache: *build-backend_cache # here we use a reference
script: *build-backend_script # here as well
.unit-tests # this is a “hidden key”
services:
# use a mongodb image from dockerhub
- name: mongo:3.2
command: ["mongod"]
# pipeline will not stop if unit tests are failing
allow_failure: true
script: # unit test script
dev-unit-tests:
<<: *unit-tests # here we inject a definition (see above)
stage: build-backend
environment:
name: dev
only:
- dev
# we don't need to download any artifact for this task
dependencies: []
dev-deploy:
stage: deploy
environment:
name: dev
only:
- dev
script: # deploy script
dependencies: []
Gitlab-ci.yml (suite)
Migration
Feedback
Use the right tool...
… for the job to be done!
Let's discuss!