Add display property to pipeline schema

In Concourse 6.6, a feature was introduced to allow pipeline developers
to set custom background images to their pipelines. This commit adds
support for that field to the language server.
This commit is contained in:
Josh Ghiloni
2021-03-04 13:38:43 -07:00
parent a33dc1eb73
commit 6be4e4c014
4 changed files with 57 additions and 3 deletions

View File

@@ -22,6 +22,7 @@ import org.springframework.ide.vscode.commons.util.MimeTypes;
import org.springframework.ide.vscode.commons.util.PartialCollection;
import org.springframework.ide.vscode.commons.util.Renderable;
import org.springframework.ide.vscode.commons.util.Renderables;
import org.springframework.ide.vscode.commons.util.StringUtil;
import org.springframework.ide.vscode.commons.util.ValueParseException;
import org.springframework.ide.vscode.commons.util.ValueParser;
import org.springframework.ide.vscode.commons.util.ValueParsers;
@@ -36,6 +37,7 @@ import org.springframework.ide.vscode.commons.yaml.reconcile.YamlSchemaValuePars
import org.springframework.ide.vscode.commons.yaml.reconcile.TypeBasedYamlHierarchicalSymbolHandler.HierarchicalDefType;
import org.springframework.ide.vscode.commons.yaml.schema.BasicYValueHint;
import org.springframework.ide.vscode.commons.yaml.schema.DynamicSchemaContext;
import org.springframework.ide.vscode.commons.yaml.schema.SchemaContextAware;
import org.springframework.ide.vscode.commons.yaml.schema.YType;
import org.springframework.ide.vscode.commons.yaml.schema.YTypeFactory;
import org.springframework.ide.vscode.commons.yaml.schema.YTypeFactory.AbstractType;
@@ -57,6 +59,7 @@ import org.springframework.ide.vscode.concourse.github.GithubValueParsers;
import org.yaml.snakeyaml.nodes.MappingNode;
import org.yaml.snakeyaml.nodes.Node;
import com.fasterxml.jackson.databind.jsonschema.SchemaAware;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableSet;
@@ -456,6 +459,12 @@ public class PipelineYmlSchema implements YamlSchema {
addProp(group, "resources", f.yseq(t_resource_name));
addProp(group, "jobs", f.yseq(t_job_name));
YType t_background_image_def = f.yatomic("Background Image")
.parseWith(ValueParsers.NE_STRING);
AbstractType t_display = f.ybean("Display");
addProp(t_display, "background_image", t_background_image_def).isRequired(true);
YSeqType t_resources = f.yseq(t_resource);
YSeqType t_jobs = f.yseq(job);
YSeqType t_resourceTypes = f.yseq(resourceType);
@@ -464,12 +473,14 @@ public class PipelineYmlSchema implements YamlSchema {
addProp(TOPLEVEL_TYPE, "jobs", t_jobs);
addProp(TOPLEVEL_TYPE, "resource_types", t_resourceTypes);
addProp(TOPLEVEL_TYPE, "groups", t_groups);
addProp(TOPLEVEL_TYPE, "display", t_display);
definitionTypes = ImmutableList.of(
jobNameDef,
resourceTypeNameDef,
t_resource_name_def,
t_group_name_def
t_group_name_def,
t_background_image_def
);
hierarchicDefinitions = ImmutableList.of(
new HierarchicalDefType(t_resources, null, SymbolKind.File, "Resources"),
@@ -482,7 +493,9 @@ public class PipelineYmlSchema implements YamlSchema {
new HierarchicalDefType(resourceType, YamlPath.fromSimpleProperty("name"), SymbolKind.Interface, "Resource Type"),
new HierarchicalDefType(t_groups, null, SymbolKind.Package, "Groups"),
new HierarchicalDefType(group, YamlPath.fromSimpleProperty("name"), SymbolKind.Package, "Groups")
new HierarchicalDefType(group, YamlPath.fromSimpleProperty("name"), SymbolKind.Package, "Groups"),
new HierarchicalDefType(t_display, null, SymbolKind.Package, "Display Settings")
);
initializeDefaultResourceTypes();

View File

@@ -0,0 +1 @@
Allow users to specify a custom background image which is put at 30% opacity, grayscaled and blended into existing background. Must be an http, https, or relative URL.

View File

@@ -0,0 +1,8 @@
Visual configurations for personalizing your pipeline (Concourse 6.6+ only)
You may use this optional section to set a background image on your pipeline.
A simple example looks like this:
display:
background_image: https://avatars1.githubusercontent.com/u/7809479?s=400&v=4