mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2025-01-22 07:08:58 +00:00
Merge branch 'origin/main' into 'next-release/main'
This commit is contained in:
commit
1a7da20ea0
5 changed files with 16 additions and 8 deletions
|
@ -74,8 +74,9 @@ steps:
|
|||
|
||||
deploy-prepare:
|
||||
image: *alpine_image
|
||||
secrets:
|
||||
- BOT_PRIVATE_KEY
|
||||
environment:
|
||||
BOT_PRIVATE_KEY:
|
||||
from_secret: BOT_PRIVATE_KEY
|
||||
commands:
|
||||
- apk add openssh-client git
|
||||
- mkdir -p $HOME/.ssh
|
||||
|
@ -127,8 +128,9 @@ steps:
|
|||
|
||||
deploy:
|
||||
image: *alpine_image
|
||||
secrets:
|
||||
- BOT_PRIVATE_KEY
|
||||
environment:
|
||||
BOT_PRIVATE_KEY:
|
||||
from_secret: BOT_PRIVATE_KEY
|
||||
commands:
|
||||
- apk add openssh-client rsync git
|
||||
- mkdir -p $HOME/.ssh
|
||||
|
|
|
@ -40,6 +40,7 @@ steps:
|
|||
- go run go.woodpecker-ci.org/woodpecker/v2/cmd/cli lint
|
||||
environment:
|
||||
WOODPECKER_DISABLE_UPDATE_CHECK: true
|
||||
WOODPECKER_LINT_STRICT: true
|
||||
WOODPECKER_PLUGINS_PRIVILEGED: 'docker.io/woodpeckerci/plugin-docker-buildx:5.0.0'
|
||||
when:
|
||||
- event: pull_request
|
||||
|
|
|
@ -220,7 +220,7 @@ func execWithAxis(ctx context.Context, c *cli.Command, file, repoPath string, ax
|
|||
Workflow: conf,
|
||||
}})
|
||||
if err != nil {
|
||||
str, err := lint.FormatLintError(file, err)
|
||||
str, err := lint.FormatLintError(file, err, false)
|
||||
fmt.Print(str)
|
||||
if err != nil {
|
||||
return err
|
||||
|
|
|
@ -48,6 +48,11 @@ var Command = &cli.Command{
|
|||
Usage: "Plugins which are trusted to handle the netrc info in clone steps",
|
||||
Value: constant.TrustedClonePlugins,
|
||||
},
|
||||
&cli.BoolFlag{
|
||||
Sources: cli.EnvVars("WOODPECKER_LINT_STRICT"),
|
||||
Name: "strict",
|
||||
Usage: "treat warnings as errors",
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
|
@ -119,7 +124,7 @@ func lintFile(_ context.Context, c *cli.Command, file string) error {
|
|||
linter.WithTrustedClonePlugins(c.StringSlice("plugins-trusted-clone")),
|
||||
).Lint([]*linter.WorkflowConfig{config})
|
||||
if err != nil {
|
||||
str, err := FormatLintError(config.File, err)
|
||||
str, err := FormatLintError(config.File, err, c.Bool("strict"))
|
||||
|
||||
if str != "" {
|
||||
fmt.Print(str)
|
||||
|
|
|
@ -10,7 +10,7 @@ import (
|
|||
pipeline_errors "go.woodpecker-ci.org/woodpecker/v2/pipeline/errors"
|
||||
)
|
||||
|
||||
func FormatLintError(file string, err error) (string, error) {
|
||||
func FormatLintError(file string, err error, strict bool) (string, error) {
|
||||
if err == nil {
|
||||
return "", nil
|
||||
}
|
||||
|
@ -24,7 +24,7 @@ func FormatLintError(file string, err error) (string, error) {
|
|||
for _, err := range linterErrors {
|
||||
line := " "
|
||||
|
||||
if err.IsWarning {
|
||||
if !strict && err.IsWarning {
|
||||
line = fmt.Sprintf("%s ⚠️ ", line)
|
||||
amountWarnings++
|
||||
} else {
|
||||
|
|
Loading…
Reference in a new issue