summaryrefslogtreecommitdiff
path: root/yarns
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2018-05-19 18:45:36 +0300
committerLars Wirzenius <liw@liw.fi>2018-05-19 22:58:43 +0300
commit7a4c92e7171d642a1e1fce324441710ad4d44ce9 (patch)
tree290526533839801bf060df347f8ee32232f3e1e5 /yarns
parentb11d31ef23c5dfee6bfa54afbec47fc8b8bab7b1 (diff)
downloadick2-7a4c92e7171d642a1e1fce324441710ad4d44ce9.tar.gz
Change: use build graphs in build resources, instead of action list
Diffstat (limited to 'yarns')
-rw-r--r--yarns/400-build.yarn212
-rw-r--r--yarns/500-build-fail.yarn53
2 files changed, 203 insertions, 62 deletions
diff --git a/yarns/400-build.yarn b/yarns/400-build.yarn
index 4b3c085..5ab5895 100644
--- a/yarns/400-build.yarn
+++ b/yarns/400-build.yarn
@@ -115,6 +115,7 @@ the worker to construct a new workspace for the build.
... "parameters": {
... "foo": "bar"
... },
+ ... "action_id": "1",
... "step": {
... "action": "create_workspace",
... "where": "host"
@@ -133,6 +134,7 @@ the worker to construct a new workspace for the build.
... "parameters": {
... "foo": "bar"
... },
+ ... "action_id": "1",
... "step": {
... "action": "create_workspace",
... "where": "host"
@@ -155,6 +157,7 @@ User can now see pipeline is running and which worker is building it.
... "parameters": {
... "foo": "bar"
... },
+ ... "action_id": "1",
... "step": {
... "action": "create_workspace",
... "where": "host"
@@ -173,12 +176,23 @@ User can now see pipeline is running and which worker is building it.
... "log": "/logs/rome/1",
... "worker": "obelix",
... "project": "rome",
- ... "actions": [
- ... { "where": "host", "action": "create_workspace" },
- ... { "where": "host", "shell": "day 1" },
- ... { "where": "host", "shell": "day 2" }
- ... ],
- ... "current_action": 0,
+ ... "graph": {
+ ... "1": {
+ ... "status": "building",
+ ... "depends": [],
+ ... "action": {"where": "host", "action": "create_workspace" }
+ ... },
+ ... "2": {
+ ... "status": "blocked",
+ ... "depends": ["1"],
+ ... "action": {"where": "host", "shell": "day 1" }
+ ... },
+ ... "3": {
+ ... "status": "blocked",
+ ... "depends": ["2"],
+ ... "action": {"where": "host", "shell": "day 2" }
+ ... }
+ ... },
... "parameters": {
... "foo": "bar"
... },
@@ -198,6 +212,7 @@ Worker reports workspace creation is done. Note the zero exit code.
WHEN obelix makes request POST /work with a valid token and body
... {
... "build_id": "rome/1",
+ ... "action_id": "1",
... "worker": "obelix",
... "project": "rome",
... "exit_code": 0,
@@ -221,6 +236,7 @@ Worker requests more work, and gets the first actual build step.
... "parameters": {
... "foo": "bar"
... },
+ ... "action_id": "2",
... "step": {
... "shell": "day 1",
... "where": "host"
@@ -233,6 +249,7 @@ hasn't finished yet.
WHEN obelix makes request POST /work with a valid token and body
... {
... "build_id": "rome/1",
+ ... "action_id": "2",
... "worker": "obelix",
... "project": "rome",
... "exit_code": null,
@@ -242,8 +259,8 @@ hasn't finished yet.
... }
THEN result has status code 201
-Worker-manager still gets the same step, since the first build step
-didnt't finish.
+Worker-manager still gets the same step, since the build step
+didn't finish.
WHEN obelix makes request GET /work
THEN result has status code 200
@@ -257,6 +274,7 @@ didnt't finish.
... "parameters": {
... "foo": "bar"
... },
+ ... "action_id": "2",
... "step": {
... "shell": "day 1",
... "where": "host"
@@ -275,6 +293,7 @@ Report the step is done, and successfully.
WHEN obelix makes request POST /work with a valid token and body
... {
... "build_id": "rome/1",
+ ... "action_id": "2",
... "worker": "obelix",
... "project": "rome",
... "exit_code": 0,
@@ -302,15 +321,26 @@ The build status now shows the next step as the active one.
... "log": "/logs/rome/1",
... "worker": "obelix",
... "project": "rome",
- ... "actions": [
- ... { "where": "host", "action": "create_workspace" },
- ... { "where": "host", "shell": "day 1" },
- ... { "where": "host", "shell": "day 2" }
- ... ],
- ... "current_action": 2,
... "parameters": {
... "foo": "bar"
... },
+ ... "graph": {
+ ... "1": {
+ ... "status": "done",
+ ... "depends": [],
+ ... "action": {"where": "host", "action": "create_workspace" }
+ ... },
+ ... "2": {
+ ... "status": "done",
+ ... "depends": ["1"],
+ ... "action": {"where": "host", "shell": "day 1" }
+ ... },
+ ... "3": {
+ ... "status": "ready",
+ ... "depends": ["2"],
+ ... "action": {"where": "host", "shell": "day 2" }
+ ... }
+ ... },
... "status": "building",
... "log": "/logs/rome/1"
... }
@@ -331,6 +361,7 @@ Now there's another step to do.
... "parameters": {
... "foo": "bar"
... },
+ ... "action_id": "3",
... "step": {
... "shell": "day 2",
... "where": "host"
@@ -352,6 +383,7 @@ User sees changed status.
... "parameters": {
... "foo": "bar"
... },
+ ... "action_id": "3",
... "step": {
... "shell": "day 2",
... "where": "host"
@@ -365,6 +397,7 @@ Report it done.
WHEN obelix makes request POST /work with a valid token and body
... {
... "build_id": "rome/1",
+ ... "action_id": "3",
... "worker": "obelix",
... "project": "rome",
... "exit_code": 0,
@@ -394,15 +427,26 @@ current action.
... "log": "/logs/rome/1",
... "worker": "obelix",
... "project": "rome",
- ... "actions": [
- ... { "where": "host", "action": "create_workspace" },
- ... { "where": "host", "shell": "day 1" },
- ... { "where": "host", "shell": "day 2" }
- ... ],
- ... "current_action": null,
... "parameters": {
... "foo": "bar"
... },
+ ... "graph": {
+ ... "1": {
+ ... "status": "done",
+ ... "depends": [],
+ ... "action": {"where": "host", "action": "create_workspace" }
+ ... },
+ ... "2": {
+ ... "status": "done",
+ ... "depends": ["1"],
+ ... "action": {"where": "host", "shell": "day 1" }
+ ... },
+ ... "3": {
+ ... "status": "done",
+ ... "depends": ["2"],
+ ... "action": {"where": "host", "shell": "day 2" }
+ ... }
+ ... },
... "status": 0
... }
... ]
@@ -417,15 +461,26 @@ current action.
... "log": "/logs/rome/1",
... "worker": "obelix",
... "project": "rome",
- ... "actions": [
- ... { "where": "host", "action": "create_workspace" },
- ... { "where": "host", "shell": "day 1" },
- ... { "where": "host", "shell": "day 2" }
- ... ],
- ... "current_action": null,
... "parameters": {
... "foo": "bar"
... },
+ ... "graph": {
+ ... "1": {
+ ... "status": "done",
+ ... "depends": [],
+ ... "action": {"where": "host", "action": "create_workspace" }
+ ... },
+ ... "2": {
+ ... "status": "done",
+ ... "depends": ["1"],
+ ... "action": {"where": "host", "shell": "day 1" }
+ ... },
+ ... "3": {
+ ... "status": "done",
+ ... "depends": ["2"],
+ ... "action": {"where": "host", "shell": "day 2" }
+ ... }
+ ... },
... "status": 0
... }
@@ -451,6 +506,7 @@ Start build again. This should become build number 2.
... "parameters": {
... "foo": "bar"
... },
+ ... "action_id": "1",
... "step": {
... "action": "create_workspace",
... "where": "host"
@@ -468,15 +524,26 @@ Start build again. This should become build number 2.
... "log": "/logs/rome/1",
... "worker": "obelix",
... "project": "rome",
- ... "actions": [
- ... { "where": "host", "action": "create_workspace" },
- ... { "where": "host", "shell": "day 1" },
- ... { "where": "host", "shell": "day 2" }
- ... ],
- ... "current_action": null,
... "parameters": {
... "foo": "bar"
... },
+ ... "graph": {
+ ... "1": {
+ ... "status": "done",
+ ... "depends": [],
+ ... "action": {"where": "host", "action": "create_workspace" }
+ ... },
+ ... "2": {
+ ... "status": "done",
+ ... "depends": ["1"],
+ ... "action": {"where": "host", "shell": "day 1" }
+ ... },
+ ... "3": {
+ ... "status": "done",
+ ... "depends": ["2"],
+ ... "action": {"where": "host", "shell": "day 2" }
+ ... }
+ ... },
... "status": 0
... },
... {
@@ -485,15 +552,26 @@ Start build again. This should become build number 2.
... "log": "/logs/rome/2",
... "worker": "obelix",
... "project": "rome",
- ... "actions": [
- ... { "where": "host", "action": "create_workspace" },
- ... { "where": "host", "shell": "day 1" },
- ... { "where": "host", "shell": "day 2" }
- ... ],
- ... "current_action": 0,
... "parameters": {
... "foo": "bar"
... },
+ ... "graph": {
+ ... "1": {
+ ... "status": "building",
+ ... "depends": [],
+ ... "action": {"where": "host", "action": "create_workspace" }
+ ... },
+ ... "2": {
+ ... "status": "blocked",
+ ... "depends": ["1"],
+ ... "action": {"where": "host", "shell": "day 1" }
+ ... },
+ ... "3": {
+ ... "status": "blocked",
+ ... "depends": ["2"],
+ ... "action": {"where": "host", "shell": "day 2" }
+ ... }
+ ... },
... "status": "building"
... }
... ]
@@ -502,6 +580,7 @@ Start build again. This should become build number 2.
WHEN obelix makes request POST /work with a valid token and body
... {
... "build_id": "rome/2",
+ ... "action_id": "1",
... "worker": "obelix",
... "project": "rome",
... "exit_code": 0,
@@ -523,6 +602,7 @@ Start build again. This should become build number 2.
... "parameters": {
... "foo": "bar"
... },
+ ... "action_id": "2",
... "step": {
... "shell": "day 1",
... "where": "host"
@@ -532,6 +612,7 @@ Start build again. This should become build number 2.
WHEN obelix makes request POST /work with a valid token and body
... {
... "build_id": "rome/2",
+ ... "action_id": "2",
... "worker": "obelix",
... "project": "rome",
... "exit_code": 0,
@@ -547,6 +628,7 @@ Start build again. This should become build number 2.
WHEN obelix makes request POST /work with a valid token and body
... {
... "build_id": "rome/2",
+ ... "action_id": "3",
... "worker": "obelix",
... "project": "rome",
... "exit_code": 0,
@@ -567,15 +649,26 @@ Start build again. This should become build number 2.
... "log": "/logs/rome/1",
... "worker": "obelix",
... "project": "rome",
- ... "actions": [
- ... { "where": "host", "action": "create_workspace" },
- ... { "where": "host", "shell": "day 1" },
- ... { "where": "host", "shell": "day 2" }
- ... ],
- ... "current_action": null,
... "parameters": {
... "foo": "bar"
... },
+ ... "graph": {
+ ... "1": {
+ ... "status": "done",
+ ... "depends": [],
+ ... "action": {"where": "host", "action": "create_workspace" }
+ ... },
+ ... "2": {
+ ... "status": "done",
+ ... "depends": ["1"],
+ ... "action": {"where": "host", "shell": "day 1" }
+ ... },
+ ... "3": {
+ ... "status": "done",
+ ... "depends": ["2"],
+ ... "action": {"where": "host", "shell": "day 2" }
+ ... }
+ ... },
... "status": 0
... },
... {
@@ -584,15 +677,26 @@ Start build again. This should become build number 2.
... "log": "/logs/rome/2",
... "worker": "obelix",
... "project": "rome",
- ... "actions": [
- ... { "where": "host", "action": "create_workspace" },
- ... { "where": "host", "shell": "day 1" },
- ... { "where": "host", "shell": "day 2" }
- ... ],
- ... "current_action": null,
... "parameters": {
... "foo": "bar"
... },
+ ... "graph": {
+ ... "1": {
+ ... "status": "done",
+ ... "depends": [],
+ ... "action": {"where": "host", "action": "create_workspace" }
+ ... },
+ ... "2": {
+ ... "status": "done",
+ ... "depends": ["1"],
+ ... "action": {"where": "host", "shell": "day 1" }
+ ... },
+ ... "3": {
+ ... "status": "done",
+ ... "depends": ["2"],
+ ... "action": {"where": "host", "shell": "day 2" }
+ ... }
+ ... },
... "status": 0
... }
... ]
@@ -674,6 +778,7 @@ Build the first project.
WHEN obelix makes request POST /work with a valid token and body
... {
... "build_id": "first/1",
+ ... "action_id": "1",
... "build_number": 1,
... "worker": "obelix",
... "project": "first",
@@ -694,6 +799,7 @@ Build the first project.
WHEN obelix makes request POST /work with a valid token and body
... {
... "build_id": "first/1",
+ ... "action_id": "2",
... "build_number": 1,
... "worker": "obelix",
... "project": "first",
@@ -722,6 +828,7 @@ Build second project.
WHEN obelix makes request POST /work with a valid token and body
... {
... "build_id": "second/1",
+ ... "action_id": "1",
... "worker": "obelix",
... "project": "second",
... "exit_code": 0,
@@ -741,6 +848,7 @@ Build second project.
WHEN obelix makes request POST /work with a valid token and body
... {
... "build_id": "second/1",
+ ... "action_id": "2",
... "worker": "obelix",
... "project": "second",
... "exit_code": 0,
@@ -861,6 +969,7 @@ Trigger both projects.
WHEN asterix makes request POST /work with a valid token and body
... {
... "build_id": "first/1",
+ ... "action_id": "1",
... "build_number": 1,
... "worker": "asterix",
... "project": "first",
@@ -888,6 +997,7 @@ Trigger both projects.
WHEN obelix makes request POST /work with a valid token and body
... {
... "build_id": "second/1",
+ ... "action_id": "1",
... "build_number": 1,
... "worker": "obelix",
... "project": "second",
@@ -908,6 +1018,7 @@ Trigger both projects.
WHEN asterix makes request POST /work with a valid token and body
... {
... "build_id": "first/1",
+ ... "action_id": "2",
... "worker": "asterix",
... "project": "first",
... "exit_code": 0,
@@ -923,6 +1034,7 @@ Trigger both projects.
WHEN obelix makes request POST /work with a valid token and body
... {
... "build_id": "second/1",
+ ... "action_id": "2",
... "worker": "obelix",
... "project": "second",
... "exit_code": 0,
diff --git a/yarns/500-build-fail.yarn b/yarns/500-build-fail.yarn
index 59a2e67..4d4071a 100644
--- a/yarns/500-build-fail.yarn
+++ b/yarns/500-build-fail.yarn
@@ -88,6 +88,7 @@ Worker wants work and gets the first step to run.
... "worker": "obelix",
... "project": "rome",
... "parameters": {},
+ ... "action_id": "1",
... "step": {
... "action": "create_workspace",
... "where": "host"
@@ -139,13 +140,27 @@ There's a build with a log.
... "log": "/logs/rome/1",
... "worker": "obelix",
... "project": "rome",
- ... "actions": [
- ... { "where": "host", "action": "create_workspace" },
- ... { "where": "host", "shell": "day 1" },
- ... { "where": "host", "shell": "day 2" }
- ... ],
- ... "current_action": null,
... "parameters": {},
+ ... "graph": {
+ ... "1": {
+ ... "status": "failed",
+ ... "depends": [],
+ ... "action": {
+ ... "action": "create_workspace",
+ ... "where": "host"
+ ... }
+ ... },
+ ... "2": {
+ ... "status": "blocked",
+ ... "depends": ["1"],
+ ... "action": {"shell": "day 1", "where": "host"}
+ ... },
+ ... "3": {
+ ... "status": "blocked",
+ ... "depends": ["2"],
+ ... "action": {"shell": "day 2", "where": "host"}
+ ... }
+ ... },
... "status": 1
... }
... ]
@@ -160,13 +175,27 @@ There's a build with a log.
... "log": "/logs/rome/1",
... "worker": "obelix",
... "project": "rome",
- ... "actions": [
- ... { "where": "host", "action": "create_workspace" },
- ... { "where": "host", "shell": "day 1" },
- ... { "where": "host", "shell": "day 2" }
- ... ],
- ... "current_action": null,
... "parameters": {},
+ ... "graph": {
+ ... "1": {
+ ... "status": "failed",
+ ... "depends": [],
+ ... "action": {
+ ... "action": "create_workspace",
+ ... "where": "host"
+ ... }
+ ... },
+ ... "2": {
+ ... "status": "blocked",
+ ... "depends": ["1"],
+ ... "action": {"shell": "day 1", "where": "host"}
+ ... },
+ ... "3": {
+ ... "status": "blocked",
+ ... "depends": ["2"],
+ ... "action": {"shell": "day 2", "where": "host"}
+ ... }
+ ... },
... "status": 1
... }