Concourse: basic support for 'tags' attribute

This commit is contained in:
Kris De Volder
2016-12-21 11:38:52 -08:00
parent 121c8a7c72
commit 50cc31f149
3 changed files with 23 additions and 0 deletions

View File

@@ -135,6 +135,7 @@ public class PipelineYmlSchema implements YamlSchema {
prop(step, "on_failure", step);
prop(step, "ensure", step);
prop(step, "attempts", t_strictly_pos_integer);
prop(step, "tags", t_strings);
YBeanType resource = f.ybean("Resource");
prop(resource, "name", t_ne_string);

View File

@@ -0,0 +1,9 @@
Perform a step on certain workers.
Any step can be directed at a pool of workers for a given set of tags, by adding the `tags` attribute to it.
tags: [string]
*Optional. Default* `[]`. The tags by which to match workers.
For example, if `[a, b]` is specified, only workers advertising the `a` and `b` tags (or any others) will be used for running the step.

View File

@@ -106,6 +106,17 @@ public class PipelineYamlEditorTest {
editor.assertProblems(
"name: git\n type: git|Expecting a 'Sequence' but found a 'Map'"
);
editor = harness.newEditor(
"jobs:\n" +
"- name: a-job\n" +
" plan:\n" +
" - task: a-task\n" +
" tags: a-single-string\n"
);
editor.assertProblems(
"a-single-string|Expecting a 'Sequence'"
);
//TODO: Add more test cases for structural problem?
}
@@ -217,6 +228,7 @@ public class PipelineYamlEditorTest {
" output_mapping:\n" +
" map: of-stuff\n" +
" config: some-config\n" +
" tags: [a, b, c]\n"+
" attempts: 10\n" +
" ensure:\n" +
" bogus: bad\n" +
@@ -232,6 +244,7 @@ public class PipelineYamlEditorTest {
editor.assertHoverContains("input_mapping", "A map from task input names to concrete names in the build plan");
editor.assertHoverContains("output_mapping", "A map from task output names to concrete names");
editor.assertHoverContains("config", "Use `config` to inline the task config");
editor.assertHoverContains("tags", "Any step can be directed at a pool of workers");
}
@Test