continuous deployment and testing for mobile apps the cloud revolution youve never heard of mark...

47
Continuous Deployment and Testing for Mobile Apps The Cloud Revolution You’ve Never Heard Of Mark Prichard @CloudBees

Upload: jayson-fugate

Post on 31-Mar-2015

215 views

Category:

Documents


2 download

TRANSCRIPT

Page 1: Continuous Deployment and Testing for Mobile Apps The Cloud Revolution Youve Never Heard Of Mark Prichard @CloudBees

Continuous Deployment and Testing for Mobile AppsThe Cloud Revolution You’ve Never Heard Of

Mark Prichard

@CloudBees

Page 2: Continuous Deployment and Testing for Mobile Apps The Cloud Revolution Youve Never Heard Of Mark Prichard @CloudBees

2

Mark Prichard – My Back Pages

©2011 CloudBees, Inc. All Rights Reserved

• Cambridge University Computer Lab, 1990-1991

• Logica/SHL/CSC: 1991-2000– Integration/Middleware Specialist– Managing Consultant

• BEA Systems, 2000-2008– Senior Architect, EMEA– Director, Java Virtualization

• Oracle, 2008 -2012– WebLogic Platform PM– FMW Web Tier PM

• CloudBees, 2012– Senior Director of Product

Management

@mqprichard [email protected]

blogs.cloudbees.comClouds, Bees and Blogs

Page 3: Continuous Deployment and Testing for Mobile Apps The Cloud Revolution Youve Never Heard Of Mark Prichard @CloudBees

3

• Quick Introduction to CloudBees and PaaS• Building Apps in the Cloud• Continuous Integration for iOS and

Android• Gesture-aware touch testing• Multi-configuration mobile testing• Beta test distribution• Mobile + PaaS models• AWS and the Token Vending Machine

Today’s Agenda

Page 4: Continuous Deployment and Testing for Mobile Apps The Cloud Revolution Youve Never Heard Of Mark Prichard @CloudBees

4

• Free and complete for developers• Get started with just a couple of

clicks: all you need is a browser

www.cloudbees.com/signup

Step 1 - Sign Up with CloudBees

Page 5: Continuous Deployment and Testing for Mobile Apps The Cloud Revolution Youve Never Heard Of Mark Prichard @CloudBees

5

What’s a Platform?

• Something you can use to – Run your apps– Build your apps– Add services to your apps–Manage your apps

• Plaform-as-a-Service (PaaS) uses elastic, on-demand Cloud resources to do this

Page 6: Continuous Deployment and Testing for Mobile Apps The Cloud Revolution Youve Never Heard Of Mark Prichard @CloudBees

6

CloudBees Is a Platform Delivered As A Service

cloudbees.com

JenkinsMaster

Test

Stage

Build

Code

JenkinsExecutor

Forg

e R

ep

osit

ori

es

Git

SVN

mvn

Development Services

(DEV@cloud)

Developer and OperationsInteraction

End User Interaction

Runtime Services

(RUN@cloud)

CloudBees API

Grand Central Web

Console

SDK

SessionClustering

MySQL

Router

Application

PartnerEcosystem

6

©CloudBees, Inc. All Rights Reserved

Page 7: Continuous Deployment and Testing for Mobile Apps The Cloud Revolution Youve Never Heard Of Mark Prichard @CloudBees

7

Cloud Terminology

• Infrastructure-as-a-Service (IaaS)– Think: Amazon Web Services–What: Server Instances, Storage

Buckets etc

• Software-as-a-Service (SaaS)– Think: Salesforce.com–What: Packaged Applications (in the

Cloud)

• Plaform-as-a-Service (PaaS)–What: Managed Service for Custom

Apps

Page 8: Continuous Deployment and Testing for Mobile Apps The Cloud Revolution Youve Never Heard Of Mark Prichard @CloudBees

8

What is Platform-as-a-Service?

• We run your applications for you• We provide and manage all the

supporting infrastructure needed to run your apps

• We monitor and can scale out your apps

• We provide a full, enterprise-class build environment using Jenkins CI – the world’s #1 OSS continuous integration server

• You write the code and we do all the rest

Page 9: Continuous Deployment and Testing for Mobile Apps The Cloud Revolution Youve Never Heard Of Mark Prichard @CloudBees

