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

add CSV-separated job run causes to RunMessage #16

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

jordanglassman
Copy link

Description

Adds a CSV-separated list of run cause simple class names for downstream consumers to decide if they want to consume these events or not.

Submitter checklist

  • Link to JIRA ticket in description, if appropriate.
  • Change is code complete and matches issue description
  • Appropriate unit or acceptance tests or explanation to why this change has no tests
  • Reviewer's manual test instructions provided in PR description. See Reviewer's first task below.

Reviewer checklist

  • Run the changes and verified the change matches the issue description
  • Reviewed the code
  • Verified that the appropriate tests have been written or valid explanation given

@@ -63,6 +67,13 @@ public RunMessage(@Nonnull Run run) {
set(EventProps.Jenkins.jenkins_object_url, run.getUrl());
set(EventProps.Job.job_run_queueId, Long.toString(run.getQueueId()));

// CSV list of the accumulated causes of this run
final List<String> causes = new ArrayList<>();
for (Cause cause : (List<Cause>) run.getCauses()) {
Copy link
Member

Choose a reason for hiding this comment

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

Might want to wrap all of this in a check for null on the return of run.getCauses().

Copy link
Author

@jordanglassman jordanglassman Sep 18, 2018

Choose a reason for hiding this comment

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

#getCauses is tagged @Nonnull and looks safe:

public @Nonnull List<Cause> getCauses() {
        CauseAction a = getAction(CauseAction.class);
        if (a==null)    return Collections.emptyList();
        return Collections.unmodifiableList(a.getCauses());
    }

Copy link
Author

Choose a reason for hiding this comment

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

@tfennelly ping?

Copy link
Member

Choose a reason for hiding this comment

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

So this will be added on every event, right? I'd restrict it just the run_started event.

@jordanglassman
Copy link
Author

@tfennelly any objections to going forward with this?

@jordanglassman
Copy link
Author

@tfennelly updated with recommended change.

Copy link
Member

@tfennelly tfennelly left a comment

Choose a reason for hiding this comment

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

Look good @jordanglassman

Would be important to test these changes in a Jenkins that has Blue Ocean installed.

@tfennelly
Copy link
Member

Also of course ... the CI is failing there atm.

@jordanglassman
Copy link
Author

@tfennelly I've tested this in all the ways I know how.

Blue Ocean acceptance tests pass, and works with local testing. LMK what the next step for moving this ball forward is?

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