ci-sfdx-plugin

0.5.3 • Public • Published

ci-sfdx-plugin

Set of commands making CI and dev's life easier.

Version CircleCI Appveyor CI Greenkeeper Known Vulnerabilities Downloads/week License

Intro
Commands
Configuration

Intro

# installation
$ sf plugins install ci-sfdx-plugin

# get info
$ sf plugins inspect ci-sfdx-plugin
$ sf (-h|--help) [COMMAND]

Commands

ci:apex:execute

Executes Apex in an org. Either 'prepush' or 'postpush' flag must be provided.

USAGE
  $ sfdx ci:apex:execute [--prepush] [--postpush] [-x <filepath>] [-u <string>] [--apiversion <string>] [--json] [--loglevel 
  trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]

OPTIONS
  -u, --targetusername=targetusername                                               username or alias for the target org; overrides 
                                                                                    default target org

  -x, --ciconfigfile=ciconfigfile                                                   [default: ciconfig.json] path to a 'ciconfig.json' 
                                                                                    file with 'apexPrePush' or 'apexPostPush' property

  --apiversion=apiversion                                                           override the api version used for api requests made 
                                                                                    by this command

  --json                                                                            format output as json

  --loglevel=(trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL)  [default: warn] logging level for this command 
                                                                                    invocation

  --postpush                                                                        executes post-push scripts.

  --prepush                                                                         executes pre-push scripts.

EXAMPLES
  sfdx ci:apex:execute -u orgAlias --prePush
  sfdx ci:apex:execute --postPush

ci:apex:test:run

Run unit tests in an org.

USAGE
  $ sfdx ci:apex:test:run [-l <string>] [-u <string>] [--apiversion <string>] [--json] [--loglevel 
  trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]

OPTIONS
  -l, --testlevel=RunLocalTests|RunAllTestsInOrg                                    [default: RunLocalTests] specifies which tests to 
                                                                                    run

  -u, --targetusername=targetusername                                               username or alias for the target org; overrides 
                                                                                    default target org

  --apiversion=apiversion                                                           override the api version used for api requests made 
                                                                                    by this command

  --json                                                                            format output as json

  --loglevel=(trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL)  [default: warn] logging level for this command 
                                                                                    invocation

EXAMPLES
  sfdx ci:apex:test:run -u orgAlias
  sfdx ci:apex:test:run -u orgAlias --testlevel=RunLocalTests

ci:limits:api:display

Display org's limits.

USAGE
  $ sfdx ci:limits:api:display [-u <string>] [--apiversion <string>] [--json] [--loglevel 
  trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]

OPTIONS
  -u, --targetusername=targetusername                                               username or alias for the target org; overrides 
                                                                                    default target org

  --apiversion=apiversion                                                           override the api version used for api requests made 
                                                                                    by this command

  --json                                                                            format output as json

  --loglevel=(trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL)  [default: warn] logging level for this command 
                                                                                    invocation

EXAMPLE
  sfdx ci:limits:api:limits -u orgAlias

ci:org:create

Creates a scratch org from your default dev hub. User can be also notified about possibly needed post-org-create manual steps together with instructions how to continue. Different behaviour can be configured for CI environment.

USAGE
  $ sfdx ci:org:create [-a <string>] [-d <number>] [-f <string>] [--ci] [-t <number>] [-x <filepath>] [-v <string>] [--apiversion 
  <string>] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]

OPTIONS
  -a, --setalias=setalias                                                           alias for the created org

  -d, --durationdays=durationdays                                                   [default: 30] duration of the scratch org (in days) 
                                                                                    (min:1, max:30)

  -f, --definitionfile=definitionfile                                               [default: config/project-scratch-def.json] path to 
                                                                                    an org definition file

  -t, --validationtimeout=validationtimeout                                         [default: 30] timeout in seconds before org 
                                                                                    validation happens

  -v, --targetdevhubusername=targetdevhubusername                                   username or alias for the dev hub org; overrides 
                                                                                    default dev hub org

  -x, --ciconfigfile=ciconfigfile                                                   [default: ciconfig.json] path to a 'ciconfig.json' 
                                                                                    file with 'projectName' property

  --apiversion=apiversion                                                           override the api version used for api requests made 
                                                                                    by this command

  --ci                                                                              set for CI environment

  --json                                                                            format output as json

  --loglevel=(trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL)  [default: warn] logging level for this command 
                                                                                    invocation

