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

[8.x] [Security Solution][Serverless] Github tickets / notifications (#197265) #199314

Merged
merged 2 commits into from
Dec 3, 2024

Conversation

kibanamachine
Copy link
Contributor

Backport

This will backport the following commits from main to 8.x:

Questions ?

Please refer to the Backport tool documentation

…ic#197265)

## Summary

This PR is accompanied with the [PR in kibana-operations
repo](elastic/kibana-operations#236) and
integrates the security solution quality gate pipelines with the
functionality to create ticket when a test fails and then notify the
respective **codeowner** team with a _Test failed alert_. Also when a
test fails a second time and a ticket exist a new comment is added in
the same issue that the test failed again in a given pipeline.

Last a similar flow exist when a test is skipped by a team.

**Specifications:**

- In the `failed_test_reporter_cli.ts` [a new field is introduced
](https://github.com/elastic/kibana/compare/main...security-mki-github-tickets#diff-bb801c18fd2e1a3a36a3b39fbf02c1abe337c46c201ad5a01239a9d2501d4b56R47)`prependTitle`
which is initialized by the environmental variable
`process.env.PREPEND_FAILURE_TITLE` if exists, in order to add a custom
text of preference before the issue title.

The scope of this is to be able to give the team the opportunity to add
some tags or any convention agreed within the team in the issue created
in order to easily understand the context without opening the ticket. If
this field is not initialized, the normal existing flow proceeds.
[Here](elastic#197133) an example of
the prependTitle usage can be seen where the tags `[MKI][QA]` are
prepended in order to identify where did the test fail, having the same
exactly tests running on both CI and MKI. This means that a github issue
with the exact same title would be created for both cases if this
prepend title field would not exist.

- In the
[junit_transformer/lib.ts](elastic/kibana@main...security-mki-github-tickets#diff-31c5651af613c7d02139f3e9fccd00ddb997f2502523372dd19db9e0659a66d6R278)
a new functionality is introduced to cover an existing issue. The
existing issue is: the fact that we are retrying the failed test in
cypress in the `parallel_serverless` script, leads to two junit xml
result files completely identical with only difference the execution
time and the timestamps. This change will take one by one the xml
outputs, transform them exactly as it was happening before and then save
the file, but also remove the time and timestamp fields, convert it to a
string and add it to a "state" list. Then in a next file if it is
already parsed and saved to the list having the exact same results
within, it deletes the file instead of saving it transformed.

The problem before this fix was the fact that when two xml outputs
existed, a github ticket was created and when parsing-uploading the
second file it was immediately failing for a second time as well. This
means that `new-failure` notification was never triggered after the
github actions flow split, and the existing failure was always
triggered, something that most teams have disabled.

With the fix, the identical files are parsed but only once uploaded and
the new failure flow works again.

(cherry picked from commit 9353497)
@delanni
Copy link
Contributor

delanni commented Dec 3, 2024

/ci

@kibanamachine kibanamachine merged commit 167719c into elastic:8.x Dec 3, 2024
8 checks passed
@elasticmachine
Copy link
Contributor

💚 Build Succeeded

Metrics [docs]

Unknown metric groups

ESLint disabled line counts

id before after diff
securitySolution 555 556 +1

Total ESLint disabled count

id before after diff
securitySolution 640 641 +1

History

cc @dkirchan

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants