22
3/22/2019 1 WELCOME TO THE WORKSHOP Creating a Continuous Delivery Pipeline with Automated Testing Josh Grant, STPCon 2019 AGENDA Item 1 Item 2 Item 3 Item 4 After completing this workshop, you will be able to: 1 2

WELCOME TO THE WORKSHOP · 2019-03-22 · The New World of DevOps 3 4. 3/22/2019 3 Buzz Word Salad The Whole Point ... Code Versioning Feature Branch vs Trunk Based Development Feature

  • Upload
    others

  • View
    1

  • Download
    0

Embed Size (px)

Citation preview

Page 1: WELCOME TO THE WORKSHOP · 2019-03-22 · The New World of DevOps 3 4. 3/22/2019 3 Buzz Word Salad The Whole Point ... Code Versioning Feature Branch vs Trunk Based Development Feature

3/22/2019

1

WELCOME TO THE WORKSHOP

Creating a Continuous Delivery Pipeline with Automated Testing

Josh Grant, STPCon 2019

AGENDA

Item 1

Item 2

Item 3

Item 4

After completing this workshop, you will be able to:

1

2

Page 2: WELCOME TO THE WORKSHOP · 2019-03-22 · The New World of DevOps 3 4. 3/22/2019 3 Buzz Word Salad The Whole Point ... Code Versioning Feature Branch vs Trunk Based Development Feature

3/22/2019

2

Trainer NAME.Your

TrainerTrainer Photo.

The New World of DevOps

3

4

Page 3: WELCOME TO THE WORKSHOP · 2019-03-22 · The New World of DevOps 3 4. 3/22/2019 3 Buzz Word Salad The Whole Point ... Code Versioning Feature Branch vs Trunk Based Development Feature

3/22/2019

3

Buzz Word Salad

The Whole Point

▪ What the Money Wants▪ More Sales▪ More Users▪ What the User Wants

5

6

Page 4: WELCOME TO THE WORKSHOP · 2019-03-22 · The New World of DevOps 3 4. 3/22/2019 3 Buzz Word Salad The Whole Point ... Code Versioning Feature Branch vs Trunk Based Development Feature

3/22/2019

4

More Agile

▪ Deliver Quality Software More Frequently

▪ Continuous Delivery Requires Continuous Testing

The Path to CI/CD

7

8

Page 5: WELCOME TO THE WORKSHOP · 2019-03-22 · The New World of DevOps 3 4. 3/22/2019 3 Buzz Word Salad The Whole Point ... Code Versioning Feature Branch vs Trunk Based Development Feature

3/22/2019

5

Customer Journey

▪ Philosophy▪ Organization▪ Application Structure▪ Code Versioning▪ Dev Process▪ Deployment

Vectors of Change

Know the state of all your environment components.

9

10

Page 6: WELCOME TO THE WORKSHOP · 2019-03-22 · The New World of DevOps 3 4. 3/22/2019 3 Buzz Word Salad The Whole Point ... Code Versioning Feature Branch vs Trunk Based Development Feature

3/22/2019

6

Philosophy Changes

▪ Proactive vs Reactive▪ Expense▪ Reliability▪ Incentives▪ Perception

Mean Time to Failurevs

Mean Time to Recovery

▪ Tester as a distinct role going away▪ Developers are becoming testers▪ Responsible for the quality of their

own code▪ Writing all of the necessary tests▪ Ensuring the entire build and

deployment▪ Cross-Functional Agile TeamsSelf-

contained team can convert idea to delivered solution

Organizational Changes

11

12

Page 7: WELCOME TO THE WORKSHOP · 2019-03-22 · The New World of DevOps 3 4. 3/22/2019 3 Buzz Word Salad The Whole Point ... Code Versioning Feature Branch vs Trunk Based Development Feature

3/22/2019

7

Moving to Microservices

Tightly coupled code base

Changes Unpredictable (harder torefactor)

Requires more UI Tests (inverted testpyramid)

Lots of Tech Debt

Moving to Microservices

Monolith Application

13

14

Page 8: WELCOME TO THE WORKSHOP · 2019-03-22 · The New World of DevOps 3 4. 3/22/2019 3 Buzz Word Salad The Whole Point ... Code Versioning Feature Branch vs Trunk Based Development Feature

3/22/2019

8

Easier to understand functionality

Easier to create contracts

Easier to mock contracts

Less reliance on UI Tests

Moving to Microservices

MicroServices

Application Changes

Kill the Monolith Applications

▪ Class for each page▪ MicroService All the Things▪ Mock Services, not Tests▪ Contract Testing

© 2018 Sauce Labs. All rights reserved

15

16

Page 9: WELCOME TO THE WORKSHOP · 2019-03-22 · The New World of DevOps 3 4. 3/22/2019 3 Buzz Word Salad The Whole Point ... Code Versioning Feature Branch vs Trunk Based Development Feature

3/22/2019

9

Code Versioning

Feature Branch vs

Trunk Based Development

Feature Branches - Gitflow

17

18

Page 10: WELCOME TO THE WORKSHOP · 2019-03-22 · The New World of DevOps 3 4. 3/22/2019 3 Buzz Word Salad The Whole Point ... Code Versioning Feature Branch vs Trunk Based Development Feature

3/22/2019

10

Feature Branches - Merge Party!!!!

Feature Branches - Merge Party?

19

20

Page 11: WELCOME TO THE WORKSHOP · 2019-03-22 · The New World of DevOps 3 4. 3/22/2019 3 Buzz Word Salad The Whole Point ... Code Versioning Feature Branch vs Trunk Based Development Feature

3/22/2019

11

