37
Beratung Software Lösungen Andreas Koop Consultant Oracle Technologies TEAM GmbH Continuous Integration ist nicht schwer Hudson, Plugins, Skripte umrühren und fertig

Consultant nicht schwer Hudson, Plugins, Skripte umrühren und · n Andreas Koop Consultant Oracle Technologies TEAM GmbH Continuous Integration ist nicht schwer – Hudson, Plugins,

  • Upload
    doandan

  • View
    217

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Consultant nicht schwer Hudson, Plugins, Skripte umrühren und · n Andreas Koop Consultant Oracle Technologies TEAM GmbH Continuous Integration ist nicht schwer – Hudson, Plugins,

Be

ratu

ng S

oft

wa

re L

ösu

ng

en

Andreas Koop

Consultant

Oracle Technologies

TEAM GmbH

Continuous Integration ist

nicht schwer – Hudson,

Plugins, Skripte umrühren und

fertig

Page 2: Consultant nicht schwer Hudson, Plugins, Skripte umrühren und · n Andreas Koop Consultant Oracle Technologies TEAM GmbH Continuous Integration ist nicht schwer – Hudson, Plugins,

Über mich

Andreas Koop

Diplom-Informatiker

Entwicklung, Projekte, Beratung, Training Oracle Technologien

bei/für TEAM GmbH

Oracle ADF Implementation Specialist

Community

DOAG

Oracle ADF News Session

ADF Enterprise Methodology Group

XING Oracle ADF Community

Blog

http://padora.blogspot.com (TEAM, de)

http://multikoop.blogspot.com (en)

22.09.2011 © TEAM - Ihr Partner für IT 2

Page 3: Consultant nicht schwer Hudson, Plugins, Skripte umrühren und · n Andreas Koop Consultant Oracle Technologies TEAM GmbH Continuous Integration ist nicht schwer – Hudson, Plugins,

TEAM - Ihr Partner für IT

Gründung 1982

Unternehmensgruppe Materna

1.300 Mitarbeiter –

153 Mio. Euro Umsatz in 2009

Geschäftsführung

Michael Baranowski - Heike Käferle

über 50 Mitarbeiter

Zahlen und Fakten

Page 4: Consultant nicht schwer Hudson, Plugins, Skripte umrühren und · n Andreas Koop Consultant Oracle Technologies TEAM GmbH Continuous Integration ist nicht schwer – Hudson, Plugins,

Oracle-Dienstleistungen vom Oracle Platinum Partner

Lizenzierung

Consulting

Schulungen

Busines Intelligence

Individualentwicklungen

Online DBA Support

Page 5: Consultant nicht schwer Hudson, Plugins, Skripte umrühren und · n Andreas Koop Consultant Oracle Technologies TEAM GmbH Continuous Integration ist nicht schwer – Hudson, Plugins,

Agenda

22.09.2011 © TEAM - Ihr Partner für IT 5

Ad Hoc Integration

Continuous Integration mit Hudson

Installation, Jobs

Most Useful Plugins

Best Practice for continuously

Generate Code

Compile / Script Code

Measure code quality

Test Java / PL/SQL Code

Deploy DB Code / EAR / Reports

Release Artefacts

Handling Changes / Patches

Lessons learned

Page 6: Consultant nicht schwer Hudson, Plugins, Skripte umrühren und · n Andreas Koop Consultant Oracle Technologies TEAM GmbH Continuous Integration ist nicht schwer – Hudson, Plugins,

Ad Hoc Integration

22.09.2011 © TEAM - Ihr Partner für IT 6

install

deploy

patch

Pro

d

Te

st

Developer

Page 7: Consultant nicht schwer Hudson, Plugins, Skripte umrühren und · n Andreas Koop Consultant Oracle Technologies TEAM GmbH Continuous Integration ist nicht schwer – Hudson, Plugins,

Ad Hoc Integration im Team

„Von meinem Rechner aus geht es doch“

„Ja, bei dir fehlen noch einige Jars“

„Ist das die richtige Version?“

..

22.09.2011 © TEAM - Ihr Partner für IT 7

install

deploy

patch

Pro

d

Te

st

Development

Team

Page 8: Consultant nicht schwer Hudson, Plugins, Skripte umrühren und · n Andreas Koop Consultant Oracle Technologies TEAM GmbH Continuous Integration ist nicht schwer – Hudson, Plugins,

Auswirkungen

Integrationsprozess ist sehr zeitintensiv

In der Regel nicht vorher getestet

Fehler sind vorprogrammiert

Ungutes Gefühl bei Auslieferung

Unzufriedene Kunden

22.09.2011 © TEAM - Ihr Partner für IT 8

Page 9: Consultant nicht schwer Hudson, Plugins, Skripte umrühren und · n Andreas Koop Consultant Oracle Technologies TEAM GmbH Continuous Integration ist nicht schwer – Hudson, Plugins,