9

Have You Met Jenkins?

• #1 OSS CI server• Easy to install/use• Extensible via 600+ plugins• Very widely adopted– 47K+ installations

• Very active community– Over 7 years of history, 440+ releases– 600+ plugins, 300+ developers

• CloudBees adds plugins for cloud builds

Page 10: Continuous Deployment and Testing for Mobile Apps The Cloud Revolution Youve Never Heard Of Mark Prichard @CloudBees

10

CloudBees Step-by-Stepcloudbees.com

JenkinsMaster

Test

Stage

Build

Code

JenkinsExecutor

Forg

e R

ep

osit

ori

es

Git

SVN

mvn

Development Services

(DEV@cloud)

Developer and OperationsInteraction

End User Interaction

Runtime Services

(RUN@cloud)

CloudBees API

Grand Central Web

Console

SDK

SessionClustering

MySQL

Router

Application

PartnerEcosystem

Multi-Tenanted

Dedicated

Amazon Web Services

10

©CloudBees, Inc. All Rights Reserved

Page 11: Continuous Deployment and Testing for Mobile Apps The Cloud Revolution Youve Never Heard Of Mark Prichard @CloudBees

11

What Platform-as-a-Service Is Not

• Commercial, packaged applications don’t usually run on a PaaS

• You don’t need to purchase any hardware or software licenses

• You won’t have to install anything – you just deploy your Java apps to the platform

• If you need to run applications in your own data center, PaaS may be the wrong model

Page 12: Continuous Deployment and Testing for Mobile Apps The Cloud Revolution Youve Never Heard Of Mark Prichard @CloudBees

12

Getting Started: CloudBees ClickStarts

©2012 CloudBees, Inc. All Rights Reserved

The easiest way to get started – and learn new technologies

Page 13: Continuous Deployment and Testing for Mobile Apps The Cloud Revolution Youve Never Heard Of Mark Prichard @CloudBees

13

cloudbees.com

What’s up with this new framework!

What Did I Just Do?

13

CloudBeesGit

Repo

Database

Build/Test

db:create

App

PartnerServicePartner

Service

CloudBees API

Grand Centra

l Web

Console

app:creategit clone

Jenkins job create

Bind

Bind

Trigger

Deploy

Wow! At yourservice

©2013 CloudBees, Inc. All rights reserved

Page 14: Continuous Deployment and Testing for Mobile Apps The Cloud Revolution Youve Never Heard Of Mark Prichard @CloudBees

14

cloudbees.com

Develop Locally, Build in the Cloud

CloudBeesGit

Repo

Database

Build/Test

App

PartnerServicePartner

Service

Bind

Bind

TriggerDeployI want to make

some changes!

Local GitRepo

git clonegi

t com

mit git push

Chan

ges

Wow! At yourservice

Page 15: Continuous Deployment and Testing for Mobile Apps The Cloud Revolution Youve Never Heard Of Mark Prichard @CloudBees

First Demo• Complete Application with its full lifecycle, in a

click ClickStart

• No resource other than a laptop, everything else is in the cloud

• No need to deal with IT either!

• You can create your own ClickStart-s if you want

• Templates, etc.

• Pay as you go (to production), scale as you need, full HA, etc. Not just a development workbench!

Page 16: Continuous Deployment and Testing for Mobile Apps The Cloud Revolution Youve Never Heard Of Mark Prichard @CloudBees

Second Demo: All Mobile!

• Complete Chess application for iOS & Android

• Covered:

• Where to store app, how to build, how to test, how to distribute, etc.

• NOT Covered:

• iOS/Android app coding itself

• WARNING: testing is especially important for mobile applications – most users won’t give it a second chances!

Page 17: Continuous Deployment and Testing for Mobile Apps The Cloud Revolution Youve Never Heard Of Mark Prichard @CloudBees

#fail #fail #fail

Typical flow/pipeline

CodeBuild App

Code

BuildTest

Deploy

TestBetaDeplo

y

GADeplo

y

• Get started fast!

• Team Work• Automatically

push new code to test

#fail

• Build on several targets: iOS, Android, etc.

• If it fails, stop

• Test is costly!• Easy-first, then