EXAMPLES
  sfdx ci:org:create -a orgAlias
  sfdx ci:org:create --setalias orgAlias --definitionfile config/project-scratch-def.json
  sfdx ci:org:create --setalias orgAlias --ci -validationtimeout 60

ci:org:delete

Delete a scratch org. Either explicitly specified org or the default one, if any.

USAGE
  $ sfdx ci:org:delete [-u <string>] [--apiversion <string>] [--json] [--loglevel 
  trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]

OPTIONS
  -u, --targetusername=targetusername                                               username or alias for the target org; overrides 
                                                                                    default target org

  --apiversion=apiversion                                                           override the api version used for api requests made 
                                                                                    by this command

  --json                                                                            format output as json

  --loglevel=(trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL)  [default: warn] logging level for this command 
                                                                                    invocation

EXAMPLE
  sfdx ci:org:delete -u orgAlias

ci:org:printurl

Display navigation URL for either specified org or the default one, if any, but don’t launch browser.

USAGE
  $ sfdx ci:org:printurl [-u <string>] [--apiversion <string>] [--json] [--loglevel 
  trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]

OPTIONS
  -u, --targetusername=targetusername                                               username or alias for the target org; overrides 
                                                                                    default target org

  --apiversion=apiversion                                                           override the api version used for api requests made 
                                                                                    by this command

  --json                                                                            format output as json

  --loglevel=(trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL)  [default: warn] logging level for this command 
                                                                                    invocation

EXAMPLE
  sfdx ci:org:printurl -u orgAlias

ci:package:install

Installs packages into an org.

USAGE
  $ sfdx ci:package:install [-s <string>] [-p <string>] [-x <filepath>] [-u <string>] [--apiversion <string>] [--json] [--loglevel 
  trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]

OPTIONS
  -p, --package=package                                                             ID (starts with 04t) or alias of the package version 
                                                                                    to install, overrides 'ciconfig.json' configuration

  -s, --securitytype=AllUsers|AdminsOnly                                            [default: AdminsOnly] security access type for the 
                                                                                    installed package

  -u, --targetusername=targetusername                                               username or alias for the target org; overrides 
                                                                                    default target org

  -x, --ciconfigfile=ciconfigfile                                                   [default: ciconfig.json] path to a 'ciconfig.json' 
                                                                                    file with 'packageIds' array property

  --apiversion=apiversion                                                           override the api version used for api requests made 
                                                                                    by this command

  --json                                                                            format output as json

  --loglevel=(trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL)  [default: warn] logging level for this command 
                                                                                    invocation

EXAMPLES
  sfdx ci:package:install -u orgAlias
  sfdx ci:package:install --targetusername orgAlias --package 04t0W000001MRQIQA4

ci:source:push

Pushes DX source into an org.

USAGE
  $ sfdx ci:source:push [-u <string>] [--apiversion <string>] [--json] [--loglevel 
  trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]

OPTIONS
  -u, --targetusername=targetusername                                               username or alias for the target org; overrides 
                                                                                    default target org

  --apiversion=apiversion                                                           override the api version used for api requests made 
                                                                                    by this command

  --json                                                                            format output as json

  --loglevel=(trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL)  [default: warn] logging level for this command 
                                                                                    invocation

EXAMPLE
  sfdx ci:source:push -u orgAlias

ci:source:sort

Sort selected metadata. Profiles, permission sets, muting permission sets and permission set groups are sorted by default.

USAGE
  $ sfdx ci:source:sort [-d <string>] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]