Wie kann man es besser machen?

22.09.2011 © TEAM - Ihr Partner für IT 9

DB

IDE

Integrated

App Server

Develo

pm

ent

DB

„CI Tools“

App Server

(C)

Inte

gra

tion S

erv

er

VCS Ticketsystem

DB

IDE

Integrated

App Server

Download-

Server

Notification

Email, IM

Client

Continuous D

eliv

ery

MVN-Repo

Page 10: Consultant nicht schwer Hudson, Plugins, Skripte umrühren und · n Andreas Koop Consultant Oracle Technologies TEAM GmbH Continuous Integration ist nicht schwer – Hudson, Plugins,

Hudson – Installieren / Starten

Installation

java -jar hudson.war

oder Deployment in einem Java WebContainer

Browser: http://localhost:8080

22.09.2011 © TEAM - Ihr Partner für IT 10

Page 11: Consultant nicht schwer Hudson, Plugins, Skripte umrühren und · n Andreas Koop Consultant Oracle Technologies TEAM GmbH Continuous Integration ist nicht schwer – Hudson, Plugins,

Hudson – Build-Jobs

Build-Verfahren

Batch, Shell, Ant, Maven

Versionskontrollsystem (VCS)

CVS, Subversion, Git, ..

Auslöser

Zeitgesteuert (cron expression)

Änderung im VCS

Abhängig von einem anderen Hudson-Job

Abhängig von Maven-Dependency-Änderungen

HTTP-Request

22.09.2011 © TEAM - Ihr Partner für IT 11

Page 12: Consultant nicht schwer Hudson, Plugins, Skripte umrühren und · n Andreas Koop Consultant Oracle Technologies TEAM GmbH Continuous Integration ist nicht schwer – Hudson, Plugins,

Hudson – Erweiterbarkeit

Als zunächst ausreichend

und nützlich haben sich erwiesen

task scanner / dry / PMD / cpd / analysis collector

email ext

log parser

22.09.2011 © TEAM - Ihr Partner für IT 12

Page 13: Consultant nicht schwer Hudson, Plugins, Skripte umrühren und · n Andreas Koop Consultant Oracle Technologies TEAM GmbH Continuous Integration ist nicht schwer – Hudson, Plugins,

Hudson – Plugins Installation

22.09.2011 © TEAM - Ihr Partner für IT 13

Page 14: Consultant nicht schwer Hudson, Plugins, Skripte umrühren und · n Andreas Koop Consultant Oracle Technologies TEAM GmbH Continuous Integration ist nicht schwer – Hudson, Plugins,

Agenda

22.09.2011 © TEAM - Ihr Partner für IT 14

Ad Hoc Integration

Continuous Integration mit Hudson

Installation, Jobs

Most Useful Plugins

Best Practice for continuously

Generate Code

Compile / Script Code

Measure code quality

Test Java / PL/SQL Code

Deploy DB Code / EAR / Reports

Release Artefacts

Handling Changes / Patches

Lessons learned

Page 15: Consultant nicht schwer Hudson, Plugins, Skripte umrühren und · n Andreas Koop Consultant Oracle Technologies TEAM GmbH Continuous Integration ist nicht schwer – Hudson, Plugins,

Build Job(s)

Best Practice: Shell-Skripte!

Master Build-Skript für

generate

compile

test -> (test.sh)

deploy db -> (deploy_db.sh)

deploy app -> (deploy_app.sh)

doc -> (doc.sh)

release -> (release.sh)

=> Parametrierbar, in separate Jobs teilbar, „standalone

ausführbar“.

22.09.2011 © TEAM - Ihr Partner für IT 15

Page 16: Consultant nicht schwer Hudson, Plugins, Skripte umrühren und · n Andreas Koop Consultant Oracle Technologies TEAM GmbH Continuous Integration ist nicht schwer – Hudson, Plugins,

Setup a new project

Master-Build Job, Parametrierbar, Shell Skript

Wiederverwenbarkeit, Modularisierung

svn copy (from project template)

svn:externals

env / master.properties / build_env_scripte.sh

22.09.2011 © TEAM - Ihr Partner für IT 16

Page 17: Consultant nicht schwer Hudson, Plugins, Skripte umrühren und · n Andreas Koop Consultant Oracle Technologies TEAM GmbH Continuous Integration ist nicht schwer – Hudson, Plugins,

Build-Nummer integrieren

Verfügbarkeit

In Shell-Skripten

$BUILD_NUMBER

in Ant-Skripten über

<property environment="env"/>

anschließend ${env.BUILD_NUMBER}

Integration

cd $WORKSPACE/build

ant preprocess.integrate-buildnumber

22.09.2011 © TEAM - Ihr Partner für IT 17

