From 66fe1de8368ba7e754fa6dad798bf351f3c3bf93 Mon Sep 17 00:00:00 2001 From: Lars Wirzenius Date: Fri, 19 Jan 2018 19:16:57 +0200 Subject: Change: builds are now numbered foo/123, as are logs --- yarns/400-build.yarn | 114 +++++++++++++++++++++++++-------------------------- 1 file changed, 56 insertions(+), 58 deletions(-) (limited to 'yarns/400-build.yarn') diff --git a/yarns/400-build.yarn b/yarns/400-build.yarn index 9ccb7ae..e28bccf 100644 --- a/yarns/400-build.yarn +++ b/yarns/400-build.yarn @@ -115,8 +115,8 @@ the worker to construct a new workspace for the build. THEN result has status code 200 AND body matches ... { - ... "build_id": 1, - ... "log": "/logs/1", + ... "build_id": "rome/1", + ... "log": "/logs/rome/1", ... "worker": "obelix", ... "project": "rome", ... "pipeline": "construct", @@ -132,8 +132,8 @@ the worker to construct a new workspace for the build. THEN result has status code 200 AND body matches ... { - ... "build_id": 1, - ... "log": "/logs/1", + ... "build_id": "rome/1", + ... "log": "/logs/rome/1", ... "worker": "obelix", ... "project": "rome", ... "pipeline": "construct", @@ -160,8 +160,8 @@ User can now see pipeline is running and which worker is building it. ... { ... "worker": "obelix", ... "doing": { - ... "build_id": 1, - ... "log": "/logs/1", + ... "build_id": "rome/1", + ... "log": "/logs/rome/1", ... "worker": "obelix", ... "project": "rome", ... "pipeline": "construct", @@ -180,8 +180,8 @@ User can now see pipeline is running and which worker is building it. ... { ... "builds": [ ... { - ... "build_id": 1, - ... "log": "/logs/1", + ... "build_id": "rome/1", + ... "log": "/logs/rome/1", ... "worker": "obelix", ... "project": "rome", ... "pipeline": "construct", @@ -195,12 +195,12 @@ User can now see pipeline is running and which worker is building it. ... "foo": "bar" ... }, ... "status": "building", - ... "log": "/logs/1" + ... "log": "/logs/rome/1" ... } ... ] ... } - WHEN user makes request GET /logs/1 + WHEN user makes request GET /logs/rome/1 THEN result has status code 200 AND result has header Content-Type: text/plain AND body text is "" @@ -209,7 +209,7 @@ Worker reports workspace creation is done. Note the zero exit code. WHEN worker-manager makes request POST /work with a valid token and body ... { - ... "build_id": 1, + ... "build_id": "rome/1", ... "worker": "obelix", ... "project": "rome", ... "pipeline": "construct", @@ -226,8 +226,8 @@ Worker requests more work, and gets the first actual build step. THEN result has status code 200 AND body matches ... { - ... "build_id": 1, - ... "log": "/logs/1", + ... "build_id": "rome/1", + ... "log": "/logs/rome/1", ... "worker": "obelix", ... "project": "rome", ... "pipeline": "construct", @@ -244,7 +244,7 @@ hasn't finished yet. WHEN worker-manager makes request POST /work with a valid token and body ... { - ... "build_id": 1, + ... "build_id": "rome/1", ... "worker": "obelix", ... "project": "rome", ... "pipeline": "construct", @@ -262,8 +262,8 @@ didnt't finish. THEN result has status code 200 AND body matches ... { - ... "build_id": 1, - ... "log": "/logs/1", + ... "build_id": "rome/1", + ... "log": "/logs/rome/1", ... "worker": "obelix", ... "project": "rome", ... "pipeline": "construct", @@ -277,7 +277,7 @@ didnt't finish. The build log is immediately accessible. - WHEN user makes request GET /logs/1 + WHEN user makes request GET /logs/rome/1 THEN result has status code 200 AND result has header Content-Type: text/plain AND body text is "hey ho" @@ -286,7 +286,7 @@ Report the step is done, and successfully. WHEN worker-manager makes request POST /work with a valid token and body ... { - ... "build_id": 1, + ... "build_id": "rome/1", ... "worker": "obelix", ... "project": "rome", ... "pipeline": "construct", @@ -297,7 +297,7 @@ Report the step is done, and successfully. ... } THEN result has status code 201 - WHEN user makes request GET /logs/1 + WHEN user makes request GET /logs/rome/1 THEN result has status code 200 AND result has header Content-Type: text/plain AND body text is "hey ho, hey ho\n" @@ -310,8 +310,8 @@ The build status now shows the next step as the active one. ... { ... "builds": [ ... { - ... "build_id": 1, - ... "log": "/logs/1", + ... "build_id": "rome/1", + ... "log": "/logs/rome/1", ... "worker": "obelix", ... "project": "rome", ... "pipeline": "construct", @@ -325,7 +325,7 @@ The build status now shows the next step as the active one. ... "foo": "bar" ... }, ... "status": "building", - ... "log": "/logs/1" + ... "log": "/logs/rome/1" ... } ... ] ... } @@ -336,8 +336,8 @@ Now there's another step to do. THEN result has status code 200 AND body matches ... { - ... "build_id": 1, - ... "log": "/logs/1", + ... "build_id": "rome/1", + ... "log": "/logs/rome/1", ... "worker": "obelix", ... "project": "rome", ... "pipeline": "construct", @@ -357,7 +357,7 @@ User sees changed status. ... { ... "worker": "obelix", ... "doing": { - ... "build_id": 1, + ... "build_id": "rome/1", ... "worker": "obelix", ... "project": "rome", ... "pipeline": "construct", @@ -367,7 +367,7 @@ User sees changed status. ... "step": { ... "shell": "day 2" ... }, - ... "log": "/logs/1" + ... "log": "/logs/rome/1" ... } ... } @@ -375,7 +375,7 @@ Report it done. WHEN worker-manager makes request POST /work with a valid token and body ... { - ... "build_id": 1, + ... "build_id": "rome/1", ... "worker": "obelix", ... "project": "rome", ... "pipeline": "construct", @@ -407,8 +407,8 @@ no current action. ... { ... "builds": [ ... { - ... "build_id": 1, - ... "log": "/logs/1", + ... "build_id": "rome/1", + ... "log": "/logs/rome/1", ... "worker": "obelix", ... "project": "rome", ... "pipeline": "construct", @@ -421,18 +421,17 @@ no current action. ... "parameters": { ... "foo": "bar" ... }, - ... "status": 0, - ... "log": "/logs/1" + ... "status": 0 ... } ... ] ... } - WHEN user makes request GET /builds/1 + WHEN user makes request GET /builds/rome/1 THEN result has status code 200 AND body matches ... { - ... "build_id": 1, - ... "log": "/logs/1", + ... "build_id": "rome/1", + ... "log": "/logs/rome/1", ... "worker": "obelix", ... "project": "rome", ... "pipeline": "construct", @@ -445,11 +444,10 @@ no current action. ... "parameters": { ... "foo": "bar" ... }, - ... "status": 0, - ... "log": "/logs/1" + ... "status": 0 ... } - WHEN user makes request GET /logs/1 + WHEN user makes request GET /logs/rome/1 THEN result has status code 200 AND result has header Content-Type: text/plain AND body text is "hey ho, hey ho\nto the gold mine we go!\n" @@ -464,8 +462,8 @@ Start build again. This should become build number 2. THEN result has status code 200 AND body matches ... { - ... "build_id": 2, - ... "log": "/logs/2", + ... "build_id": "rome/2", + ... "log": "/logs/rome/2", ... "worker": "obelix", ... "project": "rome", ... "pipeline": "construct", @@ -483,8 +481,8 @@ Start build again. This should become build number 2. ... { ... "builds": [ ... { - ... "build_id": 1, - ... "log": "/logs/1", + ... "build_id": "rome/1", + ... "log": "/logs/rome/1", ... "worker": "obelix", ... "project": "rome", ... "pipeline": "construct", @@ -500,8 +498,8 @@ Start build again. This should become build number 2. ... "status": 0 ... }, ... { - ... "build_id": 2, - ... "log": "/logs/2", + ... "build_id": "rome/2", + ... "log": "/logs/rome/2", ... "worker": "obelix", ... "project": "rome", ... "pipeline": "construct", @@ -521,7 +519,7 @@ Start build again. This should become build number 2. WHEN worker-manager makes request POST /work with a valid token and body ... { - ... "build_id": 2, + ... "build_id": "rome/2", ... "worker": "obelix", ... "project": "rome", ... "pipeline": "construct", @@ -536,8 +534,8 @@ Start build again. This should become build number 2. THEN result has status code 200 AND body matches ... { - ... "build_id": 2, - ... "log": "/logs/2", + ... "build_id": "rome/2", + ... "log": "/logs/rome/2", ... "worker": "obelix", ... "project": "rome", ... "pipeline": "construct", @@ -551,7 +549,7 @@ Start build again. This should become build number 2. WHEN worker-manager makes request POST /work with a valid token and body ... { - ... "build_id": 2, + ... "build_id": "rome/2", ... "worker": "obelix", ... "project": "rome", ... "pipeline": "construct", @@ -567,7 +565,7 @@ Start build again. This should become build number 2. WHEN worker-manager makes request POST /work with a valid token and body ... { - ... "build_id": 2, + ... "build_id": "rome/2", ... "worker": "obelix", ... "project": "rome", ... "pipeline": "construct", @@ -584,8 +582,8 @@ Start build again. This should become build number 2. ... { ... "builds": [ ... { - ... "build_id": 1, - ... "log": "/logs/1", + ... "build_id": "rome/1", + ... "log": "/logs/rome/1", ... "worker": "obelix", ... "project": "rome", ... "pipeline": "construct", @@ -601,8 +599,8 @@ Start build again. This should become build number 2. ... "status": 0 ... }, ... { - ... "build_id": 2, - ... "log": "/logs/2", + ... "build_id": "rome/2", + ... "log": "/logs/rome/2", ... "worker": "obelix", ... "project": "rome", ... "pipeline": "construct", @@ -694,7 +692,7 @@ Build the first project. WHEN worker-manager makes request POST /work with a valid token and body ... { - ... "build_id": 1, + ... "build_id": "first/1", ... "worker": "obelix", ... "project": "first", ... "pipeline": "do_something", @@ -713,7 +711,7 @@ Build the first project. WHEN worker-manager makes request POST /work with a valid token and body ... { - ... "build_id": 1, + ... "build_id": "first/1", ... "worker": "obelix", ... "project": "first", ... "pipeline": "do_something", @@ -725,7 +723,7 @@ Build the first project. THEN result has status code 201 WHEN user requests list of builds - THEN the list of builds is [1] + THEN the list of builds is ["first/1"] Build second project. @@ -741,7 +739,7 @@ Build second project. WHEN worker-manager makes request POST /work with a valid token and body ... { - ... "build_id": 2, + ... "build_id": "second/1", ... "worker": "obelix", ... "project": "second", ... "pipeline": "do_something", @@ -760,7 +758,7 @@ Build second project. WHEN worker-manager makes request POST /work with a valid token and body ... { - ... "build_id": 2, + ... "build_id": "second/1", ... "worker": "obelix", ... "project": "second", ... "pipeline": "do_something", @@ -772,7 +770,7 @@ Build second project. THEN result has status code 201 WHEN user requests list of builds - THEN the list of builds is [1, 2] + THEN the list of builds is ["first/1", "second/1"] Finish up. -- cgit v1.2.1