Download - Breaking bad habits with GitLab CI
![Page 1: Breaking bad habits with GitLab CI](https://reader035.vdocuments.mx/reader035/viewer/2022081513/586f867c1a28ab54768b5517/html5/thumbnails/1.jpg)
BREAKING BADWITH GITLAB CIIVAN NEMYTCHENKO, DEVELOPER ADVOCATE
![Page 2: Breaking bad habits with GitLab CI](https://reader035.vdocuments.mx/reader035/viewer/2022081513/586f867c1a28ab54768b5517/html5/thumbnails/2.jpg)
IVAN NEMYTCHENKO
> Ruby developer> Project manager
> Co-founder of outsourcing agency> Developer advocate at GitLab
> railshurts.com> inem.at> @inem
![Page 3: Breaking bad habits with GitLab CI](https://reader035.vdocuments.mx/reader035/viewer/2022081513/586f867c1a28ab54768b5517/html5/thumbnails/3.jpg)
SOFTWARE DEVELOPMENT PROCESS
![Page 4: Breaking bad habits with GitLab CI](https://reader035.vdocuments.mx/reader035/viewer/2022081513/586f867c1a28ab54768b5517/html5/thumbnails/4.jpg)
![Page 5: Breaking bad habits with GitLab CI](https://reader035.vdocuments.mx/reader035/viewer/2022081513/586f867c1a28ab54768b5517/html5/thumbnails/5.jpg)
Every tool covers a part of the whole process
![Page 6: Breaking bad habits with GitLab CI](https://reader035.vdocuments.mx/reader035/viewer/2022081513/586f867c1a28ab54768b5517/html5/thumbnails/6.jpg)
MODERN SOFTWARE DEVELOPMENT PROCESSIS SPREAD ACROSS MANY TOOLS
![Page 7: Breaking bad habits with GitLab CI](https://reader035.vdocuments.mx/reader035/viewer/2022081513/586f867c1a28ab54768b5517/html5/thumbnails/7.jpg)
Travis - GitHub - Trello - Slack
![Page 8: Breaking bad habits with GitLab CI](https://reader035.vdocuments.mx/reader035/viewer/2022081513/586f867c1a28ab54768b5517/html5/thumbnails/8.jpg)
Bitbucket - Semaphore - Pivotal Tracker - HipChat
![Page 9: Breaking bad habits with GitLab CI](https://reader035.vdocuments.mx/reader035/viewer/2022081513/586f867c1a28ab54768b5517/html5/thumbnails/9.jpg)
Jenkins - GitLab - Jira
![Page 10: Breaking bad habits with GitLab CI](https://reader035.vdocuments.mx/reader035/viewer/2022081513/586f867c1a28ab54768b5517/html5/thumbnails/10.jpg)
![Page 11: Breaking bad habits with GitLab CI](https://reader035.vdocuments.mx/reader035/viewer/2022081513/586f867c1a28ab54768b5517/html5/thumbnails/11.jpg)
![Page 12: Breaking bad habits with GitLab CI](https://reader035.vdocuments.mx/reader035/viewer/2022081513/586f867c1a28ab54768b5517/html5/thumbnails/12.jpg)
![Page 13: Breaking bad habits with GitLab CI](https://reader035.vdocuments.mx/reader035/viewer/2022081513/586f867c1a28ab54768b5517/html5/thumbnails/13.jpg)
![Page 14: Breaking bad habits with GitLab CI](https://reader035.vdocuments.mx/reader035/viewer/2022081513/586f867c1a28ab54768b5517/html5/thumbnails/14.jpg)
![Page 15: Breaking bad habits with GitLab CI](https://reader035.vdocuments.mx/reader035/viewer/2022081513/586f867c1a28ab54768b5517/html5/thumbnails/15.jpg)
![Page 16: Breaking bad habits with GitLab CI](https://reader035.vdocuments.mx/reader035/viewer/2022081513/586f867c1a28ab54768b5517/html5/thumbnails/16.jpg)
![Page 17: Breaking bad habits with GitLab CI](https://reader035.vdocuments.mx/reader035/viewer/2022081513/586f867c1a28ab54768b5517/html5/thumbnails/17.jpg)
BREAKING BADWITH GITLAB CI
IVAN NEMYTCHENKO, DEVELOPER ADVOCATE
![Page 18: Breaking bad habits with GitLab CI](https://reader035.vdocuments.mx/reader035/viewer/2022081513/586f867c1a28ab54768b5517/html5/thumbnails/18.jpg)
BREAKING BAD WITH GITLAB CI
![Page 19: Breaking bad habits with GitLab CI](https://reader035.vdocuments.mx/reader035/viewer/2022081513/586f867c1a28ab54768b5517/html5/thumbnails/19.jpg)
BREAKING BAD WITH GITLAB CI
![Page 20: Breaking bad habits with GitLab CI](https://reader035.vdocuments.mx/reader035/viewer/2022081513/586f867c1a28ab54768b5517/html5/thumbnails/20.jpg)
BREAKING BAD
HABITSWITH GITLAB CI
IVAN NEMYTCHENKO, DEVELOPER ADVOCATE
![Page 21: Breaking bad habits with GitLab CI](https://reader035.vdocuments.mx/reader035/viewer/2022081513/586f867c1a28ab54768b5517/html5/thumbnails/21.jpg)
![Page 22: Breaking bad habits with GitLab CI](https://reader035.vdocuments.mx/reader035/viewer/2022081513/586f867c1a28ab54768b5517/html5/thumbnails/22.jpg)
HABIT OFNOT AUTOMATING
THE ROUTINE TASKS
![Page 23: Breaking bad habits with GitLab CI](https://reader035.vdocuments.mx/reader035/viewer/2022081513/586f867c1a28ab54768b5517/html5/thumbnails/23.jpg)
THIS HABIT COMES FROM THE FEAR OF CI SYSTEMS
![Page 24: Breaking bad habits with GitLab CI](https://reader035.vdocuments.mx/reader035/viewer/2022081513/586f867c1a28ab54768b5517/html5/thumbnails/24.jpg)
![Page 25: Breaking bad habits with GitLab CI](https://reader035.vdocuments.mx/reader035/viewer/2022081513/586f867c1a28ab54768b5517/html5/thumbnails/25.jpg)
![Page 26: Breaking bad habits with GitLab CI](https://reader035.vdocuments.mx/reader035/viewer/2022081513/586f867c1a28ab54768b5517/html5/thumbnails/26.jpg)
![Page 27: Breaking bad habits with GitLab CI](https://reader035.vdocuments.mx/reader035/viewer/2022081513/586f867c1a28ab54768b5517/html5/thumbnails/27.jpg)
![Page 28: Breaking bad habits with GitLab CI](https://reader035.vdocuments.mx/reader035/viewer/2022081513/586f867c1a28ab54768b5517/html5/thumbnails/28.jpg)
![Page 29: Breaking bad habits with GitLab CI](https://reader035.vdocuments.mx/reader035/viewer/2022081513/586f867c1a28ab54768b5517/html5/thumbnails/29.jpg)
![Page 30: Breaking bad habits with GitLab CI](https://reader035.vdocuments.mx/reader035/viewer/2022081513/586f867c1a28ab54768b5517/html5/thumbnails/30.jpg)
![Page 31: Breaking bad habits with GitLab CI](https://reader035.vdocuments.mx/reader035/viewer/2022081513/586f867c1a28ab54768b5517/html5/thumbnails/31.jpg)
![Page 32: Breaking bad habits with GitLab CI](https://reader035.vdocuments.mx/reader035/viewer/2022081513/586f867c1a28ab54768b5517/html5/thumbnails/32.jpg)
![Page 33: Breaking bad habits with GitLab CI](https://reader035.vdocuments.mx/reader035/viewer/2022081513/586f867c1a28ab54768b5517/html5/thumbnails/33.jpg)
![Page 34: Breaking bad habits with GitLab CI](https://reader035.vdocuments.mx/reader035/viewer/2022081513/586f867c1a28ab54768b5517/html5/thumbnails/34.jpg)
![Page 35: Breaking bad habits with GitLab CI](https://reader035.vdocuments.mx/reader035/viewer/2022081513/586f867c1a28ab54768b5517/html5/thumbnails/35.jpg)
![Page 36: Breaking bad habits with GitLab CI](https://reader035.vdocuments.mx/reader035/viewer/2022081513/586f867c1a28ab54768b5517/html5/thumbnails/36.jpg)
CATGREP SOPHISTICATED TECHNOLOGIES INC.
> file1.txt> file2.txt
![Page 37: Breaking bad habits with GitLab CI](https://reader035.vdocuments.mx/reader035/viewer/2022081513/586f867c1a28ab54768b5517/html5/thumbnails/37.jpg)
REQUIREMENT #1CONCATENATION RESULT SHOULD
CONTAIN "HELLO WORLD"
![Page 38: Breaking bad habits with GitLab CI](https://reader035.vdocuments.mx/reader035/viewer/2022081513/586f867c1a28ab54768b5517/html5/thumbnails/38.jpg)
cat file1.txt file2.txt | grep -q "Hello world"
![Page 39: Breaking bad habits with GitLab CI](https://reader035.vdocuments.mx/reader035/viewer/2022081513/586f867c1a28ab54768b5517/html5/thumbnails/39.jpg)
![Page 40: Breaking bad habits with GitLab CI](https://reader035.vdocuments.mx/reader035/viewer/2022081513/586f867c1a28ab54768b5517/html5/thumbnails/40.jpg)
RUN OUR FIRST TEST INSIDE CI
![Page 41: Breaking bad habits with GitLab CI](https://reader035.vdocuments.mx/reader035/viewer/2022081513/586f867c1a28ab54768b5517/html5/thumbnails/41.jpg)
.gitlab-ci.yml
![Page 42: Breaking bad habits with GitLab CI](https://reader035.vdocuments.mx/reader035/viewer/2022081513/586f867c1a28ab54768b5517/html5/thumbnails/42.jpg)
test: script: cat file1.txt file2.txt | grep -q 'Hello world'
![Page 43: Breaking bad habits with GitLab CI](https://reader035.vdocuments.mx/reader035/viewer/2022081513/586f867c1a28ab54768b5517/html5/thumbnails/43.jpg)
![Page 44: Breaking bad habits with GitLab CI](https://reader035.vdocuments.mx/reader035/viewer/2022081513/586f867c1a28ab54768b5517/html5/thumbnails/44.jpg)
![Page 45: Breaking bad habits with GitLab CI](https://reader035.vdocuments.mx/reader035/viewer/2022081513/586f867c1a28ab54768b5517/html5/thumbnails/45.jpg)
REQUIREMENT #2PACKAGE CODE BEFORE SENDING IT TO CUSTOMER
![Page 46: Breaking bad habits with GitLab CI](https://reader035.vdocuments.mx/reader035/viewer/2022081513/586f867c1a28ab54768b5517/html5/thumbnails/46.jpg)
test: script: cat file1.txt file2.txt | grep -q 'Hello world'
package: script: cat file1.txt file2.txt | gzip > package.gz
![Page 47: Breaking bad habits with GitLab CI](https://reader035.vdocuments.mx/reader035/viewer/2022081513/586f867c1a28ab54768b5517/html5/thumbnails/47.jpg)
![Page 48: Breaking bad habits with GitLab CI](https://reader035.vdocuments.mx/reader035/viewer/2022081513/586f867c1a28ab54768b5517/html5/thumbnails/48.jpg)
MAKE RESULTS OF YOUR BUILD DOWNLOADABLE
![Page 49: Breaking bad habits with GitLab CI](https://reader035.vdocuments.mx/reader035/viewer/2022081513/586f867c1a28ab54768b5517/html5/thumbnails/49.jpg)
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
![Page 50: Breaking bad habits with GitLab CI](https://reader035.vdocuments.mx/reader035/viewer/2022081513/586f867c1a28ab54768b5517/html5/thumbnails/50.jpg)
![Page 51: Breaking bad habits with GitLab CI](https://reader035.vdocuments.mx/reader035/viewer/2022081513/586f867c1a28ab54768b5517/html5/thumbnails/51.jpg)
RUN JOBS SEQUENTIALLY
![Page 52: Breaking bad habits with GitLab CI](https://reader035.vdocuments.mx/reader035/viewer/2022081513/586f867c1a28ab54768b5517/html5/thumbnails/52.jpg)
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
![Page 53: Breaking bad habits with GitLab CI](https://reader035.vdocuments.mx/reader035/viewer/2022081513/586f867c1a28ab54768b5517/html5/thumbnails/53.jpg)
SPEEDING UP THE BUILD
![Page 54: Breaking bad habits with GitLab CI](https://reader035.vdocuments.mx/reader035/viewer/2022081513/586f867c1a28ab54768b5517/html5/thumbnails/54.jpg)
#1: DUPLICATION
![Page 55: Breaking bad habits with GitLab CI](https://reader035.vdocuments.mx/reader035/viewer/2022081513/586f867c1a28ab54768b5517/html5/thumbnails/55.jpg)
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
![Page 56: Breaking bad habits with GitLab CI](https://reader035.vdocuments.mx/reader035/viewer/2022081513/586f867c1a28ab54768b5517/html5/thumbnails/56.jpg)
![Page 57: Breaking bad habits with GitLab CI](https://reader035.vdocuments.mx/reader035/viewer/2022081513/586f867c1a28ab54768b5517/html5/thumbnails/57.jpg)
compile: stage: compile script: cat file1.txt file2.txt > compiled.txt artifacts: paths: - compiled.txt expire_in: 20 minutes
![Page 58: Breaking bad habits with GitLab CI](https://reader035.vdocuments.mx/reader035/viewer/2022081513/586f867c1a28ab54768b5517/html5/thumbnails/58.jpg)
#2: RUBY 2.1 ????
![Page 59: Breaking bad habits with GitLab CI](https://reader035.vdocuments.mx/reader035/viewer/2022081513/586f867c1a28ab54768b5517/html5/thumbnails/59.jpg)
LEARNING WHAT DOCKER IMAGE TO USE
![Page 60: Breaking bad habits with GitLab CI](https://reader035.vdocuments.mx/reader035/viewer/2022081513/586f867c1a28ab54768b5517/html5/thumbnails/60.jpg)
image: alpine
![Page 61: Breaking bad habits with GitLab CI](https://reader035.vdocuments.mx/reader035/viewer/2022081513/586f867c1a28ab54768b5517/html5/thumbnails/61.jpg)
image: alpinestages: - compile - test - package
compile: ...test: ...
![Page 62: Breaking bad habits with GitLab CI](https://reader035.vdocuments.mx/reader035/viewer/2022081513/586f867c1a28ab54768b5517/html5/thumbnails/62.jpg)
![Page 63: Breaking bad habits with GitLab CI](https://reader035.vdocuments.mx/reader035/viewer/2022081513/586f867c1a28ab54768b5517/html5/thumbnails/63.jpg)
> defined 3 stages> pass files between stages> downloadable artifacts> optimized execution time
![Page 64: Breaking bad habits with GitLab CI](https://reader035.vdocuments.mx/reader035/viewer/2022081513/586f867c1a28ab54768b5517/html5/thumbnails/64.jpg)
REQUIREMENT #3ISO INSTEAD OF GZIP
![Page 65: Breaking bad habits with GitLab CI](https://reader035.vdocuments.mx/reader035/viewer/2022081513/586f867c1a28ab54768b5517/html5/thumbnails/65.jpg)
DEALING WITH COMPLEX SCENARIOS
![Page 66: Breaking bad habits with GitLab CI](https://reader035.vdocuments.mx/reader035/viewer/2022081513/586f867c1a28ab54768b5517/html5/thumbnails/66.jpg)
![Page 67: Breaking bad habits with GitLab CI](https://reader035.vdocuments.mx/reader035/viewer/2022081513/586f867c1a28ab54768b5517/html5/thumbnails/67.jpg)
image: alpinestages: - 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
![Page 68: Breaking bad habits with GitLab CI](https://reader035.vdocuments.mx/reader035/viewer/2022081513/586f867c1a28ab54768b5517/html5/thumbnails/68.jpg)
![Page 69: Breaking bad habits with GitLab CI](https://reader035.vdocuments.mx/reader035/viewer/2022081513/586f867c1a28ab54768b5517/html5/thumbnails/69.jpg)
DEALING WITH MISSING SOFTWARE/PACKAGES
![Page 70: Breaking bad habits with GitLab CI](https://reader035.vdocuments.mx/reader035/viewer/2022081513/586f867c1a28ab54768b5517/html5/thumbnails/70.jpg)
apk add -U cdrkit
![Page 71: Breaking bad habits with GitLab CI](https://reader035.vdocuments.mx/reader035/viewer/2022081513/586f867c1a28ab54768b5517/html5/thumbnails/71.jpg)
script:- apk add -U cdrkit- mkisofs -o ./packaged.iso ./compiled.txt
![Page 72: Breaking bad habits with GitLab CI](https://reader035.vdocuments.mx/reader035/viewer/2022081513/586f867c1a28ab54768b5517/html5/thumbnails/72.jpg)
pack-iso: stage: package before_script: - apk add -U cdrkit script: - mkisofs -o ./packaged.iso ./compiled.txt artifacts: paths: - packaged.iso
![Page 73: Breaking bad habits with GitLab CI](https://reader035.vdocuments.mx/reader035/viewer/2022081513/586f867c1a28ab54768b5517/html5/thumbnails/73.jpg)
![Page 74: Breaking bad habits with GitLab CI](https://reader035.vdocuments.mx/reader035/viewer/2022081513/586f867c1a28ab54768b5517/html5/thumbnails/74.jpg)
![Page 75: Breaking bad habits with GitLab CI](https://reader035.vdocuments.mx/reader035/viewer/2022081513/586f867c1a28ab54768b5517/html5/thumbnails/75.jpg)
GITLAB OUIREMENT #4PUBLISH
A SMALL WEBSITE WITH OUR PACKAGES
![Page 76: Breaking bad habits with GitLab CI](https://reader035.vdocuments.mx/reader035/viewer/2022081513/586f867c1a28ab54768b5517/html5/thumbnails/76.jpg)
HTML → AMAZON S3
![Page 77: Breaking bad habits with GitLab CI](https://reader035.vdocuments.mx/reader035/viewer/2022081513/586f867c1a28ab54768b5517/html5/thumbnails/77.jpg)
aws s3 cp ./ s3://yourbucket/ --recursive
![Page 78: Breaking bad habits with GitLab CI](https://reader035.vdocuments.mx/reader035/viewer/2022081513/586f867c1a28ab54768b5517/html5/thumbnails/78.jpg)
![Page 79: Breaking bad habits with GitLab CI](https://reader035.vdocuments.mx/reader035/viewer/2022081513/586f867c1a28ab54768b5517/html5/thumbnails/79.jpg)
![Page 80: Breaking bad habits with GitLab CI](https://reader035.vdocuments.mx/reader035/viewer/2022081513/586f867c1a28ab54768b5517/html5/thumbnails/80.jpg)
FIRST AUTOMATED DEPLOYMENT
![Page 81: Breaking bad habits with GitLab CI](https://reader035.vdocuments.mx/reader035/viewer/2022081513/586f867c1a28ab54768b5517/html5/thumbnails/81.jpg)
> awscli can be installed using pip> pip goes together with python
![Page 82: Breaking bad habits with GitLab CI](https://reader035.vdocuments.mx/reader035/viewer/2022081513/586f867c1a28ab54768b5517/html5/thumbnails/82.jpg)
s3: image: python:latest stage: deploy script: - pip install awscli - aws s3 cp ./ s3://yourbucket/ --recursive
![Page 83: Breaking bad habits with GitLab CI](https://reader035.vdocuments.mx/reader035/viewer/2022081513/586f867c1a28ab54768b5517/html5/thumbnails/83.jpg)
AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY
![Page 84: Breaking bad habits with GitLab CI](https://reader035.vdocuments.mx/reader035/viewer/2022081513/586f867c1a28ab54768b5517/html5/thumbnails/84.jpg)
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
![Page 85: Breaking bad habits with GitLab CI](https://reader035.vdocuments.mx/reader035/viewer/2022081513/586f867c1a28ab54768b5517/html5/thumbnails/85.jpg)
KEEPING SECRET THINGS SECRET
![Page 86: Breaking bad habits with GitLab CI](https://reader035.vdocuments.mx/reader035/viewer/2022081513/586f867c1a28ab54768b5517/html5/thumbnails/86.jpg)
SETTINGS --> VARIABLES
![Page 87: Breaking bad habits with GitLab CI](https://reader035.vdocuments.mx/reader035/viewer/2022081513/586f867c1a28ab54768b5517/html5/thumbnails/87.jpg)
s3: image: python:latest stage: deploy script: - pip install awscli - aws s3 cp ./ s3://yourbucket/ --recursive
![Page 88: Breaking bad habits with GitLab CI](https://reader035.vdocuments.mx/reader035/viewer/2022081513/586f867c1a28ab54768b5517/html5/thumbnails/88.jpg)
So far so good:
![Page 89: Breaking bad habits with GitLab CI](https://reader035.vdocuments.mx/reader035/viewer/2022081513/586f867c1a28ab54768b5517/html5/thumbnails/89.jpg)
REQUIREMENT #5MORE THAN ONE DEVELOPER
ON THE PROJECT
![Page 90: Breaking bad habits with GitLab CI](https://reader035.vdocuments.mx/reader035/viewer/2022081513/586f867c1a28ab54768b5517/html5/thumbnails/90.jpg)
s3: image: python:latest stage: deploy script: - pip install awscli - aws s3 cp ./ s3://yourbucket/ --recursive only: - master
![Page 91: Breaking bad habits with GitLab CI](https://reader035.vdocuments.mx/reader035/viewer/2022081513/586f867c1a28ab54768b5517/html5/thumbnails/91.jpg)
![Page 92: Breaking bad habits with GitLab CI](https://reader035.vdocuments.mx/reader035/viewer/2022081513/586f867c1a28ab54768b5517/html5/thumbnails/92.jpg)
REQUIREMENT #6WE NEED A SEPARATE PLACE
FOR TESTING
![Page 93: Breaking bad habits with GitLab CI](https://reader035.vdocuments.mx/reader035/viewer/2022081513/586f867c1a28ab54768b5517/html5/thumbnails/93.jpg)
GITLAB PAGES
![Page 94: Breaking bad habits with GitLab CI](https://reader035.vdocuments.mx/reader035/viewer/2022081513/586f867c1a28ab54768b5517/html5/thumbnails/94.jpg)
HOST WEBSITES ON GITLAB PAGES
> your job should be named "pages"> put your files into "public" folder
> specify "artifacts" section with this "public" folder
![Page 95: Breaking bad habits with GitLab CI](https://reader035.vdocuments.mx/reader035/viewer/2022081513/586f867c1a28ab54768b5517/html5/thumbnails/95.jpg)
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>
![Page 96: Breaking bad habits with GitLab CI](https://reader035.vdocuments.mx/reader035/viewer/2022081513/586f867c1a28ab54768b5517/html5/thumbnails/96.jpg)
pages: stage: deploy image: alpine:latest script: - mkdir -p ./public && cp ./*.* ./public/ artifacts: paths: - public except: - master
![Page 97: Breaking bad habits with GitLab CI](https://reader035.vdocuments.mx/reader035/viewer/2022081513/586f867c1a28ab54768b5517/html5/thumbnails/97.jpg)
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
![Page 98: Breaking bad habits with GitLab CI](https://reader035.vdocuments.mx/reader035/viewer/2022081513/586f867c1a28ab54768b5517/html5/thumbnails/98.jpg)
![Page 99: Breaking bad habits with GitLab CI](https://reader035.vdocuments.mx/reader035/viewer/2022081513/586f867c1a28ab54768b5517/html5/thumbnails/99.jpg)
![Page 100: Breaking bad habits with GitLab CI](https://reader035.vdocuments.mx/reader035/viewer/2022081513/586f867c1a28ab54768b5517/html5/thumbnails/100.jpg)
![Page 101: Breaking bad habits with GitLab CI](https://reader035.vdocuments.mx/reader035/viewer/2022081513/586f867c1a28ab54768b5517/html5/thumbnails/101.jpg)
INTRODUCING ENVIRONMENTS
![Page 102: Breaking bad habits with GitLab CI](https://reader035.vdocuments.mx/reader035/viewer/2022081513/586f867c1a28ab54768b5517/html5/thumbnails/102.jpg)
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
![Page 103: Breaking bad habits with GitLab CI](https://reader035.vdocuments.mx/reader035/viewer/2022081513/586f867c1a28ab54768b5517/html5/thumbnails/103.jpg)
![Page 104: Breaking bad habits with GitLab CI](https://reader035.vdocuments.mx/reader035/viewer/2022081513/586f867c1a28ab54768b5517/html5/thumbnails/104.jpg)
![Page 105: Breaking bad habits with GitLab CI](https://reader035.vdocuments.mx/reader035/viewer/2022081513/586f867c1a28ab54768b5517/html5/thumbnails/105.jpg)
![Page 106: Breaking bad habits with GitLab CI](https://reader035.vdocuments.mx/reader035/viewer/2022081513/586f867c1a28ab54768b5517/html5/thumbnails/106.jpg)
REQUIREMENT #7DO NOT MESS UP PRODUCTION
![Page 107: Breaking bad habits with GitLab CI](https://reader035.vdocuments.mx/reader035/viewer/2022081513/586f867c1a28ab54768b5517/html5/thumbnails/107.jpg)
SWITCHING TO MANUAL DEPLOYMENT
![Page 108: Breaking bad habits with GitLab CI](https://reader035.vdocuments.mx/reader035/viewer/2022081513/586f867c1a28ab54768b5517/html5/thumbnails/108.jpg)
s3: image: python:latest stage: deploy script: - pip install awscli - aws s3 cp ./ s3://yourbucket/ --recursive only: - master when: manual
![Page 109: Breaking bad habits with GitLab CI](https://reader035.vdocuments.mx/reader035/viewer/2022081513/586f867c1a28ab54768b5517/html5/thumbnails/109.jpg)
![Page 110: Breaking bad habits with GitLab CI](https://reader035.vdocuments.mx/reader035/viewer/2022081513/586f867c1a28ab54768b5517/html5/thumbnails/110.jpg)
BOOTING UP APPLICATION INSTANCE PER FEATURE-BRANCH
![Page 111: Breaking bad habits with GitLab CI](https://reader035.vdocuments.mx/reader035/viewer/2022081513/586f867c1a28ab54768b5517/html5/thumbnails/111.jpg)
![Page 112: Breaking bad habits with GitLab CI](https://reader035.vdocuments.mx/reader035/viewer/2022081513/586f867c1a28ab54768b5517/html5/thumbnails/112.jpg)
<S3_BUCKET>.S3-WEBSITE-US-EAST-1.AMAZONAWS.COM/<BRANCHNAME>
![Page 113: Breaking bad habits with GitLab CI](https://reader035.vdocuments.mx/reader035/viewer/2022081513/586f867c1a28ab54768b5517/html5/thumbnails/113.jpg)
review apps: image: python:latest environment: review script: - pip install awscli - aws s3 cp ./ s3://reviewbucket/$CI_BUILD_REF_NAME/ --recursive
![Page 114: Breaking bad habits with GitLab CI](https://reader035.vdocuments.mx/reader035/viewer/2022081513/586f867c1a28ab54768b5517/html5/thumbnails/114.jpg)
$CI_BUILD_REF_NAME
?
![Page 115: Breaking bad habits with GitLab CI](https://reader035.vdocuments.mx/reader035/viewer/2022081513/586f867c1a28ab54768b5517/html5/thumbnails/115.jpg)
PREDEFINED VARIABLES
![Page 116: Breaking bad habits with GitLab CI](https://reader035.vdocuments.mx/reader035/viewer/2022081513/586f867c1a28ab54768b5517/html5/thumbnails/116.jpg)
SUMMARY
1. Deployment is just a set of commands2. You need to provide secret keys
3. You specify where which branches should go to4. GitLab conserves the history of deployments
5. You can enable manual deployment
![Page 117: Breaking bad habits with GitLab CI](https://reader035.vdocuments.mx/reader035/viewer/2022081513/586f867c1a28ab54768b5517/html5/thumbnails/117.jpg)
![Page 118: Breaking bad habits with GitLab CI](https://reader035.vdocuments.mx/reader035/viewer/2022081513/586f867c1a28ab54768b5517/html5/thumbnails/118.jpg)
![Page 119: Breaking bad habits with GitLab CI](https://reader035.vdocuments.mx/reader035/viewer/2022081513/586f867c1a28ab54768b5517/html5/thumbnails/119.jpg)
![Page 120: Breaking bad habits with GitLab CI](https://reader035.vdocuments.mx/reader035/viewer/2022081513/586f867c1a28ab54768b5517/html5/thumbnails/120.jpg)
GO TO GITLAB.COM