OPTIONS
  -d, --directory=directory                                                         [default: src/main/default] relative path to the 
                                                                                    parent folder of metadata ('profiles' etc. folders 
                                                                                    inside)

  --json                                                                            format output as json

  --loglevel=(trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL)  [default: warn] logging level for this command 
                                                                                    invocation

EXAMPLES
  sfdx ci:source:sort
  sfdx ci:source:sort -d '~/projects/project-dx/src/main/default'

ci:user:assign:permsetgroup

Assigns permission set groups to an authenticated user.

USAGE
  $ sfdx ci:user:assign:permsetgroup [-n <string>] [-x <filepath>] [-u <string>] [--apiversion <string>] [--json] [--loglevel 
  trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]

OPTIONS
  -n, --permsetgroupname=permsetgroupname                                           permission set group name to assign

  -u, --targetusername=targetusername                                               username or alias for the target org; overrides 
                                                                                    default target org

  -x, --ciconfigfile=ciconfigfile                                                   [default: ciconfig.json] path to a 'ciconfig.json' 
                                                                                    file with 'permsetGroups' array property

  --apiversion=apiversion                                                           override the api version used for api requests made 
                                                                                    by this command

  --json                                                                            format output as json

  --loglevel=(trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL)  [default: warn] logging level for this command 
                                                                                    invocation

EXAMPLES
  sfdx ci:user:assign:permsetgroup -u orgAlias
  sfdx ci:user:assign:permsetgroup --targetusername orgAlias --permsetgroupname PermsetGroup_DevName

ci:user:assign:profile

Assigns profile to the currently authenticated user.

USAGE
  $ sfdx ci:user:assign:profile [-n <string>] [-x <filepath>] [-u <string>] [--apiversion <string>] [--json] [--loglevel 
  trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]

OPTIONS
  -n, --profilename=profilename                                                     profile name to assign

  -u, --targetusername=targetusername                                               username or alias for the target org; overrides 
                                                                                    default target org

  -x, --ciconfigfile=ciconfigfile                                                   [default: ciconfig.json] path to a 'ciconfig.json' 
                                                                                    file with 'profile' property

  --apiversion=apiversion                                                           override the api version used for api requests made 
                                                                                    by this command

  --json                                                                            format output as json

  --loglevel=(trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL)  [default: warn] logging level for this command 
                                                                                    invocation

EXAMPLES
  sfdx ci:user:assign:profile -u orgAlias
  sfdx ci:user:assign:profile --targetusername orgAlias --profilename "Custom Admin Profile"

Configuration

  • Complete example of ciconfig.json file which should be placed in the root of your DX project.
    {
        "projectName": "my-project",
        "packageIds": [
            {
                "id": "04t1W000000aaa4QAK"
            },
            {
                "id": "04t2E000000bbbxQAA",
                "name": "name of this package",
                "versionNumber": "2.14"
            }
        ],
        "apexPrePush": [
            "scripts/anonymous-apex/enableMarketingUser.apex"
        ],
        "apexPostPush": [
            "scripts/anonymous-apex/insertCustomSettings.apex"
        ],
        "profile": "My Admin Profile",
        "permsetGroups": [
            "Admin_Application_Access",
            "Admin_Accounts_Access"
        ],
        "postCreateManualSteps": {
            "apexOrgVerification": "scripts/anonymous-apex/verifyOrgFeatures.apex",
            "continueInstruction": "Please, continue by running '...' command.",
            "features": [
                {
                    "name": "ContactsToMultipleAccounts",
                    "manualStepDescription": "Open the new scratch org, go to Setup/Account Settings and enable 'Allow users to relate a contact to multiple accounts'."
                },
                {
                    "manualStepDescription": "Open the new scratch org, go to Setup/Asset Settings and turn on 'Enable Asset Sharing'."
                }
            ],
            "settings": {
                "accountSettings": {
                    "enableRelateContactToMultipleAccounts": true
                }
            }
        }
    }

Package Sidebar

Install

npm i ci-sfdx-plugin

Weekly Downloads

13

Version

0.5.3

License

MIT

Unpacked Size

171 kB

Total Files

50

Last publish

Collaborators

  • malecka1
  • honiik