-
Notifications
You must be signed in to change notification settings - Fork 88
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: keep downloaded packages (releases only) #1187
Conversation
Thanks this is a fine ideas, however some issues with the current approach:
I'd prefer to downgrade the IB repositories to HTTP and use squid, which should in turn automatically upgrade the connection to https. This should solve all the above problems and is used anyway for snapshot Downloads. Would you be willing to modify your PR to do that? |
I tested it and it worked as expected, would you mind adopting your PR? diff --git a/asu/build.py b/asu/build.py
index bc29a90..d9e7e78 100644
--- a/asu/build.py
+++ b/asu/build.py
@@ -75,14 +75,15 @@ def build(build_request: BuildRequest, job=None):
.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(
+ {
+ "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()
@@ -178,6 +179,7 @@ def build(build_request: BuildRequest, job=None):
container, ["make", "info"]
)
+
job.meta["imagebuilder_status"] = "validate_revision"
job.save_meta()
@@ -218,6 +220,15 @@ def build(build_request: BuildRequest, job=None):
job.meta["imagebuilder_status"] = "validate_manifest"
job.save_meta()
+ returncode, job.meta["stdout"], job.meta["stderr"] = run_cmd(
+ container, ["sed", "-i", "s|https|http|g", "repositories"]
+ )
+ returncode, job.meta["stdout"], job.meta["stderr"] = run_cmd(
+ container, ["sed", "-i", "s|https|http|g", "repositories.conf"]
+ )
+
returncode, job.meta["stdout"], job.meta["stderr"] = run_cmd(
container,
[ |
Hi sorry i did some tests and written almost the same stuff [0] but I can't figure out quickly how to upgrade automatically to https with squid without 'trying' dockerizing an alpine with squid ssl-bump etc but my setup currently fails also running ./setup.sh with http for snapshots, both with podman-compose and with dev server (giving me connection refused on 127.0.0.1:3128, probably squid is not configured properly) let's close this and continue with your setup that is working! [0] diff --git a/asu/build.py b/asu/build.py
index bc29a90..8a675ac 100644
--- a/asu/build.py
+++ b/asu/build.py
@@ -75,14 +75,23 @@ def build(build_request: BuildRequest, job=None):
.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(
+ {
+ "UPSTREAM_URL": settings.upstream_url.replace("https", "http"),
+ "use_proxy": "on",
+ "http_proxy": "http://127.0.0.1:3128",
+ "repositories_file": (
+ "repositories.conf"
+ if (
+ not build_request.version.lower().startswith("snapshot")
+ and int(build_request.version[:2]) < 25
+ )
+ else "repositories"
+ ),
+ }
+ )
job.meta["imagebuilder_status"] = "container_setup"
job.save_meta()
@@ -218,6 +227,11 @@ def build(build_request: BuildRequest, job=None):
job.meta["imagebuilder_status"] = "validate_manifest"
job.save_meta()
+ if settings.squid_cache:
+ returncode, job.meta["stdout"], job.meta["stderr"] = run_cmd(
+ container, ["bash", "-c", "sed -i 's|https|http|g' ${repositories_file}"]
+ )
+
returncode, job.meta["stdout"], job.meta["stderr"] = run_cmd(
container,
[ |
Allow to "downgrade" HTTPS connections to be cached by squid. In both cases, packages indexes are verified by OPKG keys (usign) or APK itself. Related: openwrt#1187 Signed-off-by: Paul Spooren <[email protected]>
Allow to "downgrade" HTTPS connections to be cached by squid. In both cases, packages indexes are verified by OPKG keys (usign) or APK itself. Related: openwrt#1187 Signed-off-by: Paul Spooren <[email protected]>
Allow to "downgrade" HTTPS connections to be cached by squid. In both cases, packages indexes are verified by OPKG keys (usign) or APK itself. Related: #1187 Signed-off-by: Paul Spooren <[email protected]>
This increase the speed of subsequent builds for the same target (excluding snapshots),
by saving a local copy of downloaded packages in a path defined as version/target/subtarget
that is then mounted on the imagebuilder as a bind-volume,
for example
/path/to/asu/dl/23.05.5/ath79/generic:/builder/dl
when building for ath79/generic.Since this increase a few the storage needed, it is added as opt-in.
In addition, to enable this also for snapshots, a mechanism to auto delete old/lower version_codes
should be added, presumably linked to the
environment.update
part. [0]This is the result of some tests made via the api at
http://0.0.0.0:8000/docs
Tested running the dev server, building for ath79-generic-8dev_carambola2
Tested with the podman-compose setup, building for ath79-nand-glinet_gl-xe300 [1]
[0] Note: An alternative approach, would be to instruct apk (opkg)
to use the local instance of squid if enabled
for example adding this before the validate_manifest cmd
make manifest...
:however in snapshots this apparently could not benefit of the squid cache without becoming error prone.
[1] Note: to complete the tests with podman I had to change these settings in
asu/config.py
,because it seems that
Path.cwd()
when is read inside the container erroneously points to/app/dl/23.05.5/ath79/generic
instead of/home/openwrt/asu/dl/23.05.5/ath79/generic
.Maybe I missed a better option to do the same changes: