From 020973ec32fbcd3caf559ec12aa6627d34c998b3 Mon Sep 17 00:00:00 2001 From: Kris De Volder Date: Fri, 23 Dec 2016 22:17:15 -0800 Subject: [PATCH] Concourse: Hover Docs for Resource attributes --- .../ide/vscode/concourse/PipelineYmlSchema.java | 1 + .../main/resources/desc/Resource/check_every.md | 1 + .../src/main/resources/desc/Resource/name.md | 1 + .../src/main/resources/desc/Resource/source.md | 7 +++++++ .../src/main/resources/desc/Resource/type.md | 3 +++ .../vscode/concourse/PipelineYamlEditorTest.java | 16 ++++++++++++++++ 6 files changed, 29 insertions(+) create mode 100644 vscode-extensions/vscode-concourse/src/main/resources/desc/Resource/check_every.md create mode 100644 vscode-extensions/vscode-concourse/src/main/resources/desc/Resource/name.md create mode 100644 vscode-extensions/vscode-concourse/src/main/resources/desc/Resource/source.md create mode 100644 vscode-extensions/vscode-concourse/src/main/resources/desc/Resource/type.md diff --git a/vscode-extensions/vscode-concourse/src/main/java/org/springframework/ide/vscode/concourse/PipelineYmlSchema.java b/vscode-extensions/vscode-concourse/src/main/java/org/springframework/ide/vscode/concourse/PipelineYmlSchema.java index 325f54531..b079d81e5 100644 --- a/vscode-extensions/vscode-concourse/src/main/java/org/springframework/ide/vscode/concourse/PipelineYmlSchema.java +++ b/vscode-extensions/vscode-concourse/src/main/java/org/springframework/ide/vscode/concourse/PipelineYmlSchema.java @@ -165,6 +165,7 @@ public class PipelineYmlSchema implements YamlSchema { prop(resource, "name", resourceNameDef); prop(resource, "type", t_resource_type_name); prop(resource, "source", t_any); + prop(resource, "check_every", t_duration); YBeanType job = f.ybean("Job"); prop(job, "name", jobNameDef); diff --git a/vscode-extensions/vscode-concourse/src/main/resources/desc/Resource/check_every.md b/vscode-extensions/vscode-concourse/src/main/resources/desc/Resource/check_every.md new file mode 100644 index 000000000..79739b2ec --- /dev/null +++ b/vscode-extensions/vscode-concourse/src/main/resources/desc/Resource/check_every.md @@ -0,0 +1 @@ +*Optional. Default 1m.* The interval on which to check for new versions of the resource. Acceptable interval options are defined by the [time.ParseDuration function](https://golang.org/pkg/time/#ParseDuration). \ No newline at end of file diff --git a/vscode-extensions/vscode-concourse/src/main/resources/desc/Resource/name.md b/vscode-extensions/vscode-concourse/src/main/resources/desc/Resource/name.md new file mode 100644 index 000000000..7c5ceaa24 --- /dev/null +++ b/vscode-extensions/vscode-concourse/src/main/resources/desc/Resource/name.md @@ -0,0 +1 @@ +*Required.* The name of the resource. This should be short and simple. This name will be referenced by [build plans](https://concourse.ci/build-plans.html) of jobs in the pipeline. \ No newline at end of file diff --git a/vscode-extensions/vscode-concourse/src/main/resources/desc/Resource/source.md b/vscode-extensions/vscode-concourse/src/main/resources/desc/Resource/source.md new file mode 100644 index 000000000..0b00bce8e --- /dev/null +++ b/vscode-extensions/vscode-concourse/src/main/resources/desc/Resource/source.md @@ -0,0 +1,7 @@ +*Optional.* The location of the resource. This varies by resource type, and is a black box to Concourse; it is blindly passed to the resource at runtime. + +To use `git` as an example, the source may contain the repo URI, the branch of the repo to track, and a private key to use when pushing/pulling. + +By convention, documentation for each resource type's configuration is in each implementation's `README`. + +You can find the source for the resource types provided with Concourse at the [Concourse GitHub organization](https://github.com/concourse?query=-resource). \ No newline at end of file diff --git a/vscode-extensions/vscode-concourse/src/main/resources/desc/Resource/type.md b/vscode-extensions/vscode-concourse/src/main/resources/desc/Resource/type.md new file mode 100644 index 000000000..230728a11 --- /dev/null +++ b/vscode-extensions/vscode-concourse/src/main/resources/desc/Resource/type.md @@ -0,0 +1,3 @@ +*Required.* The type of the resource. Each worker advertises a mapping of `resource-type -> container-image; type` corresponds to the key in the map. + +To see what resource types your deployment supports, check the status of your worker pool via the `/api/v1/workers` API endpoint. \ No newline at end of file diff --git a/vscode-extensions/vscode-concourse/src/test/java/org/springframework/ide/vscode/concourse/PipelineYamlEditorTest.java b/vscode-extensions/vscode-concourse/src/test/java/org/springframework/ide/vscode/concourse/PipelineYamlEditorTest.java index 30abba30c..09ae893d2 100644 --- a/vscode-extensions/vscode-concourse/src/test/java/org/springframework/ide/vscode/concourse/PipelineYamlEditorTest.java +++ b/vscode-extensions/vscode-concourse/src/test/java/org/springframework/ide/vscode/concourse/PipelineYamlEditorTest.java @@ -663,6 +663,22 @@ public class PipelineYamlEditorTest { editor.assertHoverContains("source", 2, "The location of the resource type's resource"); } + @Test + public void resourceAttributeHovers() throws Exception { + Editor editor = harness.newEditor( + "resources:\n" + + "- name: sts4\n" + + " type: git\n" + + " check_every: 5m\n" + + " source:\n" + + " repository: https://github.com/spring-projects/sts4\n" + ); + + editor.assertHoverContains("name", "The name of the resource"); + editor.assertHoverContains("type", "The type of the resource. Each worker advertises"); + editor.assertHoverContains("source", 2, "The location of the resource"); + editor.assertHoverContains("check_every", "The interval on which to check for new versions"); + } //////////////////////////////////////////////////////////////////////////////