Use CircleCI version 2.1 at the top of your .circleci/config.yml file.
1
version: 2.1
Add the orbs
stanza below your version, invoking the orb:
1
2
orbs:
sfdx: salestrip/sfdx@0.0.1
Use sfdx
elements in your existing workflows and jobs.
Opt-in to use of uncertified orbs on your organization’s Security settings page.
Authorizes a Salesforce org using a private key file
PARAMETER | DESCRIPTION | REQUIRED | DEFAULT | TYPE |
---|---|---|---|---|
clientid | - | Yes | - | env_var_name |
jwtkeyfile | Path to private key file | Yes | - | string |
setalias | - | Yes | - | string |
username | - | Yes | - | env_var_name |
Create a scratch org
PARAMETER | DESCRIPTION | REQUIRED | DEFAULT | TYPE |
---|---|---|---|---|
definitionfile | - | Yes | - | string |
params | - | No | '' | string |
setalias | - | Yes | - | string |
targetdevhubusername | - | Yes | - | string |
Print org login url to the output
PARAMETER | DESCRIPTION | REQUIRED | DEFAULT | TYPE |
---|---|---|---|---|
targetusername | - | Yes | - | string |
Import data to the org
PARAMETER | DESCRIPTION | REQUIRED | DEFAULT | TYPE |
---|---|---|---|---|
definitionfile | - | Yes | - | string |
params | - | No | '' | string |
setalias | - | Yes | - | string |
targetdevhubusername | - | Yes | - | string |
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
# This code is licensed from CircleCI to the user under the MIT license.
# See here for details: https://circleci.com/developer/orbs/licensing
version: 2.1
description: "Orb to expose sfdx-cli commands as CircleCI commands"
executors:
sfdx-cli:
docker:
- image: salestrip/sfdx-cli
commands:
force-auth-jwt-grant:
description: "Authorizes a Salesforce org using a private key file"
parameters:
clientid:
type: env_var_name
jwtkeyfile:
description: "Path to private key file"
type: string
setalias:
type: string
username:
type: env_var_name
steps:
- run:
name: Authorise with Org <<parameters.setalias>>
command: |
sfdx force:auth:jwt:grant --clientid ${<<parameters.clientid>>} \
--jwtkeyfile <<parameters.jwtkeyfile>> \
--username ${<<parameters.username>>} \
--setalias <<parameters.setalias>>
force-org-create:
description: "Create a scratch org"
parameters:
definitionfile:
type: string
params:
default: ""
type: string
setalias:
type: string
targetdevhubusername:
type: string
steps:
- run:
name: Create Scratch Org <<parameters.setalias>>
command: |
sfdx force:org:create --definitionfile <<parameters.definitionfile>> \
--targetdevhubusername <<parameters.targetdevhubusername>> \
--setalias <<parameters.setalias>> \
<<parameters.params>>
force-org-open:
description: "Print org login url to the output"
parameters:
targetusername:
type: string
steps:
- run:
name: Login URL for <<parameters.targetusername>>
command: |
sfdx force:org:open --targetusername <<parameters.targetusername>> \
--urlonly
force-data-tree-import:
description: "Import data to the org"
parameters:
definitionfile:
type: string
params:
default: ""
type: string
setalias:
type: string
targetdevhubusername:
type: string
steps:
- run:
name: Import data <<parameters.setalias>>
command: |
sfdx force:org:create --definitionfile <<parameters.definitionfile>> \
--targetdevhubusername <<parameters.targetdevhubusername>> \
--setalias <<parameters.setalias>> \
<<parameters.params>>