SlideShare uma empresa Scribd logo
1 de 58
© Copyright 2017 Pivotal Software, Inc. All rights Reserved. Version 1.0
Lars Rosenquist
May 2018
Cloud Native CI/CD with
Spring Cloud Pipelines
Cover w/ Image
Agenda
■ Introduction
■ Why Spring Cloud Pipelines?
■ Anatomy of an opinionated deployment
pipeline
■ Demo
■ Q+A
Introduction
So what’s this about?
Lars Rosenquist
● Platform Architect at Pivotal
○ Field organisation
○ Helping customers become great software companies
● Developing software professionally since 1998
○ Financial, governmental, commercial
○ Java, Spring, Cloud Foundry
● Twitter: @larsrosenquist
● Email: lrosenquist@pivotal.io
About me
About you
How is CI/CD setup in your organization?
● Do you have a pipeline for every piece of software you build?
● How much effort (time, steps) does it cost to setup a new pipeline?
● Is it standardized, based on best practices? Or every app its own custom pipeline?
● Do your pipeline(s) make manual testing obsolete?
● Who’s doing CI? Who’s doing CD?
○ CI - Build and run tests
○ CD - The confidence to deploy to production in a fully automated way
● When to deploy to production? Office hours? Evenings/weekends?
CI/CD is hard!
Challenges with build server
● Setting up build server can be hard
○ Jenkins, (XML) jobs or (Groovy) pipelines
○ Concourse, (yaml) pipelines
● Lots of work in automating jobs and tests
○ Different pipeline for each app
○ Maintenance headache
● Pipeline setup is a chore. Why not automated?
CI/CD is hard (1/2)
Challenges on test environments
● Dependent services and applications
○ Available in test environment? Correct version?
● Dependent test data (sets)
○ Available in test environment?
○ Setup? Cleanup?
● Multiple teams in same environment
○ Wait until environment is ‘free’
● And then again for staging and production
CI/CD is hard (2/2)
We move to a microservices architecture
● Increases number of applications
● Increases number of dependencies
● Increases complexity
● Increases (wait) time
● Increases costs
And then?
So we go from this
To this
And ultimately this
We need
● Standardized and automated way of building our applications
● Standardized and automated way of deploying our applications
● Standardized and automated way of doing various kinds of tests
How do we fix this?
Why pipelines?
So how do pipelines help?
What does a good CI/CD pipeline look like?
A good pipeline
● Consistent, automated and repeatable steps
○ Build, test, deploy
○ Guarantee of success against a given set of tests
● Testing
○ Rollback testing
○ Backwards compatibility on DB schema changes
○ Use stubs for dependencies
● Zero downtime updates
○ Rolling, blue/green deployments
But that’s not all
Also use pipelines for
● Create new uSVC
○ App scaffolding (project structure, Spring/Boot/other libraries)
■ E.g. start.spring.io via curl
○ Build pipeline
○ Tracker/JIRA
○ Wiki/Confluence pages, etc.
● Managing your platform(s)
● Your use case here
Spring Cloud Pipelines
Introducing
Provide a common way of running, configuring and
deploying applications
Solve for:
- Creation of a common deployment pipeline
- Propagation of good testing & deployment
practices
- Speed up the time required to deploy a feature to
production
The goal
What it is...
- An opinionated pipeline to continuously deploy applications
to either Cloud Foundry or Kubernetes
- A mechanism to encourage /enforce best practices ranging
from increased automated test coverage, versioned
database schemas, and contract-based APIs
- Templates and scripts for easily creating standardized
pipelines for Concourse or Jenkins, and integrating with a
git source code repo and a maven artifact repo
- Easily extensible / customizable
What it isn’t...
- Your typical Spring project
- Annotations to add to your code
- Libraries to add to your application
- Turnkey solution
- A silver bullet or golden hammer
How do I use it?
- https://github.com/spring-cloud/spring-cloud-pipelines
- Treat the project as a template for your pipeline
- Download the repository and use it to init a new
git project
- Modify your new project to suit your needs
- We have our opinions
- But you have yours
- More important: standardize/automate!
Anatomy of an opinionated
deployment pipeline
So how does it work?
The Big Picture on Jenkins
The Big Picture on Concourse
Pipeline
● Different environments/phases
● Most of it is deployment and testing
So what’s in the picture
Environments
Anatomy of an opinionated pipeline
Build
● Local build environment
● No dependencies or other apps
● CICD tool worker
Environments
Test
● Remote deployment environment
● Not production-like
● Shared with multiple teams
● Dependencies or other apps may or may not be present, so use stubs
Environments
Stage
● Remote deployment environment
● (Tries to be) production-like
● Shared with multiple teams
● Dependencies or other apps present, so no stubs
○ Correct state
○ Correct version
● Need to wait for time slot
○ Until environment is in correct state
○ No one else is using it when you run a (load) test
Environments
Prod
● Where our customers go
● Definitely production-like
○ Probably the only one that is. ;)
● Do you verify production?
● Collect metrics?
Environments
Tests
Anatomy of an opinionated pipeline
Automated testing
● Who does this in a structural and automated way?
● Who knows the testing pyramid?
● If not structural and automated, how then?
Tests
Tests
Unit tests
● Executed during build phase
● No dependencies
● Fast
● A lot of them
● Do you write before or after writing your code?
Tests
Integration tests
● Executed during build phase
● Integrated, but stubbed database/HTTP endpoints
● More expensive, so less amount than unit tests
Tests
Smoke tests
● Executed on a deployed application
● Only primary, most critical features
● Executed against an application surrounded by stubs
Tests
End to end tests
● Executed on multiple deployed applications
● Only primary, critical usage scenarios
● Executed against multiple applications and all of their dependencies
Tests
Performance tests
● Can your application(s) handle a certain load within parameters
○ Throughout
○ Response time
● Run against test (stubbed)
● or stage (end to end)
Tests
So about end to end testing
End to end testing
● End to end tests is supposed to be prod-like
● But in reality, most E2E testing is not (dependencies, versions, data, etc.)
● False sense of security/trust (doesn’t really protect against issues)
● Very complex to maintain
● In the end doesn’t work
● Is it just to check off responsibility/blame?
So what if we just ….
Get rid of end to end testing?
Getting rid of end to end testing
Benefits
● Replace with contract testing and stubs (e.g. Spring Cloud Contract)
● No need to deploy additional applications
● Stubs are the same as used in integration tests
● Stubs tested against the application that produces them (use Spring Cloud Contract)
● Tests will be a lot faster -> faster pipeline -> faster to production
● No waiting for other teams or preparation of testing environments
● Less resource (VM) usage
Getting rid of end to end testing
Drawbacks
● Your end to end test will be production
● First time applications will communicate will be production
● Do you really trust your tests enough?
● Can you detect in production if something goes wrong?
Use contract testing to replace end to end
Replace with contract testing and stubs, only if
● Your microservice architecture if mature
○ Well defined bound contexts
● Your contract testing is mature
○ Proper scenarios in place
○ Builds trust
● You have KPI/monitoring in place on PROD
■ Prometheus/Graphite/Grafana/Seyren/etc.
Steps
Anatomy of an opinionated pipeline
Pipeline steps
Basic layout
● Test application in isolation
● Test backwards compatibility so it can be rollback in case of failures
● Test deployed version of the application
● User acceptance/performance test on deployed environment (or use…;))
● Deploy to production
Build and upload
● Build and publish to artifact repository
● Generate stubs for REST interfaces
● Build and publish Docker image (if Kubernetes)
Steps
API compatibility check
● Make sure API changes don’t break current production version (if available)
● Test against API contracts of -1 version (if available)
Steps
Deploy to test platform
● Cloud Foundry space or Kubernetes namespace
● Application deployed in isolation with necessary stubs
● Test database migration (if applicable)
○ Flyway, Liquibase
Steps
Smoke test new version on test platform
● Execute against stubbed application in isolation
● Best practice
○ A few critical use cases
■ Is primary functionality working?
○ Keep relatively small/limited
■ Want to keep it quick
Steps
Deploy rollback on test platform
● Deploy current production version
● Maintain migrated database (to check backwards compatibility)
Steps
Smoke test production version on test platform
● Execute another smoke test
Steps
Deploy to staging platform for end to end test
● Deploy application alongside other microservices
● No stubs
● Test database migration
● Or use contract testing and stubs!
Steps
End to end test new version on staging platform
● Execute against non-stubbed application
● Best practice
○ Hard to maintain, so
■ Only a few critical use cases
■ Keep relatively small/limited
○ Use contract testing and stubs instead
Steps
Deploy to production platform
● Tag in git
● Blue-green deployment to new version
● Great success!
● Or is it?
Steps
Rollback production platform
● Restore traffic to previous version
● Remove latest production tag in git
Steps
Demo/tour!
Now show me the money

