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-evergreen-auth: heroku/sfdx-evergreen-auth@2.0.2
Use sfdx-evergreen-auth
elements in your existing workflows and jobs.
Opt-in to use of uncertified orbs on your organization’s Security settings page.
Removes unencrypted credentials. This command deletes the `~/.netrc` file, so be cautious where it is used to avoid conflicts with other usage of this shared credentials file.
Authorizes sfdx evergreen CLI using the Evergreen Identity refresh token. This command appends entries to `~/.netrc`, so be cautious how it is used to avoid conflicts with other usage of this shared credentials file. The appended Netrc "machine" entries are generated from the parameters `identity-hostname` & `api-hostname`.
PARAMETER | DESCRIPTION | REQUIRED | DEFAULT | TYPE |
---|---|---|---|---|
api-hostname | - | No | api.evergreen.salesforce.com | string |
identity-hostname | - | No | id.evergreen.salesforce.com | 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
# This code is licensed from CircleCI to the user under the MIT license.
# See here for details: https://circleci.com/developer/ja/orbs/licensing
commands:
cleanup:
description: |
Removes unencrypted credentials.
This command deletes the `~/.netrc` file, so be cautious where it is used to avoid conflicts with other usage of this shared credentials file.
steps:
- run:
command: |
rm .netrc || true
name: Clean-up sfdx evergreen auth
setup:
description: |
Authorizes sfdx evergreen CLI using the Evergreen Identity refresh token.
This command appends entries to `~/.netrc`, so be cautious how it is used to avoid conflicts with other usage of this shared credentials file. The appended Netrc "machine" entries are generated from the parameters `identity-hostname` & `api-hostname`.
parameters:
api-hostname:
default: api.evergreen.salesforce.com
type: string
identity-hostname:
default: id.evergreen.salesforce.com
type: string
steps:
- run:
command: |
has_errors=false
if ! sfdx version; then
echo "Requires installation of sfdx: npm install sfdx-cli"
has_errors=true
fi
if ! sfdx evergreen; then
echo "Requires installation of sfdx evergreen plugin: sfdx plugins:install @salesforce/plugin-evergreen"
has_errors=true
fi
if [ -z "$EVERGREEN_REFRESH_TOKEN" ]; then
echo "Requires EVERGREEN_REFRESH_TOKEN environment variable"
has_errors=true
fi
if [ "$has_errors" = true ]; then
exit 2
fi
echo "machine << parameters.identity-hostname >>"$'\n password' "$EVERGREEN_REFRESH_TOKEN" >> "$HOME/.netrc"
echo "machine << parameters.api-hostname >>"$'\n password' "placeholder" >> "$HOME/.netrc"
echo "sfdx evergreen:whoami"
sfdx evergreen:whoami
name: Set-up sfdx evergreen auth
description: |
Authorize `sfdx evergreen` CLI via Evergreen Identity.
version: 2.1