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

Allow None override for version_base and ancestor_id in create_package_version #3670

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
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
5 changes: 5 additions & 0 deletions cumulusci/core/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,11 @@ def process_list_of_pairs_dict_arg(arg):
except TypeError as e:
raise TaskOptionsError(e) from e

def process_none_arg(arg):
if arg == "None":
return None
else:
return arg

def decode_to_unicode(content):
"""decode ISO-8859-1 to unicode, when using sf api"""
Expand Down
8 changes: 5 additions & 3 deletions cumulusci/tasks/create_package_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
)
from cumulusci.core.github import get_version_id_from_tag
from cumulusci.core.sfdx import convert_sfdx_source
from cumulusci.core.utils import process_bool_arg
from cumulusci.core.utils import process_bool_arg, process_none_arg
from cumulusci.core.versions import PackageType, PackageVersionNumber, VersionTypeEnum
from cumulusci.salesforce_api.package_zip import (
BasePackageZipBuilder,
Expand Down Expand Up @@ -168,7 +168,7 @@ def _init_options(self, kwargs):
namespace=self.options.get("namespace")
or self.project_config.project__package__namespace,
version_name=self.options.get("version_name") or "Release",
version_base=self.options.get("version_base"),
version_base=process_none_arg(self.options.get("version_base")),
version_type=self.options.get("version_type") or VersionTypeEnum("build"),
)
self.options["skip_validation"] = process_bool_arg(
Expand Down Expand Up @@ -226,7 +226,9 @@ def _run_task(self):
context=self.context,
)

ancestor_id = self._resolve_ancestor_id(self.options.get("ancestor_id"))
ancestor_id = self._resolve_ancestor_id(
process_none_arg(self.options.get("ancestor_id"))
)

self.request_id = self._create_version_request(
self.package_id,
Expand Down
12 changes: 12 additions & 0 deletions cumulusci/tests/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -655,3 +655,15 @@ def test_get_git_config_error(self, Command):

assert utils.get_git_config("user.email") is None
p.run.assert_called_once()

def test_process_none_arg__none(self):
none_value = utils.process_none_arg(None)
assert none_value is None

def test_process_none_arg__none_str(self):
none_value = utils.process_none_arg("None")
assert none_value is None

def test_process_none_arg__not_none_str(self):
some_value = utils.process_none_arg("Value")
assert some_value == "Value"