diff --git a/Jenkinsfile b/Jenkinsfile index 6176ffd4..a466b3a4 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -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. @@ -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 @@ -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.' } @@ -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.' } @@ -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); } } diff --git a/src/classes/MyClass.cls b/src/classes/MyClass.cls index 51e359d4..1b3a8f35 100644 --- a/src/classes/MyClass.cls +++ b/src/classes/MyClass.cls @@ -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'; } }