Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: allow gitlab eventsource to work without projects or groups #3508

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
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
2 changes: 1 addition & 1 deletion pkg/apis/events/v1alpha1/eventsource_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -858,7 +858,7 @@ type GitlabEventSource struct {
// Metadata holds the user defined metadata which will passed along the event payload.
// +optional
Metadata map[string]string `json:"metadata,omitempty" protobuf:"bytes,9,rep,name=metadata"`
// List of project IDs or project namespace paths like "whynowy/test". Projects and groups cannot be empty at the same time.
// List of project IDs or project namespace paths like "whynowy/test".
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add that not defining a group or project means the event source will not manage webhooks?

// +optional
Projects []string `json:"projects,omitempty" protobuf:"bytes,10,rep,name=projects"`
// SecretToken references to k8 secret which holds the Secret Token used by webhook config
Expand Down
3 changes: 0 additions & 3 deletions pkg/eventsources/sources/gitlab/validate.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,6 @@ func validate(eventSource *v1alpha1.GitlabEventSource) error {
if eventSource == nil {
return v1alpha1.ErrNilEventSource
}
if len(eventSource.GetProjects()) == 0 && len(eventSource.GetGroups()) == 0 {
return fmt.Errorf("projects and groups cannot be empty at the same time")
}
if eventSource.Events == nil {
return fmt.Errorf("events can't be empty")
}
Expand Down
1 change: 0 additions & 1 deletion pkg/eventsources/sources/gitlab/validate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ func TestValidateEventSource(t *testing.T) {

err := listener.ValidateEventSource(context.Background())
assert.Error(t, err)
assert.Equal(t, "projects and groups cannot be empty at the same time", err.Error())

content, err := os.ReadFile(fmt.Sprintf("%s/%s", sources.EventSourceDir, "gitlab.yaml"))
assert.Nil(t, err)
Expand Down
Loading