Mais conteúdo relacionado

Mais procurados

QCon'17 talk: CI/CD at scale - lessons from LinkedIn and Mockito
QCon'17 talk: CI/CD at scale - lessons from LinkedIn and MockitoQCon'17 talk: CI/CD at scale - lessons from LinkedIn and Mockito
QCon'17 talk: CI/CD at scale - lessons from LinkedIn and Mockito
Szczepan Faber
 
40 square's git workflow
40 square's git workflow40 square's git workflow
40 square's git workflow
Ruben Tan
 

Mais procurados (20)

Why You Should Start Using Docker
Why You Should Start Using DockerWhy You Should Start Using Docker
Why You Should Start Using Docker
 
LCE13: Test and Validation Summit: Evolution of Testing in Linaro (I)
LCE13: Test and Validation Summit: Evolution of Testing in Linaro (I)LCE13: Test and Validation Summit: Evolution of Testing in Linaro (I)
LCE13: Test and Validation Summit: Evolution of Testing in Linaro (I)
 
Lightweight continuous delivery for small schools
Lightweight continuous delivery for small schoolsLightweight continuous delivery for small schools
Lightweight continuous delivery for small schools
 
Developing with versioning and CI/CD
Developing with versioning and CI/CDDeveloping with versioning and CI/CD
Developing with versioning and CI/CD
 
