Automated Testing for Florian Winkler Infrastructure- B1 Systems … · Automated Testing for...

41
Automated Testing for Infrastructure- as-a-code Automated Testing for Infrastructure- as-a-code Florian Winkler B1 Systems GmbH Florian Winkler B1 Systems GmbH @pinguintiger, @b1systems @pinguintiger, @b1systems

Transcript of Automated Testing for Florian Winkler Infrastructure- B1 Systems … · Automated Testing for...

Page 1: Automated Testing for Florian Winkler Infrastructure- B1 Systems … · Automated Testing for Infrastructure-as-a-code Florian Winkler B1 Systems GmbH Florian Winkler @pinguintiger,

Automated Testing for Infrastructure-as-a-code

Automated Testing for Infrastructure-as-a-code

Florian WinklerB1 Systems GmbH

Florian WinklerB1 Systems GmbH

@pinguintiger, @b1systems@pinguintiger, @b1systems

Page 2: Automated Testing for Florian Winkler Infrastructure- B1 Systems … · Automated Testing for Infrastructure-as-a-code Florian Winkler B1 Systems GmbH Florian Winkler @pinguintiger,

Automated Testing for Infrastructure-as-a-codeAutomated Testing for Infrastructure-as-a-code

• $ ls *– $ id; groups– $ last– $ rpm -qa– $ ps aux– $ git commit– $ exit 0– $ exit 1– $ ./run.sh– $ logout

• $ ls *– $ id; groups– $ last– $ rpm -qa– $ ps aux– $ git commit– $ exit 0– $ exit 1– $ ./run.sh– $ logout

Page 3: Automated Testing for Florian Winkler Infrastructure- B1 Systems … · Automated Testing for Infrastructure-as-a-code Florian Winkler B1 Systems GmbH Florian Winkler @pinguintiger,

idid

• Florian Winkler– European– born in West-Berlin– likes penguins, cats and bears– likes good food and drinks– loves to cook– frequent festival visitor

• Florian Winkler– European– born in West-Berlin– likes penguins, cats and bears– likes good food and drinks– loves to cook– frequent festival visitor

Page 4: Automated Testing for Florian Winkler Infrastructure- B1 Systems … · Automated Testing for Infrastructure-as-a-code Florian Winkler B1 Systems GmbH Florian Winkler @pinguintiger,

idid

• Florian Winkler– started with Basic on C64– Linux since 1999– professional since 2008– trainer since 2010– B1 Systems since 2014

• Consultant• Trainer

– SCI-, LF-approved

• Florian Winkler– started with Basic on C64– Linux since 1999– professional since 2008– trainer since 2010– B1 Systems since 2014

• Consultant• Trainer

– SCI-, LF-approved

Page 5: Automated Testing for Florian Winkler Infrastructure- B1 Systems … · Automated Testing for Infrastructure-as-a-code Florian Winkler B1 Systems GmbH Florian Winkler @pinguintiger,

groupsgroups

• B1 Systems GmbH– founded in 2004– operating both nationally and internationally– about 100 employees– offices in Rockolding, Berlin, Cologne & Dresden– vendor-independent (hardware and software)– focus:

• consulting• support• development• training• operations• solutions

• B1 Systems GmbH– founded in 2004– operating both nationally and internationally– about 100 employees– offices in Rockolding, Berlin, Cologne & Dresden– vendor-independent (hardware and software)– focus:

• consulting• support• development• training• operations• solutions

Page 6: Automated Testing for Florian Winkler Infrastructure- B1 Systems … · Automated Testing for Infrastructure-as-a-code Florian Winkler B1 Systems GmbH Florian Winkler @pinguintiger,
Page 7: Automated Testing for Florian Winkler Infrastructure- B1 Systems … · Automated Testing for Infrastructure-as-a-code Florian Winkler B1 Systems GmbH Florian Winkler @pinguintiger,

lastlast

• DC Management like we are used to– management– developers– QA– L1, L2, L3 operations– ticket-based workflows– or even worse...

• DC Management like we are used to– management– developers– QA– L1, L2, L3 operations– ticket-based workflows– or even worse...

Page 8: Automated Testing for Florian Winkler Infrastructure- B1 Systems … · Automated Testing for Infrastructure-as-a-code Florian Winkler B1 Systems GmbH Florian Winkler @pinguintiger,

Things are changing ...Things are changing ...

Page 9: Automated Testing for Florian Winkler Infrastructure- B1 Systems … · Automated Testing for Infrastructure-as-a-code Florian Winkler B1 Systems GmbH Florian Winkler @pinguintiger,

