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

feat: add cache to packages #1191

Merged
merged 1 commit into from
Feb 4, 2025
Merged
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
24 changes: 15 additions & 9 deletions asu/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@

image = f"{settings.base_container}:{build_request.target.replace('/', '-')}-{container_version_tag}"

if build_request.version.lower().endswith("snapshot"):
if is_snapshot_build(build_request.version):
environment.update(
{
"TARGET": build_request.target,
Expand All @@ -75,14 +75,15 @@
.replace("{version}", build_request.version),
}
)
if settings.squid_cache:
environment.update(
{
"UPSTREAM_URL": settings.upstream_url.replace("https", "http"),
"use_proxy": "on",
"http_proxy": "http://127.0.0.1:3128",
}
)

if settings.squid_cache:
environment.update(

Check warning on line 80 in asu/build.py

View check run for this annotation

Codecov / codecov/patch

asu/build.py#L80

Added line #L80 was not covered by tests
{
"UPSTREAM_URL": settings.upstream_url.replace("https", "http"),
"use_proxy": "on",
"http_proxy": "http://127.0.0.1:3128",
}
)

job.meta["imagebuilder_status"] = "container_setup"
job.save_meta()
Expand Down Expand Up @@ -218,6 +219,11 @@
job.meta["imagebuilder_status"] = "validate_manifest"
job.save_meta()

if settings.squid_cache and not is_snapshot_build(build_request.version):
log.info("Disabling HTTPS for repositories")

Check warning on line 223 in asu/build.py

View check run for this annotation

Codecov / codecov/patch

asu/build.py#L223

Added line #L223 was not covered by tests
# Once APK is used for a stable release, handle `repositories`, too
run_cmd(container, ["sed", "-i", "s|https|http|g", "repositories.conf"])

Check warning on line 225 in asu/build.py

View check run for this annotation

Codecov / codecov/patch

asu/build.py#L225

Added line #L225 was not covered by tests

returncode, job.meta["stdout"], job.meta["stderr"] = run_cmd(
container,
[
Expand Down