Skip to content

Commit

Permalink
feat: update to use config.yaml plugin configuration for Aspect CLI 5…
Browse files Browse the repository at this point in the history
….2.0 (#1)
  • Loading branch information
gregmagolan authored Mar 4, 2023
1 parent f4863e1 commit aa176ef
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 25 deletions.
14 changes: 14 additions & 0 deletions .aspect/cli/config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Configuration of plugins to the Aspect CLI
# See https://docs.aspect.build/v/cli/plugins
plugins:
- name: augment-error
# This file is created by running `bazel build :dev` so that we can easily test local changes.
# Since the bazel-bin folder is in .gitignore, you'll get a warning on the first run.
# Users will install the plugin from a pre-built binary, using the instructions in the release notes.
from: bazel-bin/plugin
# The possible log levels are: TRACE, DEBUG, INFO, WARN, ERROR, OFF.
# NB: to diagnose plugin crashes, use DEBUG
log_level: WARN
properties:
error_mappings:
demo: this message helps our devs understand failures with the string "demo"
13 changes: 0 additions & 13 deletions .aspect/cli/plugins.yaml

This file was deleted.

9 changes: 5 additions & 4 deletions .github/workflows/release_notes.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
To use this plugin, add it to your `.aspect/cli/plugins.yaml` file like so:
To use this plugin, add it to your `.aspect/cli/config.yaml` file like so:

```
- name: hello-world
from: github.com/aspect-build/aspect-cli-plugin-template
version: ${GITHUB_REF_NAME}
plugins:
- name: augment-error
from: github.com/aspect-build/plugin-augment-error
version: ${GITHUB_REF_NAME}
```
2 changes: 1 addition & 1 deletion BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ go_binary(
)

# Copy the plugin to bazel-bin/plugin and checksum it.
# Referenced by the .aspect/cli/plugins.yaml in the `From:` line.
# Referenced by the .aspect/cli/config.yaml in the `From:` line.
local_plugin(
name = "dev",
binary = ":main",
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ First build the plugin from source:
% bazel build ...
```

Note that the `.aspect/cli/plugins.yaml` file has a reference to the path under `bazel-bin` where the plugin binary was just written.
Note that the `.aspect/cli/config.yaml` file has a reference to the path under `bazel-bin` where the plugin binary was just written.
On the first build, you'll see a warning printed that the plugin doesn't exist at this path.
This is just the development flow for working on plugins; users will reference the plugin's releases which are downloaded for them automatically.

Expand Down
11 changes: 6 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,18 @@ It matches on error messages from Bazel, and adds extra information that can hel
such as golinks to your internal documentation, tell them that a migration is underway with
additional instructions, or whatever you can think of.

Users configure it in an `error_mappings` property in the `.aspect/cli/plugins.yaml` file in their repo.
Users configure it in an `error_mappings` property in the `.aspect/cli/config.yaml` file in their repo.

## Demo

With a configuration like:

```yaml
- name: augment-error
properties:
error_mappings:
demo: this message helps our devs understand failures with the string "demo"
plugins:
- name: augment-error
properties:
error_mappings:
demo: this message helps our devs understand failures with the string "demo"
```
This plugin will print the message when the error contains "demo", like the following:
Expand Down
2 changes: 1 addition & 1 deletion release/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ load(":release.bzl", "multi_platform_binaries", "release")

# Build a plugin for all supported platforms
multi_platform_binaries(
# This name will determine what users put in their .aspect/cli/plugins.yaml:
# This name will determine what users put in their .aspect/cli/config.yaml:
# - name: augment-error
name = "augment-error",
embed = ["//:main_lib"],
Expand Down

0 comments on commit aa176ef

Please sign in to comment.