Add support for missing GitGetParams properties:

- fetch_tags
- short_ref_format
- timestamp_format
- describe_ref_options
This commit is contained in:
Kris De Volder
2021-08-11 14:28:03 -07:00
parent d377672706
commit 99a579279f
6 changed files with 37 additions and 6 deletions

View File

@@ -568,12 +568,16 @@ public class PipelineYmlSchema implements YamlSchema {
AbstractType get = f.ybean("GitGetParams");
addProp(get, "depth", t_pos_integer);
addProp(get, "fetch_tags", t_boolean);
addProp(get, "submodules", f.yany("GitSubmodules").addHints("all", "none"));
addProp(get, "submodule_recursive", t_boolean);
addProp(get, "submodule_remote", t_boolean);
addProp(get, "disable_git_lfs", t_boolean);
addProp(get, "clean_tags", t_boolean);
addProp(get, "fetch", t_strings).isDeprecated(true); //Warning: t_strings is just a guess. This property is undocumented. The example I've seen seem to use list of git branch/tag names.
addProp(get, "short_ref_format", t_ne_string);
addProp(get, "timestamp_format", t_ne_string);
addProp(get, "describe_ref_options", t_ne_string);
AbstractType put = f.ybean("GitPutParams");
addProp(put, "repository", t_ne_string).isPrimary(true);

View File

@@ -0,0 +1 @@
*Optional.* When populating `.git/describe_ref` use these options to call [`git describe`](https://git-scm.com/docs/git-describe). Defaults to `--always --dirty --broken`.

View File

@@ -0,0 +1,4 @@
*Optional.* If `true` the flag `--tags` will be used to
fetch all tags in the repository. If `false` no tags will be fetched.
Will override `fetch_tags` source configuration if defined.

View File

@@ -0,0 +1 @@
*Optional.* When populating `.git/short_ref` use this `printf` format. Defaults to `%s`.

View File

@@ -0,0 +1 @@
*Optional.* When populating `.git/commit_timestamp` use this options to pass to [`git log --date`](https://git-scm.com/docs/git-log#Documentation/git-log.txt---dateltformatgt). Defaults to `iso8601`.

View File

@@ -1780,8 +1780,14 @@ public class ConcourseEditorTest {
,
"depth: <*>"
,
"describe_ref_options: <*>"
,
"disable_git_lfs: <*>"
,
"fetch_tags: <*>"
,
"short_ref_format: <*>"
,
"submodule_recursive: <*>"
,
"submodule_remote: <*>"
@@ -1789,6 +1795,8 @@ public class ConcourseEditorTest {
"submodules:\n"+
" <*>"
,
"timestamp_format: <*>"
,
"fetch:\n" + // Deprecated, so suggested last
" - <*>"
);
@@ -1817,19 +1825,26 @@ public class ConcourseEditorTest {
" - get: my-git\n" +
" params:\n" +
" depth: -1\n" +
" fetch_tags: is-fetch\n" +
" submodules: none\n" +
" disable_git_lfs: not-bool-a\n" +
" submodule_recursive: not-bool-b\n" +
" submodule_remote: not-bool-c\n" +
" clean_tags: not-bool-d\n"
" clean_tags: not-bool-d\n" +
" short_ref_format: '%s'\n" +
" timestamp_format: iso8601\n" +
" describe_ref_options: '--allways --broken'"
);
editor.assertHoverContains("depth", "using the `--depth` option");
editor.assertHoverContains("fetch_tags", "fetch all tags in the repository");
editor.assertHoverContains("submodules", "If `none`, submodules will not be fetched");
editor.assertHoverContains("submodule_recursive", "If `false`, a flat submodules checkout is performed");
editor.assertHoverContains("submodule_remote", "If `true`, the submodules are checked out for");
editor.assertHoverContains("disable_git_lfs", "will not fetch Git LFS files");
editor.assertHoverContains("clean_tags", "If `true` all incoming tags will be deleted");
editor.assertHoverContains("short_ref_format", "`.git/short_ref` use this `printf` format");
editor.assertHoverContains("describe_ref_options", "When populating `.git/describe_ref` use these options");
}
@Test public void gitResourceGetParamsReconcile() throws Exception {
@@ -1843,17 +1858,22 @@ public class ConcourseEditorTest {
" - get: my-git\n" +
" params:\n" +
" depth: -1\n" +
" disable_git_lfs: not-bool-a\n" +
" submodule_recursive: not-bool-b\n" +
" submodule_remote: not-bool-c\n" +
" clean_tags: not-bool-d\n"
" fetch_tags: not-bool-a\n" +
" disable_git_lfs: not-bool-b\n" +
" submodule_recursive: not-bool-c\n" +
" submodule_remote: not-bool-d\n" +
" clean_tags: not-bool-e\n" +
" short_ref_format: goo%s\n" +
" timestamp_format: iso8601\n" +
" describe_ref_options: whatever\n"
);
editor.assertProblems(
"-1|must be at least 0",
"not-bool-a|'boolean'",
"not-bool-b|'boolean'",
"not-bool-c|'boolean'",
"not-bool-d|'boolean'"
"not-bool-d|'boolean'",
"not-bool-e|'boolean'"
);
}