Fun with Jenkins & Salesforce

22
Fun with “Jenkins & Salesforce”

Transcript of Fun with Jenkins & Salesforce

Page 1: Fun with Jenkins & Salesforce

Fun with

“Jenkins & Salesforce”

Page 2: Fun with Jenkins & Salesforce

Who I am ?

● Abhinav Gupta● Salesforce MVP & Architect.● In love with Salesforce since

2008.● Founder of Concretio Apps,

ISV and PDO Partner.● t: @abhinavguptas

Page 3: Fun with Jenkins & Salesforce

Agenda

Credits : http://www.jimcarreyonline.com/

Page 4: Fun with Jenkins & Salesforce

Agenda - Real :-)

1. Overview of Jenkins & Force.com Migration Tool.

2. Code versioning practices.3. How could we improve ?4. Automating the same via Jenkins

Page 5: Fun with Jenkins & Salesforce

What is Jenkins

Credits: https://www.cloudbees.com/jenkins/about

Page 6: Fun with Jenkins & Salesforce

Force.com Migration Tool

Credits: https://developer.salesforce.com/docs/atlas.en-us.daas.meta/daas/

Page 7: Fun with Jenkins & Salesforce

Code Versioning Practices

How mostly devs do

Page 8: Fun with Jenkins & Salesforce

Manual Folder Backups

- Folder is created out of Force.com IDE downloads- Date is added to timestamp along with client name

Page 9: Fun with Jenkins & Salesforce

What’s the problem in it ?

- It sucks :( - Not backed up on server/cloud/hosting- No way for multiple devs to collaborate- No easy way to figure out change log.- It’s depressing and scares me a lot, really :-/

Page 10: Fun with Jenkins & Salesforce

How it could be better ?

● Use Force.com Migration Tool○ It will simplify metadata download○ Mostly one line command, after build.xml setup○ Requires least coding knowledge, mostly a simple

xml editing skill is required.● Use GIT

○ Many git hostings i.e. github, bitbucket etc are available

○ Can work well with Force.com migration tool.

Page 11: Fun with Jenkins & Salesforce

Even Better World ?

● Use Jenkins !○ Its free and open source○ Openshift and other providers offer Free hostings. ○ It can work well with Force.com migration tool○ It works like charm with GIT○ Automate simple nightly code backups.○ Once comfortable, use it like PRO, and do multi

org/sandbox strategy with your clients.

Page 12: Fun with Jenkins & Salesforce

Live Demo

● A Simple nightly code back Job on Jenkins● Auto checkout of required metadata ● Auto commit+push into GIT (bitbucket

private repo)● Hosted for free on https://www.openshift.

com/

Page 13: Fun with Jenkins & Salesforce

Jenkins Job Overview

A simple job for metadata backup in GIT

Page 14: Fun with Jenkins & Salesforce

Jenkins Job Overview

Runs periodically at 3 AM India Time, when even most messed up developer is slept

Page 15: Fun with Jenkins & Salesforce

Masked Passwords PluginPasswords are no more visible after entry, not even in console (ssh could be even better for GIT)Jenkins Plugin: https://wiki.jenkins-ci.org/display/JENKINS/Mask+Passwords+Plugin

Page 16: Fun with Jenkins & Salesforce

Clone Project GIT repo

Clone repo if it’s not already done

Page 17: Fun with Jenkins & Salesforce

Create build.xml on the fly

We don’t want to version build.xml, and want it easy to tweak, thus generate on the flyJenkins Plugin: https://wiki.jenkins-ci.org/display/JENKINS/Text+File+Operations+Plugin

Page 18: Fun with Jenkins & Salesforce

Create package.xml on the flyWe don’t want to version package.xml, and want it easy to tweak, thus generate on the fly(Add more metadata types(triggers, objects, etc) to package.xml, it’s kept simple for quick downloads)Jenkins Plugin: https://wiki.jenkins-ci.org/display/JENKINS/Text+File+Operations+Plugin

Page 19: Fun with Jenkins & Salesforce

Fetch Salesforce metadata

Use Force.com Migration Tool (ANT)to fetch required Salesforce metadata (as per package.xml)

Page 20: Fun with Jenkins & Salesforce

Push into GIT

Push fetched Metadata into GIT. Git ANT tasks could be used here to do the same.

Page 21: Fun with Jenkins & Salesforce

Code reviews Once code is in bitbucket or github online repo, peer/architect code reviews can be conducted on commits. It’s quite easy to point out a single line of code having issue, and describe what is needed (way better than word docs, or excel spreadsheets).

Page 22: Fun with Jenkins & Salesforce

Q & A

Thanks

Abhinav Guptat: @abhinavguptas