continuous intergration - uni-neumann.hu · 2018-09-22 · confidential 20 “maven is a project...
TRANSCRIPT
![Page 2: Continuous intergration - uni-neumann.hu · 2018-09-22 · CONFIDENTIAL 20 “Maven is a project management tool which encompasses a project object model, a set of standards, a project](https://reader033.vdocument.in/reader033/viewer/2022042219/5ec577ce342d7c604e107a9b/html5/thumbnails/2.jpg)
2CONFIDENTIAL
• Lead Software Engeneer at EPAM Systems Hungary
– 14 years experience, 5 years @ EPAM
• Software development
– Backend-side Java development
– Demonstrated history of working in the information technology and services industry
• Resource development
– EPAM Java Academy / Java EE trainer ~1.000 Man-Hours
– EPAM Java Mentor Program / Mentor, mentor-supervisor
About me
![Page 3: Continuous intergration - uni-neumann.hu · 2018-09-22 · CONFIDENTIAL 20 “Maven is a project management tool which encompasses a project object model, a set of standards, a project](https://reader033.vdocument.in/reader033/viewer/2022042219/5ec577ce342d7c604e107a9b/html5/thumbnails/3.jpg)
3CONFIDENTIAL
• Introduction
• What is Continuous Integration?
• Source code management (Git)
• Build automation (Maven)
• Repository management (Nexus)
• The CI server (Jenkins)
• Live demo
Agenda
![Page 4: Continuous intergration - uni-neumann.hu · 2018-09-22 · CONFIDENTIAL 20 “Maven is a project management tool which encompasses a project object model, a set of standards, a project](https://reader033.vdocument.in/reader033/viewer/2022042219/5ec577ce342d7c604e107a9b/html5/thumbnails/4.jpg)
4CONFIDENTIAL
INTRODUCTION
![Page 5: Continuous intergration - uni-neumann.hu · 2018-09-22 · CONFIDENTIAL 20 “Maven is a project management tool which encompasses a project object model, a set of standards, a project](https://reader033.vdocument.in/reader033/viewer/2022042219/5ec577ce342d7c604e107a9b/html5/thumbnails/5.jpg)
5CONFIDENTIAL
„It works on my machine!”
![Page 6: Continuous intergration - uni-neumann.hu · 2018-09-22 · CONFIDENTIAL 20 “Maven is a project management tool which encompasses a project object model, a set of standards, a project](https://reader033.vdocument.in/reader033/viewer/2022042219/5ec577ce342d7c604e107a9b/html5/thumbnails/6.jpg)
6CONFIDENTIAL
1. Requirements reviewed by team & approved by the customer
2. Code completed and checked into Git
3. Code coverage 100%
4. All unit & integration tests passed
5. Static code analisys performed
6. Code reviewed, review comments fixed
7. Code merged to develop branch
8. Demo performed
9. QA passed & all issues resolved
10. UAT passed & all issues resolved
Definition of Done
![Page 7: Continuous intergration - uni-neumann.hu · 2018-09-22 · CONFIDENTIAL 20 “Maven is a project management tool which encompasses a project object model, a set of standards, a project](https://reader033.vdocument.in/reader033/viewer/2022042219/5ec577ce342d7c604e107a9b/html5/thumbnails/7.jpg)
7CONFIDENTIAL
WHAT IS CONTINUOUS INTEGRATION?
![Page 8: Continuous intergration - uni-neumann.hu · 2018-09-22 · CONFIDENTIAL 20 “Maven is a project management tool which encompasses a project object model, a set of standards, a project](https://reader033.vdocument.in/reader033/viewer/2022042219/5ec577ce342d7c604e107a9b/html5/thumbnails/8.jpg)
8CONFIDENTIAL
Continuous Integration is a software development practice where members of a team integrate their
work frequently, usually each person integrates at least daily - leading to multiple integrations per
day. Each integration is verified by an automated build (including test) to detect integration errors
as quickly as possible. Many teams find that this approach leads to significantly reduced integration
problems and allows a team to develop cohesive software more rapidly.
Martin Fowler
What is Continuous Integration?
![Page 9: Continuous intergration - uni-neumann.hu · 2018-09-22 · CONFIDENTIAL 20 “Maven is a project management tool which encompasses a project object model, a set of standards, a project](https://reader033.vdocument.in/reader033/viewer/2022042219/5ec577ce342d7c604e107a9b/html5/thumbnails/9.jpg)
9CONFIDENTIAL
CI and Agile
Agile mindset
Agile framework
Agile techniques
Continuous Integration
Scrum, XP, Kanban,
etc.
„philosophy”
CI, Pair
Programming, etc.
Tools & conventions
![Page 10: Continuous intergration - uni-neumann.hu · 2018-09-22 · CONFIDENTIAL 20 “Maven is a project management tool which encompasses a project object model, a set of standards, a project](https://reader033.vdocument.in/reader033/viewer/2022042219/5ec577ce342d7c604e107a9b/html5/thumbnails/10.jpg)
10CONFIDENTIAL
Maintain common code repository
Frequent integration with mainline
Automated, fast build
Automated unit-testing as part of build
Dev, Test environments as clone of production
CI Principles
![Page 11: Continuous intergration - uni-neumann.hu · 2018-09-22 · CONFIDENTIAL 20 “Maven is a project management tool which encompasses a project object model, a set of standards, a project](https://reader033.vdocument.in/reader033/viewer/2022042219/5ec577ce342d7c604e107a9b/html5/thumbnails/11.jpg)
11CONFIDENTIAL
1. Reduced risk
2. Better communication
3. Faster iterations
4. Faster feedback
Results
![Page 12: Continuous intergration - uni-neumann.hu · 2018-09-22 · CONFIDENTIAL 20 “Maven is a project management tool which encompasses a project object model, a set of standards, a project](https://reader033.vdocument.in/reader033/viewer/2022042219/5ec577ce342d7c604e107a9b/html5/thumbnails/12.jpg)
![Page 13: Continuous intergration - uni-neumann.hu · 2018-09-22 · CONFIDENTIAL 20 “Maven is a project management tool which encompasses a project object model, a set of standards, a project](https://reader033.vdocument.in/reader033/viewer/2022042219/5ec577ce342d7c604e107a9b/html5/thumbnails/13.jpg)
13CONFIDENTIAL
Version Control System (Git, SVN, CVS, Mercurial)
VCS Manager (Gitlab)
Software Project Management (Maven, Ant, Gradle)
CI Servers (Jenkins, TeamCity, Bamboo)
Repository Management (Nexus, Artifactory)
Code Review, Documentation, Issue Tracking
CI Stack components & tools
![Page 14: Continuous intergration - uni-neumann.hu · 2018-09-22 · CONFIDENTIAL 20 “Maven is a project management tool which encompasses a project object model, a set of standards, a project](https://reader033.vdocument.in/reader033/viewer/2022042219/5ec577ce342d7c604e107a9b/html5/thumbnails/14.jpg)
14CONFIDENTIAL
Continuous Integration General idea of frequent integration, automated unit tests, build automation,
etc.
Continuous Delivery Product in mainline is always ready to be shipped to UAT/QA
Continuous deployment to UAT
Batched deployment to PROD
Continuous Deployment Automated deployment to PROD
Might not be in line with company policy
Continuous Delivery & Deployment
![Page 15: Continuous intergration - uni-neumann.hu · 2018-09-22 · CONFIDENTIAL 20 “Maven is a project management tool which encompasses a project object model, a set of standards, a project](https://reader033.vdocument.in/reader033/viewer/2022042219/5ec577ce342d7c604e107a9b/html5/thumbnails/15.jpg)
15CONFIDENTIAL
Maven in Real Projects
SOURCE CODE MANAGEMENT (GIT)
![Page 16: Continuous intergration - uni-neumann.hu · 2018-09-22 · CONFIDENTIAL 20 “Maven is a project management tool which encompasses a project object model, a set of standards, a project](https://reader033.vdocument.in/reader033/viewer/2022042219/5ec577ce342d7c604e107a9b/html5/thumbnails/16.jpg)
16CONFIDENTIAL
Why Git?
![Page 17: Continuous intergration - uni-neumann.hu · 2018-09-22 · CONFIDENTIAL 20 “Maven is a project management tool which encompasses a project object model, a set of standards, a project](https://reader033.vdocument.in/reader033/viewer/2022042219/5ec577ce342d7c604e107a9b/html5/thumbnails/17.jpg)
17CONFIDENTIAL
Non-linear development
Rapid branching, merging
Distributed environment
Efficient handling of large projects
Git Characteristics
![Page 18: Continuous intergration - uni-neumann.hu · 2018-09-22 · CONFIDENTIAL 20 “Maven is a project management tool which encompasses a project object model, a set of standards, a project](https://reader033.vdocument.in/reader033/viewer/2022042219/5ec577ce342d7c604e107a9b/html5/thumbnails/18.jpg)
18CONFIDENTIAL
GitHub flow
master feature/#12release
release
hotfix
![Page 19: Continuous intergration - uni-neumann.hu · 2018-09-22 · CONFIDENTIAL 20 “Maven is a project management tool which encompasses a project object model, a set of standards, a project](https://reader033.vdocument.in/reader033/viewer/2022042219/5ec577ce342d7c604e107a9b/html5/thumbnails/19.jpg)
19CONFIDENTIAL
Maven in Real Projects
BUILD AUTOMATION (MAVEN)
![Page 20: Continuous intergration - uni-neumann.hu · 2018-09-22 · CONFIDENTIAL 20 “Maven is a project management tool which encompasses a project object model, a set of standards, a project](https://reader033.vdocument.in/reader033/viewer/2022042219/5ec577ce342d7c604e107a9b/html5/thumbnails/20.jpg)
20CONFIDENTIAL
“Maven is a project management tool which encompasses a project object model, a set
of standards, a project lifecycle, a dependency management system, and logic for
executing plugin goals at defined phases in a lifecycle. When you use Maven, you
describe your project using a well-defined project object model, Maven can then apply
cross-cutting logic from a set of shared (or custom) plugins.”
From http://maven.apache.org/
What is Maven?
![Page 21: Continuous intergration - uni-neumann.hu · 2018-09-22 · CONFIDENTIAL 20 “Maven is a project management tool which encompasses a project object model, a set of standards, a project](https://reader033.vdocument.in/reader033/viewer/2022042219/5ec577ce342d7c604e107a9b/html5/thumbnails/21.jpg)
21CONFIDENTIAL
Convention Over Configuration
![Page 22: Continuous intergration - uni-neumann.hu · 2018-09-22 · CONFIDENTIAL 20 “Maven is a project management tool which encompasses a project object model, a set of standards, a project](https://reader033.vdocument.in/reader033/viewer/2022042219/5ec577ce342d7c604e107a9b/html5/thumbnails/22.jpg)
22CONFIDENTIAL
Declarative vs. Imperative
Initial state Results
Program explicitly
specifies process
Initial state Results
Program specifies
desired final state
What to do?
What we would
like to have as the
result?
![Page 23: Continuous intergration - uni-neumann.hu · 2018-09-22 · CONFIDENTIAL 20 “Maven is a project management tool which encompasses a project object model, a set of standards, a project](https://reader033.vdocument.in/reader033/viewer/2022042219/5ec577ce342d7c604e107a9b/html5/thumbnails/23.jpg)
23CONFIDENTIAL
• How do you run unit tests?
• What does the project need to build?
• What libraries do I need to download?
• Which quality gates we have?
• ...
Common Interface
mvn install
![Page 24: Continuous intergration - uni-neumann.hu · 2018-09-22 · CONFIDENTIAL 20 “Maven is a project management tool which encompasses a project object model, a set of standards, a project](https://reader033.vdocument.in/reader033/viewer/2022042219/5ec577ce342d7c604e107a9b/html5/thumbnails/24.jpg)
24CONFIDENTIAL
• Delegate most responsibility to a set of Maven Plugins
Maven Plugins
Core plugins
clean
compiler
deploy
failsafe
install
resources
site
surefire
verifier
Compiler plugin
goals
compile
help
testCompile
![Page 25: Continuous intergration - uni-neumann.hu · 2018-09-22 · CONFIDENTIAL 20 “Maven is a project management tool which encompasses a project object model, a set of standards, a project](https://reader033.vdocument.in/reader033/viewer/2022042219/5ec577ce342d7c604e107a9b/html5/thumbnails/25.jpg)
25CONFIDENTIAL
• Description of a software project
• Attributes of the project
• Project coordinates
• Enables features such as:
– Dependency management
– Remote repositories
– Universal reuse of build logic
– Tool Portability / Integration
– Easy Searching and Filtering
Conceptual Model of a "Project"
<project><modelVersion>4.0.0</modelVersion><groupId>com.epam.app</groupId><artifactId>best-app</artifactId><version>1</version>
</project>
![Page 26: Continuous intergration - uni-neumann.hu · 2018-09-22 · CONFIDENTIAL 20 “Maven is a project management tool which encompasses a project object model, a set of standards, a project](https://reader033.vdocument.in/reader033/viewer/2022042219/5ec577ce342d7c604e107a9b/html5/thumbnails/26.jpg)
26CONFIDENTIAL
Default lifecycle
validate initialize
generate-
sources
process-sources
generate-
resources
process-
resources
compile
process-classes
generate-test-
resources
process-test-
sources
generate-test-
resources
process-test-
resources
test-compile
process-test-
classes
test
prepare-package
package
pre-integration-
test
integration-test
post-integration-
test
verify
install
deploy
![Page 27: Continuous intergration - uni-neumann.hu · 2018-09-22 · CONFIDENTIAL 20 “Maven is a project management tool which encompasses a project object model, a set of standards, a project](https://reader033.vdocument.in/reader033/viewer/2022042219/5ec577ce342d7c604e107a9b/html5/thumbnails/27.jpg)
27CONFIDENTIAL
Create a simple Java project with maven
mvn archetype:generate-DgroupId=com.epam.training-DartifactId=first-project-DarchetypeArtifactId=maven-archetype-quickstart
first-project|-pom.xml|-src|---main|-----java|-------com|---------epam|-----------training|-------------App.java|---test|-----java|-------com|---------epam|-----------training|-------------AppTest.java
![Page 28: Continuous intergration - uni-neumann.hu · 2018-09-22 · CONFIDENTIAL 20 “Maven is a project management tool which encompasses a project object model, a set of standards, a project](https://reader033.vdocument.in/reader033/viewer/2022042219/5ec577ce342d7c604e107a9b/html5/thumbnails/28.jpg)
28CONFIDENTIAL
Triggering „install” phase will instruct Maven to place built artifact into Local repository.
Install project to local repo
mvn clean install
Internal network
Local machine
WorkspaceLocal
repository
Remote
repositoryCentral
repository
![Page 29: Continuous intergration - uni-neumann.hu · 2018-09-22 · CONFIDENTIAL 20 “Maven is a project management tool which encompasses a project object model, a set of standards, a project](https://reader033.vdocument.in/reader033/viewer/2022042219/5ec577ce342d7c604e107a9b/html5/thumbnails/29.jpg)
29CONFIDENTIAL
• Add your artifact to a remote repository for
sharing with other developers and projects
Deploy project
Internal network
Local
repository
Local
repository
Remote
repository
Central
repository
mvn clean deploy
![Page 30: Continuous intergration - uni-neumann.hu · 2018-09-22 · CONFIDENTIAL 20 “Maven is a project management tool which encompasses a project object model, a set of standards, a project](https://reader033.vdocument.in/reader033/viewer/2022042219/5ec577ce342d7c604e107a9b/html5/thumbnails/30.jpg)
30CONFIDENTIAL
• Transitive Dependencies
• Dependency mediation
• Excluded dependencies
• Optional dependencies
• Dependency scope
Dependency resolution
<project> ...<dependencies>
<dependency><groupId>test</groupId><artifactId>runner</artifactId><version>1.0</version><scope>runtime</scope>
</dependency></dependencies>...
</project>
![Page 31: Continuous intergration - uni-neumann.hu · 2018-09-22 · CONFIDENTIAL 20 “Maven is a project management tool which encompasses a project object model, a set of standards, a project](https://reader033.vdocument.in/reader033/viewer/2022042219/5ec577ce342d7c604e107a9b/html5/thumbnails/31.jpg)
31CONFIDENTIAL
Multi-module projects
<project> <modules><module>calculator-lib</module><module>calculator-app</module>
</modules>[...]
</project>
calculator
calculator-
app
calculator-
lib
• Typical in real-life projects
![Page 32: Continuous intergration - uni-neumann.hu · 2018-09-22 · CONFIDENTIAL 20 “Maven is a project management tool which encompasses a project object model, a set of standards, a project](https://reader033.vdocument.in/reader033/viewer/2022042219/5ec577ce342d7c604e107a9b/html5/thumbnails/32.jpg)
32CONFIDENTIAL
• Configuration reuse
• pom -> parent-pom -> super-pom
• Effective pom
Configuration inheritance
<project><groupId>com.epam.sampleproject</groupId><artifactId>sample-parent</artifactId><version>0.0.1-SNAPSHOT</version>
</project>
<project><parent>
<groupId>com.epam.sampleproject</groupId><artifactId>sample-parent</artifactId><version>0.0.1-SNAPSHOT</version>
</parent></project>
![Page 33: Continuous intergration - uni-neumann.hu · 2018-09-22 · CONFIDENTIAL 20 “Maven is a project management tool which encompasses a project object model, a set of standards, a project](https://reader033.vdocument.in/reader033/viewer/2022042219/5ec577ce342d7c604e107a9b/html5/thumbnails/33.jpg)
33CONFIDENTIAL
IDE independence
POM
![Page 34: Continuous intergration - uni-neumann.hu · 2018-09-22 · CONFIDENTIAL 20 “Maven is a project management tool which encompasses a project object model, a set of standards, a project](https://reader033.vdocument.in/reader033/viewer/2022042219/5ec577ce342d7c604e107a9b/html5/thumbnails/34.jpg)
34CONFIDENTIAL
Maven in Real Projects
REPOSITORY MANAGEMENT (NEXUS)
![Page 35: Continuous intergration - uni-neumann.hu · 2018-09-22 · CONFIDENTIAL 20 “Maven is a project management tool which encompasses a project object model, a set of standards, a project](https://reader033.vdocument.in/reader033/viewer/2022042219/5ec577ce342d7c604e107a9b/html5/thumbnails/35.jpg)
35CONFIDENTIAL
A repository manager is a dedicated server application designed to manage repositories of binary
components. The usage of a repository manager is considered an essential best practice for any
significant usage of Maven.
Nexus
![Page 36: Continuous intergration - uni-neumann.hu · 2018-09-22 · CONFIDENTIAL 20 “Maven is a project management tool which encompasses a project object model, a set of standards, a project](https://reader033.vdocument.in/reader033/viewer/2022042219/5ec577ce342d7c604e107a9b/html5/thumbnails/36.jpg)
36CONFIDENTIAL
• „deploy” instructs Maven do deploy artifact(s) to remote repository defined in distribution
management
Deployment to remote repository
mvn clean deployLocal
repository
Remote
repository
<distributionManagement><repository><id>training-releases</id><url>http://192.168.33.20:8081/nexus/content/repositories/releases/</url>
</repository><snapshotRepository><id>training-snapshots</id><url>http://192.168.33.20:8081/nexus/content/repositories/snapshots/</url>
</snapshotRepository></distributionManagement>
![Page 37: Continuous intergration - uni-neumann.hu · 2018-09-22 · CONFIDENTIAL 20 “Maven is a project management tool which encompasses a project object model, a set of standards, a project](https://reader033.vdocument.in/reader033/viewer/2022042219/5ec577ce342d7c604e107a9b/html5/thumbnails/37.jpg)
37CONFIDENTIAL
Snapshots
• Repository Policy: Snapshot
• Deployment Policy: Allow redeploy
Releases
• Repository Policy: Release
• Deployment Policy: Disable redeploy
Nexus hosted repositories
![Page 38: Continuous intergration - uni-neumann.hu · 2018-09-22 · CONFIDENTIAL 20 “Maven is a project management tool which encompasses a project object model, a set of standards, a project](https://reader033.vdocument.in/reader033/viewer/2022042219/5ec577ce342d7c604e107a9b/html5/thumbnails/38.jpg)
38CONFIDENTIAL
Maven in Real Projects
CI SERVER (JENKIINS)
![Page 39: Continuous intergration - uni-neumann.hu · 2018-09-22 · CONFIDENTIAL 20 “Maven is a project management tool which encompasses a project object model, a set of standards, a project](https://reader033.vdocument.in/reader033/viewer/2022042219/5ec577ce342d7c604e107a9b/html5/thumbnails/39.jpg)
39CONFIDENTIAL
Jenkins is an award-winning, cross-platform, continuous integration and continuous delivery
application that increases your productivity. Use Jenkins to build and test your software projects
continuously making it easier for developers to integrate changes to the project, and making it easier
for users to obtain a fresh build. It also allows you to continuously deliver your software by providing
powerful ways to define your build pipelines and integrating with a large number of testing and
deployment technologies.
Jenkins
![Page 40: Continuous intergration - uni-neumann.hu · 2018-09-22 · CONFIDENTIAL 20 “Maven is a project management tool which encompasses a project object model, a set of standards, a project](https://reader033.vdocument.in/reader033/viewer/2022042219/5ec577ce342d7c604e107a9b/html5/thumbnails/40.jpg)
40CONFIDENTIAL
• Free
• Core distribution
• Lots of public plugins
• Extensibility - team can develop their own plugins with Jenkins API
• Scalability – multiple slaves (agents)
Jenkins features
![Page 41: Continuous intergration - uni-neumann.hu · 2018-09-22 · CONFIDENTIAL 20 “Maven is a project management tool which encompasses a project object model, a set of standards, a project](https://reader033.vdocument.in/reader033/viewer/2022042219/5ec577ce342d7c604e107a9b/html5/thumbnails/41.jpg)
41CONFIDENTIAL
Jenkins UI
![Page 42: Continuous intergration - uni-neumann.hu · 2018-09-22 · CONFIDENTIAL 20 “Maven is a project management tool which encompasses a project object model, a set of standards, a project](https://reader033.vdocument.in/reader033/viewer/2022042219/5ec577ce342d7c604e107a9b/html5/thumbnails/42.jpg)
42CONFIDENTIAL
Jenkins Agent
• How does it work?
Jenkins - Junior Program CI – Build
Git Repo workspaceLocal
repository
Git fetchRemote
Nexus
mvn clean install mvn clean deploy
![Page 43: Continuous intergration - uni-neumann.hu · 2018-09-22 · CONFIDENTIAL 20 “Maven is a project management tool which encompasses a project object model, a set of standards, a project](https://reader033.vdocument.in/reader033/viewer/2022042219/5ec577ce342d7c604e107a9b/html5/thumbnails/43.jpg)
43CONFIDENTIAL
Main sections:
• Header (Maven project name, Project description, etc.)
• Source Code Management (Git, URL, credentials, Branch Specifier – master)
• Build trigger (Poll scm – Cron trigger or triggered by the VCS server)
• Build commands
– mvn clean deploy
– Publish results (JUNit, Checkstyle, FindBugs, Cobertura, etc.)
– Deploy to container
– Etc.
Configure Jenkins Job
![Page 44: Continuous intergration - uni-neumann.hu · 2018-09-22 · CONFIDENTIAL 20 “Maven is a project management tool which encompasses a project object model, a set of standards, a project](https://reader033.vdocument.in/reader033/viewer/2022042219/5ec577ce342d7c604e107a9b/html5/thumbnails/44.jpg)
44CONFIDENTIAL
Maven in Real Projects
LIVE DEMO
![Page 45: Continuous intergration - uni-neumann.hu · 2018-09-22 · CONFIDENTIAL 20 “Maven is a project management tool which encompasses a project object model, a set of standards, a project](https://reader033.vdocument.in/reader033/viewer/2022042219/5ec577ce342d7c604e107a9b/html5/thumbnails/45.jpg)
45CONFIDENTIAL
Maven in Real Projects
THANK YOU!