Add support for new DockerImageSource properties

- aws_session_token
- max_concurrent_downloads
- max_concurrent_uploads
This commit is contained in:
Kris De Volder
2018-06-04 09:31:25 -07:00
parent a4ea1a474c
commit bc0d114f27
5 changed files with 29 additions and 6 deletions

View File

@@ -477,6 +477,7 @@ public class PipelineYmlSchema implements YamlSchema {
addProp(source, "password", t_ne_string);
addProp(source, "aws_access_key_id", t_ne_string);
addProp(source, "aws_secret_access_key", t_ne_string);
addProp(source, "aws_session_token", t_ne_string);
addProp(source, "insecure_registries", t_strings);
addProp(source, "registry_mirror", t_ne_string);
addProp(source, "ca_certs", f.yseq(f.ybean("CaCertsEntry",
@@ -488,6 +489,8 @@ public class PipelineYmlSchema implements YamlSchema {
f.yprop("key", t_ne_string),
f.yprop("cert", t_ne_string)
)));
addProp(source, "max_concurrent_downloads", t_pos_integer);
addProp(source, "max_concurrent_uploads", t_pos_integer);
AbstractType get = f.ybean("DockerImageGetParams");
addProp(get, "save", t_boolean);
@@ -495,23 +498,27 @@ public class PipelineYmlSchema implements YamlSchema {
addProp(get, "skip_download", t_boolean);
AbstractType put = f.ybean("DockerImagePutParams");
//TODO 'additional_tags'
addProp(put, "build", t_ne_string);
addProp(put, "load", t_ne_string);
addProp(put, "dockerfile", t_ne_string);
addProp(put, "build_args", t_string_params);
addProp(put, "build_args_file", t_ne_string);
addProp(put, "cache", t_boolean);
//TODO 'cache_from'
addProp(put, "cache_tag", t_ne_string);
addProp(put, "dockerfile", t_ne_string);
addProp(put, "import_file", t_ne_string);
addProp(put, "load", t_ne_string);
addProp(put, "load_base", t_ne_string);
//TODO 'load_bases'
addProp(put, "load_file", t_ne_string);
addProp(put, "load_repository", t_ne_string);
addProp(put, "load_tag", t_ne_string);
addProp(put, "import_file", t_ne_string);
addProp(put, "pull_repository", t_ne_string).isDeprecated(true);
addProp(put, "pull_tag", t_ne_string).isDeprecated(true);
addProp(put, "tag", t_ne_string);
addProp(put, "tag_prefix", t_ne_string);
addProp(put, "tag_as_latest", t_boolean);
addProp(put, "build_args", t_string_params);
addProp(put, "build_args_file", t_ne_string);
addProp(put, "tag_prefix", t_ne_string);
//TODO 'target_name'
resourceTypes.def("docker-image", source, get, put);
}

View File

@@ -0,0 +1,2 @@
*Optional*. AWS session token (assumed role) to use for acquiring ECR credentials.

View File

@@ -0,0 +1,3 @@
*Optional*. Maximum concurrent downloads.
Limits the number of concurrent download threads.

View File

@@ -0,0 +1,3 @@
*Optional*. Maximum concurrent uploads.
Limits the number of concurrent upload threads.

View File

@@ -1622,8 +1622,11 @@ public class ConcourseEditorTest {
" password: {{docker_password}}\n" +
" aws_access_key_id: {{aws_access_key}}\n" +
" aws_secret_access_key: {{aws_secret_key}}\n" +
" aws_session_token: ((aws_token))\n" +
" insecure_registries: no-list\n" +
" registry_mirror: https://my-docker-registry.com\n" +
" max_concurrent_downloads: num-down\n" +
" max_concurrent_uploads: num-up\n" +
" ca_certs:\n" +
" - domain: example.com:443\n" +
" cert: |\n" +
@@ -1646,6 +1649,8 @@ public class ConcourseEditorTest {
editor.assertProblems(
"my-docker-image|Unused 'Resource'",
"no-list|Expecting a 'Sequence'",
"num-down|NumberFormat",
"num-up|NumberFormat",
"bogus_ca_certs_prop|Unknown property", //ca_certs
"bogus_client_cert_prop|Unknown property" //client_certs
);
@@ -1656,10 +1661,13 @@ public class ConcourseEditorTest {
editor.assertHoverContains("password", "password to use");
editor.assertHoverContains("aws_access_key_id", "AWS access key to use");
editor.assertHoverContains("aws_secret_access_key", "AWS secret key to use");
editor.assertHoverContains("aws_session_token", "AWS session token (assumed role)");
editor.assertHoverContains("insecure_registries", "array of CIDRs");
editor.assertHoverContains("registry_mirror", "URL pointing to a docker registry");
editor.assertHoverContains("ca_certs", "Each entry specifies the x509 CA certificate for");
editor.assertHoverContains("client_certs", "Each entry specifies the x509 certificate and key");
editor.assertHoverContains("max_concurrent_downloads", "Limits the number of concurrent download threads");
editor.assertHoverContains("max_concurrent_uploads", "Limits the number of concurrent upload threads");
}
@Test public void dockerImageResourceGetParamsReconcileAndHovers() throws Exception {