Trunk based development
Trunk based developmentTrunk based development
Trunk based development
 
Trunk based development for Beginners
Trunk based development for BeginnersTrunk based development for Beginners
Trunk based development for Beginners
 
vodQA Pune (2019) - Jenkins pipeline As code
vodQA Pune (2019) - Jenkins pipeline As codevodQA Pune (2019) - Jenkins pipeline As code
vodQA Pune (2019) - Jenkins pipeline As code
 
OPNFV CI and Challenges: How we solved them - if we solved them at all!
OPNFV CI and Challenges: How we solved them - if we solved them at all!OPNFV CI and Challenges: How we solved them - if we solved them at all!
OPNFV CI and Challenges: How we solved them - if we solved them at all!
 
QA Strategies for Testing Legacy Web Apps
QA Strategies for Testing Legacy Web AppsQA Strategies for Testing Legacy Web Apps
QA Strategies for Testing Legacy Web Apps
 
TDD with Python and App Engine
TDD with Python and App EngineTDD with Python and App Engine
TDD with Python and App Engine
 
OSDC 2018 | Migrating to the cloud by Devdas Bhagat
OSDC 2018 | Migrating to the cloud by Devdas BhagatOSDC 2018 | Migrating to the cloud by Devdas Bhagat
OSDC 2018 | Migrating to the cloud by Devdas Bhagat
 
QCon'17 talk: CI/CD at scale - lessons from LinkedIn and Mockito
QCon'17 talk: CI/CD at scale - lessons from LinkedIn and MockitoQCon'17 talk: CI/CD at scale - lessons from LinkedIn and Mockito
QCon'17 talk: CI/CD at scale - lessons from LinkedIn and Mockito
 
Creating a reasonable project boilerplate
Creating a reasonable project boilerplateCreating a reasonable project boilerplate
Creating a reasonable project boilerplate
 
40 square's git workflow
40 square's git workflow40 square's git workflow
40 square's git workflow
 
How to plan and define your CI-CD pipeline
How to plan and define your CI-CD pipelineHow to plan and define your CI-CD pipeline
How to plan and define your CI-CD pipeline
 
Survival of the Continuist
Survival of the ContinuistSurvival of the Continuist
Survival of the Continuist
 
