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: [CI-11840]: Added env variable to control the event of inbound w… #3508

Merged
merged 4 commits into from May 7, 2024

Conversation

ShobhitSingh11
Copy link

@ShobhitSingh11 ShobhitSingh11 commented Apr 30, 2024

Have added the env var "DRONE_INCOMING_WEBHOOK_EVENTS" (of type list of string) to control the event in case of incoming webhook. If no such env variable is provided then it will fallback to default behaviour. Below are the test cases

  • Case 1: When no env variable "DRONE_INCOMING_WEBHOOK_EVENTS" is present.
Screen.Recording.2024-04-30.at.1.20.01.PM.mov
  • Case 2: When Deployment event is missing from env var.
Screen.Recording.2024-04-30.at.1.23.45.PM.2.mov
  • Case 3: When Deployment, pull_request events are missing from env var.
Screen.Recording.2024-04-30.at.1.47.50.PM.mov
  • Case 4: When Deployment and push events are only present in env var.
Screen.Recording.2024-04-30.at.1.53.22.PM.mov

Tested with few more combinations as well.

@@ -443,6 +444,10 @@ type (
ContentSecurityPolicy string `envconfig:"DRONE_HTTP_CONTENT_SECURITY_POLICY"`
ReferrerPolicy string `envconfig:"DRONE_HTTP_REFERRER_POLICY"`
}

InboundWebhookEvents struct {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Nit: remove Events from InboundWebhookEvents
And rename Inbound -> Incoming

}

func (s *service) Create(ctx context.Context, user *core.User, repo *core.Repository) error {
err := s.renew.Renew(ctx, user, false)
if err != nil {
return err
}

var eventsMap map[string]bool
eventsMap = make(map[string]bool)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Nit: eventsMap := make(map[string]bool)

@vistaarjuneja vistaarjuneja merged commit 87381af into drone May 7, 2024
2 checks passed
@vistaarjuneja vistaarjuneja deleted the CI-11840 branch May 7, 2024 15:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants