Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions cmd/server/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,12 @@ var flags = append([]cli.Flag{
Usage: "The maximum time in minutes you can set in the repo settings before a pipeline gets killed",
Value: 120,
},
&cli.StringFlag{
Sources: cli.EnvVars("WOODPECKER_LOG_LEVEL_PIPELINE_SKIPS"),
Name: "log-level-pipeline-skips",
Usage: "log level for pipeline lifecycle events (skip-ci, filtered, blocked). one of: trace, debug, info, warn, error",
Value: "debug",
},
&cli.StringSliceFlag{
Sources: cli.EnvVars("WOODPECKER_DEFAULT_WORKFLOW_LABELS"),
Name: "default-workflow-labels",
Expand Down
8 changes: 8 additions & 0 deletions cmd/server/setup.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import (
"strings"
"time"

"github.com/rs/zerolog"
"github.com/rs/zerolog/log"
"github.com/tink-crypto/tink-go/v2/subtle/random"
"github.com/urfave/cli/v3"
Expand Down Expand Up @@ -260,6 +261,13 @@ func setupEvilGlobals(ctx context.Context, c *cli.Command, s store.Store) (err e
server.Config.WebUI.SkipVersionCheck = c.Bool("skip-version-check")
server.Config.Pipeline.PrivilegedPlugins = c.StringSlice("plugins-privileged")

// set log level for pipeline lifecycle events (skip-ci, filtered, blocked)
eventLogLevel, err := zerolog.ParseLevel(c.String("log-level-pipeline-skips"))
if err != nil {
return fmt.Errorf("invalid pipeline-event-log-level: %w", err)
}
server.Config.Pipeline.LogLevelForSkips = eventLogLevel

// prometheus
server.Config.Prometheus.AuthToken = c.String("prometheus-auth-token")

Expand Down
7 changes: 7 additions & 0 deletions docs/docs/30-administration/10-configuration/10-server.md
Original file line number Diff line number Diff line change
Expand Up @@ -858,6 +858,13 @@ The default time for a repo in minutes before a pipeline gets killed

The maximum time in minutes you can set in the repo settings before a pipeline gets killed

### LOG_LEVEL_PIPELINE_SKIPS

- Name: `WOODPECKER_LOG_LEVEL_PIPELINE_SKIPS`
- Default: `debug`

The log level for pipeline lifecycle events (skip-ci, filtered, blocked). Possible values are `trace`, `debug`, `info`, `warn` and `error`

---

### SESSION_EXPIRES
Expand Down
2 changes: 2 additions & 0 deletions server/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ package server
import (
"time"

"github.com/rs/zerolog"
"go.woodpecker-ci.org/woodpecker/v3/server/cache"
"go.woodpecker-ci.org/woodpecker/v3/server/logging"
"go.woodpecker-ci.org/woodpecker/v3/server/model"
Expand Down Expand Up @@ -77,6 +78,7 @@ var Config = struct {
PrivilegedPlugins []string
DefaultTimeout int64
MaxTimeout int64
LogLevelForSkips zerolog.Level
Proxy struct {
No string
HTTP string
Expand Down
6 changes: 3 additions & 3 deletions server/pipeline/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ func Create(ctx context.Context, _store store.Store, repo *model.Repo, pipeline
if len(ref) == 0 {
ref = pipeline.Ref
}
log.Debug().Str("repo", repo.FullName).Msgf("ignoring pipeline as skip-ci was found in the commit (%s) message '%s'", ref, pipeline.Message)
log.WithLevel(server.Config.Pipeline.LogLevelForSkips).Str("repo", repo.FullName).Msgf("ignoring pipeline as skip-ci was found in the commit (%s) message '%s'", ref, pipeline.Message)
return nil, ErrFiltered
}
}
Expand Down Expand Up @@ -80,7 +80,7 @@ func Create(ctx context.Context, _store store.Store, repo *model.Repo, pipeline
configService := server.Config.Services.Manager.ConfigServiceFromRepo(repo)
forgeYamlConfigs, configFetchErr := configService.Fetch(ctx, _forge, repoUser, repo, pipeline, nil, false)
if errors.Is(configFetchErr, &forge_types.ErrConfigNotFound{}) {
log.Debug().Str("repo", repo.FullName).Err(configFetchErr).Msgf("cannot find config '%s' in '%s' with user: '%s'", repo.Config, pipeline.Ref, repoUser.Login)
log.WithLevel(server.Config.Pipeline.LogLevelForSkips).Str("repo", repo.FullName).Err(configFetchErr).Msgf("cannot find config '%s' in '%s' with user: '%s'", repo.Config, pipeline.Ref, repoUser.Login)
if err := _store.DeletePipeline(pipeline); err != nil {
log.Error().Str("repo", repo.FullName).Err(err).Msg("failed to delete pipeline without config")
}
Expand All @@ -100,7 +100,7 @@ func Create(ctx context.Context, _store store.Store, repo *model.Repo, pipeline
}

if len(pipelineItems) == 0 {
log.Debug().Str("repo", repo.FullName).Msg(ErrFiltered.Error())
log.WithLevel(server.Config.Pipeline.LogLevelForSkips).Str("repo", repo.FullName).Msg(ErrFiltered.Error())
if err := _store.DeletePipeline(pipeline); err != nil {
log.Error().Str("repo", repo.FullName).Err(err).Msg("failed to delete empty pipeline")
}
Expand Down
3 changes: 2 additions & 1 deletion server/pipeline/stepbuilder/step_builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ import (
"go.woodpecker-ci.org/woodpecker/v3/pipeline/frontend/yaml/linter"
"go.woodpecker-ci.org/woodpecker/v3/pipeline/frontend/yaml/matrix"
yaml_types "go.woodpecker-ci.org/woodpecker/v3/pipeline/frontend/yaml/types"
"go.woodpecker-ci.org/woodpecker/v3/server"
forge_types "go.woodpecker-ci.org/woodpecker/v3/server/forge/types"
"go.woodpecker-ci.org/woodpecker/v3/server/model"
)
Expand Down Expand Up @@ -162,7 +163,7 @@ func (b *StepBuilder) genItemForWorkflow(workflow *model.Workflow, axis matrix.A

// checking if filtered.
if match, err := parsed.When.Match(workflowMetadata, true, environ); !match && err == nil {
log.Debug().Str("pipeline", workflow.Name).Msg(
log.WithLevel(server.Config.Pipeline.LogLevelForSkips).Str("pipeline", workflow.Name).Msg(
"marked as skipped, does not match metadata",
)
return nil, nil
Expand Down