Support (CA/hover/reconcile) for task.run sub-properties

This commit is contained in:
Kris De Volder
2017-01-26 18:31:41 -08:00
parent 3c3eb58970
commit c8e5c6e3c5
6 changed files with 55 additions and 2 deletions

View File

@@ -173,8 +173,11 @@ public class PipelineYmlSchema implements YamlSchema {
f.yprop("path", t_ne_string)
);
YType t_command = f.yany("Command");
//TODO: add structure for command.
YBeanType t_command = f.ybean("Command");
addProp(t_command, "path", t_ne_string).isRequired(true);
addProp(t_command, "args", t_strings);
addProp(t_command, "dir", t_ne_string);
addProp(t_command, "user", t_string);
task = f.ybean("TaskConfig");
addProp(task, "platform", t_platform).isRequired(true);

View File

@@ -0,0 +1 @@
*Optional.* Arguments to pass to the command. Note that when executed with `fly`, any arguments passed to `fly` are appended to this array.

View File

@@ -0,0 +1 @@
*Optional.* A directory, relative to the initial working directory, to set as the working directory when running the script.

View File

@@ -0,0 +1 @@
*Required.* The command to execute, relative to the task's working directory. For a script living in a resource's repo, you must specify the full path to the resource, i.e. `my-resource/scripts/test`.

View File

@@ -0,0 +1 @@
*Optional.* Explicitly set the user to run as. If not specified, this defaults to the user configured by the task's image. If not specified there, it's up to the Garden backend, and may be e.g. `root` on Linux.

View File

@@ -1580,6 +1580,52 @@ public class ConcourseEditorTest {
);
}
@Test public void taskRunPropertiesValidationAndHovers() throws Exception {
Editor editor;
editor = harness.newEditor(LanguageIds.CONCOURSE_TASK,
"inputs:\n" +
"- name: sts4\n" +
"outputs:\n" +
"- name: vsix-files\n" +
"platform: linux\n" +
"image_resource:\n" +
" type: docker-image\n" +
" source:\n" +
" repository: kdvolder/sts4-build-env\n" +
"run:\n" +
" path: sts4/concourse/tasks/build-vscode-extensions.sh\n" +
" args: the-args\n" +
" user: admin\n" +
" dir: the-dir\n" +
" bogus: bad\n"
);
editor.assertProblems(
"the-args|Expecting a 'Sequence'",
"bogus|Unknown property"
);
editor.assertHoverContains("path", "The command to execute, relative to the task's working directory");
editor.assertHoverContains("args", "Arguments to pass to the command");
editor.assertHoverContains("dir", "A directory, relative to the initial working directory, to set as the working directory");
editor.assertHoverContains("user", "Explicitly set the user to run as");
editor = harness.newEditor(LanguageIds.CONCOURSE_TASK,
"inputs:\n" +
"- name: sts4\n" +
"outputs:\n" +
"- name: vsix-files\n" +
"platform: linux\n" +
"image_resource:\n" +
" type: docker-image\n" +
" source:\n" +
" repository: kdvolder/sts4-build-env\n" +
"run:\n" +
" user: admin\n"
);
editor.assertProblems("user: admin|'path' is required");
}
//////////////////////////////////////////////////////////////////////////////
private void assertContextualCompletions(String conText, String textBefore, String... textAfter) throws Exception {