Environment

sfp server environment

Manage environments in the SFP server

Commands


sfp server environment create

Create a new environment in the server.

USAGE
  $ sfp server environment create -n <value> [--json] [-t <value>] [-d <value>]
    [--sfdx-auth-url <value>] [--repository <value>] [-e <value> | -a <value>]
    [--sfp-server-url <value>] [-g <value>...] [--loglevel
    trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]

FLAGS
  -n, --name=<value>                (required) Name of the environment
  -t, --type=<value>                Environment type (production, staging, dev, sandbox)
  -d, --description=<value>         Description of the environment
  --sfdx-auth-url=<value>           SFDX auth URL for the Salesforce org
  --repository=<value>              Repository identifier (e.g., owner/repo)
  -m, --metadata=<value>            JSON metadata to associate with the environment
  
  AUTHENTICATION
  -e, --email=<value>               Email address for authenticated CLI user
  -a, --application-token=<value>   Application token for authentication
  --sfp-server-url=<value>          URL of the SFP server
  
  OTHER OPTIONS
  --json                            Format output as json
  -g, --logsgroupsymbol=<value>...  Symbol used by CICD platform to group/collapse logs
  --loglevel=<option>               [default: info] logging level
                                    <options: trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL>

DESCRIPTION
  Create a new environment in the server

  Environments represent Salesforce orgs (production, sandbox, scratch orgs)
  that can be targets for deployments and releases.

EXAMPLES
  $ sfp server environment create --name production --type production

  $ sfp server environment create --name staging --type staging --description "Staging environment for UAT"

  $ sfp server environment create --name dev-sandbox --type sandbox --sfdx-auth-url force://...

  $ sfp server environment create --name qa-env --type sandbox --repository myorg/myrepo

sfp server environment list

List environments from the SFP server with optional filtering.

Output Formats

Standard Output:

Matrix Output (for CI/CD):


sfp server environment get

Get detailed information about a specific environment.


sfp server environment lock

Lock an environment for exclusive access.

Output:


sfp server environment unlock

Unlock an environment using the ticket ID.


sfp server environment delete

Delete an environment from the server.

Use Cases

CI/CD Pipeline with Environment Locking

Environment Matrix for Parallel Testing

Best Practices

  1. Always Lock for Deployments: Lock environments during deployments to prevent conflicts

  2. Use Wait with Timeout: In CI/CD, use --wait with appropriate timeout values

  3. Always Unlock: Ensure environments are unlocked in finally/always blocks

  4. Document Environment Types: Maintain clear naming conventions for environment types

  5. Regular Cleanup: Remove unused environments to keep the list manageable

Note: Environment locks have automatic expiration to prevent indefinite locks from failed processes.

Warning: Deleting an environment only removes it from the SFP server. The actual Salesforce org remains unchanged.

Last updated