Skip to content

Commit 0863d31

Browse files
authored
Add support for stage logs option (#25)
1 parent b1daacd commit 0863d31

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@ stages = [{
4343
"privileged": True,
4444
# the number of seconds until the container is killed (optional, defaults to 30)
4545
"timeout": 30,
46+
# enable saving the logs from this stage
47+
"logs": False,
4648
# container environment additions/overrides (optional, defaults to none)
4749
"env": {
4850
"VAR1": "1"

chainlink/__init__.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -108,11 +108,12 @@ async def _run_stage(self, stage, mount, environ):
108108
result = {
109109
"data": self.client.api.inspect_container(container.id)["State"],
110110
"killed": killed,
111-
"logs": {
112-
"stdout": container.logs(stderr=False, timestamps=True),
113-
"stderr": container.logs(stdout=False, timestamps=True),
114-
},
111+
"logs": {"stdout": None, "stderr": None},
115112
}
113+
if stage.get("logs", True):
114+
result["logs"]["stdout"] = container.logs(stderr=False, timestamps=True)
115+
result["logs"]["stderr"] = container.logs(stdout=False, timestamps=True)
116+
116117
result["success"] = (not killed) and (result["data"]["ExitCode"] == 0)
117118
container.remove()
118119

0 commit comments

Comments
 (0)