-
-
Notifications
You must be signed in to change notification settings - Fork 386
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Deprecate environment filter and improve errors (#3634)
Co-authored-by: Anbraten <6918444+anbraten@users.noreply.github.com>
- Loading branch information
Showing
11 changed files
with
120 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
# Linter | ||
|
||
Woodpecker automatically lints your workflow files for errors, deprecations and bad habits. Errors and warnings are shown in the UI for any pipelines. | ||
|
||
![errors and warnings in UI](./linter-warnings-errors.png) | ||
|
||
## Running the linter from CLI | ||
|
||
You can run the linter also manually from the CLI: | ||
|
||
```shell | ||
woodpecker-cli lint <workflow files> | ||
``` | ||
|
||
## Bad habit warnings | ||
|
||
Woodpecker warns you if your configuration contains some bad habits. | ||
|
||
### Event filter for all steps | ||
|
||
All your items in `when` blocks should have an `event` filter, so no step runs on all events. This is recommended because if new events are added, your steps probably shouldn't run on those as well. | ||
|
||
Examples of an **incorrect** config for this rule: | ||
|
||
```yaml | ||
when: | ||
- branch: main | ||
- event: tag | ||
``` | ||
This will trigger the warning because the first item (`branch: main`) does not filter with an event. | ||
|
||
```yaml | ||
steps: | ||
- name: test | ||
when: | ||
branch: main | ||
- name: deploy | ||
when: | ||
event: tag | ||
``` | ||
|
||
Examples of a **correct** config for this rule: | ||
|
||
```yaml | ||
when: | ||
- branch: main | ||
event: push | ||
- event: tag | ||
``` | ||
|
||
```yaml | ||
steps: | ||
- name: test | ||
when: | ||
event: [tag, push] | ||
- name: deploy | ||
when: | ||
- event: tag | ||
``` |
File renamed without changes.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters