diff --git a/headless-services/concourse-language-server/src/main/java/org/springframework/ide/vscode/concourse/PipelineYmlSchema.java b/headless-services/concourse-language-server/src/main/java/org/springframework/ide/vscode/concourse/PipelineYmlSchema.java index 158965385..bd7d8ca7a 100644 --- a/headless-services/concourse-language-server/src/main/java/org/springframework/ide/vscode/concourse/PipelineYmlSchema.java +++ b/headless-services/concourse-language-server/src/main/java/org/springframework/ide/vscode/concourse/PipelineYmlSchema.java @@ -524,23 +524,47 @@ public class PipelineYmlSchema implements YamlSchema { AbstractType t_git_repo_uri = f.yatomic("GitRepoUri"); t_git_repo_uri.setCustomContentAssistant(new GithubRepoContentAssistant(github)); t_git_repo_uri.parseWith(GithubValueParsers.uri(github)); + + AbstractType t_https_tunnel = f.ybean("HttpsTunnel"); + addProp(t_https_tunnel, "proxy_host", t_ne_string).isRequired(true); + addProp(t_https_tunnel, "proxy_port", t_pos_integer).isRequired(true); + addProp(t_https_tunnel, "proxy_user", t_ne_string); + addProp(t_https_tunnel, "proxy_password", t_ne_string); + + AbstractType t_commit_filters = f.ybean("CommitFilters"); + addProp(t_commit_filters, "exclude", f.yseq(t_ne_string)); + addProp(t_commit_filters, "include", f.yseq(t_ne_string)); AbstractType source = f.ybean("GitSource"); addProp(source, "uri", t_git_repo_uri).isPrimary(true); - addProp(source, "branch", t_ne_string); //It's more complicated than that! Its only required in 'put' step. So we'll check this as a contrain in put steps! + addProp(source, "branch", t_ne_string); //It's more complicated than that! Its only required in 'put' step. So we'll check this as a contraint in put steps! addProp(source, "private_key", t_ne_string); + addProp(source, "private_key_user", t_ne_string); + addProp(source, "private_key_passphrase", t_ne_string); + addProp(source, "forward_agent", t_boolean); addProp(source, "username", t_ne_string); addProp(source, "password", t_string); addProp(source, "paths", t_strings); addProp(source, "ignore_paths", t_strings); addProp(source, "skip_ssl_verification", t_boolean); - addProp(source, "tag_filter", t_string); + addProp(source, "tag_filter", t_ne_string); + addProp(source, "tag_regex", t_ne_string); addProp(source, "fetch_tags", t_boolean); + addProp(source, "submodule_credentials", f.yseq(f.ybean("SubmoduleCredential", + f.yprop("host", t_ne_string).isRequired(true), + f.yprop("username", t_ne_string).isRequired(true), + f.yprop("password", t_ne_string).isRequired(true) + ))); addProp(source, "git_config", t_pair_list); addProp(source, "disable_ci_skip", t_boolean); addProp(source, "commit_verification_keys", t_strings); addProp(source, "commit_verification_key_ids", t_strings); - addProp(source, "gpg_keyserver", t_string); + addProp(source, "gpg_keyserver", t_ne_string); + addProp(source, "git_crypt_key", t_ne_string); + addProp(source, "https_tunnel", t_https_tunnel); + addProp(source, "commit_filter", t_commit_filters); + addProp(source, "version_depth", t_strictly_pos_integer); + source.require(Constraints.mutuallyExclusive("tag_filter", "tag_regex")); AbstractType get = f.ybean("GitGetParams"); addProp(get, "depth", t_pos_integer); diff --git a/headless-services/concourse-language-server/src/main/resources/desc/CommitFilters/exclude.md b/headless-services/concourse-language-server/src/main/resources/desc/CommitFilters/exclude.md new file mode 100644 index 000000000..5bff25140 --- /dev/null +++ b/headless-services/concourse-language-server/src/main/resources/desc/CommitFilters/exclude.md @@ -0,0 +1 @@ +*Optional.* Array containing strings that should cause a commit to be skipped \ No newline at end of file diff --git a/headless-services/concourse-language-server/src/main/resources/desc/CommitFilters/include.md b/headless-services/concourse-language-server/src/main/resources/desc/CommitFilters/include.md new file mode 100644 index 000000000..1cd3c4700 --- /dev/null +++ b/headless-services/concourse-language-server/src/main/resources/desc/CommitFilters/include.md @@ -0,0 +1 @@ +*Optional.* Array continuing strings that *MUST* be included in commit messages for the commit to not be skipped \ No newline at end of file diff --git a/headless-services/concourse-language-server/src/main/resources/desc/GitSource/commit_filter.md b/headless-services/concourse-language-server/src/main/resources/desc/GitSource/commit_filter.md new file mode 100644 index 000000000..2261bb684 --- /dev/null +++ b/headless-services/concourse-language-server/src/main/resources/desc/GitSource/commit_filter.md @@ -0,0 +1,7 @@ +*Optional.* Object containing commit message filters + + * `commit_filter.exclude`: *Optional.* Array containing strings that should + cause a commit to be skipped + * `commit_filter.include`: *Optional.* Array continuing strings that + *MUST* be included in commit messages for the commit to not be + skipped \ No newline at end of file diff --git a/headless-services/concourse-language-server/src/main/resources/desc/GitSource/forward_agent.md b/headless-services/concourse-language-server/src/main/resources/desc/GitSource/forward_agent.md new file mode 100644 index 000000000..5f0fdd5bf --- /dev/null +++ b/headless-services/concourse-language-server/src/main/resources/desc/GitSource/forward_agent.md @@ -0,0 +1 @@ +*Optional*. Enables ForwardAgent SSH option when set to true. Useful when using proxy/jump hosts. Defaults to false. \ No newline at end of file diff --git a/headless-services/concourse-language-server/src/main/resources/desc/GitSource/git_crypt_key.md b/headless-services/concourse-language-server/src/main/resources/desc/GitSource/git_crypt_key.md new file mode 100644 index 000000000..ca3d88140 --- /dev/null +++ b/headless-services/concourse-language-server/src/main/resources/desc/GitSource/git_crypt_key.md @@ -0,0 +1,4 @@ +*Optional.* Base64 encoded +[git-crypt](https://github.com/AGWA/git-crypt) key. Setting this +will unlock / decrypt the repository with `git-crypt`. To get the key simply +execute `git-crypt export-key -- - | base64` in an encrypted repository. \ No newline at end of file diff --git a/headless-services/concourse-language-server/src/main/resources/desc/GitSource/https_tunnel.md b/headless-services/concourse-language-server/src/main/resources/desc/GitSource/https_tunnel.md new file mode 100644 index 000000000..d6a2756e5 --- /dev/null +++ b/headless-services/concourse-language-server/src/main/resources/desc/GitSource/https_tunnel.md @@ -0,0 +1,8 @@ +*Optional.* Information about an HTTPS proxy that will be used to tunnel SSH-based git commands over. + +Has the following sub-properties: + * `proxy_host`: *Required.* The host name or IP of the proxy server + * `proxy_port`: *Required.* The proxy server's listening port + * `proxy_user`: *Optional.* If the proxy requires authentication, use this username + * `proxy_password`: *Optional.* If the proxy requires authenticate, + use this password \ No newline at end of file diff --git a/headless-services/concourse-language-server/src/main/resources/desc/GitSource/private_key_passphrase.md b/headless-services/concourse-language-server/src/main/resources/desc/GitSource/private_key_passphrase.md new file mode 100644 index 000000000..a69e0c133 --- /dev/null +++ b/headless-services/concourse-language-server/src/main/resources/desc/GitSource/private_key_passphrase.md @@ -0,0 +1 @@ +*Optional*. To unlock `private_key` if it is protected by a passphrase \ No newline at end of file diff --git a/headless-services/concourse-language-server/src/main/resources/desc/GitSource/private_key_user.md b/headless-services/concourse-language-server/src/main/resources/desc/GitSource/private_key_user.md new file mode 100644 index 000000000..06201efa9 --- /dev/null +++ b/headless-services/concourse-language-server/src/main/resources/desc/GitSource/private_key_user.md @@ -0,0 +1 @@ +*Optional*. Enables setting User in the ssh config. \ No newline at end of file diff --git a/headless-services/concourse-language-server/src/main/resources/desc/GitSource/submodule_credentials.md b/headless-services/concourse-language-server/src/main/resources/desc/GitSource/submodule_credentials.md new file mode 100644 index 000000000..a94c0e673 --- /dev/null +++ b/headless-services/concourse-language-server/src/main/resources/desc/GitSource/submodule_credentials.md @@ -0,0 +1,9 @@ +*Optional*. List of credentials for HTTP(s) auth when pulling/pushing private git submodules which are not stored in the same git server as the container repository. Example: + +``` +submodule_credentials: +- host: github.com + username: git-user + password: git-password +- +``` \ No newline at end of file diff --git a/headless-services/concourse-language-server/src/main/resources/desc/GitSource/tag_regex.md b/headless-services/concourse-language-server/src/main/resources/desc/GitSource/tag_regex.md new file mode 100644 index 000000000..424d960af --- /dev/null +++ b/headless-services/concourse-language-server/src/main/resources/desc/GitSource/tag_regex.md @@ -0,0 +1,2 @@ +*Optional*. If specified, the resource will only detect commits that have a tag matching the expression that have been made against the branch. +Patterns are grep compatible (extended matching enabled, matches entire lines only). Ignored if `tag_filter` is also specified. \ No newline at end of file diff --git a/headless-services/concourse-language-server/src/main/resources/desc/GitSource/version_depth.md b/headless-services/concourse-language-server/src/main/resources/desc/GitSource/version_depth.md new file mode 100644 index 000000000..c5c4df956 --- /dev/null +++ b/headless-services/concourse-language-server/src/main/resources/desc/GitSource/version_depth.md @@ -0,0 +1 @@ +*Optional.* The number of versions to return when performing a check \ No newline at end of file diff --git a/headless-services/concourse-language-server/src/main/resources/desc/HttpsTunnel/proxy_host.md b/headless-services/concourse-language-server/src/main/resources/desc/HttpsTunnel/proxy_host.md new file mode 100644 index 000000000..e87715b7c --- /dev/null +++ b/headless-services/concourse-language-server/src/main/resources/desc/HttpsTunnel/proxy_host.md @@ -0,0 +1 @@ +*Required.* The host name or IP of the proxy server \ No newline at end of file diff --git a/headless-services/concourse-language-server/src/main/resources/desc/HttpsTunnel/proxy_password.md b/headless-services/concourse-language-server/src/main/resources/desc/HttpsTunnel/proxy_password.md new file mode 100644 index 000000000..221e161ec --- /dev/null +++ b/headless-services/concourse-language-server/src/main/resources/desc/HttpsTunnel/proxy_password.md @@ -0,0 +1 @@ +*Optional.* If the proxy requires authenticate, use this password diff --git a/headless-services/concourse-language-server/src/main/resources/desc/HttpsTunnel/proxy_port.md b/headless-services/concourse-language-server/src/main/resources/desc/HttpsTunnel/proxy_port.md new file mode 100644 index 000000000..fc172f04f --- /dev/null +++ b/headless-services/concourse-language-server/src/main/resources/desc/HttpsTunnel/proxy_port.md @@ -0,0 +1 @@ +*Required.* The proxy server's listening port \ No newline at end of file diff --git a/headless-services/concourse-language-server/src/main/resources/desc/HttpsTunnel/proxy_user.md b/headless-services/concourse-language-server/src/main/resources/desc/HttpsTunnel/proxy_user.md new file mode 100644 index 000000000..f37811c39 --- /dev/null +++ b/headless-services/concourse-language-server/src/main/resources/desc/HttpsTunnel/proxy_user.md @@ -0,0 +1 @@ +*Optional.* If the proxy requires authentication, use this username \ No newline at end of file diff --git a/headless-services/concourse-language-server/src/test/java/org/springframework/ide/vscode/concourse/ConcourseEditorTest.java b/headless-services/concourse-language-server/src/test/java/org/springframework/ide/vscode/concourse/ConcourseEditorTest.java index 98f1ecb27..3c90a7421 100644 --- a/headless-services/concourse-language-server/src/test/java/org/springframework/ide/vscode/concourse/ConcourseEditorTest.java +++ b/headless-services/concourse-language-server/src/test/java/org/springframework/ide/vscode/concourse/ConcourseEditorTest.java @@ -1533,12 +1533,24 @@ public class ConcourseEditorTest { " bogus: bad\n" + " branch: {{branch}}\n" + " private_key: {{rsa_id}}\n" + + " private_key_user: pkuser\n" + + " private_key_passphrase: pkpassf\n" + + " forward_agent: isForwardAgent\n" + " username: jeffy\n" + " password: {{git_passwords}}\n" + " paths: not-a-list\n" + " ignore_paths: also-not-a-list\n" + " skip_ssl_verification: skip-it\n" + " tag_filter: RELEASE_*\n" + + " tag_regex: aTagRegExp\n" + + " fetch_tags: is-fetch-tags\n" + + " submodule_credentials:\n" + + " - host: host1\n" + + " username: username1\n" + + " password: pass1\n" + + " - submodbogus: bad\n" + + " - host: host2\n" + + " - username: user2\n" + " git_config:\n" + " - name: good\n" + " val: bad\n" + @@ -1546,19 +1558,38 @@ public class ConcourseEditorTest { " commit_verification_keys: not-a-list-of-keys\n" + " commit_verification_key_ids: not-a-list-of-ids\n" + " gpg_keyserver: hkp://somekeyserver.net\n" + - " fetch_tags: is-fetch-tags\n" + " git_crypt_key: YXNhc2Zm\n" + + " https_tunnel:\n" + + " proxy_host: proxhost\n" + + " proxy_port: portnum\n" + + " proxy_user: proxuser\n" + + " proxy_password: proxpass\n" + + " commit_filter:\n" + + " exclude: exclude-commit-filters\n" + + " include: include-commit-filters\n" + + " version_depth: verdep\n" ); editor.assertProblems( "sts4-out|Unused", "bogus|Unknown property", + "isForwardAgent|'boolean'", "not-a-list|Expecting a 'Sequence'", "also-not-a-list|Expecting a 'Sequence'", "skip-it|'boolean'", + "tag_filter|Only one of 'tag_filter' and 'tag_regex'", + "tag_regex|Only one of 'tag_filter' and 'tag_regex'", + "is-fetch-tags|'boolean'", + "submodbogus|Unknown property", + "-|[password, username] are required", + "-|[host, password] are required", "val|Unknown property", "no_ci_skip|'boolean'", "not-a-list-of-keys|Expecting a 'Sequence'", "not-a-list-of-ids|Expecting a 'Sequence'", - "is-fetch-tags|'boolean'" + "portnum|NumberFormat", + "exclude-commit-filters|Expecting a 'Sequence'", + "include-commit-filters|Expecting a 'Sequence'", + "verdep|NumberFormat" ); } @@ -1587,6 +1618,9 @@ public class ConcourseEditorTest { , // ==> "branch: <*>" , + "commit_filter:\n" + + " <*>" + , "commit_verification_key_ids:\n" + " - <*>" , @@ -1597,11 +1631,19 @@ public class ConcourseEditorTest { , "fetch_tags: <*>" , + "forward_agent: <*>" + , "git_config:\n" + " - <*>" , + "git_crypt_key: <*>" + , "gpg_keyserver: <*>" , + "https_tunnel:\n" + + " proxy_host: $1\n" + + " proxy_port: $2<*>" + , "ignore_paths:\n" + " - <*>" , @@ -1612,11 +1654,24 @@ public class ConcourseEditorTest { , "private_key: <*>" , + "private_key_passphrase: <*>" + , + "private_key_user: <*>" + , "skip_ssl_verification: <*>" , + "submodule_credentials:\n" + + " - host: $1\n" + + " username: $2\n" + + " password: $3<*>" + , "tag_filter: <*>" , + "tag_regex: <*>" + , "username: <*>" + , + "version_depth: <*>" ); assertContextualCompletions( @@ -1644,12 +1699,18 @@ public class ConcourseEditorTest { " bogus: bad\n" + " branch: {{branch}}\n" + " private_key: {{rsa_id}}\n" + + " private_key_user: pkuser\n" + + " private_key_passphrase: pkpassf\n" + + " forward_agent: isForwardAgent\n" + " username: jeffy\n" + " password: {{git_passwords}}\n" + " paths: not-a-list\n" + " ignore_paths: also-not-a-list\n" + " skip_ssl_verification: skip-it\n" + " tag_filter: RELEASE_*\n" + + " tag_regex: tagRegex\n" + + " fetch_tags: is-fetch-tags\n" + + " submodule_credentials: []\n" + " git_config:\n" + " - name: good\n" + " val: bad\n" + @@ -1657,22 +1718,46 @@ public class ConcourseEditorTest { " commit_verification_keys: not-a-list-of-keys\n" + " commit_verification_key_ids: not-a-list-of-ids\n" + " gpg_keyserver: hkp://somekeyserver.net\n" + - " fetch_tags: is-fetch-tags" + " git_crypt_key: YXNhc2Zm\n" + + " https_tunnel:\n" + + " proxy_host: proxhost\n" + + " proxy_port: portnum\n" + + " proxy_user: proxuser\n" + + " proxy_password: proxpass\n" + + " commit_filter:\n" + + " include: []\n" + + " exclude: []\n" + + " version_depth: 3\n" ); editor.assertHoverContains("uri", "*Required.* The location of the repository."); editor.assertHoverContains("branch", "The branch to track"); editor.assertHoverContains("private_key", "Private key to use when pulling/pushing"); + editor.assertHoverContains("private_key_user", "Enables setting User in the ssh config"); + editor.assertHoverContains("private_key_passphrase", "unlock `private_key` if it is protected by a passphrase"); + editor.assertHoverContains("forward_agent", "Enables ForwardAgent SSH option when set to true"); editor.assertHoverContains("username", "Username for HTTP(S) auth"); editor.assertHoverContains("password", "Password for HTTP(S) auth"); editor.assertHoverContains("paths", "a list of glob patterns"); editor.assertHoverContains("ignore_paths", "The inverse of `paths`"); editor.assertHoverContains("skip_ssl_verification", "Skips git ssl verification"); editor.assertHoverContains("tag_filter", "the resource will only detect commits"); + editor.assertHoverContains("tag_regex", "only detect commits that have a tag matching the expression"); + editor.assertHoverContains("fetch_tags", "fetch all tags in the repository"); + editor.assertHoverContains("submodule_credentials", "List of credentials for HTTP(s) auth"); editor.assertHoverContains("git_config", "configure git global options"); editor.assertHoverContains("disable_ci_skip", "Allows for commits that have been labeled with `[ci skip]`"); editor.assertHoverContains("commit_verification_keys", "Array of GPG public keys"); - editor.assertHoverContains("commit_verification_key_ids", "Array of GPG public key ids"); - editor.assertHoverContains("fetch_tags", "fetch all tags in the repository"); + editor.assertHoverContains("gpg_keyserver", "GPG keyserver to download the public keys from"); + editor.assertHoverContains("git_crypt_key", "will unlock / decrypt the repository"); + editor.assertHoverContains("https_tunnel", "Information about an HTTPS proxy"); + editor.assertHoverContains("proxy_host", "host name or IP"); + editor.assertHoverContains("proxy_port", "listening port"); + editor.assertHoverContains("proxy_user", "use this username"); + editor.assertHoverContains("proxy_password", "use this password"); + editor.assertHoverContains("commit_filter", "Object containing commit message filters"); + editor.assertHoverContains("include", "not be skipped"); + editor.assertHoverContains("exclude", "cause a commit to be skipped"); + editor.assertHoverContains("version_depth", "number of versions to return"); } @Test public void gitResourceGetParamsCompletions() throws Exception { @@ -4004,6 +4089,11 @@ public class ConcourseEditorTest { "bra<*>" , // ==> "branch: <*>" + , + "submodule_credentials:\n" + + " - host: $1\n" + + " username: $2\n" + + " password: $3<*>" ); assertContextualCompletions( @@ -4018,6 +4108,11 @@ public class ConcourseEditorTest { "bra<*>" , // ==> "branch: <*>" + , + "submodule_credentials:\n" + + " - host: $1\n" + + " username: $2\n" + + " password: $3<*>" ); assertContextualCompletions( @@ -4032,6 +4127,11 @@ public class ConcourseEditorTest { "bra<*>" , // ==> "branch: <*>" + , + "submodule_credentials:\n" + + " - host: $1\n" + + " username: $2\n" + + " password: $3<*>" ); } @@ -4242,7 +4342,7 @@ public class ConcourseEditorTest { " uri: blah\n" + " <*>" , // ========= - "bra" + "bran" , //=> " branch: <*>" );