Add new attributes to S3 resource schema

GetParams:
- skip_download
- unpack

Source:
- skip_download
- skip_ssl_verification
- session_token
This commit is contained in:
Kris De Volder
2018-10-29 11:54:17 -07:00
parent 83ded61abb
commit 05fbcd81f4
7 changed files with 43 additions and 4 deletions

View File

@@ -543,11 +543,14 @@ public class PipelineYmlSchema implements YamlSchema {
addProp(source, "bucket", t_ne_string).isPrimary(true);
addProp(source, "access_key_id", t_ne_string);
addProp(source, "secret_access_key", t_ne_string);
addProp(source, "session_token", t_ne_string);
addProp(source, "region_name", t_s3_region);
addProp(source, "private", t_boolean);
addProp(source, "cloudfront_url", t_ne_string);
addProp(source, "endpoint", t_ne_string);
addProp(source, "disable_ssl", t_boolean);
addProp(source, "skip_ssl_verification", t_boolean);
addProp(source, "skip_download", t_boolean);
addProp(source, "server_side_encryption", t_ne_string);
addProp(source, "sse_kms_key_id", t_ne_string);
addProp(source, "use_v2_signing", t_boolean);
@@ -556,7 +559,8 @@ public class PipelineYmlSchema implements YamlSchema {
source.requireOneOf("regexp", "versioned_file");
AbstractType get = f.ybean("S3GetParams");
//Note: S3GetParams intentionally has no properties since no params are expected according to the docs.
addProp(get, "unpack", t_boolean);
addProp(get, "skip_download", t_boolean);
AbstractType put = f.ybean("S3PutParams");
addProp(put, "file", t_ne_string).isPrimary(true);

View File

@@ -0,0 +1 @@
*Optional*. Skip downloading object from S3. Same parameter as source configuration but used to define/override by get.

View File

@@ -0,0 +1,2 @@
*Optional*. If true and the file is an archive (tar, gzipped tar, other gzipped file, or zip), unpack the file.
Gzipped tarballs will be both ungzipped and untarred. It is ignored when `get` is running on the initial version.

View File

@@ -0,0 +1 @@
*Optional*. The AWS STS session token to use when accessing the bucket.

View File

@@ -0,0 +1 @@
*Optional*. Skip downloading object from S3. Useful to only trigger the pipeline without using the object.

View File

@@ -0,0 +1 @@
*Optional*. Skip SSL verification for S3 endpoint. Useful for S3 compatible providers using self-signed SSL certificates.

View File

@@ -33,7 +33,6 @@ import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.mock.mockito.MockBean;
import org.springframework.ide.vscode.commons.languageserver.util.SimpleLanguageServer;
import org.springframework.ide.vscode.commons.util.IOUtil;
import org.springframework.ide.vscode.commons.util.Unicodes;
import org.springframework.ide.vscode.commons.util.text.LanguageId;
@@ -1863,11 +1862,14 @@ public class ConcourseEditorTest {
" bucket: the-bucket\n" +
" access_key_id: the-access-key\n" +
" secret_access_key: the-secret-key\n" +
" session_token: the-session-token\n" +
" region_name: bogus-region\n" +
" private: is-private\n" +
" cloudfront_url: https://d5yxxxxx.cloudfront.net\n" +
" endpoint: https://blah.custom.com/blah/blah\n" +
" disable_ssl: no_ssl_checking\n" +
" skip_ssl_verification: skipping-ssl\n" +
" skip_download: skipping-downloading\n" +
" server_side_encryption: some-encryption-algo\n" + //TODO: validation and CA? What values are acceptable?
" sse_kms_key_id: the-master-key-id\n" +
" use_v2_signing: should-use-v2\n" +
@@ -1879,6 +1881,8 @@ public class ConcourseEditorTest {
"bogus-region|unknown 'S3Region'",
"is-private|'boolean'",
"no_ssl_checking|'boolean'",
"skipping-ssl|'boolean'",
"skipping-downloading|'boolean'",
"should-use-v2|'boolean'",
"regexp|Only one of [regexp, versioned_file] should be defined",
"versioned_file|Only one of [regexp, versioned_file] should be defined"
@@ -1887,11 +1891,14 @@ public class ConcourseEditorTest {
editor.assertHoverContains("bucket", "The name of the bucket");
editor.assertHoverContains("access_key_id", "The AWS access key");
editor.assertHoverContains("secret_access_key", "The AWS secret key");
editor.assertHoverContains("session_token", "The AWS STS session token");
editor.assertHoverContains("region_name", "The region the bucket is in");
editor.assertHoverContains("private", "Indicates that the bucket is private");
editor.assertHoverContains("cloudfront_url", "The URL (scheme and domain) of your CloudFront distribution");
editor.assertHoverContains("endpoint", "Custom endpoint for using S3");
editor.assertHoverContains("disable_ssl", "Disable SSL for the endpoint");
editor.assertHoverContains("skip_ssl_verification", "Skip SSL verification for S3 endpoint");
editor.assertHoverContains("skip_download", "Skip downloading object from S3");
editor.assertHoverContains("server_side_encryption", "An encryption algorithm to use");
editor.assertHoverContains("sse_kms_key_id", "The ID of the AWS KMS master encryption key");
editor.assertHoverContains("use_v2_signing", "Use signature v2 signing");
@@ -1938,14 +1945,36 @@ public class ConcourseEditorTest {
"jobs:\n" +
"- name: a-job\n" +
" plan:\n" +
" - get: my-s3-bucket\n" +
" - put: my-s3-bucket\n" +
" params:\n" +
" acl: public-read\n" +
" get_params:\n" +
" no-params-expected: bad"
);
editor.assertProblems(
"params|'file' is required",
"no-params-expected|Unknown property"
);
editor = harness.newEditor(
"resources:\n" +
"- name: my-s3-bucket\n" +
" type: s3\n" +
"jobs:\n" +
"- name: a-job\n" +
" plan:\n" +
" - get: my-s3-bucket\n" +
" params:\n" +
" skip_download: no-bool1\n" +
" unpack: no-bool2\n"
);
editor.assertProblems(
"no-bool1|boolean",
"no-bool2|boolean"
);
editor.assertHoverContains("skip_download", "Skip downloading object from S3");
editor.assertHoverContains("unpack", "unpack the file");
}
@Test public void s3ResourcePutParamsReconcileAndHovers() throws Exception {