Skip to content

Commit

Permalink
Read TERCC from Kubernetes instead of environment
Browse files Browse the repository at this point in the history
  • Loading branch information
andmat900 committed Nov 19, 2024
1 parent c46929e commit d44fcb9
Showing 1 changed file with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
EiffelTestExecutionRecipeCollectionCreatedEvent,
)
from etos_lib import ETOS
from etos_lib.kubernetes import Kubernetes, TestRun
from packageurl import PackageURL

from .graphql import request_artifact_created
Expand Down Expand Up @@ -76,7 +77,14 @@ def tercc(self) -> EiffelTestExecutionRecipeCollectionCreatedEvent:
"""
if self.etos.config.get("tercc") is None:
tercc = EiffelTestExecutionRecipeCollectionCreatedEvent()
tercc.rebuild(json.loads(os.getenv("TERCC")))
tercc_json = None
if os.getenv("TERCC") is not None:
# first option for backwards compatibility
tercc_json = json.loads(os.getenv("TERCC"))
else:
# requires testrun custom resource defined in Kubernetes
tercc_json = TestRun(Kubernetes()).get(os.getenv("TESTRUN"))
tercc.rebuild(tercc_json)
self.etos.config.set("tercc", tercc)
return self.etos.config.get("tercc")

Expand Down

0 comments on commit d44fcb9

Please sign in to comment.