Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
wadewegner committed Oct 19, 2016
0 parents commit 42bbcd8
Show file tree
Hide file tree
Showing 120 changed files with 3,789 additions and 0 deletions.
10 changes: 10 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
.DS_Store
.appcloud
.project
.salesforce
.settings
node_modules
.idea

selenium-client-jars/
testArtifacts/
12 changes: 12 additions & 0 deletions .project
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>dreamhouse-devkeynote-sdx</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
</buildSpec>
<natures>
<nature>mega.lightning.lightningNature</nature>
</natures>
</projectDescription>
20 changes: 20 additions & 0 deletions .tern-project
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"plugins": {
"guess-types": {

},
"outline": {

},
"doc_comment": {

},
"aura": {
"ide": true
}
},
"libs": [
"ecma5",
"browser"
]
}
72 changes: 72 additions & 0 deletions Jenkinsfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
#!groovy
import groovy.json.JsonSlurperClassic
node {

def SERIAL = System.currentTimeMillis()
def BRANCH = env.BRANCH_NAME.replaceAll(/[\/\\]/, '')
def BUILD_NUMBER=env.BUILD_NUMBER
def RUN_ARTIFACT_DIR="tests/${BUILD_NUMBER}"
def SFDC_USERNAME="ci-${BRANCH}-${SERIAL}-pr@dhci.com"
def CONNECTED_APP_CALLBACK_URL=env.CONNECTED_APP_CALLBACK_URL
def SIGN_UP_EMAIL=env.SIGN_UP_EMAIL
def API_VERSION=env.API_VERSION

// Hard coding until pete can repair the damage
// def HUB_ORG=env.HUB_ORG_DH
// def HUB_KEY=env.HUB_KEY_FILE_PATH
// def SFDC_HOST = env.SFDC_HOST
// def CONNECTED_APP_CONSUMER_KEY=env.CONNECTED_APP_CONSUMER_KEY
def HUB_ORG="wade.wegner@acdxgs0hub.org"
def HUB_KEY="jenkins/server_adcxgs0hub.my.salesforce.com.key"
def SFDC_HOST="https://adcxgs0hub.my.salesforce.com"
def CONNECTED_APP_CONSUMER_KEY="3MVG9SemV5D80oBfPBCgboxuJ9df3F8MrzZxhqU5qeUb5MoRs.vuBNHRhhdMh2WDeh5cFiAXcv9z2PnZ7CScu"

def toolbelt = tool 'toolbelt'

stage('checkout source') {
// when running in multi-branch job, one must issue this command
checkout scm
}

stage('Create Scratch Org') {

rc = sh returnStatus: true, script: "${toolbelt}/sfdx force:org:authorize -i ${CONNECTED_APP_CONSUMER_KEY} -u ${HUB_ORG} -f ${HUB_KEY} -y debug"
if (rc != 0) { error 'hub org authorization failed' }

// need to pull out assigned username
rmsg = sh returnStdout: true, script: "${toolbelt}/sfdx force:org:create -f config/workspace-scratch-def.json -j -t test -y debug"
printf rmsg
def jsonSlurper = new JsonSlurperClassic()
def robj = jsonSlurper.parseText(rmsg)
if (robj.status != "ok") { error 'org creation failed: ' + robj.message }
SFDC_USERNAME=robj.username
robj = null

}

stage('Push To Test Org') {
rc = sh returnStatus: true, script: "${toolbelt}/sfdx force:src:push --all --username ${SFDC_USERNAME} -y debug"
if (rc != 0) {
error 'push all failed'
}
// assign permset
rc = sh returnStatus: true, script: "${toolbelt}/sfdx force:permset:assign --username ${SFDC_USERNAME} --name DreamHouse -y debug"
if (rc != 0) {
error 'push all failed'
}
}

stage('Run Apex Test') {
sh "mkdir -p ${RUN_ARTIFACT_DIR}"
timeout(time: 120, unit: 'SECONDS') {
rc = sh returnStatus: true, script: "${toolbelt}/sfdx force:apex:test --testlevel RunLocalTests --outputdir ${RUN_ARTIFACT_DIR} --reporter tap --username ${SFDC_USERNAME} -y debug"
if (rc != 0) {
error 'apex test run failed'
}
}
}

stage('collect results') {
junit keepLongStdio: true, testResults: 'tests/**/*-junit.xml'
}
}
6 changes: 6 additions & 0 deletions Procfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Deploy source to SALESFORCE_URL org.
release: bin/release

# Redirect all Heroku app domain requests to SALESFORCE_URL org.
# Defaults to /one/one.app, configurable via SALESFORCE_START_URL config var.
web: .salesforce/node/bin/node .salesforce/force.js redirect
18 changes: 18 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#DreamHouse Developer Keynote Demo

