24
www.infostretch.com | 408.727.1100 | 2880 Lakeside Drive, Suite 200, Santa Clara, CA 95054 ©2012 InfoStretch Corporation. All rights reserved. Continuous Integration .NET Framework December 4 th , 2012

Continious integration using .net framework

Embed Size (px)

DESCRIPTION

 

Citation preview

Page 1: Continious integration using .net framework

www.infostretch.com | 408.727.1100 | 2880 Lakeside Drive, Suite 200, Santa Clara, CA 95054 ©2012 InfoStretch Corporation. All rights reserved.

Continuous Integration.NET Framework

December 4th, 2012

Page 2: Continious integration using .net framework

www.infostretch.com | 408.727.1100 | 2880 Lakeside Drive, Suite 200, Santa Clara, CA 95054 ©2012 InfoStretch Corporation. All rights reserved.

56 7 812 3 4

Agenda

Client Case StudyObjective CI ArchitectureInvestigation

CI ModulesSCM - TFS Q & ACulture Change

Page 3: Continious integration using .net framework

www.infostretch.com | 408.727.1100 | 2880 Lakeside Drive, Suite 200, Santa Clara, CA 95054 ©2012 InfoStretch Corporation. All rights reserved.

Objective

• Continuous Integration … see Martin Fowler’s quote

• CI is a marathon not a sprint.

• Effective software continuous integration solutions need to be agile life cycle to facilitate your organizations growth toward software release agility. Continuous Integration is not THE silver bullet that will solve your issues – it is the culture change.

Page 4: Continious integration using .net framework

www.infostretch.com | 408.727.1100 | 2880 Lakeside Drive, Suite 200, Santa Clara, CA 95054 ©2012 InfoStretch Corporation. All rights reserved.

Client Case Study

A web based product has well over hundred unplanned deployments to production annually. How can continuous integration (CI) help us here?

We engaged with the client to assess their CI and agile scrum needs. Objective: Define the CI flow and architecture.

Understand the culture – listen to the architects, release engineers, managers, software leads, QA leads, product managers – i.e. unit tests, deployment, automated tests, SCM

Understand the SDLC processes – Is it documented?

Communicate the objective - Organization ROI from CI.

Agile CI phased solution – Phased deliverables

Page 5: Continious integration using .net framework

www.infostretch.com | 408.727.1100 | 2880 Lakeside Drive, Suite 200, Santa Clara, CA 95054 ©2012 InfoStretch Corporation. All rights reserved.

Content

• CI Flow and Architecture• Detail Design• Reports

Page 6: Continious integration using .net framework

www.infostretch.com | 408.727.1100 | 2880 Lakeside Drive, Suite 200, Santa Clara, CA 95054 ©2012 InfoStretch Corporation. All rights reserved.

Overall CI Flow and Architecture

Jointly architected CI flow and objectives with emphasis on code coverage to improve both unit and regression test coverage; and one click deployment to production. Following slides are details of the below modules in .NET environment.

Buildtfs

Centralized Jenkins distributed build server

Pre-Commit

Ensure Build success & passes unit test

Publish / Deploy

Release Candidate

Scrum Team declares RC

DeployDeploy Environments

EnvironmentsEnvironments

DevelopmentQAStagingProduction

Tests

NCover

Code Coverage Reports

Page 7: Continious integration using .net framework

www.infostretch.com | 408.727.1100 | 2880 Lakeside Drive, Suite 200, Santa Clara, CA 95054 ©2012 InfoStretch Corporation. All rights reserved.

Why Jenkins?

Jenkins’ core strength:• Simplicity• Reporting• Flexibility• Modular Design• Uses Forms to Configure Projects

together to form a solutions. As organization CI matures, additional modules can be integrated to existing CI Flow.

Software Build

Test Types Smoke Regression

Deploy Publish

Code Coverage

Page 8: Continious integration using .net framework

www.infostretch.com | 408.727.1100 | 2880 Lakeside Drive, Suite 200, Santa Clara, CA 95054 ©2012 InfoStretch Corporation. All rights reserved.

TFS Repository – Source Control Strategy

Development on branch or on trunk? TFS Label applied at release candidate.

Polling (20 minutes)

tfs

V5.5 Release BranchV5.5_Test Branch

V5.6 Release BranchesV5.6_Test Branch

/TLS/v5.5/trunkAt RC

/TLS/v5.5_Test/trunk

Notes –

1. Dependent DLL change will trigger clean build.

2. New Jenkins job for each version / branch3. Source code and automated regression

test source code trigger different Jenkins job.

4. Apply TFS Label and branch at Release Candidate if necessary

5. Release candidate criteria needed.

Jenkins Software Build Stream

Jenkins Regression Test

Build Stream