Just buzzwords(?)Just buzzwords(?)

• New ideas

– $anything-as-a-service– agile– DevOps– hybrid– hyperconverged (sic!)

• Bingo!

• New ideas

– $anything-as-a-service– agile– DevOps– hybrid– hyperconverged (sic!)

• Bingo!

Page 10: Automated Testing for Florian Winkler Infrastructure- B1 Systems … · Automated Testing for Infrastructure-as-a-code Florian Winkler B1 Systems GmbH Florian Winkler @pinguintiger,

Lets have a look at the tools ...Lets have a look at the tools ...

Page 11: Automated Testing for Florian Winkler Infrastructure- B1 Systems … · Automated Testing for Infrastructure-as-a-code Florian Winkler B1 Systems GmbH Florian Winkler @pinguintiger,

rpm -qarpm -qa

• Source code management

– git– svn– cvs– mercurial

• Source code management

– git– svn– cvs– mercurial

Page 12: Automated Testing for Florian Winkler Infrastructure- B1 Systems … · Automated Testing for Infrastructure-as-a-code Florian Winkler B1 Systems GmbH Florian Winkler @pinguintiger,

rpm -qarpm -qa

• Predefined installation

– kickstart– AutoYAST– preseed

• Predefined installation

– kickstart– AutoYAST– preseed

Page 13: Automated Testing for Florian Winkler Infrastructure- B1 Systems … · Automated Testing for Infrastructure-as-a-code Florian Winkler B1 Systems GmbH Florian Winkler @pinguintiger,

rpm -qarpm -qa

• Software and images

– Koji– Open Build Service– Kiwi

• Software and images

– Koji– Open Build Service– Kiwi

Page 14: Automated Testing for Florian Winkler Infrastructure- B1 Systems … · Automated Testing for Infrastructure-as-a-code Florian Winkler B1 Systems GmbH Florian Winkler @pinguintiger,

rpm -qarpm -qa

• Installation tools

– Cobbler– The Foreman– FAI

• Installation tools

– Cobbler– The Foreman– FAI

Page 15: Automated Testing for Florian Winkler Infrastructure- B1 Systems … · Automated Testing for Infrastructure-as-a-code Florian Winkler B1 Systems GmbH Florian Winkler @pinguintiger,

rpm -qarpm -qa

• Configuration management

– CFEngine– Puppet– Chef– Ansible– SaltStack

• Configuration management

– CFEngine– Puppet– Chef– Ansible– SaltStack

Page 16: Automated Testing for Florian Winkler Infrastructure- B1 Systems … · Automated Testing for Infrastructure-as-a-code Florian Winkler B1 Systems GmbH Florian Winkler @pinguintiger,

rpm -qarpm -qa

• Enterprise tools

– Red Hat Satellite– SUSE Manager– Spacewalk

• Enterprise tools

– Red Hat Satellite– SUSE Manager– Spacewalk

Page 17: Automated Testing for Florian Winkler Infrastructure- B1 Systems … · Automated Testing for Infrastructure-as-a-code Florian Winkler B1 Systems GmbH Florian Winkler @pinguintiger,

rpm -qarpm -qa

• Containers

– LXC– Docker– BSD Jails– Solaris Zones

• Containers

– LXC– Docker– BSD Jails– Solaris Zones

Page 18: Automated Testing for Florian Winkler Infrastructure- B1 Systems … · Automated Testing for Infrastructure-as-a-code Florian Winkler B1 Systems GmbH Florian Winkler @pinguintiger,

rpm -qarpm -qa

• IaaC tools

– docker-compose– Docker Swarm– Kubernetes– vagrant– terraform

• IaaC tools

– docker-compose– Docker Swarm– Kubernetes– vagrant– terraform

Page 19: Automated Testing for Florian Winkler Infrastructure- B1 Systems … · Automated Testing for Infrastructure-as-a-code Florian Winkler B1 Systems GmbH Florian Winkler @pinguintiger,

rpm -qarpm -qa

• Continuous integration/deployment

– Jenkins– Travis– Gitlab CI

• Continuous integration/deployment

– Jenkins– Travis– Gitlab CI

Page 20: Automated Testing for Florian Winkler Infrastructure- B1 Systems … · Automated Testing for Infrastructure-as-a-code Florian Winkler B1 Systems GmbH Florian Winkler @pinguintiger,

Wow, that‘s a lot ...Wow, that‘s a lot ...

