sfpowerscripts logo sfpowerscripts

This task is used to create and delete a scratch org and mostly used in a Pull Request validation pipeline. The task is an exact wrapper over the sfdx force:org:create/ sfdx force:org:delete command. The task also features a post execution script which provides maintenance options such as delete the scratch org after all subsequent tasks are completed,maintain the scratch org for the provided number of days and also a ‘do nothing’ option, where the management is left to the end user.

To retain scratch org’s for review purposes, the maintain org has to be selected and the link to the scratch org along with the expiry timeline will be available in the summary tab as shown below.

Prerequisites

Please note Install SFDX with Sfpowerkit task is added to the pipeline before utilizing this task

Task Snapshot

Task Version and Details

id: sfpwowerscript-managescratchorg-task

version: 7.0.4

Input Variables

The path to the file containing the configurations of the scratch org to be created. This field is only visible when Create mode is selected.

Provide the alias for the scratch org, that is to be created. This field is visible only when create is activated

Provide the alias for the scratch org, that is to be created. This field is visible only when create is activated

Provide the alias of the devhub previously authenticated, default value is HubOrg if using the Authenticate Org task

The following options are available to be executed post the run of this command. The options are the following

  - "delete": "Delete this org after all subsequent tasks are executed",
  - "maintain": "Maintain this org for x number of days",
  - "donothing": "Do Nothing, Deletion of the scratch org will be handled explicitly"

This option is only visible if the value for maintain is set to “Maintain this org for x number of days (maintain)”. Provide the number of days for which the scratch org has to be maintained for reviewing the Pull Request

The root directory that contains the sfdx-project.json. In build pipelines you can craete this blank, however when used in release pipelines mention the repo directory

Output Variables

The url of the scratch org that was created

The username of the scratch org that was created

Control Options

Gotcha’s

Provide the repo path for the working directory in a releaase pipeline

Changelog