-
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
Add a library to check code coverage #631
Conversation
Signed-off-by: Sayali Gaikawad <gaiksaya@amazon.com>
Signed-off-by: Sayali Gaikawad <gaiksaya@amazon.com>
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #631 +/- ##
============================================
- Coverage 89.15% 89.04% -0.12%
- Complexity 111 118 +7
============================================
Files 116 118 +2
Lines 544 575 +31
Branches 30 32 +2
============================================
+ Hits 485 512 +27
- Misses 29 31 +2
- Partials 30 32 +2 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Signed-off-by: Sayali Gaikawad <gaiksaya@amazon.com>
@@ -0,0 +1,6 @@ | |||
Hi, </br> | |||
|
|||
This component is not reporting code-coverage for branch [$BRANCH]($CODECOV_URL). </br> |
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.
Is it possible to insert the 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.
We are directly commenting on the component's issue. But sure just to be clear let me add it.
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 the change here: 8af4484
Thanks!
|
||
def process(String pathToTemplate, def bindings, String outputDir) { | ||
try { | ||
def randomName = getRandomName() |
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 random 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.
Same environment can lead to overwriting the file so just getting random name. The file is used as a parameter passed in gh comment command as --body-file <file_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.
since this will always run in jenkins context, can we just use component-build_id
for naming?
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.
Too much hassle to pass the component name here again or parse the bindings again. Just needed a unique id so used random method.
def process(String pathToTemplate, def bindings, String outputDir) { | ||
try { | ||
def randomName = getRandomName() | ||
def content = this.script.libraryResource pathToTemplate |
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.
what does this do?
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.
Load the script from the resource. Groovy code under src
does not have direct access to jenkins env. So all the inbuild functions like echo, sh, etc needs jenkins object. We are passing the instance in the constructor. See https://github.com/opensearch-project/opensearch-build-libraries/pull/631/files#diff-7a4ffa30ad30b3c57f651a0f7b007cab18cf1bd50594694fb181505e3eb62ab8R98
Signed-off-by: Sayali Gaikawad <gaiksaya@amazon.com>
Signed-off-by: Sayali Gaikawad <gaiksaya@amazon.com> (cherry picked from commit 3766071) Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Signed-off-by: Sayali Gaikawad <gaiksaya@amazon.com> (cherry picked from commit 3766071) Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Description
Add a library to check code coverage for all the components in the release. Currently this will only report components missing the code coverage. Regarding meeting the threshold or not, we will be adding in next iteration once we know everyone is on-board.
This change also add a new utility to parse the template using GStringTemplateEngine that would help replacing the values and also add conditions based on values within the template much easier in the future.
Issues Resolved
closes opensearch-project/opensearch-build#5332
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.