Eric Guimarães de Sousa Silva
Mmm.... Don't know what to say. >D
#QConSP
A pipeline de pipelines
Linha de montagem
Pode ser entendida como uma forma de produção em série; ocorre quando um estabelecimento industrial com o auxílio de máquinas transformam as matérias-primas e produtos semi-acabados em produtos acabados destinados ao consumo. (Wikipédia)
Pipeline de Pipelines
Senta que lá vem história...
Build - Test - Push
---
stages:
- CI
ci:
stage: CI
image: docker:1.11
services:
- docker:dind
script:
# Build
- docker build -t registry.gitlab.com/fewbits/pipeline-samples .
# Test
- docker run --rm registry.gitlab.com/fewbits/pipeline-samples npm test
# Push
- docker login -u gitlab-ci-token -p $CI_BUILD_TOKEN $CI_REGISTRY
- docker push registry.gitlab.com/fewbits/pipeline-samples
Test
Build
Push
---
image: docker:1.11
stages:
- Build
- Test
- Push
docker:build:
stage: Build
services:
- docker:dind
script:
- docker build -t registry.gitlab.com/fewbits/pipeline-samples:temp .
- docker login -u gitlab-ci-token -p $CI_BUILD_TOKEN $CI_REGISTRY
- docker push registry.gitlab.com/fewbits/pipeline-samples:temp
npm:test:
stage: Test
services:
- docker:dind
script:
- docker run --rm registry.gitlab.com/fewbits/pipeline-samples:temp npm test
docker:push:
stage: Push
services:
- docker:dind
script:
- docker login -u gitlab-ci-token -p $CI_BUILD_TOKEN $CI_REGISTRY
- docker pull registry.gitlab.com/fewbits/pipeline-samples:temp
- docker tag registry.gitlab.com/fewbits/pipeline-samples:temp registry.gitlab.com/fewbits/pipeline-samples
- docker push registry.gitlab.com/fewbits/pipeline-samples
Test
Build
Push
---
image: docker:1.11
stages:
- Build
- Test
- Push
Docker Build:
stage: Build
services:
- docker:dind
script:
- docker build -t registry.gitlab.com/fewbits/pipeline-samples:temp .
- docker login -u gitlab-ci-token -p $CI_BUILD_TOKEN $CI_REGISTRY
- docker push registry.gitlab.com/fewbits/pipeline-samples:temp
Image 1:
stage: Test
services:
- docker:dind
script:
- docker run --rm registry.gitlab.com/fewbits/pipeline-samples:temp npm test
Image 2:
stage: Test
services:
- docker:dind
script:
- docker run --rm registry.gitlab.com/fewbits/pipeline-samples:temp npm test
Image 3:
stage: Test
services:
- docker:dind
script:
- docker run --rm registry.gitlab.com/fewbits/pipeline-samples:temp npm test
Docker Push:
stage: Push
services:
- docker:dind
script:
- docker login -u gitlab-ci-token -p $CI_BUILD_TOKEN $CI_REGISTRY
- docker pull registry.gitlab.com/fewbits/pipeline-samples:temp
- docker tag registry.gitlab.com/fewbits/pipeline-samples:temp registry.gitlab.com/fewbits/pipeline-samples
- docker push registry.gitlab.com/fewbits/pipeline-samples
Test
Build
Push
Deploy
Something else
---
stages:
- Build
- Test
- Escalate
- Push
- Deploy
Docker Build:
stage: Build
image: docker:1.11
services:
- docker:dind
script:
- docker build -t registry.gitlab.com/fewbits/pipeline-samples:temp .
- docker login -u gitlab-ci-token -p $CI_BUILD_TOKEN $CI_REGISTRY
- docker push registry.gitlab.com/fewbits/pipeline-samples:temp
Test:
stage: Test
image: docker:1.11
script:
- echo "Flipping a coin - If 0 => OK / If 1 => Error"
- coin=`shuf -n1 -i0-1`
- echo "Coin is => $coin"
- exit $coin
Asking for Help:
stage: Escalate
image: docker:1.11
when: on_failure
script:
- echo "We have an error!!!"
- echo "Calling someone to help us..."
Docker Push:
stage: Push
image: docker:1.11
services:
- docker:dind
script:
- docker login -u gitlab-ci-token -p $CI_BUILD_TOKEN $CI_REGISTRY
- docker pull registry.gitlab.com/fewbits/pipeline-samples:temp
- docker tag registry.gitlab.com/fewbits/pipeline-samples:temp registry.gitlab.com/fewbits/pipeline-samples
- docker push registry.gitlab.com/fewbits/pipeline-samples
Deploy:
stage: Deploy
image: docker:1.11
retry: 2
script:
- echo "Loading config..."
- echo sleep 5
- echo "Deploying to server... "
- echo sleep 7
- echo "OK - End of deploy"
Build
Staging
Production
Continuous Delivery
Continuous Integration
Continuous Deployment
Adoçar
Cortar Limões
Espremer Limões
Suco do Limão
Açúcar
Limão
Limonada
Limão Cortado
Limão cortado
Espremedor
Suco do Limão
Limonada!
Adoçar
Cortar Limões
Espremer Limões
Açúcar
Limão
Limonada
Limão Cortado
Espremedor
Suco do Limão
Os Resources e os Jobs podem estar espalhados entre diversos repositórios diferentes.
Dev
Ops
Test
Sec
Website
Web App
qconsp-dev-site
qconsp-dev-app
qconsp-test
qconsp-sec
qconsp-ops
Pipelines
Assembly Line
By Eric Guimarães de Sousa Silva
As pipelines de CI/CD vêm evoluindo com o tempo, de forma parecida com a indústria dos automóveis. Seguindo esta tendência, conheça a próxima possível onda desta evolução: Assembly Lines for DevOps - as pipelines de pipelines. Nesta palestra, mostraremos na prática como cada equipe pode ter uma pipeline para as atividades da sua área, e como estas pipelines podem se integrar e compartilhar informações, formando uma Assembly Line flexível e capaz de atingir o Continuous Deployment do seu projeto.