Note this README is for CRE developers only, if you are a CRE user, please ask Dev Services team for the user guide.
A command-line interface (CLI) tool for managing workflows, built with Go and Cobra. This tool allows you to compile Go workflows into WebAssembly (WASM) binaries and manage your workflow projects.
-
Clone the repository:
git clone https://github.com/smartcontractkit/cre-cli.git cd cre-cli
-
Make sure you have Go installed. You can check this with:
go version
-
Build the CLI tool:
make build
or
go build -ldflags "-w" -o cre
-
(optional) Enable git pre-commit hook
ln -sf ../../.githooks/pre-commit .git/hooks/pre-commit
You can use the CLI tool to manage workflows by running commands in the terminal. The main command is cre
.
To view all available commands and subcommands, you can start by running the tool with --help
flag:
./cre --help
To view subcommands hidden under a certain command group, select the command name and run with the tool with --help
flag, for example:
./cre workflow --help
There are several ways to configure the CLI tool, with some configuration files only needed for running specific commands.
.env
file is used to specify sensitive data required for running most of the commands. It is highly recommended that you don't keep the .env
file in unencrypted format on your disk and store it somewhere safely (e.g. in secret manager tool).
The most important environment variables to define are CRE_ETH_PRIVATE_KEY
and CRE_GITHUB_API_TOKEN
.
- Install 1Password CLI
- Add variables to your 1Password Vault
- Create the
.env
file with secret references. Replace plaintext values with references likeCRE_ETH_PRIVATE_KEY=op://<vault-name>/<item-name>/[section-name/]<field-name>
- Run
cre
commands using 1Password. Use the op run command to provision secrets securely:Note:op run --env-file=".env" -- cre workflow list
op run
doesn't support~
inside env file path. Use only absolute or relative paths for the env file (e.g.--env-file="/Users/username/.chainlink/cli.env"
or--env-file="../.chainlink/cli.env"
).
To prevent any data leaks, you can also use export
command, e.g. export MY_ENV_VAR=mySecret
. For better security, use a space before the export
command to prevent the command from being saved to your terminal history.
project.yaml
file keeps CLI tool settings in one place. It is used to reconfigure the tool in cases such as using a different Capabilities or Workflow Registry, using a different Workflow DON, or a different workflow owner address.
Please find more information in the project.yaml file that is created by the cre init
command.
If you are planning on using a workflow that has a dependency on sensitive data, then it's recommended to encrypt those secrets. In such cases, a secrets template file secrets.yaml that is created by the cre init
can be used as a starting point. Secrets template is required for the secrets encrypt
command.
All of these flags are optional, but available for each command and at each level:
-h
/--help
: Prints help message.-v
/--verbose
: Enables DEBUG mode and prints more content.-S
/--workflow-settings-file
: Path to CLI tool settings file, contains configuration needed for running specific commands.-e
/--env
: Path to .env file which contains sensitive data needed for running specific commands.
For a list of all commands and their descriptions, please refer to the docs folder.
To simulate a workflow, you can use the cre workflow simulate
command. This command allows you to run a workflow locally without deploying it.
cre workflow simulate --target local-simulation --config <path-to-config.json> <path-to-workflow-file>
By using the CRE CLI tool, you agree to the Terms of Service (https://chain.link/terms) and Privacy Policy (https://chain.link/privacy-policy).