From 9759c2b51a1250aa345c21b7cc6b793f4965ac2d Mon Sep 17 00:00:00 2001 From: Lars Wirzenius Date: Mon, 28 May 2018 19:51:58 +0300 Subject: Add: BuildStateMachine class --- yarns/500-build-fail.yarn | 53 ++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 48 insertions(+), 5 deletions(-) (limited to 'yarns/500-build-fail.yarn') diff --git a/yarns/500-build-fail.yarn b/yarns/500-build-fail.yarn index 4d4071a..204bfd5 100644 --- a/yarns/500-build-fail.yarn +++ b/yarns/500-build-fail.yarn @@ -101,6 +101,7 @@ failure. 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": 1, @@ -110,8 +111,38 @@ failure. ... } THEN result has status code 201 -A build step failed, so now the build has ended, and there's no more -work to do. +Worker is next told to notify end of build. + + WHEN obelix makes request GET /work + THEN result has status code 200 + AND body matches + ... { + ... "build_id": "rome/1", + ... "build_number": 1, + ... "log": "/logs/rome/1", + ... "worker": "obelix", + ... "project": "rome", + ... "parameters": {}, + ... "action_id": "4", + ... "step": { + ... "action": "notify" + ... } + ... } + + WHEN obelix makes request POST /work with a valid token and body + ... { + ... "build_id": "rome/1", + ... "action_id": "4", + ... "worker": "obelix", + ... "project": "rome", + ... "exit_code": 0, + ... "stdout": "", + ... "stderr": "eek!", + ... "timestamp": "2017-10-27T17:08:49" + ... } + THEN result has status code 201 + +The build has ended, and there's no more work to do. WHEN obelix makes request GET /work THEN result has status code 200 @@ -159,9 +190,15 @@ There's a build with a log. ... "status": "blocked", ... "depends": ["2"], ... "action": {"shell": "day 2", "where": "host"} + ... }, + ... "4": { + ... "status": "done", + ... "depends": [], + ... "action": {"action": "notify"} ... } ... }, - ... "status": 1 + ... "status": "failed", + ... "exit_code": 1 ... } ... ] ... } @@ -194,14 +231,20 @@ There's a build with a log. ... "status": "blocked", ... "depends": ["2"], ... "action": {"shell": "day 2", "where": "host"} + ... }, + ... "4": { + ... "status": "done", + ... "depends": [], + ... "action": {"action": "notify"} ... } ... }, - ... "status": 1 + ... "status": "failed", + ... "exit_code": 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 "eek!" + AND body text contains "eek!" FINALLY stop ick controller -- cgit v1.2.1