Branch ONLY if Necessary – Production Bug fixes that cannot pull in the in development changes.

merge

CHECKOUT

Page 9: Continious integration using .net framework

www.infostretch.com | 408.727.1100 | 2880 Lakeside Drive, Suite 200, Santa Clara, CA 95054 ©2012 InfoStretch Corporation. All rights reserved.

Pre-Commit Steps

How to ensure Jenkins have high software build success rate? Developers are to perform the following steps prior to checking in their code to TFS. Use TFS to enforce code check-in policy.

Pre-Commit

Checkout Code*

Write Unit Test

All Unit Test Passed

Re-sync with latest

All Unit Test Passed

Commit to TFS with defect ID & comments

Modify code Code Review

Optional Next Slide

Legend

Note: *Policy around Solution File Needed and recommended to be code review

Page 10: Continious integration using .net framework

www.infostretch.com | 408.727.1100 | 2880 Lakeside Drive, Suite 200, Santa Clara, CA 95054 ©2012 InfoStretch Corporation. All rights reserved.

Software Build Stream

Describes the whole software build stream and verify no regressions as much as possible. This is a Jenkins job.

Software BUILD

Checkout Code from

latest / labelMSBUILD

PrecompileWeb Folder/bin/release MSTEST

Publish ReportsMSDeployGo to Smoke

Test Job

@Jenkins workspaceSourceSolution File

Unit Tests

FXCop

Static Code Analysis

NCover

Code Coverage

Page 11: Continious integration using .net framework

www.infostretch.com | 408.727.1100 | 2880 Lakeside Drive, Suite 200, Santa Clara, CA 95054 ©2012 InfoStretch Corporation. All rights reserved.

Solution File

Central and crucial input to the software build stream is the Product’s solution file. An error in the solution file can break the build stream. It is crucial that a Solution File policy should be put in place.

Jenkins dependencies on the Solution File (*.sln)

Build instructions to build both the product and unit tests Precompiled artifact stored in Precompiled Web/bin/release folder Solutions file build only valid projects. Project with invalid or

missing project file will fail the build.

Software BUILD

Page 12: Continious integration using .net framework

www.infostretch.com | 408.727.1100 | 2880 Lakeside Drive, Suite 200, Santa Clara, CA 95054 ©2012 InfoStretch Corporation. All rights reserved.

Test Build StreamClient uses Selenium framework and automated test suites. This is another Jenkins job. There are two smoke and regressions tests. At this time Jenkins have deployed the software to test environment.

Regression Test BUILD

Checkout Code from

latest / labelANT

Runs Regression

Tests Generate Reports to

Jenkins

Runs Smoke

Nightly

After every: + Source code changes+ Test code changes+ Configuration changes

Page 13: Continious integration using .net framework

www.infostretch.com | 408.727.1100 | 2880 Lakeside Drive, Suite 200, Santa Clara, CA 95054 ©2012 InfoStretch Corporation. All rights reserved.

Release Candidate (RC)

Release Candidate – Archive* the release software to the TFS and deploy to staging environment for QA manual and performance testing. Scrum team decides RC readiness and must satisfy RC criteria – i.e. No regression test failures.

Publish

TFS Check in Go to Deploy

Job

From Software Build

Steps

From Software Build

Steps

@Jenkins workspace

PrecompileWeb Folder/bin/release

TFS

Label.build#

* Archiving to TFS at Release Candidate to save space on TFS.

Page 14: Continious integration using .net framework

www.infostretch.com | 408.727.1100 | 2880 Lakeside Drive, Suite 200, Santa Clara, CA 95054 ©2012 InfoStretch Corporation. All rights reserved.

Deployment

Deploying to test, staging and production environments.

Deploy Job

MSDEPLOY Regression Test Job

PrecompileWeb Folder/bin/debug

Test Environment

MSDEPLOY Regression Test Job

Staging EnvironmentOne Click to start

MSDEPLOYSmoke non destructive

Test Job

Production EnvironmentOne Click to start

One job for each co-location.

From Software build

TFS

Label.build#

TFS

Label.build#

Page 15: Continious integration using .net framework

www.infostretch.com | 408.727.1100 | 2880 Lakeside Drive, Suite 200, Santa Clara, CA 95054 ©2012 InfoStretch Corporation. All rights reserved.

Jenkins Reports – Case Study

Identify the stake holders are accountable to the CI goals. Use the reports for improving culture, processes and next goal settings. This is actual screen shot from client Jenkins for a .NET product: TLSLegacy.

Legends Jobs: Naming Convention

TLSLegacy-Build-to-tclistage Polls TFS every 30 minutes for source code changes, builds and deploys to machine tclistage. Starts smoke test module.

TLSLegacy-Smoke-to-tclistageRuns smoke tests.

