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

fix: viur build release now sticks to versions defined in project.json #191

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
5 changes: 4 additions & 1 deletion src/viur_cli/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,10 @@ def _build(conf, name, build_cfg, additional_args):
)

case "exec":
utils.system(build_cfg["command"])
if "." in build_cfg["command"]:
utils.system(build_cfg["command"])
else:
utils.system(build_cfg["command"] + " " + build_cfg["version"])
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any "exec"-build command with a "." in its command string is now assumed to be a version number? And what if build_cfg["version"] does not exist?

In one of my projects, I have this definition, which immediately triggers this code-path as it contains a ".", an will fail as there is no "version" key:

"editor": {
    "clean": "rm -rf ./deploy/editor",
    "command": "python sources/editor/flare/tools/flare.py -s sources/editor -t deploy/editor",
     "kind": "exec"
}

Please rethink this part entirely. use a regular expression to determine if this is an admin install-command like viur package install admin with a valid version number behind. You can extract the version number using regular expression as well.


case other:
utils.echo_fatal(f"Unknown build kind {other!r}")
Expand Down
16 changes: 1 addition & 15 deletions src/viur_cli/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
from pathlib import Path
from urllib.request import urlretrieve
from . import cli, echo_error, echo_info
from operator import itemgetter
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

???


REPOS = {
"vi": ("viur-framework/viur-vi", "viur-vi.zip"),
Expand Down Expand Up @@ -144,11 +145,6 @@ def scriptor(version, target, profile):

old_version=conf.get('builds').get('scriptor').get('version')

if old_version == real_version.strip("v"):
if not click.confirm(f"You have already installed version {old_version} of scriptor.\n"
f"Do you want to continue and install it again?"):
return

scriptor_path = Path(dist_folder, target)
tmp_zip_file = Path("scriptor.zip")

Expand Down Expand Up @@ -187,11 +183,6 @@ def admin(version: str, target: str, profile):

old_version=conf.get('builds').get('admin').get('version')

if old_version == real_version.strip("v"):
if not click.confirm(f"You have already installed the version {old_version} of admin.\n"
f"Do you want to continue and install it again?"):
return

admin_path = Path(dist_folder, target)
tmp_zip_file = Path("vi-admin.zip")

Expand Down Expand Up @@ -235,11 +226,6 @@ def vi(version, target, profile):
real_version, download_url = get_version_info("vi", version)
old_version = conf.get('builds').get('vi').get('version')

if old_version == real_version.strip("v"):
if not click.confirm(f"You have already installed the version {old_version} of vi.\n"
f"Do you want to continue and install it again?"):
return

vi_path = Path(dist_folder, target)
tmp_zip_file = Path("vi.zip")

Expand Down