Add hover docs for resource_type sub attributes

This commit is contained in:
Kris De Volder
2016-12-22 11:28:25 -08:00
parent 18d795ff26
commit 1cd521bc07
6 changed files with 71 additions and 14 deletions

View File

@@ -61,8 +61,8 @@ public class PipelineYmlSchema implements YamlSchema {
YAtomicType t_image_type = f.yatomic("ImageType");
t_image_type.addHints("docker_image");
YAtomicType t_resource_type = f.yatomic("ResourceType");
t_resource_type.addHints(
YAtomicType t_resource_type_name = f.yatomic("ResourceType Name");
t_resource_type_name.addHints(
f.hint("archive", "archive - The 'archive' resource can fetch and extract .tar.gz archives."),
f.hint("git", "git - The 'git' resource can pull and push to git repositories"),
f.hint("s3", "s3 - The 's3' resource can fetch from and upload to S3 buckets."),
@@ -158,7 +158,7 @@ public class PipelineYmlSchema implements YamlSchema {
YBeanType resource = f.ybean("Resource");
prop(resource, "name", t_ne_string);
prop(resource, "type", t_resource_type);
prop(resource, "type", t_resource_type_name);
prop(resource, "source", t_any);
YBeanType job = f.ybean("Job");
@@ -171,12 +171,10 @@ public class PipelineYmlSchema implements YamlSchema {
prop(job, "disable_manual_trigger", t_boolean);
prop(job, "plan", f.yseq(step));
YType resource_type_def = f.ybean("ResourceTypeDef",
//TODO: This way of initializing the props doesn't attach descriptions!
f.yprop("name", t_ne_string),
f.yprop("type", t_image_type),
f.yprop("source", t_any)
);
YBeanType resourceType = f.ybean("ResourceType");
prop(resourceType, "name", t_ne_string);
prop(resourceType, "type", t_image_type);
prop(resourceType, "source", t_any);
YBeanType group = f.ybean("Group");
prop(group, "name", t_ne_string);
@@ -185,7 +183,7 @@ public class PipelineYmlSchema implements YamlSchema {
prop(TOPLEVEL_TYPE, "resources", f.yseq(resource));
prop(TOPLEVEL_TYPE, "jobs", f.yseq(job));
prop(TOPLEVEL_TYPE, "resource_types", f.yseq(resource_type_def));
prop(TOPLEVEL_TYPE, "resource_types", f.yseq(resourceType));
prop(TOPLEVEL_TYPE, "groups", f.yseq(group));
}

View File

@@ -0,0 +1 @@
*Required.* The name of the new resource type. This should be short and simple. This name will be referenced by `resources` defined within the same pipeline, and `image_resource`s used by tasks running in the pipeline.

View File

@@ -0,0 +1,3 @@
*Optional.* The location of the resource type's resource. This varies by resource type, and is a black box to Concourse; it is blindly passed to the resource at runtime.
To use `docker-image` as an example, the source would contain something like `repository: username/reponame`. See the [Docker Image resource](https://github.com/concourse/docker-image-resource) (or whatever resource type your resource type uses) for more information.

View File

@@ -0,0 +1 @@
*Required.* The type of the resource used to provide the resource type's container image. Yes, this is a bit meta. Usually this will be `docker-image`, as the resource type must result in a container image, though there may be other image formats (possibly themselves defined as custom resource types!).

View File

@@ -10,6 +10,7 @@
*******************************************************************************/
package org.springframework.ide.vscode.concourse;
import static org.junit.Assert.*;
import static org.springframework.ide.vscode.languageserver.testharness.TestAsserts.assertContains;
import java.io.InputStream;
@@ -606,6 +607,21 @@ public class PipelineYamlEditorTest {
);
}
@Test
public void resourceTypeAttributeHovers() throws Exception {
Editor editor = harness.newEditor(
"resource_types:\n" +
"- name: s3-multi\n" +
" type: docker-image\n" +
" source:\n" +
" repository: kdvolder/s3-resource-simple\n"
);
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");
}
//////////////////////////////////////////////////////////////////////////////