TLSLegacy-Regression-tclistage Runs Regression tests nightly

TLSLegacy_RCRelease Candidate Build

TLSLegacy_deploy-stage1Deploy to Stage 1 environment

Page 16: Continious integration using .net framework

www.infostretch.com | 408.727.1100 | 2880 Lakeside Drive, Suite 200, Santa Clara, CA 95054 ©2012 InfoStretch Corporation. All rights reserved.

Jenkins Reports

What will be some of the questions management may ask for Product: TLS Legacy? Through the use of this dashboard, we are showing how managers / leads can start ask questions to start a culture change.

• Was there a build yesterday?

• What is your plan to make all the status BLUE?

• Why isn’t the smoke tests fixed immediately?

• There was no build for the last 4 days? We should be fixing bugs in this phase?

Page 17: Continious integration using .net framework

www.infostretch.com | 408.727.1100 | 2880 Lakeside Drive, Suite 200, Santa Clara, CA 95054 ©2012 InfoStretch Corporation. All rights reserved.

Jenkins Report – TLSLegacy Build Job

This is the TLSLegacy software build jobs. October 12 is the release candidate milestone. Some questions as manager and lead can ask -

• There was no bug fixes between Oct 3rd and 11th? Is this really true?

• There are concern that management may start micro-managing the broken builds.

• When can I see unit tests?

• What was checked in for this build?

Page 18: Continious integration using .net framework

www.infostretch.com | 408.727.1100 | 2880 Lakeside Drive, Suite 200, Santa Clara, CA 95054 ©2012 InfoStretch Corporation. All rights reserved.

Did developer check in the change?

Often managers ask engineers if they have checked in the changes or not – engineers often feel they are being micro-managed. With each build, you can see what was checked into TFS. QA can see what changes went into the build.

• Why are engineers not adding defect ids to their check ins?

• For Build 33 – what flag was changed?

• To developer – I think you forgot to change these files as part of your fix.

Page 19: Continious integration using .net framework

www.infostretch.com | 408.727.1100 | 2880 Lakeside Drive, Suite 200, Santa Clara, CA 95054 ©2012 InfoStretch Corporation. All rights reserved.

Jenkins Report – TLSLegacy Smoke Tests

This is the TLSLegacy smoke test job. You can see the smoke tests are trending toward stability. The smoke tests completes in about 20 minutes. Since there was no unit tests – management decided developers must check the smoke tests after their check ins once smoke tests are stable.

• What is going on with this chart?

• When will this chart show more stability?

Page 20: Continious integration using .net framework

www.infostretch.com | 408.727.1100 | 2880 Lakeside Drive, Suite 200, Santa Clara, CA 95054 ©2012 InfoStretch Corporation. All rights reserved.

Jenkins Report – TLSLegacy Regression Tests

There are about 600+ regression tests suites. From this chart, we see still have work to go to get the regression tests to be stabilized and all passing on consistent basis.

• Management / Leads can monitor the progress and

is it progressing according to plan.

• When will this chart show more stability?

Page 21: Continious integration using .net framework

www.infostretch.com | 408.727.1100 | 2880 Lakeside Drive, Suite 200, Santa Clara, CA 95054 ©2012 InfoStretch Corporation. All rights reserved.

Jenkins Configuration

Jenkins uses a form based to configure the CI flow. This is for the build steps.

• Define Source code repository and how to checkout files

• How often to poll

• Build the software

• Deploys the software and configuration files

• Report type configuration

Page 22: Continious integration using .net framework

www.infostretch.com | 408.727.1100 | 2880 Lakeside Drive, Suite 200, Santa Clara, CA 95054 ©2012 InfoStretch Corporation. All rights reserved.

Summary

We have covered –

• Continuous Integration is not a sprint but a marathon• CI Architecture and Flow and Modular design before

implementation• Naming conventions• Source Control Management strategy• CI Flow

– Builds, Test, Deployment and release candidate CI Flows• Report generation and sample questions

Page 23: Continious integration using .net framework

www.infostretch.com | 408.727.1100 | 2880 Lakeside Drive, Suite 200, Santa Clara, CA 95054 ©2012 InfoStretch Corporation. All rights reserved.

Conclusion

CI is a marathon not a sprint. It is a tool for culture change toward software development efficiencies and product quality.

Key Points for Success • Recognition that CI is not a sprint but a marathon• Executive management support for continuous integration • Software engineers and management compliance• Set the reasonable expectation and goals• Designated Release Engineer

Before you know it, you will wonder how you did product development without CI.

Page 24: Continious integration using .net framework

www.infostretch.com | 408.727.1100 | 2880 Lakeside Drive, Suite 200, Santa Clara, CA 95054 ©2012 InfoStretch Corporation. All rights reserved.

Thank You!