Add hovers for all toplevel task properties

This commit is contained in:
Kris De Volder
2017-01-26 15:51:46 -08:00
parent 4fd18c9a7c
commit 0a92010d76
8 changed files with 103 additions and 2 deletions

View File

@@ -261,7 +261,7 @@ public class PipelineYmlSchema implements YamlSchema {
addProp(task, "platform", t_platform).isRequired(true);
addProp(task, "image_resource", t_image_resource);
addProp(task, "image", t_ne_string);
addProp(task, "inputs", f.yseq(t_name_and_path));
addProp(task, "inputs", f.yseq(t_name_and_path)).isRequired(true);
addProp(task, "outputs", f.yseq(t_name_and_path));
addProp(task, "run", t_command).isRequired(true);
addProp(task, "params", t_string_params);

View File

@@ -0,0 +1,5 @@
*Optional.* A string specifying the rootfs of the container, as interpreted
by your worker's Garden backend.
You should only use this if you cannot use `image_resource` for some reason,
and you know what you're doing.

View File

@@ -0,0 +1,22 @@
*Optional.* The base image of the container. This style of specifying the base image has the same effect as `image:` but uses Concourse resources to download the image. The contents of this field should be the same as a resource configuration in your pipeline (without the name).
The following example configures the task to use the `golang:1.6` Docker image:
image_resource:
type: docker-image
source: {repository: golang, tag: "1.6"}
...and the following example uses an insecure private Docker registry with a username and password:
image_resource:
type: docker-image
source:
repository: my.local.registry:8080/my/image
insecure_registries: ["my.local.registry:8080"]
username: myuser
password: mypass
email: x@x.com
You can use any resource that returns a filesystem in the correct format (a `/rootfs` directory and a `metadata.json` file in the top level) but normally this will be the [Docker Image resource](https://github.com/concourse/docker-image-resource). If you'd like to make a resource of your own that supports this please use that as a reference implementation for now.
If you want to use an artifact source within the plan containing an image, you must set the [image](https://concourse.ci/task-step.html#task-image) in the plan step instead.

View File

@@ -0,0 +1,13 @@
*Required.* The expected set of inputs for the task.
This determines which artifacts will propagate into the task, as the [build plan](https://concourse.ci/build-plans.html) executes. If any specified inputs are not present, the task will end with an error, without running.
Each input has the following attributes:
name: string
Required. The logical name of the input.
path: string
Optional. The path where the input will be placed. If not specified, the input's name is used.

View File

@@ -0,0 +1,47 @@
*Optional.* The artifacts produced by the task.
Each output configures a directory to make available to later steps in the [build plan](https://concourse.ci/build-plans.html). The directory will be automatically created before the task runs, and the task should place any artifacts it wants to export in the directory.
Each output has the following attributes:
name: string
*Required.* The logical name of the output. The contents under `path` will be made available to the rest of the plan under this name.
path: string
*Optional.* The path to a directory where the output will be taken from. If not specified, the output's `name` is used.
Note that this value must not overlap with any other inputs or outputs. Each output results in a new empty directory that your task should place artifacts in; if the path overlaps it'll clobber whatever files used to be there.
For example, the following task and script would be used to propagate a built binary to later steps:
---
platform: linux
image_resource: # ...
inputs:
- name: project-src
outputs:
- name: built-project
run:
path: project-src/ci/build
...assuming `project-src/ci/build` looks something like:
#!/bin/bash
set -e -u -x
export GOPATH=$PWD/project-src
go build -o built-project/my-project github.com/concourse/my-project
...this task could then be used in a build plan like so:
plan:
- get: project-src
- task: build-bin
file: project-src/ci/build.yml
- put: project-bin
params: file: built-project/my-project

View File

@@ -0,0 +1,3 @@
*Optional.* A key-value mapping of values that are exposed to the task via environment variables.
Use this to provide things like credentials, not to set up the task's Bash environment (they do not support interpolation).

View File

@@ -0,0 +1,3 @@
*Required.* The command to execute in the container.
Note that this is *not* provided as a script blob, but explicit `path` and `args` values; this allows `fly` to forward arguments to the script, and forces your config `.yml` to stay fairly small.

View File

@@ -1459,7 +1459,7 @@ public class ConcourseEditorTest {
editor = harness.newEditor(LanguageIds.CONCOURSE_TASK,
"image: some-image"
);
editor.assertProblems("image: some-image|[platform, run] are required");
editor.assertProblems("image: some-image|[inputs, platform, run] are required");
editor = harness.newEditor(LanguageIds.CONCOURSE_TASK,
"platform: a-platform\n" +
@@ -1536,6 +1536,14 @@ public class ConcourseEditorTest {
" path: sts4/concourse/tasks/build-vscode-extensions.sh"
);
editor.assertHoverContains("platform", "The platform the task should run on");
editor.assertHoverContains("image_resource", "The base image of the container");
editor.assertHoverContains("image", "A string specifying the rootfs of the container");
editor.assertHoverContains("inputs", "The expected set of inputs for the task");
editor.assertHoverContains("outputs", "The artifacts produced by the task");
editor.assertHoverContains("run", "Note that this is *not* provided as a script blob");
editor.assertHoverContains("params", "A key-value mapping of values that are exposed to the task via environment variables");
editor.assertHoverContains("platform", "The platform the task should run on");
}