-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
[Security Solution] Fix a build step when there are no tests to execute #165929
[Security Solution] Fix a build step when there are no tests to execute #165929
Conversation
b32be1b
to
54c17f6
Compare
5663af7
to
54509e4
Compare
@@ -31,8 +31,10 @@ if [[ "$IS_TEST_EXECUTION_STEP" == "true" ]]; then | |||
buildkite-agent artifact upload '.es/**/*.hprof' | |||
buildkite-agent artifact upload 'data/es_debug_*.tar.gz' | |||
|
|||
echo "--- Run Failed Test Reporter" | |||
node scripts/report_failed_tests --build-url="${BUILDKITE_BUILD_URL}#${BUILDKITE_JOB_ID}" 'target/junit/**/*.xml' | |||
if [ ${BUILDKITE_COMMAND_EXIT_STATUS} -ne 0 ]; then |
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.
I'm not sure if this will work on Buildkite, locally I can't use -ne
with [ ]
so I suggest:
if [ ${BUILDKITE_COMMAND_EXIT_STATUS} -ne 0 ]; then | |
if [[ ${BUILDKITE_COMMAND_EXIT_STATUS} -ne 0 ]]; then |
Reading through the post_command, and subsequently the kibana/packages/kbn-failed-test-reporter-cli/failed_tests_reporter/failed_tests_reporter_cli.ts Line 94 in afb09cc
Maybe we should set this flag in the post_command hooks: |
@delanni I considered using Regarding skipping |
💔 Build FailedFailed CI Steps
Test Failures
Metrics [docs]
History
To update your PR or re-run it, just comment with: cc @maximpn |
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.
This seems strange, command is exiting with a failure, report failed tests is correctly skipped but then the CI step is marked as a success. Is this intentional?
@jbudz this is an intentional behavior and a temporally fix done by this PR. Reporter merger/converter can't handle missing tests gracefully and exit with non zero code. A proper fix will take some time and I created a ticket for that. While you can see non zero exit code in the log in fact it's swallowed by |
💚 All backports created successfully
Note: Successful backport PRs will be merged automatically after passing CI. Questions ?Please refer to the Backport tool documentation |
…te (elastic#165929) ## Summary Fixes failed build steps when there are no tests to execute and hence no reports. ## Details Despite this [PR](elastic#165824) fixes tests failure when there are no reports but `yarn junit:merge` tries to convert them to junit format the problem is partially stays as `Failed Test Reporter` runs for every build step meaning also for successful build steps. We don't need to handle failed test reports for successful build steps. There are cases when there are no tests to run so Cypress doesn't produce reports and nothing is converted to junit format so `Failed Test Reporter` fails and causes a build step to fails. It could be solved by defining an environment variable `DISABLE_MISSING_TEST_REPORT_ERRORS=true` but we need to make sure reports exist for failed tests. Taking this into account we can rely on `BUILDKITE_COMMAND_EXIT_STATUS` to avoid running `Failed Test Reporter` if the build step successed. One may ask why don't skip `Upload Artifacts` too. We may need some build artifacts for successful build steps. --------- Co-authored-by: Tiago Costa <[email protected]> (cherry picked from commit 369d2fe)
Summary
Fixes failed build steps when there are no tests to execute and hence no reports.
Details
Despite this PR fixes tests failure when there are no reports but
yarn junit:merge
tries to convert them to junit format the problem is partially stays asFailed Test Reporter
runs for every build step meaning also for successful build steps. We don't need to handle failed test reports for successful build steps. There are cases when there are no tests to run so Cypress doesn't produce reports and nothing is converted to junit format soFailed Test Reporter
fails and causes a build step to fails. It could be solved by defining an environment variableDISABLE_MISSING_TEST_REPORT_ERRORS=true
but we need to make sure reports exist for failed tests. Taking this into account we can rely onBUILDKITE_COMMAND_EXIT_STATUS
to avoid runningFailed Test Reporter
if the build step successed.One may ask why don't skip
Upload Artifacts
too. We may need some build artifacts for successful build steps.