Page 21: Automated Testing for Florian Winkler Infrastructure- B1 Systems … · Automated Testing for Infrastructure-as-a-code Florian Winkler B1 Systems GmbH Florian Winkler @pinguintiger,

ps auxps aux

• Considerations

– do NOT let the tools define your work– define a goal– check your workflows– find the appropriate tools– make these tools work for you– automate

• Considerations

– do NOT let the tools define your work– define a goal– check your workflows– find the appropriate tools– make these tools work for you– automate

Page 22: Automated Testing for Florian Winkler Infrastructure- B1 Systems … · Automated Testing for Infrastructure-as-a-code Florian Winkler B1 Systems GmbH Florian Winkler @pinguintiger,

ps auxps aux

• DevOps

– mindset– close collaboration– small teams– staging

● Dev● Trial (optional)● Staging● Prod

– automated tests– fast deployments

• DevOps

– mindset– close collaboration– small teams– staging

● Dev● Trial (optional)● Staging● Prod

– automated tests– fast deployments

Page 23: Automated Testing for Florian Winkler Infrastructure- B1 Systems … · Automated Testing for Infrastructure-as-a-code Florian Winkler B1 Systems GmbH Florian Winkler @pinguintiger,

ps auxps aux

• git

– central code repositories– full access control– Intelligent merging mechanisms– branches

• git

– central code repositories– full access control– Intelligent merging mechanisms– branches

Page 24: Automated Testing for Florian Winkler Infrastructure- B1 Systems … · Automated Testing for Infrastructure-as-a-code Florian Winkler B1 Systems GmbH Florian Winkler @pinguintiger,

ps auxps aux

• Jenkins

– central automation tool– feature rich– lots of plugins– different types of workers– variety of notifications– plugins for variuos ticket systems

• Jenkins

– central automation tool– feature rich– lots of plugins– different types of workers– variety of notifications– plugins for variuos ticket systems

Page 25: Automated Testing for Florian Winkler Infrastructure- B1 Systems … · Automated Testing for Infrastructure-as-a-code Florian Winkler B1 Systems GmbH Florian Winkler @pinguintiger,

But how does it work for me?But how does it work for me?

Page 26: Automated Testing for Florian Winkler Infrastructure- B1 Systems … · Automated Testing for Infrastructure-as-a-code Florian Winkler B1 Systems GmbH Florian Winkler @pinguintiger,

git commitgit commit

• SCM polling

– code is commited– Jenkins polls the repo(s)– code is checked out if changed– defined build steps are executed– notification is send out– successful build can trigger other project to be

build

• SCM polling

– code is commited– Jenkins polls the repo(s)– code is checked out if changed– defined build steps are executed– notification is send out– successful build can trigger other project to be

build

Page 27: Automated Testing for Florian Winkler Infrastructure- B1 Systems … · Automated Testing for Infrastructure-as-a-code Florian Winkler B1 Systems GmbH Florian Winkler @pinguintiger,

git commitgit commit

• GitHub hook

– code is commited– GitHub hook triggers new build in Jenkins– code is checked out– defined build steps are executed– notification is send out– successful build can trigger other project to be

build

• GitHub hook

– code is commited– GitHub hook triggers new build in Jenkins– code is checked out– defined build steps are executed– notification is send out– successful build can trigger other project to be

build

Page 28: Automated Testing for Florian Winkler Infrastructure- B1 Systems … · Automated Testing for Infrastructure-as-a-code Florian Winkler B1 Systems GmbH Florian Winkler @pinguintiger,

git commitgit commit

• External build trigger

– a special URL is called– triggers a new build in Jenkins– code is checked out– definded build steps are executed– notification is send out– successful build can trigger new projects to be

build

• External build trigger

– a special URL is called– triggers a new build in Jenkins– code is checked out– definded build steps are executed– notification is send out– successful build can trigger new projects to be

build

Page 29: Automated Testing for Florian Winkler Infrastructure- B1 Systems … · Automated Testing for Infrastructure-as-a-code Florian Winkler B1 Systems GmbH Florian Winkler @pinguintiger,

git commitgit commit

• Ticket-based workflow

– ticket is created/updated– triggers a new build in Jenkins– code is checked out– defined build steps are executed– ticket is updated/closed on success– successful build can trigger other project to be

build

• Ticket-based workflow

– ticket is created/updated– triggers a new build in Jenkins– code is checked out– defined build steps are executed– ticket is updated/closed on success– successful build can trigger other project to be

build

