Fun with Jenkins & Salesforce
-
Upload
abhinv-gupta -
Category
Technology
-
view
164 -
download
0
Transcript of Fun with Jenkins & Salesforce
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
Agenda
Credits : http://www.jimcarreyonline.com/
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
What is Jenkins
Credits: https://www.cloudbees.com/jenkins/about
Force.com Migration Tool
Credits: https://developer.salesforce.com/docs/atlas.en-us.daas.meta/daas/
Code Versioning Practices
How mostly devs do
Manual Folder Backups
- Folder is created out of Force.com IDE downloads- Date is added to timestamp along with client name
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 :-/
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.
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.
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/
Jenkins Job Overview
A simple job for metadata backup in GIT
Jenkins Job Overview
Runs periodically at 3 AM India Time, when even most messed up developer is slept
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
Clone Project GIT repo
Clone repo if it’s not already done
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
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
Fetch Salesforce metadata
Use Force.com Migration Tool (ANT)to fetch required Salesforce metadata (as per package.xml)
Push into GIT
Push fetched Metadata into GIT. Git ANT tasks could be used here to do the same.
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).
Q & A
Thanks
Abhinav Guptat: @abhinavguptas