diff --git a/headless-services/concourse-language-server/src/main/java/org/springframework/ide/vscode/concourse/PipelineYmlSchema.java b/headless-services/concourse-language-server/src/main/java/org/springframework/ide/vscode/concourse/PipelineYmlSchema.java index 96dcc7a92..25d652c3a 100644 --- a/headless-services/concourse-language-server/src/main/java/org/springframework/ide/vscode/concourse/PipelineYmlSchema.java +++ b/headless-services/concourse-language-server/src/main/java/org/springframework/ide/vscode/concourse/PipelineYmlSchema.java @@ -219,6 +219,7 @@ public class PipelineYmlSchema implements YamlSchema { addProp(t_resource, "type", t_resource_type_name).isRequired(true); addProp(t_resource, "source", resourceSource); addProp(t_resource, "check_every", t_duration); + addProp(t_resource, "webhook_token", t_ne_string); AbstractType t_image_resource = f.ybean("ImageResource"); for (YTypedProperty p : t_resource.getProperties()) { diff --git a/headless-services/concourse-language-server/src/main/resources/desc/Resource/webhook_token.md b/headless-services/concourse-language-server/src/main/resources/desc/Resource/webhook_token.md new file mode 100644 index 000000000..b5802320a --- /dev/null +++ b/headless-services/concourse-language-server/src/main/resources/desc/Resource/webhook_token.md @@ -0,0 +1,7 @@ +*Optional.* If specified, web hooks can be sent to trigger an immediate *check* of the resource, specifying this value as a primitive form of authentication via query params. + +After configuring this value, you would then configure your hook sender with the following painfully long path appended to your external URL: + + /api/v1/teams/TEAM_NAME/pipelines/PIPELINE_NAME/resources/RESOURCE_NAME/check/webhook?webhook_token=WEBHOOK_TOKEN + +Note that the request payload sent to this API endpoint is entirely ignored. You should configure the resource as if you're not using web hooks, as the resource config is still the "source of truth." \ No newline at end of file diff --git a/headless-services/concourse-language-server/src/test/java/org/springframework/ide/vscode/concourse/ConcourseEditorTest.java b/headless-services/concourse-language-server/src/test/java/org/springframework/ide/vscode/concourse/ConcourseEditorTest.java index add931773..ffdaae38d 100644 --- a/headless-services/concourse-language-server/src/test/java/org/springframework/ide/vscode/concourse/ConcourseEditorTest.java +++ b/headless-services/concourse-language-server/src/test/java/org/springframework/ide/vscode/concourse/ConcourseEditorTest.java @@ -1392,6 +1392,7 @@ public class ConcourseEditorTest { "- name: sts4\n" + " type: git\n" + " check_every: 5m\n" + + " webhook_token: bladayadayaaa\n" + " source:\n" + " repository: https://github.com/spring-projects/sts4\n" ); @@ -1399,6 +1400,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("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"); } @@ -3107,6 +3109,7 @@ public class ConcourseEditorTest { editor.assertCompletionLabels( //For the 'exact' context: "check_every", + "webhook_token", //"name", exists //"source", exists //"type", exists