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

Creating Scratch Org in GH Actions with JWT Prevents Full-Successful scratch org creation run #2500

Closed
jdschleicher opened this issue Sep 29, 2023 · 4 comments
Labels
investigating We're actively investigating this issue validated Version information for this issue has been validated

Comments

@jdschleicher
Copy link

jdschleicher commented Sep 29, 2023

Note
Before you submit your issue, make sure that:

  • You're using the latest version of Salesforce CLI.
  • You've searched both open and closed issues for related posts.
  • You've used the doctor command to diagnose common issues.
  • You understand that GitHub Issues don't adhere to any agreement or SLA.
    • If you require immediate assistance, use official channels such as Salesforce Customer Support.

Summary

With latest cli, we found that when using the JWT authentication method to our DevHub and then creating a scratch org leads to a failure(see message below). An actual scratch org gets created in the devhub but the handoff to the running machine for authentication doesn't seem to work. :

However, when we use authentication method with an existing auth url, then create scratch org, everything works as expected.

{
  "code": 1,
  "context": "EnvCreateScratch",
  "commandName": "EnvCreateScratch",
  "message": "ENOENT: no such file or directory, open '/home/runner/work/vaempl-***/vaempl-***/6f743b10-d45d-4e9e-88d7-[573](https://github.com/department-of-veterans-affairs/vaempl-nca-watrs/actions/runs/6356359479/job/17265830708#step:6:574)0045c66ca'",
  "name": "Error",
  "status": 1,
  "stack": "Error: ENOENT: no such file or directory, open '/home/runner/work/vaempl-***/vaempl-***/6f743b10-d45d-4e9e-88d7-5730045c66ca'",
  "exitCode": 1,
  "warnings": []
}

Steps To Reproduce

IMPORTANT
Provide a repository that's configured to reproduce the issue. If you are unable to provide a repo, please explain why not. The more info we have from the start, the faster we can resolve your issue.
We may close your issue if you don't include proper instructions.

  • Generate a project with sf project generate or fork dreamhouse-lwc.
  • Provide detailed step-by-step instructions on how to reproduce the issue.

using GH Actions:

  1. install latest sfdx cli with ubuntu
  2. authenticate with jwt
  3. create scratch org

Expected result

Scratch org created and CI jobs continue to run

Actual result

scratch org creation command fails

System Information

-- edit -- took out gh actions log

Another repo to look at : https://github.com/jdschleicher/sf-sfdx-cli-version-troubleshooting/actions/runs/6305174475/job/17136572401

look at bottom jobs for scratch org creation:

image

[19:44:23.738] �[32mINFO�[39m (sf:ScratchOrgCache): �[36mReading config file: /home/runner/.sf/scratch-create-cache.json�[39m
2023-09-29T19:44:23.8057696Z [19:44:23.738] �[32mINFO�[39m (sf:ScratchOrgCache): �[36mWriting to config file: /home/runner/.sf/scratch-create-cache.json�[39m
2023-09-29T19:44:23.8058822Z [19:44:23.739] �[34mDEBUG�[39m (sf:scratchOrgCreate): �[36mscratch org has recordId 2SROE00000004Yv4AI�[39m
2023-09-29T19:44:23.8116838Z [19:44:23.739] �[34mDEBUG�[39m (sf:scratchOrgInfoA
{
  "cliVersion": "@salesforce/cli/2.10.2",
  "architecture": "linux-x64",
  "nodeVersion": "node-v18.18.0",
  "osVersion": "Linux 6.2.0-1012-azure",
  "shell": "bash",
  "rootPath": "/usr/local/lib/node_modules/@salesforce/cli",
  "pluginVersions": [
    "@oclif/plugin-autocomplete 2.3.8 (core)",
    "@oclif/plugin-commands 2.2.25 (core)",
    "@oclif/plugin-help 5.2.19 (core)",
    "@oclif/plugin-not-found 2.4.1 (core)",
    "@oclif/plugin-plugins 3.7.1 (core)",
    "@oclif/plugin-search 0.0.22 (core)",
    "@oclif/plugin-update 3.2.3 (core)",
    "@oclif/plugin-version 1.3.10 (core)",
    "@oclif/plugin-warn-if-update-available 2.1.0 (core)",
    "@oclif/plugin-which 2.2.32 (core)",
    "@salesforce/cli 2.10.2 (core)",
    "apex 2.3.15 (core)",
    "auth 2.8.17 (core)",
    "data 2.5.9 (core)",
    "deploy-retrieve 1.18.0 (core)",
    "info 2.6.43 (core)",
    "limits 2.3.34 (core)",
    "login 1.2.31 (core)",
    "marketplace 0.2.2 (core)",
    "org 2.10.8 (core)",
    "packaging 1.25.1 (user)",
    "schema 2.3.26 (core)",
    "settings 1.4.29 (core)",
    "sobject 0.2.7 (core)",
    "source 2.10.34 (core)",
    "telemetry 2.3.3 (core)",
    "templates 55.5.12 (core)",
    "trust 2.6.13 (core)",
    "user 2.3.32 (core)"
  ]
}

Additional information

@jdschleicher jdschleicher added the investigating We're actively investigating this issue label Sep 29, 2023
@github-actions
Copy link

Thank you for filing this issue. We appreciate your feedback and will review the issue as soon as possible. Remember, however, that GitHub isn't a mechanism for receiving support under any agreement or SLA. If you require immediate assistance, contact Salesforce Customer Support.

@github-actions github-actions bot added the validated Version information for this issue has been validated label Sep 29, 2023
@shetzel
Copy link
Contributor

shetzel commented Sep 29, 2023

@jdschleicher - This job https://github.com/jdschleicher/sf-sfdx-cli-version-troubleshooting/actions/runs/6305174475/job/17136573000 is using the Windows CLI tar. Can you instead use an npm install of the CLI or docker image to see if the problem goes away? Also, please let me know if you're able to reproduce this locally.

@shetzel
Copy link
Contributor

shetzel commented Sep 29, 2023

Actually, a teammate noticed that this line is deleting the jwt key file, which is needed for auth again during scratch org creation. If you comment that line it will probably be successful.

@jdschleicher
Copy link
Author

@shetzel my goodness, that was it.

we shortsightedly added that to allow for multiple authentication steps to use the same file name.....

thank you all!!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
investigating We're actively investigating this issue validated Version information for this issue has been validated
Projects
None yet
Development

No branches or pull requests

2 participants