summaryrefslogtreecommitdiff
path: root/yarns/100-projects.yarn
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2017-10-15 17:17:19 +0300
committerLars Wirzenius <liw@liw.fi>2017-10-15 17:17:19 +0300
commitb2a08dbe0b2fc596f500b4a95325f5343088ad9c (patch)
treeddfff112929b84dd313be119ed1dcead9c5345cd /yarns/100-projects.yarn
parent6fb7dc4cada78e2153fe18a24c5486a909958e4f (diff)
downloadick2-b2a08dbe0b2fc596f500b4a95325f5343088ad9c.tar.gz
Fix: make 100-projects.yarn follow arch doc for projects
Diffstat (limited to 'yarns/100-projects.yarn')
-rw-r--r--yarns/100-projects.yarn119
1 files changed, 82 insertions, 37 deletions
diff --git a/yarns/100-projects.yarn b/yarns/100-projects.yarn
index d0d72d5..1291f5e 100644
--- a/yarns/100-projects.yarn
+++ b/yarns/100-projects.yarn
@@ -25,24 +25,35 @@ like this:
EXAMPLE project resource
{
- "name": "ick2-website",
- "shell_commands": [
- "git clone git://git.liw.fi/ick2-website src",
- "cd src && ikiwiki --setup ikiwiki.setup",
- "cd html && rsync -a --delete . www-data@www.example.com:/srv/http/ick2/."
+ "project": "ick2-website",
+ "pipelines": [
+ {
+ "name": "setup-workspace",
+ "actions": [
+ { "shell": "git clone git://git.liw.fi/ick2-website src" }
+ ]
+ },
+ {
+ "name": "build-website",
+ "actions": [
+ { "shell": "cd src && ikiwiki --setup ikiwiki.setup" }
+ ]
+ },
+ {
+ "name": "publish-website",
+ "actions": [
+ { "shell": "cd html && rsync -a --delete . server::/srv/http/ick2/." }
+ ]
+ }
]
}
-In other words, there are two things that define a project:
+In other words, there are several things that define a project:
-* The name. This is used for referreing to the project in the API.
-* A sequence of shell commands to be run to build the project. At this
- point Ick2 does not know about git repositories, so the shell
- commands need to do the cloning explicitly; this will obviously have
- to be changed later on. Note also that each string in the list is
- run by a new shell process, and that the current working directory,
- or environment variables, do not get preserved. Ick2 will create a
- new, empty directory for running the commands.
+* The `name`. This is used for referreing to the project in the API.
+* A list of pipelines. Each pipeline has a name, and sequence of
+ actions that need to be taken. At the moment, each action is a shell
+ command to be run.
## Managing projects
@@ -67,20 +78,30 @@ building them. We start by starting an instance of the controller.
WHEN user makes request POST /projects
... {
... "project": "website",
- ... "shell_steps": [
- ... "git clone git://repo src",
- ... "mkdir html",
- ... "ikiwiki src html"
+ ... "pipelines": [
+ ... {
+ ... "name": "build",
+ ... "actions": [
+ ... { "shell": "git clone git://repo src" },
+ ... { "shell": "mkdir html" },
+ ... { "shell": "ikiwiki src html" }
+ ... ]
+ ... }
... ]
... }
THEN result has status code 201
AND body matches
... {
... "project": "website",
- ... "shell_steps": [
- ... "git clone git://repo src",
- ... "mkdir html",
- ... "ikiwiki src html"
+ ... "pipelines": [
+ ... {
+ ... "name": "build",
+ ... "actions": [
+ ... { "shell": "git clone git://repo src" },
+ ... { "shell": "mkdir html" },
+ ... { "shell": "ikiwiki src html" }
+ ... ]
+ ... }
... ]
... }
AND controller state directory contains project website
@@ -92,10 +113,15 @@ building them. We start by starting an instance of the controller.
... "projects": [
... {
... "project": "website",
- ... "shell_steps": [
- ... "git clone git://repo src",
- ... "mkdir html",
- ... "ikiwiki src html"
+ ... "pipelines": [
+ ... {
+ ... "name": "build",
+ ... "actions": [
+ ... { "shell": "git clone git://repo src" },
+ ... { "shell": "mkdir html" },
+ ... { "shell": "ikiwiki src html" }
+ ... ]
+ ... }
... ]
... }
... ]
@@ -108,26 +134,41 @@ building them. We start by starting an instance of the controller.
AND body matches
... {
... "project": "website",
- ... "shell_steps": [
- ... "git clone git://repo src",
- ... "mkdir html",
- ... "ikiwiki src html"
+ ... "pipelines": [
+ ... {
+ ... "name": "build",
+ ... "actions": [
+ ... { "shell": "git clone git://repo src" },
+ ... { "shell": "mkdir html" },
+ ... { "shell": "ikiwiki src html" }
+ ... ]
+ ... }
... ]
... }
WHEN user makes request PUT /projects/website
... {
... "project": "website",
- ... "shell_steps": [
- ... "build-it"
+ ... "pipelines": [
+ ... {
+ ... "name": "build",
+ ... "actions": [
+ ... { "shell": "build-it" }
+ ... ]
+ ... }
... ]
... }
THEN result has status code 200
AND body matches
... {
... "project": "website",
- ... "shell_steps": [
- ... "build-it"
+ ... "pipelines": [
+ ... {
+ ... "name": "build",
+ ... "actions": [
+ ... { "shell": "build-it" }
+ ... ]
+ ... }
... ]
... }
AND controller state directory contains project website
@@ -137,8 +178,13 @@ building them. We start by starting an instance of the controller.
AND body matches
... {
... "project": "website",
- ... "shell_steps": [
- ... "build-it"
+ ... "pipelines": [
+ ... {
+ ... "name": "build",
+ ... "actions": [
+ ... { "shell": "build-it" }
+ ... ]
+ ... }
... ]
... }
@@ -147,5 +193,4 @@ building them. We start by starting an instance of the controller.
WHEN user makes request GET /projects/website
THEN result has status code 404
-
FINALLY stop ick controller