Skip to content
Crow CI
Codeberg

Secrets

Crow CI provides an integrated secret store. These secrets can be passed securely to individual steps using the from_secret keyword.

Secrets List/Creation Dialog
Secrets List/Creation Dialog

Three different levels of secrets are available:

  1. Repository secrets: Available to all workflows of a repository.
  2. Organization secrets: Available to all workflows of an organization.
  3. Global secrets: Global secret are available to all pipelines of the entire Crow CI instance. Can only be set by instance administrators.

Secrets are defined using the from_secret: keyword in the environment: section:

steps:
- name: 'step name'
image: registry/repo/image:tag
commands:
- echo "The secret is $TOKEN_ENV"
environment:
TOKEN_ENV:
from_secret: secret_token

Secrets names can be uppercase or lowercase. The same applies to the environment variables they are assigned to.

Secrets can also be used for settings: in plugins:

steps:
- name: 'step name'
image: registry/repo/image:tag
commands:
- echo "The secret is $TOKEN_ENV"
settings:
TOKEN:
from_secret: secret_token

To prevent secrets from potential abuse in arbitrary steps, they can be limited to specific plugins in the repository settings.

Plugins offer the advantage of not being able to execute arbitrary commands (in contrast to normal steps), and by this inherently prohibit the possibility of exposing secrets in any kind of way.

Secrets can also be added via the CLI.

By default, secrets will be available without any restriction:

Terminal window
crow-cli repo secret add \
--repository octocat/hello-world \
--name my_secret \
--value <value>

Limit it to a specific plugin:

Terminal window
crow-cli secret add \
--repository octocat/hello-world \
--image woodpeckerci/plugin-s3 \
--name aws_access_key_id \
--value <value>

The --image can also be passed multiple times.

Limit to specific events:

Terminal window
crow-cli repo secret add \
--repository octocat/hello-world \
--image woodpeckerci/plugin-s3 \
--event pull_request \
--event push \
--event tag \
--name aws_access_key_id \
--value <value>

Secret can also be loaded from a file on disk. This can be useful for multi-line secrets like SSH keys:

Terminal window
crow-cli repo secret add \
--repository octocat/hello-world \
--name ssh_key \
--value @/root/ssh/id_rsa