increase!• Basic test• Multi-device• Gesture• Etc.

• If it fails, stop

• Deploy in the field on real users

• Gather input• Retrieve

dumps• Etc.• If it fails, stop

• D-Day! • Push apps to

real-life users!• If it fails, stop

Page 18: Continuous Deployment and Testing for Mobile Apps The Cloud Revolution Youve Never Heard Of Mark Prichard @CloudBees

Step 1 - CODE• Typically using a mobile-specific environment/IDE

• Store code on Github or at CloudBees (SVN/Git)

• As soon as a code change occurs, validates!

• notification sent to Jenkins, initiate pipeline

• Idea!

• Use a ClickStart to “templatify” a typical mobile project

• License headers, splash screen, login, back-end REST API, etc.

Page 19: Continuous Deployment and Testing for Mobile Apps The Cloud Revolution Youve Never Heard Of Mark Prichard @CloudBees

Step 1 - CODE• You can look at a mobile ClickStart:

• Android: https://github.com/mqprichard/stockfishchess-android

• iOS: https://github.com/mqprichard/stockfishchess-ios-app

Page 20: Continuous Deployment and Testing for Mobile Apps The Cloud Revolution Youve Never Heard Of Mark Prichard @CloudBees

Step 2 - BUILD• Android

• Easy! Android_[SDK | NDK] available in the cloud, build on linux machine on DEV@cloud

• iOS

• Requires Mac OS X guest to build

• Not available (yet) at CloudBees

• Impossible?

Page 21: Continuous Deployment and Testing for Mobile Apps The Cloud Revolution Youve Never Heard Of Mark Prichard @CloudBees

Step 2 – iOS BUILD• Mac Build Attach your own Mac

Jenkins

Master

Jenkins Slave

DEV@cloud

Jenkins Slave

DEV@cloud

Jenkins Slave

DEV@cloud

Jenkins Slave

PRIVATE

Page 22: Continuous Deployment and Testing for Mobile Apps The Cloud Revolution Youve Never Heard Of Mark Prichard @CloudBees

Preparing a mobile build slave

• Install Android SDK and NDK, install git (if using it), wget, etc.

• Modify ~/.bash_profile

• Create ANDROID_SDK and ANDROID_NDK

• add A_S/tools and A_S/platform_tools to path

• Install Xcode

• Launch to accept license

• Go in preferences, install command line tools and emulator(s)

• Type “android” on command line

• Add SDK versions + System images (ARM EABI, etc.)

Page 23: Continuous Deployment and Testing for Mobile Apps The Cloud Revolution Youve Never Heard Of Mark Prichard @CloudBees

Step 2 – iOS BUILD• Install Jenkins Java CLI agent on Mac

• Launch:

• enjoy

java -jar jenkins-cli.jar -s https://partnerdemo.ci.cloudbees.com -i ~/.ssh/id_rsa customer-managed-slave

-fsroot ~/tests/jenkins/ROOT/ -labels android -labels xcode -executors 4 -name mobile-slave-sacha-laptop

http://wiki.cloudbees.com/bin/view/DEV/Customer+Provided+Slaves

Page 24: Continuous Deployment and Testing for Mobile Apps The Cloud Revolution Youve Never Heard Of Mark Prichard @CloudBees

Step 2 - BUILD• Good Reads

• Continuous Deployment for Mobile Apps with Jenkins: iOS Builds

• http://blog.cloudbees.com/2012/09/continuous-deployment-for-mobile-apps.html

• Continuous Integration for Mobile Apps with Jenkins: Android Builds

• http://blog.cloudbees.com/2012/09/continuous-integration-for-mobile-apps.html

• http://www.youtube.com/user/CloudBeesTV

Page 25: Continuous Deployment and Testing for Mobile Apps The Cloud Revolution Youve Never Heard Of Mark Prichard @CloudBees

Step 2 - BUILD• Next:

• Details of an iOS build

Replay: http://youtu.be/DinMVVKHwTU

• Details of an Android Build

Replay: http://youtu.be/EOogyOv79NE

Page 26: Continuous Deployment and Testing for Mobile Apps The Cloud Revolution Youve Never Heard Of Mark Prichard @CloudBees

Step 3 - TEST• Lots of different testing is possible

