Add support for check_every in concourse 'ResourceType' and other...

missing ResourceType attributes

See: https://github.com/spring-projects/sts4/issues/382
This commit is contained in:
Kris De Volder
2019-10-31 15:39:39 -07:00
parent 1200241a0f
commit 9256934ce8
5 changed files with 59 additions and 1 deletions

View File

@@ -425,6 +425,10 @@ public class PipelineYmlSchema implements YamlSchema {
addProp(resourceType, "type", t_resource_type_name).isRequired(true);
addProp(resourceType, "source", resourceSource);
addProp(resourceType, "privileged", t_boolean);
addProp(resourceType, "params", t_params);
addProp(resourceType, "check_every", t_duration);
addProp(resourceType, "tags", t_strings);
addProp(resourceType, "unique_version_history", t_boolean);
YType t_group_name_def= f.yatomic("Group Name")
.parseWith(ValueParsers.NE_STRING);

View File

@@ -0,0 +1,3 @@
*Optional*. *Default* `1m`. The interval on which to check for new versions
of the resource type. Acceptable interval options are defined by the
[time.ParseDuration function](https://golang.org/pkg/time/#ParseDuration).

View File

@@ -0,0 +1,3 @@
*Optional*. A list of tags to determine which workers the checks will be performed on. You'll want to specify this if
the source is internal to a worker's network, for example. See also [tags](https://concourse-ci.org/tags-step-modifier.html) step modifier.

View File

@@ -0,0 +1,4 @@
*Optional*. *Default* `false`. Only relevant when [Global Resources](https://concourse-ci.org/global-resources.html) is enabled. When set to `true`,
resources using this resource type will have a version history that is unique to the resource, rather than sharing a global version history.

View File

@@ -1759,12 +1759,52 @@ public class ConcourseEditorTest {
);
}
@Test
public void resourceTypeAttributeReconcile() throws Exception {
//Example from https://github.com/spring-projects/sts4/issues/382
Editor editor = harness.newEditor(
"resource_types:\n" +
"\n" +
"- name: cogito\n" +
" type: registry-image\n" +
" check_every: 24h\n" +
" source:\n" +
" repository: ((docker-registry))/cogito"
);
editor.assertProblems(/*none*/);
//More elaborate example
editor = harness.newEditor(
"resource_types:\n" +
"- name: cogito\n" +
" type: registry-image\n" +
" check_every: bad-duration\n" +
" privileged: is-priviliged\n" +
" params:\n" +
" foo: bar\n"+
" tags: tags-list\n" +
" unique_version_history: is-unique-hist\n" +
" source:\n" +
" repository: ((docker-registry))/cogito"
);
editor.assertProblems(
"bad-duration|Duration",
"is-priviliged|boolean",
"tags-list|Sequence",
"is-unique-hist|boolean"
);
}
@Test
public void resourceTypeAttributeHovers() throws Exception {
Editor editor = harness.newEditor(
"resource_types:\n" +
"- name: s3-multi\n" +
" type: docker-image\n" +
" check_every: bad-duration\n" +
" privileged: is-priviliged\n" +
" tags: tags-list\n" +
" unique_version_history: is-unique-hist\n" +
" source:\n" +
" repository: kdvolder/s3-resource-simple\n"
);
@@ -1772,6 +1812,10 @@ public class ConcourseEditorTest {
editor.assertHoverContains("name", "This name will be referenced by `resources` defined within the same pipeline");
editor.assertHoverContains("type", 2, "used to provide the resource type's container image");
editor.assertHoverContains("source", 2, "The location of the resource type's resource");
editor.assertHoverContains("privileged", "containers will be run with full capabilities");
editor.assertHoverContains("check_every", "interval on which to check for new versions");
editor.assertHoverContains("tags", "list of tags to determine which workers");
editor.assertHoverContains("unique_version_history", "resource type will have a version history that is unique to the resource");
}
@Test
@@ -1789,7 +1833,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("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");