CI/CD: Lessons from LinkedIn and Mockito
CI/CD: Lessons from LinkedIn and MockitoCI/CD: Lessons from LinkedIn and Mockito
CI/CD: Lessons from LinkedIn and Mockito
 
How we git - commit policy and code review
How we git - commit policy and code reviewHow we git - commit policy and code review
How we git - commit policy and code review
 
From naive to agile - software engineering approach
From naive to agile - software engineering approachFrom naive to agile - software engineering approach
From naive to agile - software engineering approach
 
Using Crowdsourced Testing to Turbocharge your Development Team
Using Crowdsourced Testing to Turbocharge your Development TeamUsing Crowdsourced Testing to Turbocharge your Development Team
Using Crowdsourced Testing to Turbocharge your Development Team
 

Semelhante a Cloud Native CI/CD with Spring Cloud Pipelines

Semelhante a Cloud Native CI/CD with Spring Cloud Pipelines (20)

Continuous Delivery at Snyk
Continuous Delivery at SnykContinuous Delivery at Snyk
Continuous Delivery at Snyk
 
Integration testing - A&BP CC
Integration testing - A&BP CCIntegration testing - A&BP CC
Integration testing - A&BP CC
 
Continuous Deployment of your Application @SpringOne
Continuous Deployment of your Application @SpringOneContinuous Deployment of your Application @SpringOne
Continuous Deployment of your Application @SpringOne
 
DevOpsDays Tel Aviv DEC 2022 | Building A Cloud-Native Platform Brick by Bric...
DevOpsDays Tel Aviv DEC 2022 | Building A Cloud-Native Platform Brick by Bric...DevOpsDays Tel Aviv DEC 2022 | Building A Cloud-Native Platform Brick by Bric...
DevOpsDays Tel Aviv DEC 2022 | Building A Cloud-Native Platform Brick by Bric...
 
IFG for SAP Integration, webinar on Automated Testing
IFG for SAP Integration, webinar on Automated TestingIFG for SAP Integration, webinar on Automated Testing
IFG for SAP Integration, webinar on Automated Testing
 
Continuous Deployment to the cloud
Continuous Deployment to the cloudContinuous Deployment to the cloud
Continuous Deployment to the cloud
 
Continuous Deployment of your Application - SpringOne Tour Dallas
Continuous Deployment of your Application - SpringOne Tour DallasContinuous Deployment of your Application - SpringOne Tour Dallas
Continuous Deployment of your Application - SpringOne Tour Dallas
 
Continuous Integration Testing Techniques to Improve Chef Cookbook Quality
Continuous Integration Testing Techniques to Improve Chef Cookbook QualityContinuous Integration Testing Techniques to Improve Chef Cookbook Quality
Continuous Integration Testing Techniques to Improve Chef Cookbook Quality
 
[DPE Summit] How Improving the Testing Experience Goes Beyond Quality: A Deve...
[DPE Summit] How Improving the Testing Experience Goes Beyond Quality: A Deve...[DPE Summit] How Improving the Testing Experience Goes Beyond Quality: A Deve...
[DPE Summit] How Improving the Testing Experience Goes Beyond Quality: A Deve...
 
Weave GitOps 2022.09 Release: A Fast & Reliable Path to Production with Progr...
Weave GitOps 2022.09 Release: A Fast & Reliable Path to Production with Progr...Weave GitOps 2022.09 Release: A Fast & Reliable Path to Production with Progr...
Weave GitOps 2022.09 Release: A Fast & Reliable Path to Production with Progr...
 
Bootify Yyour App from Zero to Hero
Bootify Yyour App from Zero to HeroBootify Yyour App from Zero to Hero
Bootify Yyour App from Zero to Hero
 
Evolving to Cloud-Native - Anand Rao
Evolving to Cloud-Native - Anand RaoEvolving to Cloud-Native - Anand Rao
Evolving to Cloud-Native - Anand Rao
 
Mulesoft Meetup Milano #9 - Batch Processing and CI/CD
Mulesoft Meetup Milano #9 - Batch Processing and CI/CDMulesoft Meetup Milano #9 - Batch Processing and CI/CD
Mulesoft Meetup Milano #9 - Batch Processing and CI/CD
 
Continuous Load Testing with CloudTest and Jenkins
Continuous Load Testing with CloudTest and JenkinsContinuous Load Testing with CloudTest and Jenkins
Continuous Load Testing with CloudTest and Jenkins
 
Continuous Deployment of your Application @jSession#5
Continuous Deployment of your Application @jSession#5Continuous Deployment of your Application @jSession#5
Continuous Deployment of your Application @jSession#5
 
May 2021 Spark Testing ... or how to farm reputation on StackOverflow
May 2021 Spark Testing ... or how to farm reputation on StackOverflowMay 2021 Spark Testing ... or how to farm reputation on StackOverflow
May 2021 Spark Testing ... or how to farm reputation on StackOverflow
 
Dev ops
Dev opsDev ops
Dev ops
 
A guide to modern software development 2018
A guide to modern software development 2018A guide to modern software development 2018
A guide to modern software development 2018
 
Continuous Load Testing with CloudTest and Jenkins
Continuous Load Testing with CloudTest and JenkinsContinuous Load Testing with CloudTest and Jenkins
Continuous Load Testing with CloudTest and Jenkins
 
µServices Architecture @ EPAM WOW 2015
µServices Architecture @ EPAM WOW 2015µServices Architecture @ EPAM WOW 2015
µServices Architecture @ EPAM WOW 2015
 

Último

%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
masabamasaba
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
Health
 
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
Medical / Health Care (+971588192166) Mifepristone and Misoprostol tablets 200mg
 
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
VictoriaMetrics
 

Último (20)

8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students
 
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
 
tonesoftg
tonesoftgtonesoftg
tonesoftg
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital TransformationWSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
 
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
 
Architecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the pastArchitecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the past
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
 
%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand
 
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
 
Microsoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdfMicrosoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdf
 
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
 
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
 
WSO2CON 2024 - Does Open Source Still Matter?
WSO2CON 2024 - Does Open Source Still Matter?WSO2CON 2024 - Does Open Source Still Matter?
WSO2CON 2024 - Does Open Source Still Matter?
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial Goals
 
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
 
VTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnVTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learn
 

