-
Notifications
You must be signed in to change notification settings - Fork 4
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
base: main
Are you sure you want to change the base?
Conversation
projects/etos_suite_runner/src/etos_suite_runner/lib/esr_parameters.py
Outdated
Show resolved
Hide resolved
projects/etos_suite_runner/src/etos_suite_runner/lib/esr_parameters.py
Outdated
Show resolved
Hide resolved
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.
df7c2b6
to
d59859d
Compare
The Environment provider can handle this by itself now
e4d821c
to
f1fd4bc
Compare
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()}" |
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.
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 |
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 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: |
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.
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, |
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.
Won't line separating this will break black, since we use -l 100
?
{"CAUSE": tercc_id}, | ||
) | ||
|
||
if os.getenv("IDENTIFIER") is not None: |
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 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.""" |
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.
nit: perticular gives the sence that you can specify something, in this case a test run, but in essence you can't.
"""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.""" |
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 docstring doesn't seem correct, is it?
else: | ||
tercc = EiffelTestExecutionRecipeCollectionCreatedEvent() | ||
tercc.rebuild(self.tercc) | ||
artifact_created = request_artifact_created(self.etos, tercc=tercc) |
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.
Don't we need to handle the case where request_artifact_created returns None?
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