diff --git a/docs/docs/20-usage/20-pipeline-syntax.md b/docs/docs/20-usage/20-pipeline-syntax.md index 6d908044e..276e4df6f 100644 --- a/docs/docs/20-usage/20-pipeline-syntax.md +++ b/docs/docs/20-usage/20-pipeline-syntax.md @@ -303,12 +303,6 @@ when: #### `event` -:::info -**By default steps are filtered by following event types:** - -`push`, `pull_request`, `tag`, `deployment`, `manual`. -::: - Available events: `push`, `pull_request`, `tag`, `deployment`, `cron`, `manual` Execute a step if the build event is a `tag`: diff --git a/docs/docs/20-usage/45-cron.md b/docs/docs/20-usage/45-cron.md index a668c246e..d954cb2ca 100644 --- a/docs/docs/20-usage/45-cron.md +++ b/docs/docs/20-usage/45-cron.md @@ -2,11 +2,6 @@ To configure cron jobs you need at least push access to the repository. -:::warning -By default pipelines triggered by cron jobs wont execute any steps in pipelines, as they are not part of the default event filter and you explicitly need to set a `event: cron` filter. -Read more at: [pipeline-syntax#event](./20-pipeline-syntax.md#event) -::: - ## Add a new cron job 1. To create a new cron job adjust your pipeline config(s) and add the event filter to all steps you would like to run by the cron job: diff --git a/pipeline/frontend/yaml/constraint/constraint.go b/pipeline/frontend/yaml/constraint/constraint.go index 4ffea58e9..1a1fd63f4 100644 --- a/pipeline/frontend/yaml/constraint/constraint.go +++ b/pipeline/frontend/yaml/constraint/constraint.go @@ -142,8 +142,6 @@ func (when *When) UnmarshalYAML(value *yaml.Node) error { func (c *Constraint) Match(m metadata.Metadata, global bool) (bool, error) { match := true if !global { - c.SetDefaultEventFilter() - // apply step only filters match = c.Matrix.Match(m.Workflow.Matrix) } @@ -184,19 +182,6 @@ func (c *Constraint) Match(m metadata.Metadata, global bool) (bool, error) { return match, nil } -// SetDefaultEventFilter set default e event filter if not event filter is already set -func (c *Constraint) SetDefaultEventFilter() { - if c.Event.IsEmpty() { - c.Event.Include = []string{ - metadata.EventPush, - metadata.EventPull, - metadata.EventTag, - metadata.EventDeploy, - metadata.EventManual, - } - } -} - // IsEmpty return true if a constraint has no conditions func (c List) IsEmpty() bool { return len(c.Include) == 0 && len(c.Exclude) == 0 diff --git a/pipeline/frontend/yaml/constraint/constraint_test.go b/pipeline/frontend/yaml/constraint/constraint_test.go index 227ee5e95..0e92be18e 100644 --- a/pipeline/frontend/yaml/constraint/constraint_test.go +++ b/pipeline/frontend/yaml/constraint/constraint_test.go @@ -477,12 +477,6 @@ func TestConstraints(t *testing.T) { with: metadata.Metadata{Curr: metadata.Pipeline{Event: metadata.EventPush}, Sys: metadata.System{Host: "beta.agent.tld"}}, want: false, }, - { - desc: "filter cron by default constraint", - conf: "{}", - with: metadata.Metadata{Curr: metadata.Pipeline{Event: metadata.EventCron}}, - want: false, - }, { desc: "filter cron by matching name", conf: "{ event: cron, cron: job1 }", @@ -495,14 +489,6 @@ func TestConstraints(t *testing.T) { with: metadata.Metadata{Curr: metadata.Pipeline{Event: metadata.EventCron, Cron: "job1"}}, want: false, }, - { - desc: "no constraints, event gets filtered by default event filter", - conf: "", - with: metadata.Metadata{ - Curr: metadata.Pipeline{Event: "non-default"}, - }, - want: false, - }, { desc: "filter with build-in env passes", conf: "{ branch: ${CI_REPO_DEFAULT_BRANCH} }",