-
Notifications
You must be signed in to change notification settings - Fork 2
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
Ignore updates from specified users / enable validation through HV / draft for handling automation events from downstream #57
base: main
Are you sure you want to change the base?
Conversation
} | ||
|
||
@POST | ||
@Path("/downstream/{project}") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Path("/downstream/{project}") | |
@Path("/mirror/{project}") |
maybe?
@@ -307,12 +312,40 @@ public void acknowledge(String project, JiraWebHookEvent event) { | |||
throw new ConstraintViolationException("Project " + project + " is not configured.", Set.of()); | |||
} | |||
|
|||
if (context.isUserIgnored(triggeredByUser)) { | |||
Log.infof("Event was triggered by %s user that is in the ignore list.", triggeredByUser); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Log.infof("Event was triggered by %s user that is in the ignore list.", triggeredByUser); | |
Log.tracef("Event was triggered by %s user that is in the ignore list.", triggeredByUser); |
Unless you want to be flooded, of course :]
@@ -307,12 +312,40 @@ public void acknowledge(String project, JiraWebHookEvent event) { | |||
throw new ConstraintViolationException("Project " + project + " is not configured.", Set.of()); | |||
} | |||
|
|||
if (context.isUserIgnored(triggeredByUser)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note this means we will buffer a request body and deserialize the event before we check whether we ignore the request entirely (because of the user).
A potential improvement for later, to reduce the stress on the app, would be to implement this check as a filter instead. This might avoid the deserialization -- though probably not the buffering of the request body.
I say for later, because I'm not sure we even need such an optimization without our current workload :)
context.startProcessingDownstreamEvent(); | ||
doRun(); | ||
} catch (RuntimeException e) { | ||
failureCollector.critical("Failed to handled the event: %s".formatted(this), e); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
failureCollector.critical("Failed to handled the event: %s".formatted(this), e); | |
failureCollector.critical("Failed to handle the event: %s".formatted(this), e); |
478ba6d
to
224ca18
Compare
I tested this a bit with JIRATEST1.