Contenu connexe Similaire à Remove Undifferentiated Heavy Lifting from Jenkins (DEV201-R1) - AWS re:Invent 2018 (20) Plus de Amazon Web Services (20) Remove Undifferentiated Heavy Lifting from Jenkins (DEV201-R1) - AWS re:Invent 20181. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Remove Undifferentiated Heavy Lifting from
Jenkins
Paul Roberts
Strategic Solutions Architect
Amazon Web Services
D E V 2 0 1
John Hanks
Software Development Engineer
Amazon Web Services
2. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Software creation and distribution is easier
and faster than ever:
• Startups can now take on giants with little
to no funding ahead of time
• Getting your software into the hands of
millions is a download away
• Your ability to move fast is paramount to
your ability to fight off disruption
Software moves faster today
3. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
* As of 1 February 2017
2010
61
516
1,017
159
2012 2014 2016
AWS pace of innovation
1,430
2017
4. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
• Integration
tests with
other systems
• Load testing
• UI tests
• Penetration
testing
Releases have four major phases
Source Build Test Production
• Check-in
source code
such as
.java files
• Peer review
new code
• Compile code
• Unit tests
• Style
checkers
• Code metrics
• Create
container
images
• Deployment
to production
environments
5. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Release process levels
Source Build Test Production
Continuous integration
Continuous deployment
Continuous delivery
6. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
AWS code services
Source Build Test Production
Third-party
tooling
Software release steps:
AWS CodeCommit AWS CodeBuild AWS CodeDeploy
AWS CodePipeline
7. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
8. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
On-demand
Pay for compute
capacity by the
second with no long-
term commitments
For spiky workloads,
or to define needs
Amazon Elastic Compute Cloud
(Amazon EC2) consumption models
Reserved
Make a low, one-time
payment and receive
a significant discount
on the hourly charge
For committed
utilization
Spot
Bid for unused
capacity, charged at
a Spot price which
fluctuates based on
supply and demand
For time-insensitive,
transient, or stateless
workloads
9. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Get the best value for Amazon Elastic
Compute Cloud (Amazon EC2) capacity
• Since Spot Instances typically cost 50-90% less than
on-demand, you can increase your compute capacity
by 2-10x within the same budget
• Or you could save 50-90% on your existing workload
• Either way, you should try it!
10. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
“By using AWS Spot instances, we've been able to save 75% a month
simply by changing four lines of code. It makes perfect sense for
saving money when you're running continuous integration workloads
or pipeline processing.”
—Matthew Leventi, Lead Engineer, Lyft
Why use Spot—Customer examples
11. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Jenkins + Spot Instances
Save up to 90% of Jenkins infrastructure costs
Run compilations/tests on fleet of Spot Instances
Support of Spot in Jenkins, Bamboo
This plug-in makes it easier to save money
Configure Jenkins to automatically scale a fleet of Spot
Instances up or down depending on the number jobs to
be completed
https://wiki.jenkins-
ci.org/display/JENKINS/Amazon+EC2+Fleet+Plugin
12. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Continuous delivery to Amazon Elastic
Compute Cloud (Amazon EC2) Amazon Elastic
Container Service (Amazon ECS) with Jenkins
4. Push image to
Docker registry
2. Build image
from sources 3. Run test on image
1. Code push
triggers build
5. Update service
6. Pull image
13. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
14. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Fully managed build service that
compiles source code, runs tests, and
produces software packages
Launched with AWS CodePipeline and
Jenkins integration
AWS CodeBuild
15. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
AWS CodeBuild
A fully managed build service that compiles source code, runs tests, and
produces software packages that are ready to deploy
Fully managed
build service
Continuous
scaling
Pay as
you go
Extensible Enables
CI/CD
Secure
16. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
AWS CodeBuild
No need to manage build servers
Low, pay-as-you-go pricing
Use pre-configured build environments or bring your own
Source code Build trigger
AWS
CodeBuild Output artifacts
17. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Automate your release with AWS CodeBuild
• Easily pluggable (API/CLI driven)
• Bring your own build environments
• Create Docker images containing tools you need
• Open source Jenkins plug-in
• Use AWS CodeBuild as the workers off of a Jenkins master
https://github.com/awslabs/aws-codebuild-jenkins-plugin
18. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
buildspec.yml example
version: 0.2
env:
variables:
JAVA_HOME: "/usr/lib/jvm/java-8-openjdk-amd64"
phases:
install:
commands:
- apt-get update -y
- apt-get install -y maven
pre_build:
commands:
- echo Nothing to do in the pre_build phase...
build:
commands:
- echo Build started on `date`
- mvn install
post_build:
commands:
- echo Build completed on `date`
artifacts:
type: zip
files:
- target/messageUtil-1.0.jar
19. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
version: 0.2
env:
variables:
JAVA_HOME: "/usr/lib/jvm/java-8-openjdk-amd64"
phases:
install:
commands:
- apt-get update -y
- apt-get install -y maven
pre_build:
commands:
- echo Nothing to do in the pre_build phase...
build:
commands:
- echo Build started on `date`
- mvn install
post_build:
commands:
- echo Build completed on `date`
artifacts:
type: zip
files:
- target/messageUtil-1.0.jar
• Variables to be used by phases of
build
• Examples for what you can do in
the phases of a build:
• You can install packages or run
commands to prepare your
environment in ”install”
• Run syntax checking, commands
in “pre_build”
• Execute your build
tool/command in “build”
• Test your app further or ship a
container image to a repository
in post_build
• Create and store an artifact in
Amazon S3
20. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
21. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Deployment overview
Trend reporting for retail store locations
22. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Make life simple
AWS CodeBuild
Worker Worker Worker
N
Workers
23. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
DEMO!
24. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
25. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
aws.amazon.com/codebuild
27. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.