Skip to content

Commit

Permalink
Use stable releases by default
Browse files Browse the repository at this point in the history
  • Loading branch information
kmazurek committed Apr 27, 2021
1 parent 29e21ac commit 63fa726
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 3 deletions.
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 10 additions & 2 deletions goth/runner/download/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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"]
)
Expand Down Expand Up @@ -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.
Expand All @@ -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. "
Expand Down
10 changes: 9 additions & 1 deletion scripts/download_release.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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
)

0 comments on commit 63fa726

Please sign in to comment.