Feature Branches - Merging is Hard

Trunk Based

21

22

Page 12: WELCOME TO THE WORKSHOP · 2019-03-22 · The New World of DevOps 3 4. 3/22/2019 3 Buzz Word Salad The Whole Point ... Code Versioning Feature Branch vs Trunk Based Development Feature

3/22/2019

12

Mono Repo

▪ Can *not* do true Continuous Delivery/Deployment

▪ Difficult to coordinate testing different versions of the same code base

▪ Always know exact readiness level of master for deployment

Repeatable actions that scale across ALL pages

Process Changes

▪ Sprints vs Kanban

▪ Time Based vs Event Driven Testing

23

24

Page 13: WELCOME TO THE WORKSHOP · 2019-03-22 · The New World of DevOps 3 4. 3/22/2019 3 Buzz Word Salad The Whole Point ... Code Versioning Feature Branch vs Trunk Based Development Feature

3/22/2019

13

Deployment Changes

▪ A container image is a lightweight, stand-alone, executable package of a piece of software that includes everything needed to run it: code, runtime, system tools, system libraries, settings.

▪ Kubernetes can schedule and run application containers on clusters of physical or virtual machines. Dispatcher orchestrating placement and timing of all container operations.

▪ Moving from a host-centric infrastructure to a container-centric infrastructure, which provides the full advantages and benefits inherent to containers. Kubernetes provides the orchestration to build a scalable container-centric deployment environment.

The Modern Development Tool Chain

25

26

Page 14: WELCOME TO THE WORKSHOP · 2019-03-22 · The New World of DevOps 3 4. 3/22/2019 3 Buzz Word Salad The Whole Point ... Code Versioning Feature Branch vs Trunk Based Development Feature

3/22/2019

14

SETTING UP A JENKINS PIPELINE DEMO

▪ Add Sauce Connect Plugin

▪ Add Github Pull Request Builder Plugin

Jenkins Plugins

27

28

Page 15: WELCOME TO THE WORKSHOP · 2019-03-22 · The New World of DevOps 3 4. 3/22/2019 3 Buzz Word Salad The Whole Point ... Code Versioning Feature Branch vs Trunk Based Development Feature

3/22/2019

15

Jenkins Credentials

▪ Create Sauce Labs Credentials▪ Create Secret Key Credentials for GitHub with Personal Access

Token▪ Create Username/Password Credentials for GitHub

Jenkins Configure - GitHub

▪ Make sure API URL is correct▪ It will be different if you have an Enterprise Account

29

30

Page 16: WELCOME TO THE WORKSHOP · 2019-03-22 · The New World of DevOps 3 4. 3/22/2019 3 Buzz Word Salad The Whole Point ... Code Versioning Feature Branch vs Trunk Based Development Feature

3/22/2019

16

Jenkins Configure -Github Pull Request Plugin

▪ Make sure API URL is correct

▪ Use GitHub Username/Password Credentials

GitHub Project Setup

▪ Create a WebHook to point to Jenkins

31

32

Page 17: WELCOME TO THE WORKSHOP · 2019-03-22 · The New World of DevOps 3 4. 3/22/2019 3 Buzz Word Salad The Whole Point ... Code Versioning Feature Branch vs Trunk Based Development Feature

3/22/2019

17

Jenkins Pipeline Project

▪ Point to GitHub Project

Jenkins Pipeline Build Trigger

▪ Use API for GHPRB Trigger▪ Make sure hooks checkbox is checked

33

34

Page 18: WELCOME TO THE WORKSHOP · 2019-03-22 · The New World of DevOps 3 4. 3/22/2019 3 Buzz Word Salad The Whole Point ... Code Versioning Feature Branch vs Trunk Based Development Feature

3/22/2019

18

Jenkins Pipeline Settings

▪ Specify SCM & GitHub▪ Specify Repository▪ Specify Credentials for GitHub

Username/Password▪ Branch Specifier needs to be:

${sha1}▪ Make sure “Lightweight

checkout” is NOT checked

Jenkins Pipeline Settings

35

36

Page 19: WELCOME TO THE WORKSHOP · 2019-03-22 · The New World of DevOps 3 4. 3/22/2019 3 Buzz Word Salad The Whole Point ... Code Versioning Feature Branch vs Trunk Based Development Feature

3/22/2019

19

STAGES

1. Setup2. Unit Tests3. Build4. D2D Tests5. Deploy

© 2018 Sauce Labs. All rights reserved

The Modern Development Tool Chain

37

38

Page 20: WELCOME TO THE WORKSHOP · 2019-03-22 · The New World of DevOps 3 4. 3/22/2019 3 Buzz Word Salad The Whole Point ... Code Versioning Feature Branch vs Trunk Based Development Feature

3/22/2019

20

Sauce Connect

JenkinsFile - Sauce Connect

39

40

Page 21: WELCOME TO THE WORKSHOP · 2019-03-22 · The New World of DevOps 3 4. 3/22/2019 3 Buzz Word Salad The Whole Point ... Code Versioning Feature Branch vs Trunk Based Development Feature

3/22/2019

21

Pipeline Results

PR Process Summary

▪ Code inspection▪ All Unit Tests▪ Unit Test Coverage Check▪ All Integration Tests▪ All UI Tests▪ UI Test Coverage▪ Merge▪ Deploy to Prod▪ UI Test on Prod

41

42

Page 22: WELCOME TO THE WORKSHOP · 2019-03-22 · The New World of DevOps 3 4. 3/22/2019 3 Buzz Word Salad The Whole Point ... Code Versioning Feature Branch vs Trunk Based Development Feature

3/22/2019

22

Let’s do this!

43