Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature1 #11

Open
wants to merge 22 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 19 additions & 4 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,15 @@ node {
def SF_USERNAME=env.SF_USERNAME
def SERVER_KEY_CREDENTIALS_ID=env.SERVER_KEY_CREDENTIALS_ID
def DEPLOYDIR='src'
def TEST_LEVEL='RunLocalTests'
def TEST_LEVEL='NoTestRun'
def WORKSPACE = env.WORKSPACE


def toolbelt = tool 'toolbelt'





// -------------------------------------------------------------------------
// Check out code from source control.
Expand All @@ -20,6 +24,13 @@ node {
checkout scm
}

stage('copy files to local workspace'){
echo "${env.JOB_NAME}"
echo "${WORKSPACE}"
sh "mkdir -p ${WORKSPACE}/src_copy"
sh "cp -R ${DEPLOYDIR} src_copy"
}


// -------------------------------------------------------------------------
// Run all the enclosed stages with access to the Salesforce
Expand All @@ -32,7 +43,9 @@ node {
// -------------------------------------------------------------------------

stage('Authorize to Salesforce') {
rc = command "${toolbelt}/sfdx force:auth:jwt:grant --instanceurl https://test.salesforce.com --clientid ${SF_CONSUMER_KEY} --jwtkeyfile ${server_key_file} --username ${SF_USERNAME} --setalias UAT"
rl = command "${toolbelt}/sfdx force:auth:logout -p -u ${SF_USERNAME}"

rc = command "${toolbelt}/sfdx force:auth:jwt:grant --instanceurl https://login.salesforce.com --clientid ${SF_CONSUMER_KEY} --jwtkeyfile ${server_key_file} --username ${SF_USERNAME} --setalias UAT"
if (rc != 0) {
error 'Salesforce org authorization failed.'
}
Expand All @@ -44,7 +57,7 @@ node {
// -------------------------------------------------------------------------

stage('Deploy and Run Tests') {
rc = command "${toolbelt}/sfdx force:mdapi:deploy --wait 10 --deploydir ${DEPLOYDIR} --targetusername UAT --testlevel ${TEST_LEVEL}"
rc = command "${toolbelt}/sfdx force:mdapi:deploy --wait 10 --deploydir src_copy/${DEPLOYDIR} --targetusername ${SF_USERNAME} --testlevel ${TEST_LEVEL}"
if (rc != 0) {
error 'Salesforce deploy and test run failed.'
}
Expand All @@ -62,12 +75,14 @@ node {
// }
//}
}

}


def command(script) {
if (isUnix()) {
return sh(returnStatus: true, script: script);
} else {
return bat(returnStatus: true, script: script);
return bat(returnStatus: true, script: script);
}
}
4 changes: 2 additions & 2 deletions src/classes/MyClass.cls
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
public with sharing class MyClass {
public MyClass() {

system.debug('cons');
}

public String getAppVersion() {
return '1.0.0';
return '2.0.0';
}
}