hardis:org:retrieve:sources:retrofit
Description
DEPRECATED
This command is deprecated and must not be used. Changing a major org by hand is not a supported way of working.
When a change was made directly in an org, recover it as an ordinary User Story: start a branch under the lowest major branch (usually integration), retrieve exactly what changed with the Metadata Retriever of the VS Code SFDX Hardis extension, then review and merge it like any other work. See Retrofit.
Retrieve changes from org link to a ref branch not present in sources
This command need to be triggered from a branch that is connected to a SF org. It will then retrieve all changes not present in that branch sources, commit them and create a merge request against the default branch. If a merge request already exists, it will simply add a new commit.
Define the following properties in .sfdx-hardis.yml
- productionBranch : Name of the git branch that is corresponding to production org - retrofitBranch : Name of the git branch that will be used as merge request target
List of metadata to retrieve can be set in three way, in order of priority :
- CI_SOURCES_TO_RETROFIT: env variable (can be defined in CI context)
- sourcesToRetrofit property in .sfdx-hardis.yml
- Default list:
- CompactLayout
- CustomApplication
- CustomField
- CustomLabel
- CustomLabels
- CustomMetadata
- CustomObject
- CustomObjectTranslation
- CustomTab
- DuplicateRule
- EmailTemplate
- FlexiPage
- GlobalValueSet
- Layout
- ListView
- MatchingRules
- PermissionSet
- RecordType
- StandardValueSet
- Translations
- ValidationRule
You can also ignore some files even if they have been updated in production. To do that, define property retrofitIgnoredFiles in .sfdx-hardis.yml
Example of full retrofit configuration:
productionBranch: master
retrofitBranch: preprod
retrofitIgnoredFiles:
- force-app/main/default/applications/MyApp.app-meta.xml
- force-app/main/default/applications/MyOtherApp.app-meta.xml
- force-app/main/default/flexipages/MyFlexipageContainingDashboards.flexipage-meta.xml
Agent Mode
Supports non-interactive execution with --agent:
sf hardis:org:retrieve:sources:retrofit --agent
In agent mode, all interactive prompts are skipped and default values are used.
Learn by doing
The free Salesforce DevOps with sfdx-hardis course runs this command, click by click, on an org of your own:
Parameters
| Name | Type | Description | Default | Required | Options |
|---|---|---|---|---|---|
| agent | boolean | Run in non-interactive mode for agents and automation | |||
| commit | boolean | If true, a commit will be performed after the retrofit | |||
| commitmode | option | Defines if we commit all retrieved updates, or all updates including creations | updated | updated all |
|
| debug -d |
boolean | Activate debug mode (more logs) | |||
| flags-dir | option | undefined | |||
| json | boolean | Format output as json. | |||
| productionbranch | option | Name of the git branch corresponding to the org we want to perform the retrofit on. | |||
| Can be defined in productionBranch property in .sfdx-hardis.yml | |||||
| push | boolean | If true, a push will be performed after the retrofit | |||
| pushmode | option | Defines if we send merge request options to git push arguments | default | default mergerequest |
|
| retrofittargetbranch | option | Name of branch the merge request will have as target | |||
| Can be defined in retrofitBranch property in .sfdx-hardis.yml | |||||
| skipauth | boolean | Skip authentication check when a default username is required | |||
| target-org -o |
option | undefined | |||
| websocket | option | Websocket host:port for VsCode SFDX Hardis UI integration |
Examples
$ sf hardis:org:retrieve:sources:retrofit
$ sf hardis:org:retrieve:sources:retrofit --agent
sf hardis:org:retrieve:sources:retrofit --productionbranch master --commit --commitmode updated
sf hardis:org:retrieve:sources:retrofit --productionbranch master --retrofitbranch preprod --commit --commitmode updated --push --pushmode mergerequest