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

Make ESR compatible with the new ETOS kubernetes controller #67

Open
wants to merge 19 commits into
base: main
Choose a base branch
from

Conversation

t-persson
Copy link
Collaborator

Applicable Issues

eiffel-community/etos#242

Description of the Change

The ESR shall work with the current way of running ETOS but should detect if it is running as a part of the ETOS kubernetes controller.
I also removed the announcement events. This is not necessary, but they no longer provide any value.

Alternate Designs

I noticed a few environment variables set by the ETOS kubernetes controller have names that don't feel right.
I would love to update those, but I think I will leave that further on in the poc instead of now.

Possible Drawbacks

The ESR will be able to run in two different environments meaning that the risk of bugs is larger. I'll try to keep changes to the minimum in the ESR and will clean it up after the poc is done.

Sign-off

Developer's Certificate of Origin 1.1

By making a contribution to this project, I certify that:

(a) The contribution was created in whole or in part by me and I
have the right to submit it under the open source license
indicated in the file; or

(b) The contribution is based upon previous work that, to the best
of my knowledge, is covered under an appropriate open source
license and I have the right under that license to submit that
work with modifications, whether created in whole or in part
by me, under the same open source license (unless I am
permitted to submit under a different license), as indicated
in the file; or

(c) The contribution was provided directly to me by some other
person who certified (a), (b) or (c) and I have not modified
it.

(d) I understand and agree that this project and the contribution
are public and that a record of the contribution (including all
personal information I submit with it, including my sign-off) is
maintained indefinitely and may be redistributed consistent with
this project or the open source license(s) involved.

Signed-off-by: Tobias Persson tobias.persson@axis.com

@t-persson t-persson requested a review from a team as a code owner July 23, 2024 06:52
@t-persson t-persson requested review from fredjn and andmat900 and removed request for a team July 23, 2024 06:52
result = results[0]
# Convert, for example, INCONCLUSIVE to Inconclusive to match the controller result struct
# TODO Move the result struct to ETOS library and do this conversion on creation
result["conclusion"] = f"{result['conclusion'][0].upper()}{result['conclusion'][1:].lower()}"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Readability here is kind of messy, when moving these perhaps they can be made clearer and/or add descriptive code comments.

for request in self.params.environment_requests:
requests.append(request)
# This condition check is temporary to make sure that the ESR fails if environment
# requests fail. In the future the ESR shall not even start if the environment request
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a TODO or and Issues concerning this reference to an unforetold future?

if status == "false" and reason == "done":
success.append(condition)
if found and len(failed) > 0:
for request in failed:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just above we stuff the failed list with conditions, not they are referenced as requests, how come?

@@ -139,7 +192,9 @@ def _release_environment(self) -> None:
kind=opentelemetry.trace.SpanKind.CLIENT,
):
status, message = release_full_environment(
etos=self.etos, jsontas=jsontas, suite_id=self.params.tercc.meta.event_id
etos=self.etos,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Won't line separating this will break black, since we use -l 100?

{"CAUSE": tercc_id},
)

if os.getenv("IDENTIFIER") is not None:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is this IDENTIFIER, and what does running as a TestRun mean? Perhaps be a bit more descriptive in the comment.


@property
def environment_requests(self) -> list:
"""Environment requests for a particular testrun."""
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: perticular gives the sence that you can specify something, in this case a test run, but in essence you can't.

Suggested change
"""Environment requests for a particular testrun."""
"""Environment requests for testrun beeing executed"""

return response.items

def main_suite_ids(self) -> list[str]:
"""Environment requests to the environment provider."""
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This docstring doesn't seem correct, is it?

else:
tercc = EiffelTestExecutionRecipeCollectionCreatedEvent()
tercc.rebuild(self.tercc)
artifact_created = request_artifact_created(self.etos, tercc=tercc)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't we need to handle the case where request_artifact_created returns None?

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

Successfully merging this pull request may close these issues.

3 participants