Add schemas for RegistryImageRespource Parameters
This commit is contained in:
@@ -573,6 +573,35 @@ public class PipelineYmlSchema implements YamlSchema {
|
||||
|
||||
resourceTypes.def("docker-image", source, get, put);
|
||||
}
|
||||
//registry_image
|
||||
{
|
||||
AbstractType source = f.ybean("RegistryImageSource");
|
||||
addProp(source, "repository", t_ne_string).isPrimary(true);
|
||||
addProp(source, "tag", t_ne_string);
|
||||
addProp(source, "username", t_ne_string);
|
||||
addProp(source, "password", t_ne_string);
|
||||
addProp(source, "debug", t_boolean);
|
||||
{
|
||||
AbstractType contentTrust = f.ybean("RegistryImageContentTrust");
|
||||
addProp(contentTrust, "server", t_ne_string);
|
||||
addProp(contentTrust, "repository_key_id", t_ne_string).isRequired(true);
|
||||
addProp(contentTrust, "repository_key", t_ne_string).isRequired(true);
|
||||
addProp(contentTrust, "repository_passphrase", t_ne_string).isRequired(true);
|
||||
addProp(contentTrust, "tls_key", t_ne_string);
|
||||
addProp(contentTrust, "tls_cert", t_ne_string);
|
||||
|
||||
addProp(source, "content_trust", contentTrust);
|
||||
}
|
||||
|
||||
AbstractType get = f.ybean("RegistryImageGetParams");
|
||||
addProp(get, "format", f.yenum("RegistryImageFormat", "rootfs", "oci"));
|
||||
|
||||
AbstractType put = f.ybean("RegistryImagePutParams");
|
||||
addProp(put, "image", t_ne_string).isPrimary(true);
|
||||
addProp(put, "additional_tags", t_ne_string);
|
||||
|
||||
resourceTypes.def("registry-image", source, get, put);
|
||||
}
|
||||
//s3
|
||||
{
|
||||
YType t_canned_acl = f.yenum("S3CannedAcl",
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
*Required.* Target key used to sign the trusted collection.
|
||||
@@ -0,0 +1 @@
|
||||
*Required.* Target key's ID used to sign the trusted collection, could be retrieved by `notary key list`
|
||||
@@ -0,0 +1 @@
|
||||
*Required.* The passphrase of the signing/target key. (equal to `DOCKER_CONTENT_TRUST_REPOSITORY_PASSPHRASE`)
|
||||
@@ -0,0 +1 @@
|
||||
*Optional.* URL for the notary server. (equal to `DOCKER_CONTENT_TRUST_SERVER`)
|
||||
@@ -0,0 +1 @@
|
||||
*Optional. Default `""`* TLS certificate for the notary server.
|
||||
@@ -0,0 +1 @@
|
||||
*Optional. Default `""`* TLS key for the notary server.
|
||||
@@ -0,0 +1 @@
|
||||
*Optional. Default `rootfs`.* The format to fetch as.
|
||||
@@ -0,0 +1,3 @@
|
||||
*Optional.* The path to a file with whitespace-separated
|
||||
list of tag values to tag the image with (in addition to the tag configured in
|
||||
`source`).
|
||||
@@ -0,0 +1 @@
|
||||
*Required.* The path to the OCI image tarball to upload.
|
||||
@@ -0,0 +1,2 @@
|
||||
*Optional. Default `false`.* If set, progress bars will be disabled
|
||||
and debugging output will be printed instead.
|
||||
@@ -0,0 +1,4 @@
|
||||
*Optional.* A password to use when
|
||||
authenticating to the registry. Must be specified for private repos or when
|
||||
using `put`.
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
*Required*. The name of the repository, e.g. `alpine`.
|
||||
@@ -0,0 +1 @@
|
||||
*Optional*. Default `latest`. The name of the tag to monitor and publish to.
|
||||
@@ -0,0 +1,4 @@
|
||||
*Optional.* A username to use when
|
||||
authenticating to the registry. Must be specified for private repos or when
|
||||
using `put`.
|
||||
|
||||
@@ -1929,7 +1929,7 @@ public class ConcourseEditorTest {
|
||||
);
|
||||
editor.assertProblems(/*None*/);
|
||||
}
|
||||
|
||||
|
||||
@Test public void dockerImageResourceSourceReconcileAndHovers() throws Exception {
|
||||
Editor editor;
|
||||
|
||||
@@ -2122,6 +2122,125 @@ public class ConcourseEditorTest {
|
||||
editor.assertHoverContains("load_bases", "Same as `load_base`, but takes an array");
|
||||
editor.assertHoverContains("target_name", "Specify the name of the target build stage");
|
||||
}
|
||||
|
||||
@Test public void registryImageResourceeSourceReconcileAndHovers() throws Exception {
|
||||
Editor editor;
|
||||
|
||||
editor = harness.newEditor(
|
||||
"resources:\n" +
|
||||
"- name: my-docker-image\n" +
|
||||
" type: registry-image\n" +
|
||||
" source:\n" +
|
||||
" tag: latest\n"
|
||||
);
|
||||
editor.assertProblems(
|
||||
"my-docker-image|Unused 'Resource'",
|
||||
"source|'repository' is required"
|
||||
);
|
||||
|
||||
editor = harness.newEditor(
|
||||
"resources:\n" +
|
||||
"- name: my-docker-image\n" +
|
||||
" type: registry-image\n" +
|
||||
" source:\n" +
|
||||
" repository: kdvolder/sts4-build-env\n" +
|
||||
" tag: latest\n" +
|
||||
" username: kdvolder\n" +
|
||||
" password: {{docker_password}}\n" +
|
||||
" debug: no-bool\n" +
|
||||
" content_trust: {}\n"
|
||||
);
|
||||
editor.assertProblems(
|
||||
"my-docker-image|Unused 'Resource'",
|
||||
"no-bool|boolean",
|
||||
"content_trust|Properties [repository_key, repository_key_id, repository_passphrase] are required"
|
||||
);
|
||||
|
||||
editor.assertHoverContains("repository", "The name of the repository");
|
||||
editor.assertHoverContains("tag", "name of the tag");
|
||||
editor.assertHoverContains("username", "username to use");
|
||||
editor.assertHoverContains("password", "password to use");
|
||||
editor.assertHoverContains("debug", "debugging output will be printed");
|
||||
|
||||
editor = harness.newEditor(
|
||||
"resources:\n" +
|
||||
"- name: my-docker-image\n" +
|
||||
" type: registry-image\n" +
|
||||
" source:\n" +
|
||||
" repository: kdvolder/sts4-build-env\n" +
|
||||
" content_trust:\n"+
|
||||
" server: notary.server\n" +
|
||||
" repository_key: repokey\n" +
|
||||
" repository_key_id: keyid\n" +
|
||||
" repository_passphrase: Secret phrase\n" +
|
||||
" tls_key: tlskey\n" +
|
||||
" tls_cert: tlscert\n" +
|
||||
" bogus_prop:\n"
|
||||
);
|
||||
editor.assertProblems(
|
||||
"my-docker-image|Unused 'Resource'",
|
||||
"bogus_prop|Unknown property"
|
||||
);
|
||||
editor.assertHoverContains("server", "URL for the notary server");
|
||||
editor.assertHoverContains("repository_key_id", "ID used to sign the trusted collection");
|
||||
editor.assertHoverContains("repository_key", "Target key used to sign");
|
||||
editor.assertHoverContains("repository_passphrase", "passphrase of the signing/target key");
|
||||
editor.assertHoverContains("tls_key", "TLS key for the notary server");
|
||||
editor.assertHoverContains("tls_cert", "TLS certificate for the notary server");
|
||||
}
|
||||
|
||||
@Test public void registryImageResourceGetParamsReconcileAndHovers() throws Exception {
|
||||
Editor editor;
|
||||
|
||||
editor = harness.newEditor(
|
||||
"resources:\n" +
|
||||
"- name: my-docker-image\n" +
|
||||
" type: registry-image\n" +
|
||||
"jobs:\n" +
|
||||
"- name: a-job\n" +
|
||||
" plan:\n" +
|
||||
" - get: my-docker-image\n" +
|
||||
" params:\n" +
|
||||
" format: bad-format\n" +
|
||||
" bogus: bad"
|
||||
);
|
||||
|
||||
editor.assertProblems(
|
||||
"bad-format|Valid values are: [oci, rootfs]",
|
||||
"bogus|Unknown property"
|
||||
);
|
||||
|
||||
editor.assertHoverContains("format", "The format to fetch as");
|
||||
}
|
||||
|
||||
@Test public void registryImageResourcePutParamsReconcileAndHovers() throws Exception {
|
||||
Editor editor;
|
||||
|
||||
editor = harness.newEditor(
|
||||
"resources:\n" +
|
||||
"- name: my-docker-image\n" +
|
||||
" type: registry-image\n" +
|
||||
"jobs:\n" +
|
||||
"- name: a-job\n" +
|
||||
" plan:\n" +
|
||||
" - put: my-docker-image\n" +
|
||||
" params:\n" +
|
||||
" image: path/to/image/tarball\n" +
|
||||
" additional_tags: path/to/tagsfiles\n" +
|
||||
" bogus: bad\n" +
|
||||
" get_params:\n" +
|
||||
" format: bad-format\n"
|
||||
);
|
||||
|
||||
editor.assertProblems(
|
||||
"bogus|Unknown property",
|
||||
"bad-format|Valid values are: [oci, rootfs]"
|
||||
);
|
||||
|
||||
editor.assertHoverContains("image", 4, "path to the OCI image tarball");
|
||||
editor.assertHoverContains("additional_tags", "list of tag values");
|
||||
editor.assertHoverContains("format", "The format to fetch as");
|
||||
}
|
||||
|
||||
@Test public void s3ResourceSourceInitialResourceImplications() throws Exception {
|
||||
Editor editor;
|
||||
|
||||
Reference in New Issue
Block a user