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

When switching to GitHub Actions with windows-latest, installing sf cli with npm takes 5-10 minutes #2436

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

Comments

@jdschleicher
Copy link

jdschleicher commented Aug 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

Had to recently switch to windows-latest to workaround "Admin not found in package.xml" error.

Now the sfdx-cli install command takes 5-10 minutes ever time compared to 45s with ubuntu-latest

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.

Change runs-on to windows-latest

install sfdx cli:
npm install --global @salesforce/cli@latest

Expected result

Does not take 5-10 minutes

Actual result

Takes 5-10 minutes to install

System Information

{
  "cliVersion": "@salesforce/cli/2.5.8",
  "architecture": "win32-x64",
  "nodeVersion": "node-v18.17.1",
  "osVersion": "Windows_NT 10.0.20348",
  "shell": "cmd.exe",
  "rootPath": "C:\\npm\\prefix\\node_modules\\@salesforce\\cli",
  "pluginVersions": [
    "@oclif/plugin-autocomplete 2.3.6 (core)",
    "@oclif/plugin-commands 2.2.22 (core)",
    "@oclif/plugin-help 5.2.17 (core)",
    "@oclif/plugin-not-found 2.3.37 (core)",
    "@oclif/plugin-plugins 3.2.6 (core)",
    "@oclif/plugin-search 0.0.22 (core)",
    "@oclif/plugin-update 3.1.32 (core)",
    "@oclif/plugin-version 1.3.8 (core)",
    "@oclif/plugin-warn-if-update-available 2.0.48 (core)",
    "@oclif/plugin-which 2.2.30 (core)",
    "@salesforce/cli 2.5.8 (core)",
    "apex 2.3.10 (core)",
    "auth 2.8.12 (core)",
    "data 2.5.6 (core)",
    "deploy-retrieve 1.17.5 (core)",
    "info 2.6.39 (core)",
    "limits 2.3.30 (core)",
    "login 1.2.26 (core)",
    "org 2.10.0 (core)",
    "schema 2.3.23 (core)",
    "settings 1.4.25 (core)",
    "sobject 0.2.4 (core)",
    "source 2.10.31 (core)",
    "telemetry 2.3.0 (core)",
    "templates 55.5.10 (core)",
    "trust 2.6.1 (core)",
    "user 2.3.28 (core)"
  ]
}

Additional information

image

@jdschleicher jdschleicher added the investigating We're actively investigating this issue label Aug 29, 2023
@github-actions github-actions bot added the validated Version information for this issue has been validated label Aug 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.

@AllanOricil
Copy link

AllanOricil commented Aug 31, 2023

@jdschleicher

Instead of installing build dependencies while the pipeline is running, use a docker image that has sfdx and node in it already. Pulling an image takes seconds. Salesforce has images available in docker hub.

Make the container attribute a repo variable so that you can easily swap images when new versions are released. This will help u to avoid adding dummy commits to ur repository. Be careful to not use :latest tags when selecting the image version. Always specify the hash of the image.

If u need further help dm me on LinkedIn. I'm a github actions specialist hahahaha

@mshanemc
Copy link
Contributor

We use windows-latest on our CI, and see similar numbers (4 min is more common, but there are days!)

Screenshot 2023-08-31 at 1 21 22 PM

we've got some open work for continuing to shrink the CLI's dependency tree (jsforce in particular!) which will help marginall.

Other than that, we've no control of github's runners or especially the atrocious perf of FS on windows (installing a bunch of small files like node does) so I'm closing this one.

@AllanOricil
Copy link

image

@jdschleicher
Copy link
Author

jdschleicher commented Sep 14, 2023

@AllanOricil i will definitely be reaching out soon :) and THANK YOU!!!!

I got really frustrated last night as some of the feedback I was hoping to get for some new functionality was dependent upon sfdx cli install so I dove in on trying to figure out how to leverage a windows salesforce cli tar install approach. Haven't done a full end-2-end test yet to confirm if old cli commands are still working as expected but I have been able to confirm the install takes under 2 minutes consistently. ( docker still very much seems like something we want to do ). I was also able to create a fully validated package version.



### INSTALL SALESFORCE CLI
Install-Module -Name 7Zip4Powershell -RequiredVersion 2.0.0 -Force

$sf_cli_tar_xz_path = "sf-cli.tar.xz"
$sf_cli_tar_path = "sf-cli"
$sf_cli_tar_file = "sf-cli.tar"

Write-Host " Download Salesforce CLI tar file"
Invoke-WebRequest -Uri "https://developer.salesforce.com/media/salesforce-cli/sf/channels/stable/sf-win32-x64.tar.xz" -OutFile "$sf_cli_tar_xz_path"

Write-Host " Extract the downloaded tar file"
Expand-7Zip -TargetPath $sf_cli_tar_path -ArchiveFileName "$sf_cli_tar_xz_path"

tar -xvf "$sf_cli_tar_path/$sf_cli_tar_file" -C sf-cli

### BELOW CAN BE IN NEW STEP 

if (!(Test-Path -Path $PROFILE)) {
    New-Item -ItemType File -Path $PROFILE -Force
}

# Add "sf" command alias to all powershell instances with the GitHub Actions job
$sf_alias = @"
`n Set-Alias -Name sf -Value '.\sf-cli\sf\bin\sf'
"@
Add-Content -Path $PROFILE -Value $sf_alias

# Add "sfdx" alias for CI jobs that have not been updated yet
$sfdx_alias = @"
`n Set-Alias -Name sfdx -Value '.\sf-cli\sf\bin\sf'
"@
Add-Content -Path $PROFILE -Value $sfdx_alias

# INITIATE PROFILE FOR ALIASES TO REGISTER
. $PROFILE


image

@mshanemc if using tar install may be frowned upon for windows please let me know :)

@mshanemc
Copy link
Contributor

AFAIK docker on github actions doesn't support windows. We definitely don't have a docker image for the CLI built on windows.

@AllanOricil
Copy link

Is there a reason why you are using windows?

@jdschleicher
Copy link
Author

@AllanOricil we have a strange error we are hitting in ubuntu. I thought we were dead-in-the-water and just so happened to try windows and ended up not receiving the error. I have no idea what about what in the windows systems it works lol. We have an actual Salesforce case open with our account as well. So far still in research.

The error was the same for about all things related with package version creation/installation.

(not sure if i should add the issue here if it messes with the issue management)
its documented here: #2427

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

3 participants