Add support for missing GitPutParams properties:

- branch
- returning
This commit is contained in:
Kris De Volder
2021-08-11 15:15:45 -07:00
parent 99a579279f
commit 3209237334
4 changed files with 25 additions and 3 deletions

View File

@@ -583,12 +583,14 @@ public class PipelineYmlSchema implements YamlSchema {
addProp(put, "repository", t_ne_string).isPrimary(true);
addProp(put, "rebase", t_boolean);
addProp(put, "merge", t_boolean);
addProp(put, "returning", f.yenum("MergeReturning", "merged", "unmerged"));
addProp(put, "tag", t_ne_string);
addProp(put, "only_tag", t_boolean);
addProp(put, "tag_prefix", t_string);
addProp(put, "force", t_boolean);
addProp(put, "annotate", t_ne_string);
addProp(put, "notes", t_ne_string);
addProp(put, "branch", t_ne_string);
put.require(Constraints.requireAtMostOneOf("rebase", "merge"));
resourceTypes.def("git", source, get, put);
}

View File

@@ -0,0 +1,5 @@
*Optional.* The branch to push commits.
Note that the version produced by the `put` step will be picked up by subsequent `get` steps
even if the `branch` differs from the `branch` specified in the source.
To avoid this, you should use two resources of read-only and write-only.

View File

@@ -0,0 +1,3 @@
*Optional.* When passing the `merge` flag, specify whether the
merge commit or the original, unmerged commit should be passed as the output
ref. Options are `merged` and `unmerged`. Defaults to `merged`.

View File

@@ -1911,6 +1911,8 @@ public class ConcourseEditorTest {
, // ===>
"annotate: <*>"
,
"branch: <*>"
,
"force: <*>"
,
"merge: <*>"
@@ -1921,6 +1923,8 @@ public class ConcourseEditorTest {
,
"rebase: <*>"
,
"returning: <*>"
,
"tag: <*>"
,
"tag_prefix: <*>"
@@ -1986,7 +1990,10 @@ public class ConcourseEditorTest {
" only_tag: do-tag\n" +
" force: force-it\n" +
" merge: merge-it\n" +
" notes: whatever"
" returning: returningValue\n" +
" notes: whatever\n" +
" branch: main\n" +
" "
);
editor.assertProblems(
"rebase|Only one of [rebase, merge] should be defined",
@@ -1994,7 +2001,8 @@ public class ConcourseEditorTest {
"do-tag|'boolean'",
"force-it|'boolean'",
"merge|Only one of [rebase, merge] should be defined",
"merge-it|'boolean'"
"merge-it|'boolean'",
"returningValue|Valid values are: [merged, unmerged]"
);
}
@@ -2016,7 +2024,9 @@ public class ConcourseEditorTest {
" force: force-it\n" +
" annotate: release-annotion\n" +
" merge: merge-it\n" +
" notes: /path/to/notes"
" returning: unmerged\n" +
" notes: /path/to/notes\n" +
" branch: main\n"
);
editor.assertHoverContains("repository", "The path of the repository");
@@ -2027,7 +2037,9 @@ public class ConcourseEditorTest {
editor.assertHoverContains("force", "pushed regardless of the upstream state");
editor.assertHoverContains("annotate", "path to a file containing the annotation message");
editor.assertHoverContains("merge", "continuously attempt to merge remote");
editor.assertHoverContains("returning", "unmerged commit should be passed");
editor.assertHoverContains("notes", "path to a file containing the notes");
editor.assertHoverContains("branch", "branch to push commits");
}
@Test public void gitResourcePut_get_params_Hovers() throws Exception {