fix: use automatic IP detection instead of cache proxy host config value for internal cache server #1088
Labels
No labels
FreeBSD
Kind/Breaking
Kind/Bug
Kind/Chore
Kind/DependencyUpdate
Kind/Documentation
Kind/Enhancement
Kind/Feature
Kind/Security
Kind/Testing
Priority
Critical
Priority
High
Priority
Low
Priority
Medium
Reviewed
Confirmed
Reviewed
Duplicate
Reviewed
Invalid
Reviewed
Won't Fix
Status
Abandoned
Status
Blocked
Status
Need More Info
Windows
linux-powerpc64le
linux-riscv64
linux-s390x
run-end-to-end-tests
run-forgejo-tests
No milestone
No project
No assignees
6 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
forgejo/runner!1088
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "drewcassidy/runner:fix-cache-server-address"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
The description for the
cache.hostconfig value ishowever the internal cache server was being started using that value, despite it clearly stating its for the proxy.
While the address used to contact the cache proxy from the job is usually the same as the address for the cache proxy to contact the server, that is not the case with custom /etc/hosts entries, like what is used for the
host.containers.internaladdress, which is needed for contacting the cache proxy on rootless podman (see #1075).Since the cache proxy and internal cache server are always running on the same host (or container), it's safe to use localhost for the server address instead.
@ -118,3 +118,3 @@cacheServer, err := artifactcache.StartHandler(cfg.Cache.Dir,cfg.Cache.Host,"localhost",are you sure this works for external cache server too?
this is the call to start the internal cache server. it's skipped when an external cache server is used
This is indeed inconsistent, good catch.
I think better in this case to leave it empty so that it behaves as if it was not set. Also"localhost" is not guaranteed to exist so it would be better to have 127.0.0.1, if it is set explicitly.
This should have been caught by a test but there currently are no test verifying those border cases. I tried to figure out how to test that but doing so would require groundwork that is out of proportion for this simple bug fix.
I really do not like this situation because it does nothing to improve how cache servers are tested.
Manual testing is the only way out. @drewcassidy could you confirm that this fix is manually tested to work for you and explain the steps you took to do that?
127.0.0.1doesn't work on ipv6 only networking or does it?right, I did not think of that. Leaving it empty is best then.
Right, was waffling myself between automatic and localhost, I figured localhost would at least not expose the cache server to the outside world if the user isnt running a firewall.
Sockets would be the better answer, but I dont think those work on Windows?
I'll change it to the empty string, test, and report back.
Even if the cache is exposed publicly, it cannot be used without the secret (autogenerated or set in the config file) so it is not a concern.
Changed it to auto-detect. I tested by running a workflow that uses
actions/cachewith all config settings default except withcache.hostset tohost.containers.internal, and making sure the cache proxy doesnt error contacting the cache server.Thanks for doing the manual testing.
This would technically be breaking change I think (though I can't imagine a valid situation where someone is relying on this behavior)? Note that despite using
localhostfor local cache server, we're still binding it to a port specified in configuration. This seems to make little sense, as we are now exposing ability to define port for a service that will only ever be accessible locally for sole purpose of cache proxy connecting to it.It still makes sense to have the port configurable. There could be other services (like other runner instances) on the same server with conflicting ports bound to localhost.
This seems right to me, and consistent with the existing documentation. I would like another reviewer to agree with me, so I'll give it a day to see if anyone else does or does not. 🙂
this looks correct to me, though i haven't had a chance to test it.
fix: use localhost instead of cache proxy host for internal cache serverto fix: use automatic IP detection instead of cache proxy host config value for internal cache server