summaryrefslogtreecommitdiff
path: root/ick2/workapi.py
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2018-01-13 15:06:15 +0200
committerLars Wirzenius <liw@liw.fi>2018-01-14 22:23:47 +0200
commitefba85dcfa234b40160864e6eeddd472fb9853a9 (patch)
tree24123be0482f40f877a1693dff91508f11c83c3c /ick2/workapi.py
parentb1a4f39271979b1f1f9e461d8f97c2f01b6ab407 (diff)
downloadick2-efba85dcfa234b40160864e6eeddd472fb9853a9.tar.gz
Add: prepend a create_workspace action to pipelines
This replaces the old fresh_workspace attribute of work resources. It's better this way, because it moves policy from worker-manager to controller, where it belongs.
Diffstat (limited to 'ick2/workapi.py')
-rw-r--r--ick2/workapi.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/ick2/workapi.py b/ick2/workapi.py
index d1b3431..8237ff4 100644
--- a/ick2/workapi.py
+++ b/ick2/workapi.py
@@ -66,7 +66,6 @@ class WorkAPI(ick2.APIbase):
'project': project['project'],
'pipeline': pipeline['name'],
'parameters': project.get('parameters', {}),
- 'fresh_workspace': True,
'step': actions[current_action],
'log': '/logs/{}'.format(build_id),
}
@@ -102,6 +101,10 @@ class WorkAPI(ick2.APIbase):
def _start_build(self, project, pipeline, worker, build_id):
ick2.log.log('info', msg_text='Starting new build', build_id=build_id)
parameters = project.get('parameters', {})
+ create_workspace = {
+ 'action': 'create_workspace',
+ }
+ actions = [create_workspace] + list(pipeline['actions'])
build = {
'build_id': build_id,
'log': '/logs/{}'.format(build_id),
@@ -110,7 +113,7 @@ class WorkAPI(ick2.APIbase):
'pipeline': pipeline['name'],
'parameters': parameters,
'status': 'building',
- 'actions': pipeline['actions'],
+ 'actions': actions,
'current_action': 0,
}
self._builds.add(build_id, build)
@@ -155,7 +158,6 @@ class WorkAPI(ick2.APIbase):
build['current_action'] = index
self._update_build(build)
doing['step'] = actions[index]
- doing['fresh_workspace'] = False
worker_state = {
'worker': update['worker'],