Secrets¶
NOTE:
The source code for the examples below can be found on GitHub.
Secrets can be used to pass passwords and tokens securely to workflows without hard-coding them in the code.
Secrets can be added via the dstack secrets
command and accessed from the workflow
via environment variables.
Example¶
Here's an example of how to use your Weight & Biases API token in your workflows.
Go to the settings of your Weight & Biases user and copy your API token.
Use the dstack secrets add
command to add it as a secret:
$ dstack secrets add WANDB_API_KEY acd0a9d1ebe3a4e4854d2f6a7cef85b5257f8183
Now, when you run any workflow, your API token will be passed to the workflow
via the WANDB_API_KEY
environment variable:
workflows:
- name: hello
provider: bash
commands:
- conda install wandb
- wandb login
Secrets can be managed via the dstack secrets
command.
NOTE:
Secrets are currently only supported by remote workflows.