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

Sandbox Refreshes Not Possible through CLI #2627

Closed
mcarvin8 opened this issue Jan 2, 2024 · 6 comments
Closed

Sandbox Refreshes Not Possible through CLI #2627

mcarvin8 opened this issue Jan 2, 2024 · 6 comments
Labels
investigating We're actively investigating this issue validated Version information for this issue has been validated

Comments

@mcarvin8
Copy link

mcarvin8 commented Jan 2, 2024

Summary

New sandboxes can be created using the CLI, but existing sandboxes cannot be refreshed using the CLI.

I understand this issue has been around for years at this point based on some searches. I don't see any active GitHub issues for this so I decided to open this one to re-spark this topic.

Here's the terminal output when trying to refresh an existing sandbox.

sf org create sandbox --name Carvin --license-type Developer --alias MyDevSandbox --target-org PROD  --set-default
=== Config Sandbox Request

 Field       Value     
 ─────────── ───────── 
 SandboxName Carvin    
 LicenseType Developer 
? Is the configuration correct? Yes
Sandbox Create... done
Error (1): duplicate value found: SandboxName duplicates value on record with id: 0GQ5a0000004UVHGA2

To create and refresh sandboxes programmatically at the moment, I have to use the Tooling API.

Steps To Reproduce

  1. Run the sf org create sandbox command with an existing sandbox name
  2. Press Y to confirm configuration

Expected result

Creation of new sandboxes and refreshes of existing sandboxes are initiated.

Actual result

The creation of a new sandbox is initiated.

Sandbox refresh of an existing sandbox fails to initialize due to a duplicate value error.

System Information

PowerShell on Windows 11

{
  "architecture": "win32-x64",
  "cliVersion": "@salesforce/cli/2.21.8",
  "nodeVersion": "node-v20.10.0",
  "osVersion": "Windows_NT 10.0.22621",
  "rootPath": "C:\\Program Files\\sf\\client",
  "shell": "cmd.exe",
  "pluginVersions": [
    "@oclif/plugin-autocomplete 3.0.2 (core)",
    "@oclif/plugin-commands 3.0.7 (core)",
    "@oclif/plugin-help 6.0.7 (core)",
    "@oclif/plugin-not-found 3.0.4 (core)",
    "@oclif/plugin-plugins 4.1.9 (core)",
    "@oclif/plugin-search 1.0.8 (core)",
    "@oclif/plugin-update 4.1.4 (core)",
    "@oclif/plugin-version 2.0.8 (core)",
    "@oclif/plugin-warn-if-update-available 3.0.5 (core)",
    "@oclif/plugin-which 3.0.11 (core)",
    "@salesforce/cli 2.21.8 (core)",
    "apex 3.0.8 (core)",
    "auth 3.0.10 (core)",
    "data 3.0.5 (core)",
    "deploy-retrieve 2.2.3 (core)",
    "info 3.0.7 (core)",
    "limits 3.0.5 (core)",
    "marketplace 1.0.10 (core)",
    "org 3.1.1 (core)",
    "packaging 1.27.10 (core)",
    "schema 3.0.8 (core)",
    "settings 2.0.9 (core)",
    "sobject 1.0.5 (core)",
    "source 3.0.3 (core)",
    "telemetry 3.1.4 (core)",
    "templates 56.0.4 (core)",
    "trust 3.1.2 (core)",
    "user 3.1.0 (core)",
    "sfdx-git-delta 5.31.1 (user)"
  ]
}
@mcarvin8 mcarvin8 added the investigating We're actively investigating this issue label Jan 2, 2024
Copy link

github-actions bot commented Jan 2, 2024

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 Jan 2, 2024
@mcarvin8
Copy link
Author

mcarvin8 commented Jan 2, 2024

Unrelated to this bug, but I also created this discussion based on my experience testing sandbox refreshes through the CLI. I have a workaround for this discussion, but it would be nice to address this as well for sandbox creations/refreshes using the CLI.

Please let me know if I should create a separate bug for this discussion or leave it as-is.

@alan-morey
Copy link

alan-morey commented Jan 2, 2024

I would love to see this feature implemented. My team and I always use the Salesforce UI for all our sandbox creation/refreshes, partly because there is no option in the CLI to refresh them and we are mostly refreshing sandboxes rather than creating new sandboxes. We have a bunch of predefined sandbox names that we reuse and they are configured with various jobs in our CI/CD for running tests, validating deployments, etc...

Having sandbox refresh support in the CLI would also be benefical for automating the entire sandbox refresh process with CI/CD systems. Currently we have team members manually performing refreshes, this occurs during common work hours and can lead to some false-postive build failures as the environments get activated and replaced. So being able to schedule a refresh to occur during the night when it is less likely to conflict with others would be ideal.

@mcarvin8
Copy link
Author

mcarvin8 commented Jan 2, 2024

@alan-morey - Feel free to take a look at my Python scripts which creates and refreshes sandboxes using the Tooling API (Simple Salesforce library) while we await a new Salesforce CLI release that addresses this bug.

My team is using these scripts for now while we wait for a CLI release to allow this.

https://github.com/mcarvin8/prepare-sandboxes

@shetzel
Copy link
Contributor

shetzel commented Jan 2, 2024

The CLI team agrees, but you should post in this discussion: #2511

Anything we implement should cover the usecases the community wants so we're gathering all the data and will then prioritize the work. Feel free to be opinionated with the expected command parameters as well.

@mcarvin8
Copy link
Author

mcarvin8 commented Jan 2, 2024

Thanks @shetzel . I have referenced this issue on #2511 . I'm fine with you closing this issue if you're tracking feedback for this there.

@mcarvin8 mcarvin8 closed this as completed Jan 4, 2024
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