Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GH-849: Add pre_without_version and build_without_version #910

Merged
merged 2 commits into from
Nov 30, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -873,6 +873,9 @@ private void initializeDefaultResourceTypes() {
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()) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*Optional.* Same as pre_without_version but for build labels.
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
*Optional.* By default `false`, once it's set to `true`
then PreRelease will be bumped without a version number.
Original file line number Diff line number Diff line change
Expand Up @@ -3714,7 +3714,67 @@ public void resourceAttributeHovers() throws Exception {
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" +
Expand Down