reusable build scripts for managed package development (october 14, 2014)

Post on 24-Jun-2015

291 Views

Category:

Technology

0 Downloads

Preview:

Click to see full reader

DESCRIPTION

Reusable Build Scripts for Managed Package Development (October 14, 2014)

TRANSCRIPT

Reusable Build Scripts for Managed Package Development Jason Lantz / Salesforce.com Foundation Lead Release Operations Engineer @jasontlantz

Safe Harbor Safe harbor statement under the Private Securities Litigation Reform Act of 1995: This presentation may contain forward-looking statements that involve risks, uncertainties, and assumptions. If any such uncertainties materialize or if any of the assumptions proves incorrect, the results of salesforce.com, inc. could differ materially from the results expressed or implied by the forward-looking statements we make. All statements other than statements of historical fact could be deemed forward-looking, including any projections of product or service availability, subscriber growth, earnings, revenues, or other financial items and any statements regarding strategies or plans of management for future operations, statements of belief, any statements concerning new, planned, or upgraded services or technology developments and customer contracts or use of our services. The risks and uncertainties referred to above include – but are not limited to – risks associated with developing and delivering new functionality for our service, new products and services, our new business model, our past operating losses, possible fluctuations in our operating results and rate of growth, interruptions or delays in our Web hosting, breach of our security measures, the outcome of any litigation, risks associated with completed and any possible mergers and acquisitions, the immature market in which we operate, our relatively limited operating history, our ability to expand, retain, and motivate our employees and manage our growth, new releases of our service and successful customer deployment, our limited history reselling non-salesforce.com products, and utilization and selling to larger enterprise customers. Further information on potential factors that could affect the financial results of salesforce.com, inc. is included in our annual report on Form 10-K for the most recent fiscal year and in our quarterly report on Form 10-Q for the most recent fiscal quarter. These documents and others containing important disclosures are available on the SEC Filings section of the Investor Information section of our Web site. Any unreleased services or features referenced in this or other presentations, press releases or public statements are not currently available and may not be delivered on time or at all. Customers who purchase our services should make the purchase decisions based upon features that are currently available. Salesforce.com, inc. assumes no obligation and does not intend to update these forward-looking statements.

Use to introduce a

demo, video, Q&A, etc. Background

CumulusCI Reusable build and automation scripts to implement a best practices based development and release workflow for managed package development. Built by the Salesforce Foundation and released open source https://github.com/SalesforceFoundation/CumulusCI

Codeship.io Cloud hosted continuous integration platform with free plans for up to 100 builds per month (free unlimited for open source projects) Easy to setup with CumulusCI in about 15 minutes https://codeship.io

Grant Lifecycle App Open source unmanaged package to help nonprofits track grants received from foundations. Funded by a Force for Change grant from the Salesforce Foundation and developed by Bridge Farm Consulting https://github.com/britishboyindc/GrantLifecycleApp

Force for Change Grants The Force for Change grants program strives to accelerate innovation in the nonprofit and higher education sectors. The 2014 Force for Change grants program provides up to $1,500,000 in grants, individual awards up to $250,000 http://www.salesforcefoundation.org/grants/force-for-change/

Goal

Make the Grant Lifecycle App easier to develop and release as a managed package by using CumulusCI & Codeship.io to automate the process

Use to introduce a

demo, video, Q&A, etc. Demo

Demo Setup • Forked to https://github.com/jlantz/GrantLifecycleApp • Assigned namespace (npsprep_df14_1) • Changed to support dynamic namespace prefixing

–  Upgrade to API 31.0 –  Add UTIL_Namespace class to detect if running in a managed package and

dynamically handle difference between unmanaged and managed deployments –  Not dynamically rewriting code to insert namespace prefixes as part of build!

• Configure CumulusCI • https://github.com/jlantz/GrantLifecycleApp/compare/britishboyindc:master...master

Demo Roadmap • Make our package require another package • Test the change • Human: Submit a Pull Request • Merge the Pull Request • Upload and test a Beta Managed Package • Merge master to all open feature branches • Test all open feature branches after merge

Manual vs Automated Process

Use to introduce a

demo, video, Q&A, etc. Configuration

Configuring CumulusCI Build Scripts • git clone https://github.com/SalesforceFoundation/CumulusCI • export CUMULUSCI_PATH=~/CumulusCI (or wherever you cloned it to) • Copy from CumulusCI into your project

–  template/build.xml –  template/cumulusci.properties –  template/version.properties

• Edit build.xml • Edit cumulusci.properties • Edit version.properties (only if building an extension package)

Configuring Automation via Codeship.io • Copy template/codeship.sh from CumulusCI into project repository • Connect Codeship to project repository on GitHub • Enter Test Command:

bash codeship.sh • Setup Environment Variables in Codeship

–  SF_USERNAME_FEATURE (MASTER, PACKAGING, BETA, RELEASE) –  SF_PASSWORD_FEATURE (MASTER, PACKAGING, BETA, RELEASE) –  SF_SERVERURL_FEATURE (MASTER, PACKAGING, BETA, RELEASE) –  GITHUB_ORG_NAME –  GITHUB_REPO_NAME –  GITHUB_USERNAME –  GITHUB_PASSWORD –  Oauth Token to packaging org - https://cumulusci-oauth-tool.herokuapp.com/

Use to introduce a

demo, video, Q&A, etc. CumulusCI Build Features

CumulusCI Main Build Targets • deployDevOrg

–  Sets up a new dev org

• deployCI –  Tests as unmanaged metadata

• deployCIPackageOrg –  Deploys to managed package in packaging org and tests

• deployManagedBeta –  Installs beta managed package and tests

• deployManaged –  Installs production released managed package and tests

Handling Unpackaged Metadata Sometimes you need to deploy metadata before or after the build which you don’t want to include in your package In your repository, populate unpackaged metadata as subfolders under: • unpackaged/pre/* • unpackaged/post/* • unpackaged/NAMESPACE/pre/* • unpackaged/NAMESPACE/post/*

CumulusCI will automatically deploy these “metadata bundles” at the right place in the build.

Hooking in Custom Logic • CumulusCI defines a number of pre and post hooks which you can override in your package’s build.xml

• Example 1: Run custom logic after the src directory is deployed in any build

<target  name=“postDeploy”>      YOUR  CUSTOM  ACTIONS  HERE    </target>  

• Example 2: Run custom logic before the uninstall target is run <target  name=“preUninstall”>      YOUR  CUSTOM  ACTIONS  HERE    </target>

• Option 2: Environment Variables • SF_USERNAME • SF_PASSWORD • SF_SERVERURL

DE Org Credentials Option 1: build.properties •  sf.username=YOUR_USER •  sf.password=PASS+TOKEN •  sf.serverurl=https://login.salesforce.com

Add build.properties to your .gitignore!

top related