Page 18: Consultant nicht schwer Hudson, Plugins, Skripte umrühren und · n Andreas Koop Consultant Oracle Technologies TEAM GmbH Continuous Integration ist nicht schwer – Hudson, Plugins,

Generate code (clean natürlich;)

Pragmatischer Ansatz

Apache Ant(Buildskript)

Apache Velocity / Texen(Template-/Generator-Engine)

TEAM Database Ant-Task (Bereitstellung der notwendigen Objekte

im Template-Context)

22.09.2011 © TEAM - Ihr Partner für IT 18

Page 19: Consultant nicht schwer Hudson, Plugins, Skripte umrühren und · n Andreas Koop Consultant Oracle Technologies TEAM GmbH Continuous Integration ist nicht schwer – Hudson, Plugins,

Sample: generate trigger

Automatisiert ausführbar ant -f gen.build.xml gen-and-script-trigger-sql

=> einfache Integration in Hudson Master Build Skript!

22.09.2011 © TEAM - Ihr Partner für IT 19

Page 20: Consultant nicht schwer Hudson, Plugins, Skripte umrühren und · n Andreas Koop Consultant Oracle Technologies TEAM GmbH Continuous Integration ist nicht schwer – Hudson, Plugins,

Audit code quality

PMD

Custom Rules

Java

PL/SQL

22.09.2011 © TEAM - Ihr Partner für IT 20

Page 21: Consultant nicht schwer Hudson, Plugins, Skripte umrühren und · n Andreas Koop Consultant Oracle Technologies TEAM GmbH Continuous Integration ist nicht schwer – Hudson, Plugins,

Beispiel Reports: code analysis

Tasks Plugin

22.09.2011 © TEAM - Ihr Partner für IT 21

Page 22: Consultant nicht schwer Hudson, Plugins, Skripte umrühren und · n Andreas Koop Consultant Oracle Technologies TEAM GmbH Continuous Integration ist nicht schwer – Hudson, Plugins,

Unit Testing

Java Unit test: OK

PL /SQL: Hhhmmm

How we do it: Pragmatisch!

22.09.2011 © TEAM - Ihr Partner für IT 22

Page 23: Consultant nicht schwer Hudson, Plugins, Skripte umrühren und · n Andreas Koop Consultant Oracle Technologies TEAM GmbH Continuous Integration ist nicht schwer – Hudson, Plugins,

Sample: PL/SQL Unit Test

Start From

Template

Write test code

22.09.2011 © TEAM - Ihr Partner für IT 23

Page 24: Consultant nicht schwer Hudson, Plugins, Skripte umrühren und · n Andreas Koop Consultant Oracle Technologies TEAM GmbH Continuous Integration ist nicht schwer – Hudson, Plugins,

PL /SQL Test – Integration in Hudson

fail on spool match!

ant test.database (in test.sh)

22.09.2011 © TEAM - Ihr Partner für IT 24

Page 25: Consultant nicht schwer Hudson, Plugins, Skripte umrühren und · n Andreas Koop Consultant Oracle Technologies TEAM GmbH Continuous Integration ist nicht schwer – Hudson, Plugins,

Junit Testreport

22.09.2011 © TEAM - Ihr Partner für IT 25

Page 26: Consultant nicht schwer Hudson, Plugins, Skripte umrühren und · n Andreas Koop Consultant Oracle Technologies TEAM GmbH Continuous Integration ist nicht schwer – Hudson, Plugins,

db export / db script / db patch

db export: TEAM DB Ant Task

db script: shell / sqlplus [email protected]

db patch: current patch dir

nach release wird das current patch

in VCS archiviert.

ein leeres current patch dir wird erzeugt.

22.09.2011 © TEAM - Ihr Partner für IT 26

Dev-DB

TEAM Db Ant Task code.sql

Integration-DB

Page 27: Consultant nicht schwer Hudson, Plugins, Skripte umrühren und · n Andreas Koop Consultant Oracle Technologies TEAM GmbH Continuous Integration ist nicht schwer – Hudson, Plugins,

current patch / rerunnable

22.09.2011 © TEAM - Ihr Partner für IT 27

Page 28: Consultant nicht schwer Hudson, Plugins, Skripte umrühren und · n Andreas Koop Consultant Oracle Technologies TEAM GmbH Continuous Integration ist nicht schwer – Hudson, Plugins,

generate documentation

generate

javadoc

plsqldoc

maven site

testreport

custom doc

package

mvn package

zip *

22.09.2011 © TEAM - Ihr Partner für IT 28

Page 29: Consultant nicht schwer Hudson, Plugins, Skripte umrühren und · n Andreas Koop Consultant Oracle Technologies TEAM GmbH Continuous Integration ist nicht schwer – Hudson, Plugins,

Sample: generated doc output

