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

Use yagna pre-releases by default #548

Merged
merged 2 commits into from
Sep 23, 2021
Merged
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
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ docker-compose:
# branch: ...
# commit-hash: ...
# release-tag: ...
# use-prerelease: ...

compose-log-patterns: # Log message patterns used for container ready checks
ethereum: ".*Wallets supplied."
Expand Down
2 changes: 2 additions & 0 deletions goth/configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -222,13 +222,15 @@ def read_build_env(self, docker_dir: Path) -> YagnaBuildEnvironment:
commit_hash = self.get("commit-hash")
deb_path = self.get_path("deb-path", required=False)
release_tag = self.get("release-tag")
use_prerelease = self.get("use-prerelease", default=True)
return YagnaBuildEnvironment(
docker_dir,
binary_path=binary_path,
branch=branch,
commit_hash=commit_hash,
deb_path=deb_path,
release_tag=release_tag,
use_prerelease=use_prerelease,
)


Expand Down
3 changes: 2 additions & 1 deletion goth/default-assets/goth-config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,10 @@ docker-compose:

# binary-path: ...
# deb-path: ...
branch: release/v0.8
# branch: ...
# commit-hash: ...
# release-tag: ...
# use-prerelease: ...

compose-log-patterns:
ethereum: ".*Wallets supplied."
Expand Down
21 changes: 18 additions & 3 deletions goth/runner/container/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ class YagnaBuildEnvironment:
"""Local path to .deb file or dir with .deb files to be installed in the image."""
release_tag: Optional[str] = None
"""Release tag substring used to filter the GitHub release to download."""
use_prerelease: bool = True
"""If set to `False` then yagna pre-releases will be ignored."""

@property
def is_using_deb(self) -> bool:
Expand Down Expand Up @@ -130,11 +132,18 @@ def _download_artifact(env: YagnaBuildEnvironment, download_path: Path) -> None:


def _download_release(
download_path: Path, repo: str, tag_substring: str = "", asset_name: str = ""
download_path: Path,
repo: str,
tag_substring: str = "",
asset_name: str = "",
use_prerelease: bool = True,
) -> None:
downloader = ReleaseDownloader(repo=repo, token=os.environ.get(ENV_API_TOKEN))
downloader.download(
output=download_path, asset_name=asset_name, tag_substring=tag_substring
output=download_path,
asset_name=asset_name,
tag_substring=tag_substring,
use_unstable=use_prerelease,
)


Expand Down Expand Up @@ -193,7 +202,13 @@ def _setup_build_context(
shutil.unpack_archive(env.binary_path, extract_dir=str(context_binary_dir))
else:
logger.info("Using yagna release. tag_substring=%s", env.release_tag)
_download_release(context_deb_dir, "yagna", env.release_tag or "", "provider")
_download_release(
context_deb_dir,
"yagna",
env.release_tag or "",
"provider",
use_prerelease=env.use_prerelease,
)

if env.deb_path:
if env.deb_path.is_dir():
Expand Down
8 changes: 4 additions & 4 deletions goth/runner/download/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
DEFAULT_OWNER = "golemfactory"
DEFAULT_REPO = "yagna"
DEFAULT_TOKEN = os.getenv(ENV_API_TOKEN)
DEFAULT_WORKFLOW = "CI"
DEFAULT_WORKFLOW = "Build binaries (x86-64)"


class AssetNotFound(Exception):
Expand Down Expand Up @@ -229,7 +229,7 @@ def _get_latest_release(
self,
tag_substring: str,
content_type: str,
use_unstable: bool = False,
use_unstable: bool = True,
) -> Optional[dict]:
"""Get the latest version, this includes pre-releases.

Expand Down Expand Up @@ -285,7 +285,7 @@ def download(
content_type: str = DEFAULT_CONTENT_TYPE,
output: Optional[Path] = None,
tag_substring: str = "",
use_unstable: bool = False,
use_unstable: bool = True,
) -> Path:
"""Download the latest release (or pre-release) from a given GitHub repo.

Expand All @@ -296,7 +296,7 @@ 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
:param use_unstable: if `False`, pre-releases will not be included
"""
release = self._get_latest_release(tag_substring, content_type, use_unstable)
if not release:
Expand Down