hardis:source:deploy
Description
sfdx-hardis wrapper for sfdx force:source:deploy that displays tips to solve deployment errors.
Additional to the base command wrapper: If using --checkonly, add options --checkcoverage and --coverageformatters json-summary to check that org coverage is > 75% (or value defined in .sfdx-hardis.yml property apexTestsMinCoverageOrgWide)
Deployment results
You can also have deployment results as pull request comments, on:
- GitHub (see GitHub Pull Requests comments config)
- Gitlab (see Gitlab integration configuration)
- Azure DevOps (see Azure integration configuration)
Deployment pre or post commands
You can define command lines to run before or after a deployment
If the commands are not the same depending on the target org, you can define them into config/branches/.sfdx-hardis-BRANCHNAME.yml instead of root config/.sfdx-hardis.yml
Example:
commandsPreDeploy:
- id: knowledgeUnassign
label: Remove KnowledgeUser right to the user who has it
command: sf data update record --sobject User --where "UserPermissionsKnowledgeUser='true'" --values "UserPermissionsKnowledgeUser='false'" --json
- id: knowledgeAssign
label: Assign Knowledge user to the deployment user
command: sf data update record --sobject User --where "Username='deploy.github@myclient.com'" --values "UserPermissionsKnowledgeUser='true'" --json
commandsPostDeploy:
- id: knowledgeUnassign
label: Remove KnowledgeUser right to the user who has it
command: sf data update record --sobject User --where "UserPermissionsKnowledgeUser='true'" --values "UserPermissionsKnowledgeUser='false'" --json
- id: knowledgeAssign
label: Assign Knowledge user to desired username
command: sf data update record --sobject User --where "Username='admin-yser@myclient.com'" --values "UserPermissionsKnowledgeUser='true'" --json
Notes:
- You can disable coloring of errors in red by defining env variable SFDX_HARDIS_DEPLOY_ERR_COLORS=false
See documentation of Salesforce command
Parameters
Name | Type | Description | Default | Required | Options |
---|---|---|---|---|---|
apiversion | option | override the api version used for api requests made by this command | |||
checkcoverage | boolean | Check Apex org coverage | |||
checkonly -c |
boolean | checkonly | |||
coverageformatters | option | coverageformatters | |||
debug | boolean | debug | |||
forceoverwrite -f |
boolean | forceoverwrite | |||
ignoreerrors -o |
boolean | ignoreErrors | |||
ignorewarnings -g |
boolean | ignoreWarnings | |||
json | boolean | format output as json | |||
junit | boolean | junit | |||
loglevel | option | logging level for this command invocation | warn | trace debug info warn error fatal |
|
manifest -x |
option | flagsLong.manifest | |||
metadata -m |
option | metadata | |||
postdestructivechanges | option | postdestructivechanges | |||
predestructivechanges | option | predestructivechanges | |||
resultsdir | option | resultsdir | |||
runtests -r |
option | runTests | |||
soapdeploy | boolean | soapDeploy | |||
sourcepath -p |
option | sourcePath | |||
targetusername -u |
option | username or alias for the target org; overrides default target org | |||
testlevel -l |
option | testlevel | NoTestRun | NoTestRun RunSpecifiedTests RunLocalTests RunAllTestsInOrg |
|
tracksource -t |
boolean | tracksource | |||
validateddeployrequestid -q |
option | validateDeployRequestId | |||
verbose | boolean | verbose | |||
wait -w |
option | wait | [object Object] | ||
websocket | option | websocket |
Examples
$ sfdx hardis:source:deploy -x manifest/package.xml --wait 60 --ignorewarnings --testlevel RunLocalTests --postdestructivechanges ./manifest/destructiveChanges.xml --targetusername nicolas.vuillamy@cloudity.com.sfdxhardis --checkonly --checkcoverage --verbose --coverageformatters json-summary