Page 30: Automated Testing for Florian Winkler Infrastructure- B1 Systems … · Automated Testing for Infrastructure-as-a-code Florian Winkler B1 Systems GmbH Florian Winkler @pinguintiger,

And that‘s all the magic?And that‘s all the magic?

Page 31: Automated Testing for Florian Winkler Infrastructure- B1 Systems … · Automated Testing for Infrastructure-as-a-code Florian Winkler B1 Systems GmbH Florian Winkler @pinguintiger,

exit 0exit 0

• Automated workflow example (1/3)– code is written/changed– code is commited to dev branch– ticket is automatically created– dev branch is checked out– tests are executed

● i.e. syntax, linting– code is merged into trial branch– ticket is updated

• Automated workflow example (1/3)– code is written/changed– code is commited to dev branch– ticket is automatically created– dev branch is checked out– tests are executed

● i.e. syntax, linting– code is merged into trial branch– ticket is updated

Page 32: Automated Testing for Florian Winkler Infrastructure- B1 Systems … · Automated Testing for Infrastructure-as-a-code Florian Winkler B1 Systems GmbH Florian Winkler @pinguintiger,

exit 0exit 0

• Automated workflow example (2/3)

– trial branch is checked out– tests are executed

– i.e. integration tests– code is merged into staging branch– ticket is updated

• Automated workflow example (2/3)

– trial branch is checked out– tests are executed

– i.e. integration tests– code is merged into staging branch– ticket is updated

Page 33: Automated Testing for Florian Winkler Infrastructure- B1 Systems … · Automated Testing for Infrastructure-as-a-code Florian Winkler B1 Systems GmbH Florian Winkler @pinguintiger,

exit 0exit 0

• Automated workflow example (3/3)

– staging branch is checked out– tests are executed

– i.e. customer acceptance tests– code is merged into prod/master branch– ticket is closed

• Automated workflow example (3/3)

– staging branch is checked out– tests are executed

– i.e. customer acceptance tests– code is merged into prod/master branch– ticket is closed

Page 34: Automated Testing for Florian Winkler Infrastructure- B1 Systems … · Automated Testing for Infrastructure-as-a-code Florian Winkler B1 Systems GmbH Florian Winkler @pinguintiger,

But things break ...But things break ...

Page 35: Automated Testing for Florian Winkler Infrastructure- B1 Systems … · Automated Testing for Infrastructure-as-a-code Florian Winkler B1 Systems GmbH Florian Winkler @pinguintiger,

exit 1exit 1

• Something went wrong...

– $test is not successful– responsible person/team is informed– code is getting fixed and commited– code is being checked out– tests run again

• Something went wrong...

– $test is not successful– responsible person/team is informed– code is getting fixed and commited– code is being checked out– tests run again

Page 36: Automated Testing for Florian Winkler Infrastructure- B1 Systems … · Automated Testing for Infrastructure-as-a-code Florian Winkler B1 Systems GmbH Florian Winkler @pinguintiger,

Demo time?Demo time?

Page 37: Automated Testing for Florian Winkler Infrastructure- B1 Systems … · Automated Testing for Infrastructure-as-a-code Florian Winkler B1 Systems GmbH Florian Winkler @pinguintiger,

./run.sh./run.sh

• Demo (if we still have enough time)• Demo (if we still have enough time)

Page 38: Automated Testing for Florian Winkler Infrastructure- B1 Systems … · Automated Testing for Infrastructure-as-a-code Florian Winkler B1 Systems GmbH Florian Winkler @pinguintiger,

Questions?Questions?

Page 39: Automated Testing for Florian Winkler Infrastructure- B1 Systems … · Automated Testing for Infrastructure-as-a-code Florian Winkler B1 Systems GmbH Florian Winkler @pinguintiger,

Stay in touch?Stay in touch?

• https://www.b1-systems.de

[email protected][email protected][email protected]

– @b1systems

• @pinguintiger (private, non-technical, mostly german)

• https://www.b1-systems.de

[email protected][email protected][email protected]

– @b1systems

• @pinguintiger (private, non-technical, mostly german)

Page 40: Automated Testing for Florian Winkler Infrastructure- B1 Systems … · Automated Testing for Infrastructure-as-a-code Florian Winkler B1 Systems GmbH Florian Winkler @pinguintiger,

Thank you!Thank you!

Page 41: Automated Testing for Florian Winkler Infrastructure- B1 Systems … · Automated Testing for Infrastructure-as-a-code Florian Winkler B1 Systems GmbH Florian Winkler @pinguintiger,