From 917ba8f58479147e773b4a02400e280e1e4a8dff Mon Sep 17 00:00:00 2001 From: Lars Wirzenius Date: Mon, 6 Nov 2017 13:41:52 +0100 Subject: Add: update, retrieve build logs --- yarns/400-build.yarn | 46 ++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 38 insertions(+), 8 deletions(-) (limited to 'yarns/400-build.yarn') diff --git a/yarns/400-build.yarn b/yarns/400-build.yarn index b544695..c57fd07 100644 --- a/yarns/400-build.yarn +++ b/yarns/400-build.yarn @@ -35,6 +35,7 @@ Set up the controller. ... uapi_workers_id_get ... uapi_builds_get ... uapi_builds_id_get + ... uapi_log_id_get AND a running ick controller Add up a project. @@ -94,6 +95,7 @@ be in the path or can we get it in the access token?** AND body matches ... { ... "build_id": 1, + ... "log": "/log/1", ... "worker": "obelix", ... "project": "rome", ... "pipeline": "construct", @@ -108,6 +110,7 @@ be in the path or can we get it in the access token?** AND body matches ... { ... "build_id": 1, + ... "log": "/log/1", ... "worker": "obelix", ... "project": "rome", ... "pipeline": "construct", @@ -133,6 +136,7 @@ User can now see pipeline is running and which worker is building it. ... "worker": "obelix", ... "doing": { ... "build_id": 1, + ... "log": "/log/1", ... "worker": "obelix", ... "project": "rome", ... "pipeline": "construct", @@ -150,14 +154,21 @@ User can now see pipeline is running and which worker is building it. ... "builds": [ ... { ... "build_id": 1, + ... "log": "/log/1", ... "worker": "obelix", ... "project": "rome", ... "pipeline": "construct", - ... "status": "building" + ... "status": "building", + ... "log": "/log/1" ... } ... ] ... } + WHEN user makes request GET /log/1 + THEN result has status code 200 + AND result has header Content-Type: text/plain + AND body text is "" + Worker reports some build output. Note the null exit code. WHEN worker-manager makes request POST /work @@ -167,7 +178,7 @@ Worker reports some build output. Note the null exit code. ... "project": "rome", ... "pipeline": "construct", ... "exit_code": null, - ... "stdout": "hey ho hey ho", + ... "stdout": "hey ho", ... "stderr": "", ... "timestamp": "2017-10-27T17:08:49" ... } @@ -180,6 +191,7 @@ Still the same job, since the first build step didnt't finish. AND body matches ... { ... "build_id": 1, + ... "log": "/log/1", ... "worker": "obelix", ... "project": "rome", ... "pipeline": "construct", @@ -189,6 +201,13 @@ Still the same job, since the first build step didnt't finish. ... "step_index": 0 ... } +The build log is immediately accessible. + + WHEN user makes request GET /log/1 + THEN result has status code 200 + AND result has header Content-Type: text/plain + AND body text is "hey ho" + Report the step is done, and successfully. WHEN worker-manager makes request POST /work @@ -198,12 +217,17 @@ Report the step is done, and successfully. ... "project": "rome", ... "pipeline": "construct", ... "exit_code": 0, - ... "stdout": "hey ho, hey ho\n", + ... "stdout": ", hey ho\n", ... "stderr": "", ... "timestamp": "2017-10-27T17:08:49" ... } THEN result has status code 201 + WHEN user makes request GET /log/1 + THEN result has status code 200 + AND result has header Content-Type: text/plain + AND body text is "hey ho, hey ho\n" + Now there's another step to do. WHEN worker-manager makes request GET /work/obelix @@ -211,6 +235,7 @@ Now there's another step to do. AND body matches ... { ... "build_id": 1, + ... "log": "/log/1", ... "worker": "obelix", ... "project": "rome", ... "pipeline": "construct", @@ -235,7 +260,8 @@ User sees changed status. ... "step_index": 1, ... "step": { ... "shell": "day 2" - ... } + ... }, + ... "log": "/log/1" ... } ... } @@ -275,10 +301,12 @@ Also, there's a build with a log. ... "builds": [ ... { ... "build_id": 1, + ... "log": "/log/1", ... "worker": "obelix", ... "project": "rome", ... "pipeline": "construct", - ... "status": 0 + ... "status": 0, + ... "log": "/log/1" ... } ... ] ... } @@ -288,15 +316,17 @@ Also, there's a build with a log. AND body matches ... { ... "build_id": 1, + ... "log": "/log/1", ... "worker": "obelix", ... "project": "rome", ... "pipeline": "construct", - ... "status": 0 + ... "status": 0, + ... "log": "/log/1" ... } - WHEN user makes request GET /builds/1/log + WHEN user makes request GET /log/1 THEN result has status code 200 AND result has header Content-Type: text/plain - AND body matches "hey ho, hey ho\nto the gold mine we go!\n" + AND body text is "hey ho, hey ho\nto the gold mine we go!\n" FINALLY stop ick controller -- cgit v1.2.1