From 63fa726c72595250064fcfe12e9828d598513619 Mon Sep 17 00:00:00 2001 From: Kuba Mazurek Date: Tue, 27 Apr 2021 15:52:36 +0200 Subject: [PATCH] Use stable releases by default --- CHANGELOG.md | 12 ++++++++++++ goth/runner/download/__init__.py | 12 ++++++++++-- scripts/download_release.py | 10 +++++++++- 3 files changed, 31 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a264ea545..6ed094924 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,18 @@ ### Other changes +## [0.2.4] - 2021-04-27 + +### Features +- added optional `extra_monitors` parameter to `Runner#check_assertion_errors` [#495](https://github.com/golemfactory/goth/pull/495) +- added the `--unstable` option to release downloader script [#496](https://github.com/golemfactory/goth/pull/496) + +### Bugfixes +- fixed reporting of assertion success and failure in `EventMonitor` [#495](https://github.com/golemfactory/goth/pull/495) + +### Other changes +- changed the `yagna` Docker image builder to use stable releases by default [#496](https://github.com/golemfactory/goth/pull/496) + ## [0.2.3] - 2021-04-19 ### Other changes diff --git a/goth/runner/download/__init__.py b/goth/runner/download/__init__.py index 9b944a597..4373baa1d 100644 --- a/goth/runner/download/__init__.py +++ b/goth/runner/download/__init__.py @@ -217,7 +217,10 @@ def __init__(self, repo: str, *args, **kwargs): self.repo_name = repo def _get_latest_release( - self, tag_substring: str, content_type: str + self, + tag_substring: str, + content_type: str, + use_unstable: bool = False, ) -> Optional[dict]: """Get the latest version, this includes pre-releases. @@ -228,6 +231,9 @@ def _get_latest_release( logger.debug("releases=%s", json.dumps(obj2dict(all_releases))) def release_filter(release: dict, tag_substring: str) -> bool: + if not use_unstable and release["prerelease"]: + return False + has_matching_asset = any( asset["content_type"] == content_type for asset in release["assets"] ) @@ -270,6 +276,7 @@ def download( content_type: str = DEFAULT_CONTENT_TYPE, output: Optional[Path] = None, tag_substring: str = "", + use_unstable: bool = False, ) -> Path: """Download the latest release (or pre-release) from a given GitHub repo. @@ -280,8 +287,9 @@ def download( :param content_type: content-type string for the asset to download :param output: file path to where the asset should be saved :param tag_substring: substring the release's tag name must contain + :param use_unstable: if True, pre-releases will be included """ - release = self._get_latest_release(tag_substring, content_type) + release = self._get_latest_release(tag_substring, content_type, use_unstable) if not release: raise AssetNotFound( f"Could not find release. " diff --git a/scripts/download_release.py b/scripts/download_release.py index 694ed9093..143aafe93 100755 --- a/scripts/download_release.py +++ b/scripts/download_release.py @@ -24,6 +24,12 @@ help="Output path, may be either a file or a directory.", type=Path, ) +parser.add_argument( + "-u", + "--unstable", + help="If set, pre-releases will be included.", + action="store_true", +) parser.add_argument("-t", "--token", default=DEFAULT_TOKEN) parser.add_argument( "-v", "--verbose", help="If set, enables debug logging.", action="store_true" @@ -40,4 +46,6 @@ if __name__ == "__main__": args = parser.parse_args() downloader = ReleaseDownloader(args.repo, token=args.token, verbose=args.verbose) - downloader.download(args.name, args.content_type, args.output, args.tag) + downloader.download( + args.name, args.content_type, args.output, args.tag, args.unstable + )