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

Ignore updates from specified users / enable validation through HV / draft for handling automation events from downstream #57

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

marko-bekhta
Copy link
Member

I tested this a bit with JIRATEST1.

}

@POST
@Path("/downstream/{project}")
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
@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);
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
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)) {
Copy link
Member

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);
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
failureCollector.critical("Failed to handled the event: %s".formatted(this), e);
failureCollector.critical("Failed to handle the event: %s".formatted(this), e);

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.

2 participants