• Launching an emulator is level-0 of testing

• SOASTA TouchTest:

• http://youtu.be/ej21BHCxEaI

• http://blog.cloudbees.com/2012/11/continuous-integration-for-mobile-apps.html

Page 27: Continuous Deployment and Testing for Mobile Apps The Cloud Revolution Youve Never Heard Of Mark Prichard @CloudBees

SOASTAWrapper

TouchTest - Setup

AppSOASTA

SaaS

register

iOSiOS

iOSregister

Page 28: Continuous Deployment and Testing for Mobile Apps The Cloud Revolution Youve Never Heard Of Mark Prichard @CloudBees

TouchTest - Record

SOASTA

Wrapper

App

SOASTASaaS

deploy iOS

Recordgestures

Page 29: Continuous Deployment and Testing for Mobile Apps The Cloud Revolution Youve Never Heard Of Mark Prichard @CloudBees

TouchTest – Replay/test

SOASTASaaS

iOSiOS

iOS

Upload App & Replay

Scriptedgestures

RecordResult

Send backResult

CloudBees

Jenkins

InitiateTests

Page 30: Continuous Deployment and Testing for Mobile Apps The Cloud Revolution Youve Never Heard Of Mark Prichard @CloudBees

Build Matrix• Testing mobile application requires testing on

lots of different devices, form factors, etc.

• Create one build job per form factor/generation?

• No!

• Jenkins Build Matrix!

Page 31: Continuous Deployment and Testing for Mobile Apps The Cloud Revolution Youve Never Heard Of Mark Prichard @CloudBees

Jenkins Build Matrix

http://wiki.cloudbees.com/bin/view/DEV/Matrixed_Jenkins_Android_Builds

Page 32: Continuous Deployment and Testing for Mobile Apps The Cloud Revolution Youve Never Heard Of Mark Prichard @CloudBees

Build Matrix – Problem!• Build matrix are very powerful!

• But testing can become costly!

• Fail-Fast

• Organize your testing as a pipeline

• Cheap first, fail-fast

• Expensive as late as possible

Page 33: Continuous Deployment and Testing for Mobile Apps The Cloud Revolution Youve Never Heard Of Mark Prichard @CloudBees

Jenkins Promoted Builds

• Build on several targets: iOS, Android, multiple versions, etc.

• If it fails stop• If it succeeds,

PROMOTE BUILD

#fail #fail #fail

BasicTests

Matrix Tests

QA Approva

l

Release

Mgt#fail

Git notif

• Perform basic testing• Mono

device• Cheap

testing

• Deploy application onto Beta Testers’ devices• Zubhium,

TestFlight, Appaloosa

• QA receives notification of promoted build

• Perform QA validation• Code coverage,

etc.• If not OK stop• If OK,

MANUALLY APPROVE

• Real users testing

• Crash dumps• User reports• Kill switch• Etc.

Zubhium

AndroidEmulators

http://blog.cloudbees.com/2012/11/another-look-at-jenkins-promoted-builds.html

Page 34: Continuous Deployment and Testing for Mobile Apps The Cloud Revolution Youve Never Heard Of Mark Prichard @CloudBees

• CuckooChess• Earlier, simpler version of

DroidFish – no NDK, so builds are quicker

• Code and Instructions

• We’ll show you how to:• Include the Zubhium SDK• Automate push to Zubhium• Support crash reporting/feedback• Add a deliberate bug!

Quick Demo: Beta Testing with Zubhium

© 2013 CloudBees, Inc. All Rights Reserved

Page 35: Continuous Deployment and Testing for Mobile Apps The Cloud Revolution Youve Never Heard Of Mark Prichard @CloudBees

import com.zubhium.ZubhiumSDK;

