-
Notifications
You must be signed in to change notification settings - Fork 272
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
Create github issue on distribution build job failure #2448
Conversation
Codecov Report
@@ Coverage Diff @@
## main #2448 +/- ##
============================================
+ Coverage 94.63% 94.83% +0.20%
============================================
Files 211 157 -54
Lines 4322 4144 -178
Branches 29 19 -10
============================================
- Hits 4090 3930 -160
+ Misses 226 214 -12
+ Partials 6 0 -6 Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
createGithubIssue.withCredentials([[GITHUB_USER, GITHUB_TOKEN]], groovy.lang.Closure) | ||
createGithubIssue.sh({script=gh issue list --repo https://github.com/opensearch-project/OpenSearch.git -S "[AUTOCUT] OS Distribution Build Failed for OpenSearch-2.0.0 in:title" --label autocut, returnStdout=true}) | ||
createGithubIssue.sh({script=gh label list --repo https://github.com/opensearch-project/OpenSearch.git -S v2.0.0, returnStdout=true}) | ||
createGithubIssue.sh({script=gh issue create --title "[AUTOCUT] OS Distribution Build Failed for OpenSearch-2.0.0" --body "***Recived Error***: **Error building OpenSearch, retry with: ./build.sh manifests/2.2.0/opensearch-2.2.0.yml --component OpenSearch --snapshot**. |
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.
typo: Recived -> Received
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.
fixed
createGithubIssue.sh({script=gh label list --repo https://github.com/opensearch-project/OpenSearch.git -S v2.0.0, returnStdout=true}) | ||
createGithubIssue.sh({script=gh issue create --title "[AUTOCUT] OS Distribution Build Failed for OpenSearch-2.0.0" --body "***Recived Error***: **Error building OpenSearch, retry with: ./build.sh manifests/2.2.0/opensearch-2.2.0.yml --component OpenSearch --snapshot**. | ||
The distribution build for OpenSearch has failed. | ||
Please see build log at www.example.com/jobs/test/123" --label "autocut,v2.0.0" --repo https://github.com/opensearch-project/OpenSearch.git, returnStdout=true}) |
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.
nit: I think we should add /consoleFull
too. Not everyone know where to look
Example: https://build.ci.opensearch.org/job/distribution-build-opensearch/5909/consoleFull
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.
makes sense. Done.
vars/createGithubIssue.groovy
Outdated
def versionLabel = "v${curVersion}" | ||
def label = "autocut" | ||
|
||
def message = """***Recived Error***: **${failedMessage}**. |
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.
Typo: Recived -> Received
for(component in yamlFile.components){ | ||
if (failedComponents.contains(component.name)) { |
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.
The input manifest is going to contain the component, that is why it is building it right? I dont think you need to check that again here.
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.
Here I am using the same manifest that was passed and iterating over each component and checking if that component exists in the failed component list. If it exists i am passing the failed component repository info which I can only get from manifest file.
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.
Instead of iterating over all the components why not just use the mapped values. The failed components are going to be in the manifest thats not optional. However you can just get the values like repository url, etc directly from those mapped values.
@prudhvigodithi WDYT?
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.
The components
in the manifest yaml file is a list of map object, it's structure is like [{name:component1,repository:<url1>, ref:<ref1>, checks:[<list>] }, {name:component2,repository:<url2>, ref:<ref2>, checks:[<list>] }........]
. Without iterating over the list not sure how I will find at which index the failed component value is present. @gaiksaya
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.
Got it. Didn't realize its a list.
println("Component ${component.name} failed, creating github issue") | ||
compIndex = failedComponents.indexOf(component.name) | ||
create_issue(component.name, component.repository, currentVersion, failureMessages[compIndex]) | ||
sleep(time:3,unit:"SECONDS") |
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.
Why sleep?
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.
So that github doesn't throttle our calls in case there are multiple component failures.
Signed-off-by: Rishabh Singh <[email protected]>
Signed-off-by: Rishabh Singh [email protected]
Description
This PR adds capability to add github issue to component repository in case of distribution build job failure for each failing coponent. A new issue is added for each component version failure and in case an issue already exists for a particular component version then issue creation is skipped to avoid creating duplicate issues.
Issues Resolved
#1899
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.