Cloud Native CI/CD with Spring Cloud Pipelines

  • 1. © Copyright 2017 Pivotal Software, Inc. All rights Reserved. Version 1.0 Lars Rosenquist May 2018 Cloud Native CI/CD with Spring Cloud Pipelines
  • 2. Cover w/ Image Agenda ■ Introduction ■ Why Spring Cloud Pipelines? ■ Anatomy of an opinionated deployment pipeline ■ Demo ■ Q+A
  • 4. Lars Rosenquist ● Platform Architect at Pivotal ○ Field organisation ○ Helping customers become great software companies ● Developing software professionally since 1998 ○ Financial, governmental, commercial ○ Java, Spring, Cloud Foundry ● Twitter: @larsrosenquist ● Email: lrosenquist@pivotal.io About me
  • 5. About you How is CI/CD setup in your organization? ● Do you have a pipeline for every piece of software you build? ● How much effort (time, steps) does it cost to setup a new pipeline? ● Is it standardized, based on best practices? Or every app its own custom pipeline? ● Do your pipeline(s) make manual testing obsolete? ● Who’s doing CI? Who’s doing CD? ○ CI - Build and run tests ○ CD - The confidence to deploy to production in a fully automated way ● When to deploy to production? Office hours? Evenings/weekends?
  • 7. Challenges with build server ● Setting up build server can be hard ○ Jenkins, (XML) jobs or (Groovy) pipelines ○ Concourse, (yaml) pipelines ● Lots of work in automating jobs and tests ○ Different pipeline for each app ○ Maintenance headache ● Pipeline setup is a chore. Why not automated? CI/CD is hard (1/2)
  • 8. Challenges on test environments ● Dependent services and applications ○ Available in test environment? Correct version? ● Dependent test data (sets) ○ Available in test environment? ○ Setup? Cleanup? ● Multiple teams in same environment ○ Wait until environment is ‘free’ ● And then again for staging and production CI/CD is hard (2/2)
  • 9. We move to a microservices architecture ● Increases number of applications ● Increases number of dependencies ● Increases complexity ● Increases (wait) time ● Increases costs And then?
  • 10. So we go from this
  • 13. We need ● Standardized and automated way of building our applications ● Standardized and automated way of deploying our applications ● Standardized and automated way of doing various kinds of tests How do we fix this?
  • 14. Why pipelines? So how do pipelines help?
  • 15. What does a good CI/CD pipeline look like? A good pipeline ● Consistent, automated and repeatable steps ○ Build, test, deploy ○ Guarantee of success against a given set of tests ● Testing ○ Rollback testing ○ Backwards compatibility on DB schema changes ○ Use stubs for dependencies ● Zero downtime updates ○ Rolling, blue/green deployments
  • 16. But that’s not all Also use pipelines for ● Create new uSVC ○ App scaffolding (project structure, Spring/Boot/other libraries) ■ E.g. start.spring.io via curl ○ Build pipeline ○ Tracker/JIRA ○ Wiki/Confluence pages, etc. ● Managing your platform(s) ● Your use case here
  • 18. Provide a common way of running, configuring and deploying applications Solve for: - Creation of a common deployment pipeline - Propagation of good testing & deployment practices - Speed up the time required to deploy a feature to production The goal
  • 19. What it is... - An opinionated pipeline to continuously deploy applications to either Cloud Foundry or Kubernetes - A mechanism to encourage /enforce best practices ranging from increased automated test coverage, versioned database schemas, and contract-based APIs - Templates and scripts for easily creating standardized pipelines for Concourse or Jenkins, and integrating with a git source code repo and a maven artifact repo - Easily extensible / customizable
  • 20. What it isn’t... - Your typical Spring project - Annotations to add to your code - Libraries to add to your application - Turnkey solution - A silver bullet or golden hammer
  • 21. How do I use it? - https://github.com/spring-cloud/spring-cloud-pipelines - Treat the project as a template for your pipeline - Download the repository and use it to init a new git project - Modify your new project to suit your needs - We have our opinions - But you have yours - More important: standardize/automate!
  • 22.
  • 23. Anatomy of an opinionated deployment pipeline So how does it work?
  • 24. The Big Picture on Jenkins
  • 25. The Big Picture on Concourse
  • 26. Pipeline ● Different environments/phases ● Most of it is deployment and testing So what’s in the picture
  • 27. Environments Anatomy of an opinionated pipeline
  • 28. Build ● Local build environment ● No dependencies or other apps ● CICD tool worker Environments
  • 29. Test ● Remote deployment environment ● Not production-like ● Shared with multiple teams ● Dependencies or other apps may or may not be present, so use stubs Environments
  • 30. Stage ● Remote deployment environment ● (Tries to be) production-like ● Shared with multiple teams ● Dependencies or other apps present, so no stubs ○ Correct state ○ Correct version ● Need to wait for time slot ○ Until environment is in correct state ○ No one else is using it when you run a (load) test Environments
  • 31. Prod ● Where our customers go ● Definitely production-like ○ Probably the only one that is. ;) ● Do you verify production? ● Collect metrics? Environments
  • 32. Tests Anatomy of an opinionated pipeline
  • 33. Automated testing ● Who does this in a structural and automated way? ● Who knows the testing pyramid? ● If not structural and automated, how then? Tests
  • 34. Tests
  • 35. Unit tests ● Executed during build phase ● No dependencies ● Fast ● A lot of them ● Do you write before or after writing your code? Tests
  • 36. Integration tests ● Executed during build phase ● Integrated, but stubbed database/HTTP endpoints ● More expensive, so less amount than unit tests Tests
  • 37. Smoke tests ● Executed on a deployed application ● Only primary, most critical features ● Executed against an application surrounded by stubs Tests
  • 38. End to end tests ● Executed on multiple deployed applications ● Only primary, critical usage scenarios ● Executed against multiple applications and all of their dependencies Tests
  • 39. Performance tests ● Can your application(s) handle a certain load within parameters ○ Throughout ○ Response time ● Run against test (stubbed) ● or stage (end to end) Tests
  • 40. So about end to end testing End to end testing ● End to end tests is supposed to be prod-like ● But in reality, most E2E testing is not (dependencies, versions, data, etc.) ● False sense of security/trust (doesn’t really protect against issues) ● Very complex to maintain ● In the end doesn’t work ● Is it just to check off responsibility/blame?
  • 41. So what if we just ….
  • 42. Get rid of end to end testing?
  • 43. Getting rid of end to end testing Benefits ● Replace with contract testing and stubs (e.g. Spring Cloud Contract) ● No need to deploy additional applications ● Stubs are the same as used in integration tests ● Stubs tested against the application that produces them (use Spring Cloud Contract) ● Tests will be a lot faster -> faster pipeline -> faster to production ● No waiting for other teams or preparation of testing environments ● Less resource (VM) usage
  • 44. Getting rid of end to end testing Drawbacks ● Your end to end test will be production ● First time applications will communicate will be production ● Do you really trust your tests enough? ● Can you detect in production if something goes wrong?
  • 45. Use contract testing to replace end to end Replace with contract testing and stubs, only if ● Your microservice architecture if mature ○ Well defined bound contexts ● Your contract testing is mature ○ Proper scenarios in place ○ Builds trust ● You have KPI/monitoring in place on PROD ■ Prometheus/Graphite/Grafana/Seyren/etc.
  • 46. Steps Anatomy of an opinionated pipeline
  • 47. Pipeline steps Basic layout ● Test application in isolation ● Test backwards compatibility so it can be rollback in case of failures ● Test deployed version of the application ● User acceptance/performance test on deployed environment (or use…;)) ● Deploy to production
  • 48. Build and upload ● Build and publish to artifact repository ● Generate stubs for REST interfaces ● Build and publish Docker image (if Kubernetes) Steps
  • 49. API compatibility check ● Make sure API changes don’t break current production version (if available) ● Test against API contracts of -1 version (if available) Steps
  • 50. Deploy to test platform ● Cloud Foundry space or Kubernetes namespace ● Application deployed in isolation with necessary stubs ● Test database migration (if applicable) ○ Flyway, Liquibase Steps
  • 51. Smoke test new version on test platform ● Execute against stubbed application in isolation ● Best practice ○ A few critical use cases ■ Is primary functionality working? ○ Keep relatively small/limited ■ Want to keep it quick Steps
  • 52. Deploy rollback on test platform ● Deploy current production version ● Maintain migrated database (to check backwards compatibility) Steps
  • 53. Smoke test production version on test platform ● Execute another smoke test Steps
  • 54. Deploy to staging platform for end to end test ● Deploy application alongside other microservices ● No stubs ● Test database migration ● Or use contract testing and stubs! Steps
  • 55. End to end test new version on staging platform ● Execute against non-stubbed application ● Best practice ○ Hard to maintain, so ■ Only a few critical use cases ■ Keep relatively small/limited ○ Use contract testing and stubs instead Steps
  • 56. Deploy to production platform ● Tag in git ● Blue-green deployment to new version ● Great success! ● Or is it? Steps
  • 57. Rollback production platform ● Restore traffic to previous version ● Remove latest production tag in git Steps

