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 upstream causes to Slack messages #3269

Merged
merged 1 commit into from
Oct 15, 2018

Conversation

AdamBrousseau
Copy link
Contributor

  • Recursively find upstream causes
  • Print out upstream causes in Slack message
  • Allows the ability to distinguish between a nightly
    build and an OMR Acceptance for example
  • Requires Jenkins script approvals:
    • org.jenkinsci.plugins.workflow.support.steps.build.RunWrapper getRawBuild
    • method hudson.model.Run getCauses
    • hudson.model.Cause$UpstreamCause getUpstreamCauses
    • hudson.model.Cause getShortDescription

[skip ci]

Signed-off-by: Adam Brousseau adam.brousseau88@gmail.com

@AdamBrousseau
Copy link
Contributor Author

Current Slack message example:

Failure in: Pipeline-Build-Test-JDK8-aix_ppc-64_cmprssptrs #313 (Open)
Downstream Job: Test-sanity.system-JDK8-aix_ppc-64_cmprssptrs #109 (Open)

New Slack message:

Failure in: Test-sanity.system-JDK8-aix_ppc-64_cmprssptrs #109 (Open)
Started by Pipeline-Build-Test-JDK8-aix_ppc-64_cmprssptrs #313 (Open)
Started by upstream project Pipeline-Build-Test-All build number 239
Started by Started by timer

Marking as WIP to allow discussion of formatting, text, and links.
@vsebe and @pshipton for review

@pshipton
Copy link
Member

The new output format looks fine to me. I think this is a big improvement. We can always make further changes later based on real world results.

@AdamBrousseau
Copy link
Contributor Author

AdamBrousseau commented Oct 15, 2018

Ok. I will unmark WIP. I had thought about making the new lines more consistent with the first two by adding links to upstream build(s) for example. This would be a bit more investigation and work so I'm happy to leave it as is for now and improve later if we desire.

Edit: Apparently I never marked it WIP so nothing to do there.

@@ -195,6 +195,18 @@ def build_with_artifactory(JOB_NAME, VARIABLE_FILE, VENDOR_REPO, VENDOR_BRANCH,
}
}

def get_causes_recursively(cause) {
if (cause.class.toString().contains("UpstreamCause")) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Reformat:

def cause_string = cause.getShortDescription()
if (cause instanceof hudson.model.Cause.UpstreamCause) { 
      for (upCause in cause.upstreamCauses) {
            cause_string += '\n' + get_causes_recursively(upCause)
        }
}
return cause_string 

@AdamBrousseau AdamBrousseau force-pushed the slack_add_all_casues branch 2 times, most recently from 42f48cd to ddf6b5b Compare October 15, 2018 17:59
@AdamBrousseau
Copy link
Contributor Author

@vsebe updated based on feedback. Also moved the initial loop into another function.

- Recursively find upstream causes
- Print out upstream causes in Slack message
- Allows the ability to distinguish between a nightly
  build and an OMR Acceptance for example
- Requires Jenkins script approvals:
   - org.jenkinsci.plugins.workflow.support.steps.build.RunWrapper getRawBuild
   - method hudson.model.Run getCauses
   - hudson.model.Cause$UpstreamCause getUpstreamCauses
   - hudson.model.Cause getShortDescription

[skip ci]

Signed-off-by: Adam Brousseau <adam.brousseau88@gmail.com>
@pshipton pshipton merged commit ebfc93e into eclipse-openj9:master Oct 15, 2018
@pshipton
Copy link
Member

@AdamBrousseau we're getting nothing on Slack now, please take a look

@AdamBrousseau
Copy link
Contributor Author

Fixed. Hadn't run it on the OpenJ9 Jenkins yet so the scripts hadn't been approved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants