The sfp pool sandbox init
command is used to create and initialize a pool of Salesforce sandboxes.
-f, --poolconfig=<path>
: Path to the sandbox pool configuration file (default: 'config/sandbox-pool-config.json')
-v, --targetdevhubusername=<devhub-alias>
: Alias of the target Dev Hub org
-r, --repo=<owner/repo>
: GitHub repository in the format owner/repo
The configuration file should be a JSON file containing an array of pool configurations. Each configuration should include:
pool
: Name of the sandbox pool (will be converted to uppercase)
count
: Number of sandboxes to create for this pool
sourceSB
: Source sandbox name (use 'production' for creating from scratch)
branch
: Git branch associated with this pool
defaultExpirationHours
: (Optional) Default expiration time in hours (default: 24)
extendedExpirationHours
: (Optional) Extended expiration time in hours (default: 24)
averageOrgCreationTime
: (Optional) Average time in hours for sandbox creation (default: 2)
Reads the configuration file
Authenticates with GitHub
Creates sandboxes for each pool configuration
Sets up GitHub repository variables for tracking sandboxes
This command initializes sandbox pools as defined in my-sandbox-pools.json
, using the Dev Hub 'my-devhub', and creates corresponding variables in the GitHub repository 'myorg/myrepo'.
Sandbox pools in sfp are designed to provide instantly available Salesforce environments for development, testing, and review processes. By maintaining a pool of pre-created sandboxes, teams can significantly reduce wait times and streamline their development workflows.
Immediate Availability: Eliminate waiting times for sandbox creation, allowing developers to start work instantly.
Reduced Overhead: Minimize the administrative burden of creating and managing individual sandboxes for each task.
Consistent Environment: Ensure all team members work with standardized, pre-configured sandbox environments.
Seamless Integration: Easily incorporate sandbox allocation into automated CI/CD pipelines and development workflows.
The following diagram illustrates the lifecycle of a sandbox within a pool:
Initializes sandbox pools based on configuration files.
Fetches an available sandbox from a pool and assigns it to an issue.
Monitors sandbox status, handles activations, expirations, and deletions.
The sfp sandbox monitor
command is designed to be run as a continuous cron job. This ensures that:
Newly created sandboxes are activated promptly.
Expired sandboxes are identified and marked for deletion.
Marked sandboxes are deleted, freeing up resources.
The pool is kept in a healthy state, always ready for use.
It's recommended to set up this command to run at regular intervals (e.g., every 15-30 minutes) to maintain an up-to-date and efficient sandbox pool.
For detailed information on each command and the expiration process, please refer to the individual command documentation.
The sfp pool sandbox fetch
command is used to fetch an available sandbox from a pool and assign it to a specific issue or pull request.
--repository, -r
: The repository path (e.g., owner/repo
). Default is the GITHUB_REPOSITORY
environment variable.
--pool, -p
: The name of the pool to fetch the sandbox from (required).
--branch, -b
: The branch of the pool from where the environment is to be fetched (required).
--issue, -i
: Issue number to be associated with the sandbox (required).
--devhubalias
: The DevHub alias associated with the pool (default: 'devhub').
--wait
: Time in minutes to wait for an available sandbox (default: 20).
--leasefor
: Time in minutes to lease the sandbox for the current task (default: 15).
Checks for existing sandbox assignments to the issue
If no assignment, acquires a lock on the pool
Fetches an available sandbox
Assigns the sandbox to the specified issue
Sets GitHub Actions output variable (if in GitHub Actions environment)
Releases the lock on the pool
The --leasefor
parameter specifies how long the sandbox is reserved for the current task before it can be reassigned within the same issue context. This is different from the overall expiration time of the sandbox in the pool.
This fetches a sandbox from 'dev-pool' for the branch 'feature/new-feature', assigns it to issue 1234, and leases it for 60 minutes.
The sfp sandbox monitor
command is used to monitor the status of sandboxes in pools, activate new sandboxes, handle expirations, and manage deletions. This command is designed to be run as a continuous cron job.
-v, --targetdevhubusername
: Alias of the target Dev Hub org (required)
-r, --repo
: Repository in the format owner/repo (required)
-f, --configfile
: Path to the sandbox pool configuration file(s) (required, can be specified multiple times)
This command should be set up as a cron job to run at regular intervals (e.g., every 15-30 minutes). This ensures:
Prompt activation of newly created sandboxes
Timely identification and marking of expired sandboxes
Deletion of marked sandboxes to free up resources
Maintenance of a healthy and efficient sandbox pool
Identifies sandboxes in 'InProgress' state
Attempts to activate them
Updates their status in GitHub variables
Checks sandboxes against their expiration times
Considers default expiration, extended expiration, and average creation time
Marks expired sandboxes in GitHub variables
Identifies sandboxes marked as 'Expired'
Attempts to delete them from the Salesforce org
Removes corresponding GitHub variables
Logs results of the deletion process
Default Expiration: 24 hours (configurable)
Extended Expiration: Additional 24 hours (configurable)
Average Creation Time: 2 hours (configurable)
These times can be customized in the pool configuration file.
This command monitors sandbox pools defined in both configuration files, using the Dev Hub 'my-devhub', and updates statuses in the 'myorg/myrepo' GitHub repository.
sfp-pro | sfp (community) | |
---|---|---|
sfp-pro | sfp (community) | |
---|---|---|
sfp-pro | sfp (community) | |
---|---|---|
sfp-pro | sfp (community) |
---|
Availability
✅
❌
From
September '24
Availability
✅
❌
From
September 24
Availability
✅
❌
From
September 24
Availability | ✅ | ❌ |
From | September 24 |