From f11a8ecd409f280759af7227db52b1e87e389092 Mon Sep 17 00:00:00 2001 From: Lars Wirzenius Date: Thu, 19 Apr 2018 22:31:01 +0300 Subject: Change: trigger a project, build all pipelines in the project --- yarns/400-build.yarn | 64 ++++++++++++----------------------------------- yarns/500-build-fail.yarn | 14 ++++------- yarns/600-unauthz.yarn | 8 +++--- 3 files changed, 25 insertions(+), 61 deletions(-) (limited to 'yarns') diff --git a/yarns/400-build.yarn b/yarns/400-build.yarn index 3ee30a6..796bd20 100644 --- a/yarns/400-build.yarn +++ b/yarns/400-build.yarn @@ -32,8 +32,8 @@ Set up the controller. AND an access token for user with scopes ... uapi_pipelines_post ... uapi_projects_post - ... uapi_projects_id_pipelines_id_put - ... uapi_projects_id_pipelines_id_get + ... uapi_projects_id_status_put + ... uapi_projects_id_status_get ... uapi_projects_id_builds_get ... uapi_workers_id_get ... uapi_builds_get @@ -76,7 +76,7 @@ Add a second project so we know each project gets its own work steps. There are no builds for the project yet, and is idle. - WHEN user makes request GET /projects/rome/pipelines/construct + WHEN user makes request GET /projects/rome/status THEN result has status code 200 AND body matches { "status": "idle" } @@ -98,11 +98,11 @@ Register a worker. Trigger build. First with an invalid status, then a real one. - WHEN user makes request PUT /projects/rome/pipelines/construct + WHEN user makes request PUT /projects/rome/status ... with a valid token and body { "status": "VANDALS!" } THEN result has status code 400 - WHEN user makes request PUT /projects/rome/pipelines/construct + WHEN user makes request PUT /projects/rome/status ... with a valid token and body { "status": "triggered" } THEN result has status code 200 @@ -122,7 +122,6 @@ the worker to construct a new workspace for the build. ... "log": "/logs/rome/1", ... "worker": "obelix", ... "project": "rome", - ... "pipeline": "construct", ... "parameters": { ... "foo": "bar" ... }, @@ -140,7 +139,6 @@ the worker to construct a new workspace for the build. ... "log": "/logs/rome/1", ... "worker": "obelix", ... "project": "rome", - ... "pipeline": "construct", ... "parameters": { ... "foo": "bar" ... }, @@ -151,7 +149,7 @@ the worker to construct a new workspace for the build. User can now see pipeline is running and which worker is building it. - WHEN user makes request GET /projects/rome/pipelines/construct + WHEN user makes request GET /projects/rome/status THEN result has status code 200 AND body matches ... { @@ -169,7 +167,6 @@ User can now see pipeline is running and which worker is building it. ... "log": "/logs/rome/1", ... "worker": "obelix", ... "project": "rome", - ... "pipeline": "construct", ... "parameters": { ... "foo": "bar" ... }, @@ -190,7 +187,6 @@ User can now see pipeline is running and which worker is building it. ... "log": "/logs/rome/1", ... "worker": "obelix", ... "project": "rome", - ... "pipeline": "construct", ... "actions": [ ... { "action": "create_workspace" }, ... { "shell": "day 1" }, @@ -218,7 +214,6 @@ Worker reports workspace creation is done. Note the zero exit code. ... "build_id": "rome/1", ... "worker": "obelix", ... "project": "rome", - ... "pipeline": "construct", ... "exit_code": 0, ... "stdout": "", ... "stderr": "", @@ -237,7 +232,6 @@ Worker requests more work, and gets the first actual build step. ... "log": "/logs/rome/1", ... "worker": "obelix", ... "project": "rome", - ... "pipeline": "construct", ... "parameters": { ... "foo": "bar" ... }, @@ -254,7 +248,6 @@ hasn't finished yet. ... "build_id": "rome/1", ... "worker": "obelix", ... "project": "rome", - ... "pipeline": "construct", ... "exit_code": null, ... "stdout": "hey ho", ... "stderr": "", @@ -274,7 +267,6 @@ didnt't finish. ... "log": "/logs/rome/1", ... "worker": "obelix", ... "project": "rome", - ... "pipeline": "construct", ... "parameters": { ... "foo": "bar" ... }, @@ -297,7 +289,6 @@ Report the step is done, and successfully. ... "build_id": "rome/1", ... "worker": "obelix", ... "project": "rome", - ... "pipeline": "construct", ... "exit_code": 0, ... "stdout": ", hey ho\n", ... "stderr": "", @@ -323,7 +314,6 @@ The build status now shows the next step as the active one. ... "log": "/logs/rome/1", ... "worker": "obelix", ... "project": "rome", - ... "pipeline": "construct", ... "actions": [ ... { "action": "create_workspace" }, ... { "shell": "day 1" }, @@ -350,7 +340,6 @@ Now there's another step to do. ... "log": "/logs/rome/1", ... "worker": "obelix", ... "project": "rome", - ... "pipeline": "construct", ... "parameters": { ... "foo": "bar" ... }, @@ -371,7 +360,6 @@ User sees changed status. ... "build_number": 1, ... "worker": "obelix", ... "project": "rome", - ... "pipeline": "construct", ... "parameters": { ... "foo": "bar" ... }, @@ -389,7 +377,6 @@ Report it done. ... "build_id": "rome/1", ... "worker": "obelix", ... "project": "rome", - ... "pipeline": "construct", ... "exit_code": 0, ... "stdout": "to the gold mine we go!\n", ... "stderr": "", @@ -405,7 +392,7 @@ Now there's no more work to do. The pipeline status indicates success. - WHEN user makes request GET /projects/rome/pipelines/construct + WHEN user makes request GET /projects/rome/status THEN result has status code 200 AND body matches { "status": "idle" } @@ -423,7 +410,6 @@ no current action. ... "log": "/logs/rome/1", ... "worker": "obelix", ... "project": "rome", - ... "pipeline": "construct", ... "actions": [ ... { "action": "create_workspace" }, ... { "shell": "day 1" }, @@ -447,7 +433,6 @@ no current action. ... "log": "/logs/rome/1", ... "worker": "obelix", ... "project": "rome", - ... "pipeline": "construct", ... "actions": [ ... { "action": "create_workspace" }, ... { "shell": "day 1" }, @@ -467,7 +452,7 @@ no current action. Start build again. This should become build number 2. - WHEN user makes request PUT /projects/rome/pipelines/construct + WHEN user makes request PUT /projects/rome/status ... with a valid token and body { "status": "triggered" } THEN result has status code 200 @@ -480,7 +465,6 @@ Start build again. This should become build number 2. ... "log": "/logs/rome/2", ... "worker": "obelix", ... "project": "rome", - ... "pipeline": "construct", ... "parameters": { ... "foo": "bar" ... }, @@ -500,7 +484,6 @@ Start build again. This should become build number 2. ... "log": "/logs/rome/1", ... "worker": "obelix", ... "project": "rome", - ... "pipeline": "construct", ... "actions": [ ... { "action": "create_workspace" }, ... { "shell": "day 1" }, @@ -518,7 +501,6 @@ Start build again. This should become build number 2. ... "log": "/logs/rome/2", ... "worker": "obelix", ... "project": "rome", - ... "pipeline": "construct", ... "actions": [ ... { "action": "create_workspace" }, ... { "shell": "day 1" }, @@ -538,7 +520,6 @@ Start build again. This should become build number 2. ... "build_id": "rome/2", ... "worker": "obelix", ... "project": "rome", - ... "pipeline": "construct", ... "exit_code": 0, ... "stdout": "", ... "stderr": "", @@ -555,7 +536,6 @@ Start build again. This should become build number 2. ... "log": "/logs/rome/2", ... "worker": "obelix", ... "project": "rome", - ... "pipeline": "construct", ... "parameters": { ... "foo": "bar" ... }, @@ -569,7 +549,6 @@ Start build again. This should become build number 2. ... "build_id": "rome/2", ... "worker": "obelix", ... "project": "rome", - ... "pipeline": "construct", ... "exit_code": 0, ... "stdout": "hey ho", ... "stderr": "", @@ -585,7 +564,6 @@ Start build again. This should become build number 2. ... "build_id": "rome/2", ... "worker": "obelix", ... "project": "rome", - ... "pipeline": "construct", ... "exit_code": 0, ... "stdout": "hey ho", ... "stderr": "", @@ -604,7 +582,6 @@ Start build again. This should become build number 2. ... "log": "/logs/rome/1", ... "worker": "obelix", ... "project": "rome", - ... "pipeline": "construct", ... "actions": [ ... { "action": "create_workspace" }, ... { "shell": "day 1" }, @@ -622,7 +599,6 @@ Start build again. This should become build number 2. ... "log": "/logs/rome/2", ... "worker": "obelix", ... "project": "rome", - ... "pipeline": "construct", ... "actions": [ ... { "action": "create_workspace" }, ... { "shell": "day 1" }, @@ -655,8 +631,8 @@ Set up the controller. AND an access token for user with scopes ... uapi_pipelines_post ... uapi_projects_post - ... uapi_projects_id_pipelines_id_put - ... uapi_projects_id_pipelines_id_get + ... uapi_projects_id_status_put + ... uapi_projects_id_status_get ... uapi_projects_id_builds_get ... uapi_workers_id_get ... uapi_builds_get @@ -701,7 +677,7 @@ Register a worker. Build the first project. - WHEN user makes request PUT /projects/first/pipelines/do_something + WHEN user makes request PUT /projects/first/status ... with a valid token and body { "status": "triggered" } THEN result has status code 200 @@ -717,7 +693,6 @@ Build the first project. ... "build_number": 1, ... "worker": "obelix", ... "project": "first", - ... "pipeline": "do_something", ... "exit_code": 0, ... "stdout": "", ... "stderr": "", @@ -737,7 +712,6 @@ Build the first project. ... "build_number": 1, ... "worker": "obelix", ... "project": "first", - ... "pipeline": "do_something", ... "exit_code": 0, ... "stdout": "", ... "stderr": "", @@ -750,7 +724,7 @@ Build the first project. Build second project. - WHEN user makes request PUT /projects/second/pipelines/do_something + WHEN user makes request PUT /projects/second/status ... with a valid token and body { "status": "triggered" } THEN result has status code 200 @@ -765,7 +739,6 @@ Build second project. ... "build_id": "second/1", ... "worker": "obelix", ... "project": "second", - ... "pipeline": "do_something", ... "exit_code": 0, ... "stdout": "", ... "stderr": "", @@ -784,7 +757,6 @@ Build second project. ... "build_id": "second/1", ... "worker": "obelix", ... "project": "second", - ... "pipeline": "do_something", ... "exit_code": 0, ... "stdout": "", ... "stderr": "", @@ -815,8 +787,8 @@ Set up the controller. AND an access token for user with scopes ... uapi_pipelines_post ... uapi_projects_post - ... uapi_projects_id_pipelines_id_put - ... uapi_projects_id_pipelines_id_get + ... uapi_projects_id_status_put + ... uapi_projects_id_status_get ... uapi_projects_id_builds_get ... uapi_workers_id_get ... uapi_builds_get @@ -873,7 +845,7 @@ Register a couple of workers. Trigger both projects. - WHEN user makes request PUT /projects/first/pipelines/do_something + WHEN user makes request PUT /projects/first/status ... with a valid token and body { "status": "triggered" } THEN result has status code 200 @@ -889,7 +861,7 @@ Trigger both projects. WHEN user requests list of builds THEN the list of builds is ["first/1"] - WHEN user makes request PUT /projects/second/pipelines/do_something + WHEN user makes request PUT /projects/second/status ... with a valid token and body { "status": "triggered" } THEN result has status code 200 @@ -908,7 +880,6 @@ Trigger both projects. ... "build_number": 1, ... "worker": "asterix", ... "project": "first", - ... "pipeline": "do_something", ... "exit_code": 0, ... "stdout": "", ... "stderr": "", @@ -934,7 +905,6 @@ Trigger both projects. ... "build_number": 1, ... "worker": "obelix", ... "project": "second", - ... "pipeline": "do_something", ... "exit_code": 0, ... "stdout": "", ... "stderr": "", @@ -953,7 +923,6 @@ Trigger both projects. ... "build_id": "first/1", ... "worker": "asterix", ... "project": "first", - ... "pipeline": "do_something", ... "exit_code": 0, ... "stdout": "", ... "stderr": "", @@ -969,7 +938,6 @@ Trigger both projects. ... "build_id": "second/1", ... "worker": "obelix", ... "project": "second", - ... "pipeline": "do_something", ... "exit_code": 0, ... "stdout": "", ... "stderr": "", diff --git a/yarns/500-build-fail.yarn b/yarns/500-build-fail.yarn index 95fcd5e..0a12178 100644 --- a/yarns/500-build-fail.yarn +++ b/yarns/500-build-fail.yarn @@ -33,8 +33,8 @@ Set up the controller. AND an access token for user with scopes ... uapi_pipelines_post ... uapi_projects_post - ... uapi_projects_id_pipelines_id_put - ... uapi_projects_id_pipelines_id_get + ... uapi_projects_id_status_put + ... uapi_projects_id_status_get ... uapi_projects_id_builds_get ... uapi_workers_id_get ... uapi_builds_get @@ -72,9 +72,9 @@ Register a worker. ... } THEN result has status code 201 -Trigger build. First with an invalid status, then a real one. +Trigger build. - WHEN user makes request PUT /projects/rome/pipelines/construct + WHEN user makes request PUT /projects/rome/status ... with a valid token and body { "status": "triggered" } THEN result has status code 200 @@ -89,7 +89,6 @@ Worker wants work and gets the first step to run. ... "log": "/logs/rome/1", ... "worker": "obelix", ... "project": "rome", - ... "pipeline": "construct", ... "parameters": {}, ... "step": { ... "action": "create_workspace" @@ -104,7 +103,6 @@ failure. ... "build_id": "rome/1", ... "worker": "obelix", ... "project": "rome", - ... "pipeline": "construct", ... "exit_code": 1, ... "stdout": "", ... "stderr": "eek!", @@ -131,7 +129,7 @@ User sees changed status. The pipeline status indicates it's idle. - WHEN user makes request GET /projects/rome/pipelines/construct + WHEN user makes request GET /projects/rome/status THEN result has status code 200 AND body matches { "status": "idle" } @@ -148,7 +146,6 @@ Also, there's a build with a log. ... "log": "/logs/rome/1", ... "worker": "obelix", ... "project": "rome", - ... "pipeline": "construct", ... "actions": [ ... { "action": "create_workspace" }, ... { "shell": "day 1" }, @@ -170,7 +167,6 @@ Also, there's a build with a log. ... "log": "/logs/rome/1", ... "worker": "obelix", ... "project": "rome", - ... "pipeline": "construct", ... "actions": [ ... { "action": "create_workspace" }, ... { "shell": "day 1" }, diff --git a/yarns/600-unauthz.yarn b/yarns/600-unauthz.yarn index 14e0015..176ac49 100644 --- a/yarns/600-unauthz.yarn +++ b/yarns/600-unauthz.yarn @@ -32,8 +32,8 @@ Set up the controller. AND controller config uses https://auth.example.com as authentication AND an access token for user with scopes ... uapi_projects_post - ... uapi_projects_id_pipelines_id_put - ... uapi_projects_id_pipelines_id_get + ... uapi_projects_id_status_put + ... uapi_projects_id_status_get ... uapi_projects_id_builds_get ... uapi_workers_id_get ... uapi_builds_get @@ -63,7 +63,7 @@ Set up the controller. THEN result has status code 401 WHEN outsider makes request - ... GET /projects/rome/pipelines/construct + ... GET /projects/rome/status ... with an invalid token THEN result has status code 401 @@ -75,7 +75,7 @@ Set up the controller. THEN result has status code 401 WHEN outsider makes request - ... PUT /projects/rome/pipelines/construct with an invalid token + ... PUT /projects/rome/status with an invalid token THEN result has status code 401 WHEN outsider makes request -- cgit v1.2.1