O slideshow foi denunciado.
Seu SlideShare está sendo baixado. ×

Jenkins vs. AWS CodePipeline (AWS User Group Berlin)

Anúncio
Anúncio
Anúncio
Anúncio
Anúncio
Anúncio
Anúncio
Anúncio
Anúncio
Anúncio
Anúncio
Anúncio
Próximos SlideShares
Monitoring Akka with Kamon 1.0
Monitoring Akka with Kamon 1.0
Carregando em…3
×

Confira estes a seguir

1 de 64 Anúncio

Mais Conteúdo rRelacionado

Diapositivos para si (20)

Semelhante a Jenkins vs. AWS CodePipeline (AWS User Group Berlin) (20)

Anúncio

Mais de Steffen Gebert (20)

Mais recentes (20)

Anúncio

Jenkins vs. AWS CodePipeline (AWS User Group Berlin)

  1. 1. @rafaelbenvenuti @StGebert Jenkins vs. AWS CodePipeline Rafael Schleetz Benvenuti & Steffen Gebert Berlin AWS User Group Meetup – 14.01.2020
  2. 2. @rafaelbenvenuti @StGebert Abstract Who has not used Jenkins? Who does not have a love-hate relationship with it? At EMnify, we are heavy Jenkins users, but we re also always considering alternatives where hosted services could make our life easier. Therefore, we recently - once again - looked at AWS CodePipeline and its friends CodeCommit, CodeBuild, and CodeDeploy. In this talk, we will compare the current state of the two ecosystems regarding their simplicity and flexibility for implementing both trivial as well as complex pipelines. Further, we cover topics like: deployment, maintenance, security, costs, and usability. 2
  3. 3. @rafaelbenvenuti @StGebert Agenda 3 Current State Costs Feature Comparison Combining Both
  4. 4. @rafaelbenvenuti @StGebert Your Guides 4 Dr. Steffen Gebert @StGebert Director Technology, Infrastructure Würzburg Rafael Schleetz Benvenuti @rafaelbenvenuti Site Reliability Engineer Berlin
  5. 5. @rafaelbenvenuti @StGebert EMnify 5 One of the first cellular providers on AWS - dedicated for IoT businesses We’re where customers are - on AWS offering simple integrations (TGW, Kinesis) Programmable SIM that works all over the world in ~600 networks Web portal and APIs for managing SIMs and their policies
  6. 6. @rafaelbenvenuti @StGebert EMnify GmbH • Privately founded in 2014 • ~95 in total • ~25 people touching code • Engineering teams in Würzburg & Berlin • Technology stack: AWS, Terraform, Java, Akka, Perl, C++, Go 7
  7. 7. @rafaelbenvenuti @StGebert Jenkins and AWS CodePipeline Current State
  8. 8. @rafaelbenvenuti @StGebert Running Jenkins • Jenkins Master • EC2 instance, ECS+EFS, or EKS, Fargate (requires RWO file system) • Recommendation: run it in Docker and include your plugins • Build Agents • Optional J (building on master is usually a bad idea) • EC2 spot (using ec2 plugin) or EKS (using kubernetes plugin) 9
  9. 9. @rafaelbenvenuti @StGebert Job Definition Job DSL Organization Folder Everything as Code 10 Jenkins Pipeline Build Agents Configuration as Code Jenkins Master AWS CloudFormation
  10. 10. @rafaelbenvenuti @StGebert Out of Scope: Jenkins X 11
  11. 11. @rafaelbenvenuti @StGebert AWS CodePipeline 12
  12. 12. @rafaelbenvenuti @StGebert Pipeline Implementation
  13. 13. @rafaelbenvenuti @StGebert Jenkins Pipeline 14 Domain-specific language Built-in control structures Steps •sh, bat •readFile, readMavenPom •stash, archiveArtifacts •build pipeline { stages { stage("Build") { steps { echo "Starting engines.." sh "make" } } stage("Unit") { steps { sh "mvn test" } } } agent { docker { label "maven:latest" } } }
  14. 14. @rafaelbenvenuti @StGebert Jenkins Pipeline Steps • Plugins contribute additional steps • Online reference: https://jenkins.io/doc/pipeline/steps/ 15
  15. 15. @rafaelbenvenuti @StGebert CodePipeline Pipeline 16
  16. 16. @rafaelbenvenuti @StGebert CodePipeline Actions 17 Source BitBucket Github CodeCommit S3 ECR Build CodeBuild Cloudbees Jenkins Teamcity Test CodeBuild AWS Device Farm Jenkins Deploy CodeDeploy CloudFormation Elastic Beanstalk Service Catalog ECS S3 Invoke AWS Lambda
  17. 17. @rafaelbenvenuti @StGebert Pricing
  18. 18. @rafaelbenvenuti @StGebert Jenkins Pricing 19 Setup Costs •Initial Setup Costs Usage Costs •Computing resources used •EC2 instance costs •On-Demand •Reserved •Spot •A bit of storage, traffic etc. Maintenance Costs •Operational Costs
  19. 19. @rafaelbenvenuti @StGebert AWS Pricing 20 CodePipeline • Each pipeline costs $1.00 per month (when active) • Pipelines are free for the first 30 days after creation CodeCommit • Free for first active 5 users per month • Each additional active user costs $1.00 per month CodeBuild • Small instance (2 vCPUs, 3 GB RAM) - $0.005/min • Medium instance (4 vCPUs, 7 GB RAM) - $0.01/min • Large instance (8 vCPUs, 15 GB RAM) - $0.02/min CodeDeploy • Free
  20. 20. @rafaelbenvenuti @StGebert Price Comparison for Build Capacity 21 Jenkins Master Instance Jenkins Agent Instance c5.large RESERVED c5.large SPOT 2 vCPUS | 4 GB Ram 2 vCPUS | 4 GB Ram $39.42/month $0.000325/min CodeBuild Instance general1.small 2 vCPUS | 3 GB Ram $0.005 / min
  21. 21. @rafaelbenvenuti @StGebert Price Comparison for Active Pipelines 22 Jenkins Master Instance c5.large RESERVED 2 vCPUS | 4 GB Ram CodePipelines No Instances Required No Resources Required
  22. 22. @rafaelbenvenuti @StGebert Visualization
  23. 23. @rafaelbenvenuti @StGebert CodePipeline Basic Pipeline 24
  24. 24. @rafaelbenvenuti @StGebert Visualization in Jenkins 25
  25. 25. @rafaelbenvenuti @StGebert 26
  26. 26. @rafaelbenvenuti @StGebert 27
  27. 27. @rafaelbenvenuti @StGebert 28
  28. 28. @rafaelbenvenuti @StGebert CodeBuild Log Output 29
  29. 29. @rafaelbenvenuti @StGebert CodePipeline Execution Summary 30
  30. 30. @rafaelbenvenuti @StGebert Execution History 31
  31. 31. @rafaelbenvenuti @StGebert CodeBuild Metrics 32
  32. 32. @rafaelbenvenuti @StGebert Let’s Start the Pipeline
  33. 33. @rafaelbenvenuti @StGebert Access Control
  34. 34. @rafaelbenvenuti @StGebert Access Control • Jenkins • Users and groups, built-in or via SSO/OAuth • Per-project/folder permissions 35 • CodePipeline • IAM users and roles • Configure and run permissions AWS Identity and Access Management
  35. 35. @rafaelbenvenuti @StGebert CodePipeline Service Permissions 36
  36. 36. @rafaelbenvenuti @StGebert Building
  37. 37. @rafaelbenvenuti @StGebert Jenkins Build Environments • Any agent (running Java) connecting to the master (Linux, Windows, MacOS, ..) • Docker images • Kubernetes Pod with multiple containers
  38. 38. @rafaelbenvenuti @StGebert CodeBuild Build Environments • A CodeBuild build environment represents a combination of: • operating system / programming language runtime / set of tools • Essentially, a build environment is a Docker Image by definition. • You can use Docker Images stored in: • The Official Codebuild Image Repository • AWS ECR Repositories • DockerHub
  39. 39. @rafaelbenvenuti @StGebert CodeBuild BuildSpec 40
  40. 40. @rafaelbenvenuti @StGebert Secrets Handling
  41. 41. @rafaelbenvenuti @StGebert Jenkins Credentials Management 42
  42. 42. @rafaelbenvenuti @StGebert CodeBuild Credentials Management 43
  43. 43. @rafaelbenvenuti @StGebert Collecting Test Results
  44. 44. @rafaelbenvenuti @StGebert Jenkins: Collecting Test Results 45
  45. 45. @rafaelbenvenuti @StGebert CodeBuild: Collecting Test Results 46
  46. 46. @rafaelbenvenuti @StGebert Working With Multiple Branches
  47. 47. @rafaelbenvenuti @StGebert Different Behavior per Branch 48
  48. 48. @rafaelbenvenuti @StGebert Implementing Gitflow in CodePipeline 49 Source: https://aws.amazon.com/blogs/devops/implementing-gitflow-using-aws-codepipeline-aws-codecommit-aws-codebuild-and-aws-codedeploy/
  49. 49. @rafaelbenvenuti @StGebert Getting Approvals And Input
  50. 50. @rafaelbenvenuti @StGebert Approval 51
  51. 51. @rafaelbenvenuti @StGebert Getting Input • Input step • Simple approval • Values/text can be dynamically computed • During pipeline execution • Jenkins Parametrized build • Only supplied with job execution • Can come from other job / via POST 52
  52. 52. @rafaelbenvenuti @StGebert Pipeline Super Powers
  53. 53. @rafaelbenvenuti @StGebert Jenkins Scripted Pipelines • More power compared to Declarative Pipelines • Full Groovy power • Control/data structures • Classes • Variable assignment • Groovy errors only triggered during execution • Build error handling up to user (try/catch) • Greater flexibility in build agent allocation • Declarative: use script{} for super powers • Shared libraries to maintain custom steps 54
  54. 54. @rafaelbenvenuti @StGebert CodePipeline Custom Actions 55
  55. 55. @rafaelbenvenuti @StGebert Deployment
  56. 56. @rafaelbenvenuti @StGebert Deployments 57
  57. 57. @rafaelbenvenuti @StGebert Deploying to EC2 Instances 58 AWS CodeDeploy Jenkins Master Jenkins Agent Security Group EKS
  58. 58. @rafaelbenvenuti @StGebert CodeDeploy AppSpec Example for EC2 59
  59. 59. @rafaelbenvenuti @StGebert CodeDeploy Rollbacks 60
  60. 60. @rafaelbenvenuti @StGebert Jenkins and CodePipeline Working Together
  61. 61. @rafaelbenvenuti @StGebert From CodePipeline to Jenkins • AWS CodePipeline Plugin (polls for build jobs, publishes results) 62
  62. 62. @rafaelbenvenuti @StGebert From Jenkins to AWS 63
  63. 63. @rafaelbenvenuti @StGebert Summary & Conclusion
  64. 64. @rafaelbenvenuti @StGebert Summary & Conclusion • The best CI/CD tool depends on your situation and requirements (still in 2020) • Accepting that one tool can‘t cover everything makes switching easier • Integrating both together allows: • Getting the best of both / Cheaper solution / Smoother migration • Advice: Please give CodeDeploy a chance, it is a pretty interesting tool 65

×