-
Notifications
You must be signed in to change notification settings - Fork 12
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
Feature ETP-893: Update HTML Report Publishing in Pipelines #562
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
valeg-etendo
requested review from
valenvivaldi,
fran-roig,
sebastianbarrozo,
Gremiger,
isaiasb-etendo and
Emi-Polliotti
December 18, 2024 15:44
etendobot
reviewed
Dec 18, 2024
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.
GPT Review for Jenkinsfile
Review
- Estimated effort to review [1-5]:
3, because the changes involve multiple sections of the Jenkinsfile, adding conditional checks and modifying the test stages. The complexity is moderate, requiring a careful review of the logic and structure. - Score: 85
Code feedback
- File:
pipelines/unittests/Jenkinsfile - Language:
groovy - Suggestion:
Consider using a constant or a variable for the report directory path to avoid repetition and potential errors if the path needs to be updated in the future. This will improve maintainability and reduce the risk of inconsistencies. [medium] - Label:
maintainability - Existing code:
if (fileExists("build/reports/tests/test/")) {
publishHTML([
allowMissing: true,
alwaysLinkToLastBuild: false,
keepAll: true,
reportDir: 'build/reports/tests/test',
reportFiles: '*.html',
reportName: 'WEBSERVICES TESTS REPORT',
reportTitles: ''
])
sh "rm -rf build/reports/tests/test"
} else {
echo "Report directory of Webservices tests does not exist. Skipping HTML report publishing."
}
- Improved code:
def reportDirPath = "build/reports/tests/test"
if (fileExists(reportDirPath)) {
publishHTML([
allowMissing: true,
alwaysLinkToLastBuild: false,
keepAll: true,
reportDir: reportDirPath,
reportFiles: '*.html',
reportName: 'WEBSERVICES TESTS REPORT',
reportTitles: ''
])
sh "rm -rf ${reportDirPath}"
} else {
echo "Report directory of Webservices tests does not exist. Skipping HTML report publishing."
}
- File:
pipelines/unittests/Jenkinsfile - Language:
groovy - Suggestion:
Ensure that thesh "./gradlew --stop"
command is necessary in all places it is used. If it is not required after every test suite, consider removing it to optimize the build process. [medium] - Label:
performance - Existing code:
sh "./gradlew --stop"
- Improved code:
// Evaluate if this command is necessary in all instances
sh "./gradlew --stop"
etendobot
reviewed
Dec 18, 2024
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.
GPT Review for JenkinsfileOracle
Review
- Estimated effort to review [1-5]:
3, because the changes involve multiple sections of the Jenkinsfile, including error handling and report generation logic, which require careful review to ensure correctness and maintainability. - Score: 85
Code feedback
- File:
pipelines/unittests/JenkinsfileOracle - Language:
groovy - Suggestion:
Consider using a constant or a configuration parameter for the report directory paths to avoid hardcoding them multiple times. This will improve maintainability and reduce the risk of errors if the paths need to be updated in the future. [medium] - Label:
maintainability - Existing code:
if (fileExists('build/reports/tests/test/')) {
publishHTML([
allowMissing: true,
alwaysLinkToLastBuild: false,
keepAll: true,
reportDir: 'build/reports/tests/test',
reportFiles: '*.html',
reportName: 'STANDALONE TESTS REPORT',
reportTitles: ''
])
sh "rm -rf build/reports/tests/test"
} else {
echo "Report directory of Standalone tests does not exist. Skipping HTML report publishing."
}
- Improved code:
def testReportDir = 'build/reports/tests/test/'
if (fileExists(testReportDir)) {
publishHTML([
allowMissing: true,
alwaysLinkToLastBuild: false,
keepAll: true,
reportDir: testReportDir,
reportFiles: '*.html',
reportName: 'STANDALONE TESTS REPORT',
reportTitles: ''
])
sh "rm -rf ${testReportDir}"
} else {
echo "Report directory of Standalone tests does not exist. Skipping HTML report publishing."
}
- File:
pipelines/unittests/JenkinsfileOracle - Language:
groovy - Suggestion:
Ensure that thesh "rm -rf ..."
command is used cautiously, as it can delete files and directories recursively. Consider adding a confirmation step or logging the action before executing it to prevent accidental data loss. [important] - Label:
safety - Existing code:
sh "rm -rf build/reports/tests/test"
- Improved code:
echo "Cleaning up test report directory: build/reports/tests/test"
sh "rm -rf build/reports/tests/test"
- File:
pipelines/unittests/JenkinsfileOracle - Language:
groovy - Suggestion:
Thefinally
block is used to ensure that certain actions are always executed, regardless of whether an exception is thrown. Consider adding logging at the start and end of thefinally
block to improve traceability and debugging. [medium] - Label:
best practice - Existing code:
} finally {
if (fileExists('build/reports/tests/test/')) {
publishHTML([
allowMissing: true,
alwaysLinkToLastBuild: false,
keepAll: true,
reportDir: 'build/reports/tests/test',
reportFiles: '*.html',
reportName: 'STANDALONE TESTS REPORT',
reportTitles: ''
])
sh "rm -rf build/reports/tests/test"
} else {
echo "Report directory of Standalone tests does not exist. Skipping HTML report publishing."
}
}
- Improved code:
} finally {
echo "Entering finally block for test report handling."
if (fileExists('build/reports/tests/test/')) {
publishHTML([
allowMissing: true,
alwaysLinkToLastBuild: false,
keepAll: true,
reportDir: 'build/reports/tests/test',
reportFiles: '*.html',
reportName: 'STANDALONE TESTS REPORT',
reportTitles: ''
])
sh "rm -rf build/reports/tests/test"
} else {
echo "Report directory of Standalone tests does not exist. Skipping HTML report publishing."
}
echo "Exiting finally block for test report handling."
}
Emi-Polliotti
approved these changes
Dec 18, 2024
isaiasb-etendo
approved these changes
Dec 18, 2024
Gremiger
approved these changes
Dec 18, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
No description provided.