22.09.2011 © TEAM - Ihr Partner für IT 29

Page 30: Consultant nicht schwer Hudson, Plugins, Skripte umrühren und · n Andreas Koop Consultant Oracle Technologies TEAM GmbH Continuous Integration ist nicht schwer – Hudson, Plugins,

Release

release.sh

package artefacts

generate fingerprint

upload to download server

generate client certificate (once)

generate and send email notification to customer

include fixed issue list !

include new features list !

Snapshot

22.09.2011 © TEAM - Ihr Partner für IT 30

Page 31: Consultant nicht schwer Hudson, Plugins, Skripte umrühren und · n Andreas Koop Consultant Oracle Technologies TEAM GmbH Continuous Integration ist nicht schwer – Hudson, Plugins,

Release ist raus, Entwicklung geht weiter

22.09.2011 © TEAM - Ihr Partner für IT 32

Client

Build 737

Betrieb

Test / Produktion Development / Integration

DB

Hudson

myapp-build

App Server

(C)

Inte

gra

tion S

erv

er

(VM

)

Build 744

Build 738

Page 32: Consultant nicht schwer Hudson, Plugins, Skripte umrühren und · n Andreas Koop Consultant Oracle Technologies TEAM GmbH Continuous Integration ist nicht schwer – Hudson, Plugins,

Advanced CI with „Revert To Snapshot“

22.09.2011 © TEAM - Ihr Partner für IT 33

DB

Hudson

myapp-build

App Server

(C)

Inte

gra

tion S

erv

er

(VM

)

Virtualization Host

Hudson

myapp-build-

with-revert-to-

snapshot

revert

DB

Hudson

myapp-build

App Server

http:// …build

2

3

1

Development

Team

notify

Page 33: Consultant nicht schwer Hudson, Plugins, Skripte umrühren und · n Andreas Koop Consultant Oracle Technologies TEAM GmbH Continuous Integration ist nicht schwer – Hudson, Plugins,

Hudson Batch Job („Build with revert to

snapshot)

On Virtualization-Host

=> Patches werden auf diese Weise getestet. Erfolgreiche

Installation beim Kunden ist garantiert!

=> Continuous Build Numbers!

22.09.2011 © TEAM - Ihr Partner für IT 34

Page 34: Consultant nicht schwer Hudson, Plugins, Skripte umrühren und · n Andreas Koop Consultant Oracle Technologies TEAM GmbH Continuous Integration ist nicht schwer – Hudson, Plugins,

Benefits

Es existiert immer eine getestete Version der Artefakte:

app, db patch, doc

Ein Release ist per One-Klick durchführbar! Dadurch

kurze Release-Zyklen.

Durch den Buildprozess „Revert to Snapshot“ können

Patches/Updates getestet werden! Erfolgreiche

Installation beim Kunden ist garantiert!

In besonderen Wartungsfällen kann durch „Revert to

Snapshot“ der ausgelieferte Zustand in Minuten

wiederhergestellt werden.

22.09.2011 © TEAM - Ihr Partner für IT 35

Page 35: Consultant nicht schwer Hudson, Plugins, Skripte umrühren und · n Andreas Koop Consultant Oracle Technologies TEAM GmbH Continuous Integration ist nicht schwer – Hudson, Plugins,

Not Covered (all with Hudson)

UI Tests / Selenium

Continuous Monitoring

Continuous Patching of a distributed environment

Research

Revert eines DB Patches

db diff aus svn historie

22.09.2011 © TEAM - Ihr Partner für IT 36

Page 36: Consultant nicht schwer Hudson, Plugins, Skripte umrühren und · n Andreas Koop Consultant Oracle Technologies TEAM GmbH Continuous Integration ist nicht schwer – Hudson, Plugins,

Lessons learned

CI with Hudson is easy to setup

Simple yet powerful tools around Hudson CI make it

A stable ALM process saves a lot of time, nerves and

finally money

Generate, Automate and Integrate as early as possible

To be improved (At least at TEAM Development Devision)

Integration of Issue management systems

gen test reports for PL/SQL Testcases

=> Agile ALM

22.09.2011 © TEAM - Ihr Partner für IT 37

Page 37: Consultant nicht schwer Hudson, Plugins, Skripte umrühren und · n Andreas Koop Consultant Oracle Technologies TEAM GmbH Continuous Integration ist nicht schwer – Hudson, Plugins,

Be

ratu

ng S

oft

wa

re L

ösu

ng

en

TEAM Partner für Technologie und angewandte Methoden der Informationsverarbeitung

GmbH

Hermann-Löns-Str. 88

33104 Paderborn

Fon +49 5254 8008-0

Fax +49 5254 8008-19

Mail [email protected]

Web www.team-pb.de

Vielen Dank für Ihre

Aufmerksamkeit