-
Notifications
You must be signed in to change notification settings - Fork 25
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
Creating Issue Reports for Flaky Test Failures in Gradle Check #436
Conversation
1e2f270
to
77bfa7b
Compare
Adding @dblock since a similar setup was done in past for code inside src/jenkins. I have added a package Having this now the unit tests I have used
Just deleting the directory I'm wondering why just adding one extra package |
b8462b4
to
d784730
Compare
5e20a70
to
c2536f3
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #436 +/- ##
============================================
- Coverage 87.12% 86.84% -0.28%
- Complexity 31 60 +29
============================================
Files 88 100 +12
Lines 233 365 +132
Branches 12 25 +13
============================================
+ Hits 203 317 +114
- Misses 22 26 +4
- Partials 8 22 +14 ☔ View full report in Codecov by Sentry. |
ac1d2e2
to
c7fbccd
Compare
I see that there are two comments, if I remember correctly wasn't it supposed to be just one comment that would keep getting updated or description? |
Ya I have removed the The markdown table is coming from the approval opensearch-project/OpenSearch#13950 (comment), this has all the information per commit, associated PR, jenkins build and failed tests. |
@@ -22,7 +24,7 @@ void call(Map args = [:]) { | |||
try { | |||
withCredentials([usernamePassword(credentialsId: 'jenkins-github-bot-token', passwordVariable: 'GITHUB_TOKEN', usernameVariable: 'GITHUB_USER')]) { | |||
def openIssue = sh( | |||
script: "gh issue list --repo ${args.repoUrl} -S \"${args.issueTitle} in:title\" --label ${label} --json number --jq '.[0].number'", | |||
script: "gh issue list --repo ${args.repoUrl} -S \"${args.issueTitle} in:title\" --label \"${label}\" --json number --jq '.[0].number'", |
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.
In case there are multiple issues returned then is this picking up the top result?
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.
Yes Rishab that was the idea for this existing library createGithubIssue
, the logic was with same title for all the AUTOCUT issues, there will be only one issue created for one scenario.
|
||
} | ||
def getPostMergeFailedTestName(testName, gitReference) { | ||
return new OpenSearchMetricsQuery(metricsUrl,awsAccessKey, awsSecretKey, awsSessionToken, script).fetchMetrics(getQuery(testName, gitReference)) |
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: missing space after comma.
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.
Added thanks
} | ||
|
||
def fetchMetrics(String query) { | ||
def response = script.sh( |
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.
just for my knowledge, what is 'script.sh'?
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 script
is a jenkins context and will be injected to the library during runtime. Without the jenkins context the native groovy does have the sh
inbuit.
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.
Adding more to this, to run a script in groovy the ideal way to use is .execute()
, but running .execute()
in jenkins is blocked by the script security plugin, hence the ideal was is to use sh
given by jenkins and for sh
to work in libraries it needs jenkins context.
One thought I have is once the workflow has created an issue, and someone works on it, may be updates the comment or description and strikes-through a few failing tests that have been fixed. |
AFAIK only maintainers/admins's can edit the issue created by external users and I dont think one can edit the issue created by other user. |
String awsSessionToken | ||
def script | ||
|
||
FetchPostMergeFailedTestClass(String metricsUrl, String awsAccessKey, String awsSecretKey, String awsSessionToken, def script) { |
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.
except markdown class, every class has the same constructor and get_query
methods. Would it be better to have a parent/super class or interface, if supported in groovy class, and have these method defined there and other classes just inherit it and implement in its own way. Method like getPostMergeFailedTestClass
can have a generic name and implemented in all the sub-classes.
Not a blocker for me.
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.
That was my initial implementation rishab, check this commit which has the extends
and super
implementation, the jenkins pipeline works but this extends
and super
implementation ran into issues with running the tests (both old and new tests part of the PR) part of this repo, please check my comment here.
FYI I have added a comment to an open issue jenkinsci/JenkinsPipelineUnit#595 (comment) on why we cant test the library directly |
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.
Approving assuming all search queries are working as expected.
Thanks @rishabh6788 just pushed a commit change the repo from my fork to |
Signed-off-by: Prudhvi Godithi <[email protected]> (cherry picked from commit 2e95cdd) Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
The backport to
To backport manually, run these commands in your terminal: # Fetch latest updates from GitHub
git fetch
# Create a new working tree
git worktree add ../.worktrees/backport-6.x 6.x
# Navigate to the new working tree
pushd ../.worktrees/backport-6.x
# Create a new branch
git switch --create backport/backport-436-to-6.x
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 2e95cddcdf42ea02f45025b9ff1941240d7ba82f
# Push it to GitHub
git push --set-upstream origin backport/backport-436-to-6.x
# Go back to the original working tree
popd
# Delete the working tree
git worktree remove ../.worktrees/backport-6.x Then, create a pull request where the |
Signed-off-by: Prudhvi Godithi <[email protected]> (cherry picked from commit 2e95cdd) Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Description
Gradle Check flaky test failures issue creation
Issues Resolved
Part of opensearch-project/OpenSearch#13950
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.