public class CuckooChess extends Activity implements GUIInterface {

private ZubhiumSDK zubhiumSDK = null;

private final String zubhiumAppKey = "cbbb3f3ef6369131a62b47a96d3ab8";

@Override

public void onCreate(Bundle savedInstanceState) {

super.onCreate(savedInstanceState);

zubhiumSDK = ZubhiumSDK.getZubhiumSDKInstance(this, zubhiumAppKey);

AND</manifest>

<uses-permission android:name="android.permission.INTERNET"/>

<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>

</manifest>

Adding Zubhium SDK is easy

© 2013 CloudBees, Inc.All Rights Reserved

Page 36: Continuous Deployment and Testing for Mobile Apps The Cloud Revolution Youve Never Heard Of Mark Prichard @CloudBees

The Build Pipeline

©2012 CloudBees, Inc. All Rights Reserved

Page 37: Continuous Deployment and Testing for Mobile Apps The Cloud Revolution Youve Never Heard Of Mark Prichard @CloudBees

Push to Zubhium

©2012 CloudBees, Inc. All Rights Reserved

Page 38: Continuous Deployment and Testing for Mobile Apps The Cloud Revolution Youve Never Heard Of Mark Prichard @CloudBees

iOS Beta Testing – TestFlight and Appaloosa

Page 39: Continuous Deployment and Testing for Mobile Apps The Cloud Revolution Youve Never Heard Of Mark Prichard @CloudBees

Mobile + Server?• Makes PaaS value even more obvious

• Use existing Java assets on the back-end

• Communicate through HTTP/etc.

iOS

CloudBeesPaaS

Java App

DB

On-Premise Java App

DB

HTTPS SSL/VPN/HTTPS/etc.

Page 40: Continuous Deployment and Testing for Mobile Apps The Cloud Revolution Youve Never Heard Of Mark Prichard @CloudBees

Private Datacente

rApp on

PaaS

To the Internet

VPCApp on

PaaSTo the

Internet

“Legacy”On-

premises resources

Data Copy ?

Page 41: Continuous Deployment and Testing for Mobile Apps The Cloud Revolution Youve Never Heard Of Mark Prichard @CloudBees

Private Datacente

rApp on

PaaS

To the Internet

VPCApp on

PaaSTo the

Internet

“Legacy”On-

premises resources

Data Copy

1

2

3

Page 42: Continuous Deployment and Testing for Mobile Apps The Cloud Revolution Youve Never Heard Of Mark Prichard @CloudBees

AWS!• Amazon Web Services (AWS) provides plenty

of high-quality services

• Can they be used by mobile phones applications?

RDS DynamoDB SimpleDB ElastiCache

IAM Data Pipeline Flexible Payment S3

Glacier Simple Workflow Simple Queue Simple Notification

Simple Email Etc.

Page 43: Continuous Deployment and Testing for Mobile Apps The Cloud Revolution Youve Never Heard Of Mark Prichard @CloudBees

AWS – Not easy• Not advised to let Mobile app directly access

AWS

• AWS account key would need to be embedded and distributed to all users (!)

• Users stepping on each others, ouch!

• Solution?

Page 44: Continuous Deployment and Testing for Mobile Apps The Cloud Revolution Youve Never Heard Of Mark Prichard @CloudBees

“Token Vending Machine”

• Mobile app “registers” on a server app and…

• Anonymous OR Identity-based TVM available

• Requests a “token” to the server app

• Limited in SCOPE (S3, Notification, Email, etc.)

• Limited in TIME

• Mobile app uses token to use AWS in a constrained fashion

• Easy!

Page 45: Continuous Deployment and Testing for Mobile Apps The Cloud Revolution Youve Never Heard Of Mark Prichard @CloudBees

“Token Vending Machine”

CloudBeesPaaS

TVMApp

AWS S3

1. Request Token

AWS IAM

1.1 Request TokenUsing private AWS Key

2. Uses AWS Service using Token

Page 46: Continuous Deployment and Testing for Mobile Apps The Cloud Revolution Youve Never Heard Of Mark Prichard @CloudBees

Want your own TVM?• Easy! Try our TVM ClickStart

• Just put your AWS Key in the TVM and get going!

http://blog.cloudbees.com/2012/12/token-vending-machine-clickstarts-and.html

Page 47: Continuous Deployment and Testing for Mobile Apps The Cloud Revolution Youve Never Heard Of Mark Prichard @CloudBees

Conclusion• Next.gen software development is all about

TIME-TO-MARKET and FAST ITERATION

• Mobile applications make it even harder!

• No second chance, wide range of devices

• You cannot win by building your own FACTORY

• Use a PaaS – Focus on added-value

• Try it now! Onward!