Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Continuous Integration with GitLab
Search
Ivan Nemytchenko
November 23, 2016
Programming
0
1.4k
Continuous Integration with GitLab
Ivan Nemytchenko
November 23, 2016
Tweet
Share
More Decks by Ivan Nemytchenko
See All by Ivan Nemytchenko
Code Topology Notation
inem
0
78
The Shape of a Service Object
inem
0
900
The Curse of Service Object
inem
0
290
Modern Make for modern (Rails) programmers
inem
0
80
Откуда берется сложность в Rails-проектах и куда бы её деть?
inem
0
270
Rails без боли и оверинжиниринга
inem
0
440
Painless Rails: наводим порядок в контроллерах
inem
0
260
Less Abstract! Surprising effects of expressing OOP in pictures
inem
1
590
Pure functions and side effects
inem
0
45
Other Decks in Programming
See All in Programming
ChatGPT とつくる PHP で OS 実装
memory1994
PRO
3
190
ecspresso, ecschedule, lambroll を PipeCDプラグインとして動かしてみた (プロトタイプ) / Running ecspresso, ecschedule, and lambroll as PipeCD Plugins (prototype)
tkikuc
2
1.8k
Swiftコンパイラ超入門+async関数の仕組み
shiz
0
170
PSR-15 はあなたのための ものではない? - phpcon2024
myamagishi
0
400
DevFest - Serverless 101 with Google Cloud Functions
tunmise
0
140
Lookerは可視化だけじゃない。UIコンポーネントもあるんだ!
ymd65536
1
130
「とりあえず動く」コードはよい、「読みやすい」コードはもっとよい / Code that 'just works' is good, but code that is 'readable' is even better.
mkmk884
6
1.4k
知られざるDMMデータエンジニアの生態 〜かつてツチノコと呼ばれし者〜
takaha4k
1
420
LLM Supervised Fine-tuningの理論と実践
datanalyticslabo
8
1.9k
HTML/CSS超絶浅い説明
yuki0329
0
190
functionalなアプローチで動的要素を排除する
ryopeko
1
200
ESLintプラグインを使用してCDKのセオリーを適用する
yamanashi_ren01
2
240
Featured
See All Featured
Put a Button on it: Removing Barriers to Going Fast.
kastner
60
3.6k
jQuery: Nuts, Bolts and Bling
dougneiner
62
7.6k
The Art of Programming - Codeland 2020
erikaheidi
53
13k
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
251
21k
We Have a Design System, Now What?
morganepeng
51
7.3k
GitHub's CSS Performance
jonrohan
1030
460k
Thoughts on Productivity
jonyablonski
68
4.4k
Imperfection Machines: The Place of Print at Facebook
scottboms
267
13k
For a Future-Friendly Web
brad_frost
176
9.5k
VelocityConf: Rendering Performance Case Studies
addyosmani
327
24k
Docker and Python
trallard
43
3.2k
Understanding Cognitive Biases in Performance Measurement
bluesmoon
27
1.5k
Transcript
CONTINUOUS INTEGRATION WITH GITLAB IVAN NEMYTCHENKO, DEVELOPER ADVOCATE
MODERN SOFTWARE DEVELOPMENT PROCESS IS SPREAD ACROSS MANY TOOLS
Travis - GitHub - Trello - Slack
Bitbucket - Semaphore - Pivotal Tracker - HipChat
Jenkins - GitLab - Jira
None
None
None
None
None
None
None
None
None
None
None
CATGREP SOPHISTICATED TECHNOLOGIES INC. > file1.txt > file2.txt
REQUIREMENT #1 CONCATENATION RESULT SHOULD CONTAIN "HELLO WORLD"
cat file1.txt file2.txt | grep -q "Hello world"
None
RUN OUR FIRST TEST INSIDE CI
.gitlab-ci.yml
test: script: cat file1.txt file2.txt | grep -q 'Hello world'
None
None
REQUIREMENT #2 PACKAGE CODE BEFORE SENDING IT TO CUSTOMER
test: script: cat file1.txt file2.txt | grep -q 'Hello world'
package: script: cat file1.txt file2.txt | gzip > package.gz
None
MAKE RESULTS OF YOUR BUILD DOWNLOADABLE
test: script: cat file1.txt file2.txt | grep -q 'Hello world'
package: script: cat file1.txt file2.txt | gzip > packaged.gz artifacts: paths: - packaged.gz
None
RUN JOBS SEQUENTIALLY
stages: - test - package test: stage: test script: cat
file1.txt file2.txt | grep -q 'Hello world' package: stage: package script: cat file1.txt file2.txt | gzip > packaged.gz artifacts: paths: - packaged.gz
SPEEDING UP THE BUILD
#1: DUPLICATION
stages: - compile - test - package compile: stage: compile
script: cat file1.txt file2.txt > compiled.txt artifacts: paths: - compiled.txt test: stage: test script: cat compiled.txt | grep -q 'Hello world' package: stage: package script: cat compiled.txt | gzip > packaged.gz artifacts: paths: - packaged.gz
#2: RUBY 2.1 ????
LEARNING WHAT DOCKER IMAGE TO USE
image: alpine
image: alpine stages: - compile - test - package compile:
... test: ...
None
> defined 3 stages > pass files between stages >
downloadable artifacts > optimized execution time
REQUIREMENT #3 ISO INSTEAD OF GZIP
DEALING WITH COMPLEX SCENARIOS
None
image: alpine stages: - compile - test - package compile:
... test: ... pack-gz: stage: package script: cat compiled.txt | gzip > packaged.gz artifacts: paths: - packaged.gz pack-iso: stage: package script: - mkisofs -o ./packaged.iso ./compiled.txt artifacts: paths: - packaged.iso
None
DEALING WITH MISSING SOFTWARE/PACKAGES
INSTALL PACKAGE IN ALPINE LINUX apk add -U cdrkit
script: - apk add -U cdrkit - mkisofs -o ./packaged.iso
./compiled.txt
pack-iso: stage: package before_script: - apk add -U cdrkit script:
- mkisofs -o ./packaged.iso ./compiled.txt artifacts: paths: - packaged.iso
None
None
GITLAB REQUIREMENT #4 PUBLISH A SMALL WEBSITE WITH OUR PACKAGES
HTML + PACKAGES → AMAZON S3
aws s3 cp ./ s3://yourbucket/ --recursive
None
None
FIRST AUTOMATED DEPLOYMENT
> awscli can be installed using pip > pip goes
together with python
s3: image: python:latest stage: deploy script: - pip install awscli
- aws s3 cp ./ s3://yourbucket/ --recursive
AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY
variables: AWS_ACCESS_KEY_ID: "AKIAIOSFODNN7EXAMPLE" AWS_SECRET_ACCESS_KEY: “wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY” s3: image: python:latest stage: deploy
script: - pip install awscli - aws s3 cp ./ s3://yourbucket/ --recursive
KEEPING SECRET THINGS SECRET
SETTINGS --> VARIABLES
s3: image: python:latest stage: deploy script: - pip install awscli
- aws s3 cp ./ s3://yourbucket/ --recursive
So far so good:
REQUIREMENT #5 MORE THAN ONE DEVELOPER ON THE PROJECT
s3: image: python:latest stage: deploy script: - pip install awscli
- aws s3 cp ./ s3://yourbucket/ --recursive only: - master
None
REQUIREMENT #6 WE NEED A SEPARATE PLACE FOR TESTING
GITLAB PAGES
HOST WEBSITES ON GITLAB PAGES > your job should be
named "pages" > put your files into "public" folder > specify "artifacts" section with this "public" folder
HOST WEBSITES ON GITLAB PAGES > your job should be
named "pages" > put your files into "public" folder > specify "artifacts" section with this "public" folder HTTP://<USERNAME>.GITLAB.IO/<PROJECTNAME>
pages: stage: deploy image: alpine:latest script: - mkdir -p ./public
&& cp ./*.* ./public/ artifacts: paths: - public except: - master
s3: image: python:latest stage: deploy script: - pip install awscli
- aws s3 cp ./ s3://yourbucket/ --recursive only: - master pages: image: alpine:latest stage: deploy script: - mkdir -p ./public && cp ./*.* ./public/ artifacts: paths: - public except: - master
None
None
None
INTRODUCING ENVIRONMENTS
s3: environment: production image: python:latest stage: deploy script: - pip
install awscli - aws s3 cp ./ s3://$S3_BUCKET_NAME/ --recursive only: - master pages: image: alpine:latest environment: staging stage: deploy script: - mkdir -p ./public && cp ./*.* ./public/ artifacts: paths: - public except: - master
None
None
None
REQUIREMENT #7 DO NOT MESS UP PRODUCTION
SWITCHING TO MANUAL DEPLOYMENT
s3: image: python:latest stage: deploy script: - pip install awscli
- aws s3 cp ./ s3://yourbucket/ --recursive only: - master when: manual
SUMMARY 1. Deployment is just a set of commands 2.
You need to provide secret keys 3. You specify where which branches should go to 4. GitLab conserves the history of deployments 5. You can enable manual deployment
None
None
None
GO TO GITLAB.COM
@INEM
[email protected]
BIT.LY/GITLAB-CI1 BIT.LY/GITLAB-CI2