From 599e095cda626ff66c789017a752d7f91678d033 Mon Sep 17 00:00:00 2001 From: Lars Wirzenius Date: Mon, 6 Nov 2017 12:02:03 +0100 Subject: Add: /builds --- yarns/400-build.yarn | 52 ++++++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 44 insertions(+), 8 deletions(-) (limited to 'yarns/400-build.yarn') diff --git a/yarns/400-build.yarn b/yarns/400-build.yarn index 81124a4..b544695 100644 --- a/yarns/400-build.yarn +++ b/yarns/400-build.yarn @@ -33,6 +33,8 @@ Set up the controller. ... uapi_projects_id_pipeline_id_get ... uapi_projects_id_builds_get ... uapi_workers_id_get + ... uapi_builds_get + ... uapi_builds_id_get AND a running ick controller Add up a project. @@ -58,9 +60,9 @@ There are no builds for the project yet, and is idle. THEN result has status code 200 AND body matches { "status": "idle" } - WHEN user makes request GET /projects/rome/builds + WHEN user makes request GET /builds THEN result has status code 200 - AND body matches { "project": "rome", "builds": []} + AND body matches { "builds": [] } Register a worker. @@ -91,6 +93,7 @@ be in the path or can we get it in the access token?** THEN result has status code 200 AND body matches ... { + ... "build_id": 1, ... "worker": "obelix", ... "project": "rome", ... "pipeline": "construct", @@ -104,6 +107,7 @@ be in the path or can we get it in the access token?** THEN result has status code 200 AND body matches ... { + ... "build_id": 1, ... "worker": "obelix", ... "project": "rome", ... "pipeline": "construct", @@ -128,6 +132,7 @@ User can now see pipeline is running and which worker is building it. ... { ... "worker": "obelix", ... "doing": { + ... "build_id": 1, ... "worker": "obelix", ... "project": "rome", ... "pipeline": "construct", @@ -138,11 +143,26 @@ User can now see pipeline is running and which worker is building it. ... } ... } + WHEN user makes request GET /builds + THEN result has status code 200 + AND body matches + ... { + ... "builds": [ + ... { + ... "build_id": 1, + ... "worker": "obelix", + ... "project": "rome", + ... "pipeline": "construct", + ... "status": "building" + ... } + ... ] + ... } Worker reports some build output. Note the null exit code. WHEN worker-manager makes request POST /work ... { + ... "build_id": 1, ... "worker": "obelix", ... "project": "rome", ... "pipeline": "construct", @@ -159,6 +179,7 @@ Still the same job, since the first build step didnt't finish. THEN result has status code 200 AND body matches ... { + ... "build_id": 1, ... "worker": "obelix", ... "project": "rome", ... "pipeline": "construct", @@ -172,6 +193,7 @@ Report the step is done, and successfully. WHEN worker-manager makes request POST /work ... { + ... "build_id": 1, ... "worker": "obelix", ... "project": "rome", ... "pipeline": "construct", @@ -188,6 +210,7 @@ Now there's another step to do. THEN result has status code 200 AND body matches ... { + ... "build_id": 1, ... "worker": "obelix", ... "project": "rome", ... "pipeline": "construct", @@ -205,6 +228,7 @@ User sees changed status. ... { ... "worker": "obelix", ... "doing": { + ... "build_id": 1, ... "worker": "obelix", ... "project": "rome", ... "pipeline": "construct", @@ -219,6 +243,7 @@ Report it done. WHEN worker-manager makes request POST /work ... { + ... "build_id": 1, ... "worker": "obelix", ... "project": "rome", ... "pipeline": "construct", @@ -243,22 +268,33 @@ The pipeline status indicates success. Also, there's a build with a log. - WHEN user makes request GET /projects/rome/builds + WHEN user makes request GET /builds THEN result has status code 200 AND body matches ... { - ... "project": "rome", ... "builds": [ ... { + ... "build_id": 1, + ... "worker": "obelix", + ... "project": "rome", ... "pipeline": "construct", - ... "build_number": 1, - ... "status": "success", - ... "log": "/projects/rome/logs/1" + ... "status": 0 ... } ... ] ... } - WHEN user makes request GET /projects/rome/logs/1 + WHEN user makes request GET /builds/1 + THEN result has status code 200 + AND body matches + ... { + ... "build_id": 1, + ... "worker": "obelix", + ... "project": "rome", + ... "pipeline": "construct", + ... "status": 0 + ... } + + WHEN user makes request GET /builds/1/log 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" -- cgit v1.2.1