Skip to main content
Version: 5.9.x

Configuration

Workflows provides a simple DSL to configure the CI/CD pipeline, focused on Bazel-centric tasks.

Workflows expects the configuration file to be checked into the source repository. The default location is /.aspect/workflows/config.yaml.

An example configuration file looks like this:

.aspect/workflows/config.yaml
---
tasks:
# Checkout rules for the current build.
- checkout:
# Update a PR with changes from main, to avoid churning the repository cache.
# Present the user with the command to rebase the changes locally.
update_strategy: rebase
# Checks that BUILD file content is up-to-date with sources
- gazelle:
# Checks that all tests are passing
- test:
targets:
- //...
- -//experimental/...

See the API documentation for information on all top level configuration options, or see the Tasks list for a list of available tasks.

Workspaces

By default, Workflows will run tasks in the workspace at the root of the repository. If required, it is possible to configure multiple workspaces in the same repository, or set the default to a nested directory. Workspaces are defined by setting the workspaces configuration option.

Tasks defined at the root of the configuration apply to all workspaces, unless specifically overridden.

Single workspace

A single workspace of . (the repository root) is defined by default when no workspaces option is given. There is no need to define a workspace at . if it is the only workspace Workflows will run for.

The default workspace can be changed by setting a single item in the workspaces option. In the example below, this moves the default workspace to src/examples:

workspaces:
- src/examples
tasks: ...

Multiple workspaces

Workflows can run tasks across multiple Bazel workspaces. To define multiple workspaces, add the paths to the workspaces configuration option.

In the example below, three workspaces are defined, one at the root of the repository, one in third_party/library and another in src/examples. Workflows will run the tasks defined by tasks for all workspaces.

workspaces:
- .
- third_party/library
- src/examples
tasks: ...

Overriding configuration for a workspace

Configuration options may be overridden per workspace. The list of tasks at the root are merged with the task list defined on each workspace. For example, to run a different gazelle check and fix target for each non-default workspace:

workspaces:
- .
- src/examples:
tasks:
- gazelle:
target: //gazelle:example_check
tasks:
- gazelle:
target: //gazelle:check