[![Deploy on Heroku](https://www.herokucdn.com/deploy/button.svg)](https://heroku.com/deploy)

### Source-based deploy

On the command line:

```bash
git clone https://github.com/heroku/dreamhouse-deveynote-sdx
cd dreamhouse-sdx

heroku create
heroku addons:create salesforce
heroku buildpacks:add -i 1 https://github.com/heroku/salesforce-buildpack.git

git push heroku master
```
26 changes: 26 additions & 0 deletions app-ci-apex-only.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"name": "sfdx-simple",
"description": "Simple Salesforce Developer Experience Force.com Applicaiton demonstrating Force.com and Heroku Integration",
"repository": "https://github.com/forcedotcom/simple-sfdx",
"logo": "https://avatars0.githubusercontent.com/u/464563?v=3&s=200",
"addons": [
"salesforce",
"salesforcedx",
"force.com",
"heroku"
],
"addons": [
"salesforce"
],
"buildpacks": [
{
"url": "https://github.com/heroku/salesforce-buildpack"
}
],
"scripts": {
"test-setup": "node .salesforce/force.js release",
"test": "heroku force:apex:test --reporter tap"
},
"env": {
}
}
26 changes: 26 additions & 0 deletions app-ci.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"name": "Dreamhouse Salesforce DX Demo",
"description": "Dreamforce Force.com Application demonstrating Salesforce DX and Heroku Integration",
"repository": "https://github.com/forcedotcom/dreamhouse-devkeynote-sdx",
"logo": "https://avatars0.githubusercontent.com/u/464563?v=3&s=200",
"keywords": [
"salesforce",
"salesforcedx",
"force.com",
"heroku"
],
"addons": [
"salesforce"
],
"buildpacks": [
{
"url": "https://github.com/heroku/salesforce-buildpack"
}
],
"scripts": {
"test-setup": "node .salesforce/force.js release",
"test": "test/test.sh"
},
"env": {
}
}
30 changes: 30 additions & 0 deletions app.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"name": "Dreamhouse Salesforce DX Demo",
"description": "Dreamforce Force.com Application demonstrating Salesforce DX and Heroku Integration",
"repository": "https://github.com/forcedotcom/dreamhouse-devkeynote-sdx",
"logo": "https://avatars0.githubusercontent.com/u/464563?v=3&s=200",
"keywords": [
"salesforce",
"salesforcedx",
"force.com",
"heroku"
],
"addons": [
"salesforce"
],
"buildpacks": [
{
"url": "https://github.com/heroku/salesforce-buildpack"
}
],
"env": {
"HEROKU_APP_NAME": {
"description": "Provided to buildpacks by the Heroku platform when required:true. Need for Pipelines stage-awareness.",
"required": true
},
"SALESFORCE_HUB_URL": {
"description": "Required for Review apps to create orgs",
"required": true
}
}
}
45 changes: 45 additions & 0 deletions bin/extra-org-setup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
#!/usr/bin/env bash

##
# Performs additional setup on Dreamhouse org.
#
# This script:
# - Enables Dreamhouse PermissionSet on configured workspace,
# - Loads sample data.
#
# Requires Heroku CLI and AppCloud and Force.com CLI
# plugins which are installed by Salesforce Buildpack.
##

# Debug, echo every command
#set -x


SCRATCH_ORG=org@salesforce.com
HEROKU_CLIENT=heroku

runCmd() {
local cmnd="$*"
local ret_code

echo $cmnd
eval $cmnd
ret_code=$?
if [ $ret_code != 0 ]; then
printf "Error : [%d] when executing command: '$cmnd'" $ret_code
exit $ret_code
fi
}

# Set perms on apps and objects
echo "Enabling Dreamhouse PermissionSet for App and SObject visibility..."
runCmd "$HEROKU_CLIENT force:permset:assign --name DreamHouse"


if [ "$LOAD_DATA" != false ]; then
# Load the Properties, Favorites, & Brokers into the Salesforce org
echo "Loading Dreamhouse data..."
runCmd "$HEROKU_CLIENT force:data:import --plan data/sample-data-plan.json"
fi

exit 0
38 changes: 38 additions & 0 deletions bin/release
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#!/usr/bin/env bash

##
# Script called in release phase of Heroku app deployment.
#
# This script:
# - Deploys Force.com source to workspace org,
# - Installs AppCloud and Force.com CLI plugins,
# -
#
# Assumes Heroku CLI already installed.
##

START_TIME=$SECONDS

# Fail immediately on non-zero exit code.
set -e
# Fail immediately on non-zero exit code within a pipeline.
set -o pipefail
# Fail on undeclared variables.
set -u
# Debug, echo every command
#set -x

SCRIPT_DIR="$( cd "$( dirname "$0" )" && pwd )"

# Pushes source to the Salesforce org
node .salesforce/force.js release

# Set a password for the admin user and write it out to the log
#npm run set-org-password

# Perform extra org setup
chmod +x $SCRIPT_DIR/extra-org-setup.sh
sh $SCRIPT_DIR/extra-org-setup.sh

echo "DONE! Completed in $(($SECONDS - $START_TIME))s"
exit 0
11 changes: 11 additions & 0 deletions config/enterprise-scratch-def.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"Company": "ACME Org",
"Country": "US",
"LastName": "Wegner",
"Email": "wade.wegner@salesforce.com",
"Edition": "Enterprise",
"OrgPreferences" : {
"S1DesktopEnabled" : true,
"ChatterEnabled" : false
}
}
12 changes: 12 additions & 0 deletions config/unlimited-multicurrency-scratch-def.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"Company": "ACME Org",
"Country": "US",
"LastName": "Wegner",
"Email": "wade.wegner@salesforce.com",
"Edition": "Unlimited",
"Features": "Multicurrency",
"OrgPreferences" : {
"ChatterEnabled" : false,
"IsOrdersEnabled" : true
}
}
10 changes: 10 additions & 0 deletions config/workspace-scratch-def.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"Company": "ACME Org",
"Country": "US",
"LastName": "Wegner",
"Email": "wade.wegner@salesforce.com",
"TemplateId": "0TTB0000000A6Bd",
"OrgPreferences" : {
"S1DesktopEnabled" : true
}
}
11 changes: 11 additions & 0 deletions config/workspace-scratch-def.json.jim
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"Company": "ACME Org",
"Country": "US",
"LastName": "Wegner",
"Email": "wade.wegner@salesforce.com",
"Edition": "Enterprise",
"OrgPreferences" : {
“ChatterEnabled” : false,
"IsOrdersEnabled" : true
}
}
Loading

0 comments on commit 42bbcd8

Please sign in to comment.