Notas do Editor

  1. Be clear about what portion of the pipe dreams/vision/circle of code this is addressing - maybe add a slide?
  2. Spring and opinions Spring projects provide opinions through annotations, the framework… Spring Boot, JPA, Integration… all provide opinions through annotations SCP provides the opinions through pipelines SCP provides template pipelines in Jenkins and Concourse
  3. Concept based on one or two years’ worth of real enterprise work Maturity: in active development Blog post by Marcin: Cct 2015 Future: will be partially replaced by Spinnaker, pipelining will be done by Spinnaker; jobs will remain Spinnaker will call Jenkins jobs to run tests, etc. Spinnaker will orchestrate jobs Marcin modified surefire plugin in maven to verify that the smoke or end2end tests are under the smoke or end2end package… Meaning when running profile smoke, maven runs tests in smoke package only, etc. In gradle, there is an inclusion pattern that accomplishes the same effect Could integrate with JUnit annotations…??
  4. SCP in concrete Concourse Background: Pivotal build CI/CD tool borne out of need for CICD for CF, for managing many services and microservices Can use Jenkins as well In Concourse, there is a jenkins.yml file that is the manifest - you can think of it as the blueprint - of how the pipeline should look You can modify it - provides a set of opinions but you can change it
  5. Recommend 4 environments