Merge pull request #301 from jghiloni/master

Add support for Concourse 5.x in_parallel step
This commit is contained in:
Kris De Volder
2019-05-29 15:27:35 -07:00
committed by GitHub
4 changed files with 77 additions and 0 deletions

View File

@@ -236,6 +236,7 @@ public class PipelineYmlSchema implements YamlSchema {
addProp(t_resource, "check_every", t_duration);
addProp(t_resource, "tags", t_strings);
addProp(t_resource, "webhook_token", t_ne_string);
addProp(t_resource, "icon", t_ne_string);
AbstractType t_image_resource = f.ybean("ImageResource");
{
@@ -361,17 +362,20 @@ public class PipelineYmlSchema implements YamlSchema {
YBeanType aggregateStep = f.ybean("AggregateStep");
YBeanType doStep = f.ybean("DoStep");
YBeanType tryStep = f.ybean("TryStep");
YBeanType inParallelStep = f.ybean("InParallelStep");
YBeanType[] stepTypes = {
getStep,
putStep,
taskStep,
aggregateStep,
inParallelStep,
doStep,
tryStep
};
YBeanUnionType step = f.yBeanUnion("Step", stepTypes);
addProp(aggregateStep, "aggregate", f.yseq(step));
addProp(inParallelStep, "in_parallel", f.yseq(step));
addProp(doStep, "do", f.yseq(step));
addProp(tryStep, "try", step);

View File

@@ -0,0 +1,31 @@
Performs the given steps in parallel.
If any sub-steps in an `in_parallel` result in an error, the `in_parallel` step
as a whole is considered to have errored.
Similarly, when aggregating `task` steps, if any *fail*, the
`in_parallel` step will fail. This is useful for build matrices:
```
plan:
- get: some-repo
- in_parallel:
- task: unit-windows
file: some-repo/ci/windows.yml
- task: unit-linux
file: some-repo/ci/linux.yml
- task: unit-darwin
file: some-repo/ci/darwin.yml
```
The `in_parallel` step is also useful for performing arbitrary steps in parallel, for the sake of speeding up the build. It is often used to fetch all dependent resources together:
```
plan:
- in_parallel:
- get: component-a
- get: component-b
- get: integration-suite
- task: integration
file: integration-suite/task.yml
```

View File

@@ -0,0 +1 @@
*Optional* If specified, it must be the name of a [Material Design Icon](https://materialdesignicons.com) and will be rendered alongside the resource's name in the Concourse UI.

View File

@@ -313,6 +313,9 @@ public class ConcourseEditorTest {
, // ==============
"get: <*>"
, // ==============
"in_parallel:\n" +
" - <*>"
, // ==============
"put: <*>"
, // ==============
"task: <*>"
@@ -349,6 +352,8 @@ public class ConcourseEditorTest {
" - do: []\n" +
" - aggregate:\n" +
" - task: perform-something\n" +
" - in_parallel:\n" +
" - task: perform-something\n" +
" - try:\n" +
" put: test-logs\n"
);
@@ -356,6 +361,7 @@ public class ConcourseEditorTest {
editor.assertHoverContains("get", "Fetches a resource");
editor.assertHoverContains("put", "Pushes to the given [Resource]");
editor.assertHoverContains("aggregate", "Performs the given steps in parallel");
editor.assertHoverContains("in_parallel", "Performs the given steps in parallel");
editor.assertHoverContains("task", "Executes a [Task]");
editor.assertHoverContains("do", "performs the given steps serially");
editor.assertHoverContains("try", "Performs the given step, swallowing any failure");
@@ -500,6 +506,21 @@ public class ConcourseEditorTest {
editor.assertHoverContains("aggregate", "Performs the given steps in parallel");
}
@Test
public void inParallelStepHovers() throws Exception {
Editor editor;
editor = harness.newEditor(
"jobs:\n" +
"- name: some-job\n" +
" plan:\n" +
" - in_parallel:\n" +
" - get: some-resource\n"
);
editor.assertHoverContains("in_parallel", "Performs the given steps in parallel");
}
@Test
public void reconcileSimpleTypes() throws Exception {
Editor editor;
@@ -1570,6 +1591,7 @@ public class ConcourseEditorTest {
"resources:\n" +
"- name: sts4\n" +
" type: git\n" +
" icon: foo\n" +
" check_every: 5m\n" +
" webhook_token: bladayadayaaa\n" +
" source:\n" +
@@ -1578,6 +1600,7 @@ public class ConcourseEditorTest {
editor.assertHoverContains("name", "The name of the resource");
editor.assertHoverContains("type", "The type of the resource. Each worker advertises");
editor.assertHoverContains("icon", "name of a [Material Design Icon]");
editor.assertHoverContains("source", 2, "The location of the resource");
editor.assertHoverContains("webhook_token", "web hooks can be sent to trigger an immediate *check* of the resource");
editor.assertHoverContains("check_every", "The interval on which to check for new versions");
@@ -3488,6 +3511,7 @@ public class ConcourseEditorTest {
editor.assertCompletionLabels(
//For the 'exact' context:
"check_every",
"icon",
"tags",
"webhook_token",
//"name", exists
@@ -3714,6 +3738,7 @@ public class ConcourseEditorTest {
"- aggregate",
"- do",
"- get",
"- in_parallel",
"- put",
"- task",
"- try",
@@ -4143,6 +4168,22 @@ public class ConcourseEditorTest {
" - aggregate:\n" +
" - <*>"
);
editor = harness.newEditor(
"jobs:\n" +
"- name: build-docker-image\n" +
" serial: true\n" +
" plan:\n" +
" in_"
);
editor.assertCompletionWithLabel("- in_parallel",
"jobs:\n" +
"- name: build-docker-image\n" +
" serial: true\n" +
" plan:\n" +
" - in_parallel:\n" +
" - <*>"
);
}
@Test public void relaxedContentAssist_primary_properties() throws Exception{