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

Create github issue on distribution build job failure #2448

Merged
merged 1 commit into from
Aug 16, 2022
Merged

Create github issue on distribution build job failure #2448

merged 1 commit into from
Aug 16, 2022

Conversation

rishabh6788
Copy link
Collaborator

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.

@rishabh6788 rishabh6788 requested a review from a team as a code owner August 11, 2022 14:54
@codecov-commenter
Copy link

codecov-commenter commented Aug 11, 2022

Codecov Report

Merging #2448 (6c3a206) into main (856b691) will increase coverage by 0.20%.
The diff coverage is n/a.

@@             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     
Impacted Files Coverage Δ
src/system/temporary_directory.py 85.71% <0.00%> (-11.43%) ⬇️
src/system/os.py 93.75% <0.00%> (-6.25%) ⬇️
tests/jenkins/jobs/AssembleUpload_Jenkinsfile
tests/jenkins/jobs/InputManifest_Jenkinsfile
tests/jenkins/jobs/BuildManifest_Jenkinsfile
tests/jenkins/jobs/UploadIndexFile_Jenkinsfile
...sts/jenkins/jobs/ArchiveAssembleUpload_Jenkinsfile
...nkins/jobs/RpmDashboardsDistValidation_Jenkinsfile
tests/jenkins/jobs/UploadTestResults_Jenkinsfile
tests/jenkins/jobs/BuildAssembleUpload_Jenkinsfile
... and 46 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@bbarani bbarani requested a review from dblock August 11, 2022 22:10
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**.
Copy link
Member

Choose a reason for hiding this comment

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

typo: Recived -> Received

Copy link
Collaborator Author

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

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

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

makes sense. Done.

def versionLabel = "v${curVersion}"
def label = "autocut"

def message = """***Recived Error***: **${failedMessage}**.
Copy link
Member

Choose a reason for hiding this comment

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

Typo: Recived -> Received

Comment on lines +19 to +20
for(component in yamlFile.components){
if (failedComponents.contains(component.name)) {
Copy link
Member

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.

Copy link
Collaborator Author

@rishabh6788 rishabh6788 Aug 12, 2022

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.

Copy link
Member

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?

Copy link
Collaborator Author

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

Copy link
Member

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

Choose a reason for hiding this comment

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

Why sleep?

Copy link
Collaborator Author

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.

@rishabh6788 rishabh6788 merged commit 0720e05 into opensearch-project:main Aug 16, 2022
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.

4 participants