zip_deploy: allow updates to stable releases when on the "beta" channel
Users on the "beta" channel should be updated to the latest release, including stable releases. Signed-off-by: Eric Callahan <arksine.code@gmail.com>
This commit is contained in:
parent
2ceafb0ff5
commit
87444f5bcb
|
@ -40,7 +40,7 @@ class ZipDeploy(AppDeploy):
|
||||||
def __init__(self,
|
def __init__(self,
|
||||||
config: ConfigHelper,
|
config: ConfigHelper,
|
||||||
cmd_helper: CommandHelper,
|
cmd_helper: CommandHelper,
|
||||||
app_params: Optional[Dict[str, Any]]
|
app_params: Optional[Dict[str, Any]] = None
|
||||||
) -> None:
|
) -> None:
|
||||||
super().__init__(config, cmd_helper, app_params)
|
super().__init__(config, cmd_helper, app_params)
|
||||||
self.official_repo: str = "?"
|
self.official_repo: str = "?"
|
||||||
|
@ -83,8 +83,11 @@ class ZipDeploy(AppDeploy):
|
||||||
return new_app
|
return new_app
|
||||||
|
|
||||||
async def _parse_info_file(self, file_name: str) -> Dict[str, Any]:
|
async def _parse_info_file(self, file_name: str) -> Dict[str, Any]:
|
||||||
|
info_file = self.path.joinpath(file_name)
|
||||||
|
if not info_file.exists():
|
||||||
|
self.log_info(f"Unable to locate file '{info_file}'")
|
||||||
|
return {}
|
||||||
try:
|
try:
|
||||||
info_file = self.path.joinpath(file_name)
|
|
||||||
event_loop = self.server.get_event_loop()
|
event_loop = self.server.get_event_loop()
|
||||||
info_bytes = await event_loop.run_in_thread(info_file.read_text)
|
info_bytes = await event_loop.run_in_thread(info_file.read_text)
|
||||||
info: Dict[str, Any] = json.loads(info_bytes)
|
info: Dict[str, Any] = json.loads(info_bytes)
|
||||||
|
@ -124,10 +127,11 @@ class ZipDeploy(AppDeploy):
|
||||||
if key not in release_info:
|
if key not in release_info:
|
||||||
self._add_error(f"Missing release info item: {key}")
|
self._add_error(f"Missing release info item: {key}")
|
||||||
self.detected_type = "?"
|
self.detected_type = "?"
|
||||||
self.need_channel_update = False
|
self.need_channel_update = self.channel == "dev"
|
||||||
if 'channel' in release_info:
|
if 'channel' in release_info:
|
||||||
local_channel = release_info['channel']
|
local_channel = release_info['channel']
|
||||||
self.need_channel_update = self.channel != local_channel
|
if self.channel == "stable" and local_channel == "beta":
|
||||||
|
self.need_channel_update = True
|
||||||
self.detected_type = "zip"
|
self.detected_type = "zip"
|
||||||
if local_channel == "beta":
|
if local_channel == "beta":
|
||||||
self.detected_type = "zip_beta"
|
self.detected_type = "zip_beta"
|
||||||
|
@ -191,10 +195,11 @@ class ZipDeploy(AppDeploy):
|
||||||
current_release: Dict[str, Any] = {}
|
current_release: Dict[str, Any] = {}
|
||||||
for release in releases:
|
for release in releases:
|
||||||
if not latest_release:
|
if not latest_release:
|
||||||
if release['prerelease']:
|
if self.channel != "stable":
|
||||||
if self.channel != "stable":
|
# Allow the beta channel to update regardless
|
||||||
latest_release = release
|
latest_release = release
|
||||||
elif self.channel == "stable":
|
elif not release['prerelease']:
|
||||||
|
# This is a stable release on the stable channle
|
||||||
latest_release = release
|
latest_release = release
|
||||||
if current_tag is not None:
|
if current_tag is not None:
|
||||||
if not current_release and release['tag_name'] == current_tag:
|
if not current_release and release['tag_name'] == current_tag:
|
||||||
|
@ -248,15 +253,14 @@ class ZipDeploy(AppDeploy):
|
||||||
self._add_error(
|
self._add_error(
|
||||||
"RELEASE_INFO not found in latest release assets")
|
"RELEASE_INFO not found in latest release assets")
|
||||||
self.commit_log = []
|
self.commit_log = []
|
||||||
if self.short_version == self.latest_version:
|
if self.short_version != self.latest_version:
|
||||||
# No need to report the commit log when versions match
|
# Only report commit log if versions change
|
||||||
return
|
if "COMMIT_LOG" in asset_info:
|
||||||
if "COMMIT_LOG" in asset_info:
|
asset_url, content_type, size = asset_info['COMMIT_LOG']
|
||||||
asset_url, content_type, size = asset_info['COMMIT_LOG']
|
commit_bytes = await self.cmd_helper.http_download_request(
|
||||||
commit_bytes = await self.cmd_helper.http_download_request(
|
asset_url, content_type)
|
||||||
asset_url, content_type)
|
commit_info: Dict[str, Any] = json.loads(commit_bytes)
|
||||||
commit_info: Dict[str, Any] = json.loads(commit_bytes)
|
self.commit_log = commit_info.get(self.name, [])
|
||||||
self.commit_log = commit_info.get(self.name, [])
|
|
||||||
if zip_file_name in asset_info:
|
if zip_file_name in asset_info:
|
||||||
self.release_download_info = asset_info[zip_file_name]
|
self.release_download_info = asset_info[zip_file_name]
|
||||||
self._is_valid = True
|
self._is_valid = True
|
||||||
|
|
Loading…
Reference in New Issue