timja / jenkins-gh-issues-poc-06-18

0 stars 0 forks source link

[JENKINS-57565] server.key was unexpected at this time error while building Saleforce using DX #4418

Open timja opened 5 years ago

timja commented 5 years ago

Hi,

 

While building a Salesforce App using multibranch pipeline, I am getting below error. All configs are correct. Git connection successful. Secret file created and id added to path. Could anyone help whats the issue? Using jenkins-2.164.3 - the latest version

 

 

C:\Program Files (x86)\Jenkins\workspace\sfdx_>"C:\Program Files\Salesforce CLI\bin\sfdx" force:auth:jwt:grant --instanceurl https://test.salesforce.com --clientid 3MVG91LYYD8O4krRCwFq8CKUq8aUBCOGyPmIM919iQ8.rJw2w.JLmTNmuk_heggv79**** --jwtkeyfile **** --username ************ --setalias UAT \Jenkins\workspace\sfdx_@tmp\secretFiles\f28291d9-e13f-4537-9ef8-b47ea745880c{color:#FF0000}server.key was unexpected at this time.


Originally reported by manojparida, imported from: server.key was unexpected at this time error while building Saleforce using DX
  • status: Open
  • priority: Critical
  • resolution: Unresolved
  • imported: 2022/01/10
timja commented 5 years ago

yriabinin:

Hi, try to wrap --jwtkeyfile value with double quotes:   

--jwtkeyfile \"${KEY_VARIABLE}\"

timja commented 4 years ago

nickytorstensson:

I have an identical issue. In addition to the bug description:

 

I am able to authorize into Salesforce via the connected app from command prompt with client id (consumer key), username and secret file, as described in this video (see link #4 below, visual guide of link #3).

Workaround is in the script line to reference the file directly on your computer.

 

I tried Yevhenii Riabinin's suggestion on escaping the secret file with quotes (\"). It didn't work, and a different error was thrown: The flag value ""C:\Program" is not in the correct format for "filepath."

 

If it is relevant, I have been following the below guides:

  1. https://medium.com/@r.kurchenko/install-salesforcedx-cli-for-jenkins-builds-2e89495cc80b
  2. https://medium.com/@karthick.shanmugam0689/continous-differential-deployment-with-salesforce-dx-and-jenkins-24ab3192163f
  3. http://amitsalesforce.blogspot.com/2019/01/continuous-integration-using-jenkins-with-salesforceDx.html
  4. https://youtu.be/IvTlx6lBkQY?t=755 - see from 12:02.