0

Below doesn't work. Please let me know what the issue is.

sh label: 'Salesforce Validation on ' + salesforceEnvironment,
script: 'sfdx force:source:deploy --verbose' + checkOnlyParam + ' --wait 1440 --manifest manifest/package.xml --targetusername ' + salesforceEnvironment > SalesForceValidation.log

Jayan
  • 18,003
  • 15
  • 89
  • 143
Varun
  • 35
  • 4
  • Could add more detail , for example error displayed during the job execution. – YLR Sep 17 '21 at 10:04
  • In case you'd like to have the `sh` script's `stdout` (and `stderr` and `status`) passed back to your pipeline script see [How to return stdout and stderr together with the status from a Jenkins Pipeline sh script step](https://stackoverflow.com/q/68967642/1744774). – Gerold Broser Sep 18 '21 at 02:11

2 Answers2

2

Use ${...} for string interpolation inside a GString:

sh  label: "Salesforce Validation on ${salesforceEnvironment}",
    script: """
        sfdx force:source:deploy
        --verbose ${checkOnlyParam}
        --wait 1440
        --manifest manifest/package.xml
        --targetusername ${salesforceEnvironment} > SalesForceValidation.log
        """
Gerold Broser
  • 14,080
  • 5
  • 48
  • 107
Melkjot
  • 498
  • 3
  • 13
  • 2
    Reference: [Groovy Syntax, String interpolation](https://groovy-lang.org/syntax.html#_string_interpolation) ... Mei, a Steirer! Griaß di! :) – Gerold Broser Sep 18 '21 at 02:13
  • 1
    (on groovy) Using triple-double-quote may improve readability : https://stackoverflow.com/questions/37464887/vs-vs-in-groovy-when-to-use-what – Jayan Sep 18 '21 at 17:46
0

Below worked

tee('SalesForceValidation.log') { sh label: 'Salesforce Validation on ' + salesforceEnvironment, script: 'sfdx force:source:deploy --verbose' + checkOnlyParam + ' --wait 1440 --manifest manifest/package.xml --targetusername ' + salesforceEnvironment }

Varun
  • 35
  • 4