From 2fb35dbf240323ba5391937bc6c4fba895750029 Mon Sep 17 00:00:00 2001 From: Lars Wirzenius Date: Sat, 13 Jan 2018 11:10:22 +0200 Subject: Add: move actions for a build into build resource This way the list is known later even if the pipeline spec is changed. --- yarns/400-build.yarn | 85 +++++++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 71 insertions(+), 14 deletions(-) (limited to 'yarns/400-build.yarn') diff --git a/yarns/400-build.yarn b/yarns/400-build.yarn index c8746b4..225bc3b 100644 --- a/yarns/400-build.yarn +++ b/yarns/400-build.yarn @@ -123,8 +123,7 @@ be in the path or can we get it in the access token?** ... "fresh_workspace": true, ... "step": { ... "shell": "day 1" - ... }, - ... "step_index": 0 + ... } ... } WHEN worker-manager makes request GET /work/obelix @@ -142,8 +141,7 @@ be in the path or can we get it in the access token?** ... "fresh_workspace": true, ... "step": { ... "shell": "day 1" - ... }, - ... "step_index": 0 + ... } ... } User can now see pipeline is running and which worker is building it. @@ -170,7 +168,6 @@ User can now see pipeline is running and which worker is building it. ... "foo": "bar" ... }, ... "fresh_workspace": true, - ... "step_index": 0, ... "step": { ... "shell": "day 1" ... } @@ -188,6 +185,11 @@ User can now see pipeline is running and which worker is building it. ... "worker": "obelix", ... "project": "rome", ... "pipeline": "construct", + ... "actions": [ + ... { "shell": "day 1" }, + ... { "shell": "day 2" } + ... ], + ... "current_action": 0, ... "parameters": { ... "foo": "bar" ... }, @@ -217,7 +219,8 @@ Worker reports some build output. Note the null exit code. ... } THEN result has status code 201 -Still the same job, since the first build step didnt't finish. +Worker-manager still gets the same step, since the first build step +didnt't finish. WHEN worker-manager makes request GET /work/obelix THEN result has status code 200 @@ -234,8 +237,7 @@ Still the same job, since the first build step didnt't finish. ... "fresh_workspace": true, ... "step": { ... "shell": "day 1" - ... }, - ... "step_index": 0 + ... } ... } The build log is immediately accessible. @@ -265,6 +267,33 @@ Report the step is done, and successfully. AND result has header Content-Type: text/plain AND body text is "hey ho, hey ho\n" +The build status now shows the next step as the active one. + + WHEN user makes request GET /builds + THEN result has status code 200 + AND body matches + ... { + ... "builds": [ + ... { + ... "build_id": 1, + ... "log": "/logs/1", + ... "worker": "obelix", + ... "project": "rome", + ... "pipeline": "construct", + ... "actions": [ + ... { "shell": "day 1" }, + ... { "shell": "day 2" } + ... ], + ... "current_action": 1, + ... "parameters": { + ... "foo": "bar" + ... }, + ... "status": "building", + ... "log": "/logs/1" + ... } + ... ] + ... } + Now there's another step to do. WHEN worker-manager makes request GET /work/obelix @@ -282,8 +311,7 @@ Now there's another step to do. ... "fresh_workspace": false, ... "step": { ... "shell": "day 2" - ... }, - ... "step_index": 1 + ... } ... } User sees changed status. @@ -302,7 +330,6 @@ User sees changed status. ... "foo": "bar" ... }, ... "fresh_workspace": false, - ... "step_index": 1, ... "step": { ... "shell": "day 2" ... }, @@ -337,7 +364,8 @@ The pipeline status indicates success. THEN result has status code 200 AND body matches { "status": "idle" } -Also, there's a build with a log. +Also, there's a build with a log. Also, the build status shows there's +no current action. WHEN user makes request GET /builds THEN result has status code 200 @@ -350,6 +378,11 @@ Also, there's a build with a log. ... "worker": "obelix", ... "project": "rome", ... "pipeline": "construct", + ... "actions": [ + ... { "shell": "day 1" }, + ... { "shell": "day 2" } + ... ], + ... "current_action": null, ... "parameters": { ... "foo": "bar" ... }, @@ -368,6 +401,11 @@ Also, there's a build with a log. ... "worker": "obelix", ... "project": "rome", ... "pipeline": "construct", + ... "actions": [ + ... { "shell": "day 1" }, + ... { "shell": "day 2" } + ... ], + ... "current_action": null, ... "parameters": { ... "foo": "bar" ... }, @@ -401,8 +439,7 @@ Start build again. This should become build number 2. ... "fresh_workspace": true, ... "step": { ... "shell": "day 1" - ... }, - ... "step_index": 0 + ... } ... } WHEN user makes request GET /builds @@ -416,6 +453,11 @@ Start build again. This should become build number 2. ... "worker": "obelix", ... "project": "rome", ... "pipeline": "construct", + ... "actions": [ + ... { "shell": "day 1" }, + ... { "shell": "day 2" } + ... ], + ... "current_action": null, ... "parameters": { ... "foo": "bar" ... }, @@ -427,6 +469,11 @@ Start build again. This should become build number 2. ... "worker": "obelix", ... "project": "rome", ... "pipeline": "construct", + ... "actions": [ + ... { "shell": "day 1" }, + ... { "shell": "day 2" } + ... ], + ... "current_action": 0, ... "parameters": { ... "foo": "bar" ... }, @@ -475,6 +522,11 @@ Start build again. This should become build number 2. ... "worker": "obelix", ... "project": "rome", ... "pipeline": "construct", + ... "actions": [ + ... { "shell": "day 1" }, + ... { "shell": "day 2" } + ... ], + ... "current_action": null, ... "parameters": { ... "foo": "bar" ... }, @@ -486,6 +538,11 @@ Start build again. This should become build number 2. ... "worker": "obelix", ... "project": "rome", ... "pipeline": "construct", + ... "actions": [ + ... { "shell": "day 1" }, + ... { "shell": "day 2" } + ... ], + ... "current_action": null, ... "parameters": { ... "foo": "bar" ... }, -- cgit v1.2.1