GH-849: Add pre_without_version and build_without_version (#910)

* WIP: bug https://github.com/spring-projects/sts4/issues/849

* GH-849: Add build without version

Co-authored-by: Kris De Volder <kdvolder@vmware.com>
This commit is contained in:
Nieraj Singh
2022-11-30 15:07:05 -08:00
committed by GitHub
parent 187b2de322
commit 5f422bde21
4 changed files with 66 additions and 0 deletions

View File

@@ -873,6 +873,9 @@ public class PipelineYmlSchema implements YamlSchema {
AbstractType get = f.ybean("SemverGetParams");
addProp(get, "bump", f.yenum("SemverBump", "major", "minor", "patch", "final"));
addProp(get, "pre", t_ne_string);
addProp(get, "pre_without_version", t_boolean);
addProp(get, "build_without_version", t_boolean);
AbstractType put = f.ybean("SemverPutParams");
for (YTypedProperty p : get.getProperties()) {

View File

@@ -0,0 +1 @@
*Optional.* Same as pre_without_version but for build labels.

View File

@@ -0,0 +1,2 @@
*Optional.* By default `false`, once it's set to `true`
then PreRelease will be bumped without a version number.

View File

@@ -3714,7 +3714,67 @@ public class ConcourseEditorTest {
editor.assertProblems("version|Unused 'Resource'");
editor.assertHoverContains("openstack", "All openstack configuration");
}
@Test public void GH_849_pre_without_version() throws Exception {
Editor editor = harness.newEditor(
"resources:\n" +
"- name: test\n" +
" type: semver\n" +
" source:\n" +
" driver: git\n" +
" uri: some-git-url\n" +
" branch: main\n" +
" file: VERSION\n" +
"jobs:\n" +
"- name: test\n" +
" plan:\n" +
" - get: test\n" +
" params:\n" +
" pre_without_version: not-a-bool\n" +
" - put: test\n" +
" params:\n" +
" pre_without_version: not-b-bool\n"
);
editor.assertProblems(
"not-a-bool|boolean",
"not-b-bool|boolean"
);
editor.assertHoverContains("pre_without_version", 1, "PreRelease will be bumped");
editor.assertHoverContains("pre_without_version", 2, "PreRelease will be bumped");
}
@Test public void GH_849_build_without_version() throws Exception {
Editor editor = harness.newEditor(
"resources:\n" +
"- name: test\n" +
" type: semver\n" +
" source:\n" +
" driver: git\n" +
" uri: some-git-url\n" +
" branch: main\n" +
" file: VERSION\n" +
"jobs:\n" +
"- name: test\n" +
" plan:\n" +
" - get: test\n" +
" params:\n" +
" build_without_version: not-a-bool\n" +
" - put: test\n" +
" params:\n" +
" build_without_version: not-b-bool\n"
);
editor.assertProblems(
"not-a-bool|boolean",
"not-b-bool|boolean"
);
editor.assertHoverContains("build_without_version", 1, "Same as pre_without_version but for build labels");
editor.assertHoverContains("build_without_version", 2, "Same as pre_without_version but for build labels");
}
@Test public void semverResourceGetParamsReconcileAndHovers() throws Exception {
Editor editor = harness.newEditor(
"resources:\n" +