Page MenuHomeFreeBSD

ports: ensure go-build doesn't try to access internet
ClosedPublic

Authored by dch on Oct 19 2020, 3:01 PM.
Tags
None
Referenced Files
Unknown Object (File)
Wed, May 1, 12:18 PM
Unknown Object (File)
Wed, May 1, 12:17 PM
Unknown Object (File)
Wed, May 1, 12:17 PM
Unknown Object (File)
Wed, May 1, 12:17 PM
Unknown Object (File)
Wed, May 1, 5:50 AM
Unknown Object (File)
Jan 29 2024, 6:17 AM
Unknown Object (File)
Jan 14 2024, 3:43 PM
Unknown Object (File)
Dec 23 2023, 2:32 AM
Subscribers
None

Details

Summary

from go help modules

If GOPROXY is set to the string "direct", downloads use a direct connection to
source control servers. Setting GOPROXY to "off" disallows downloading modules
from any source. Otherwise, GOPROXY is expected to be list of module proxy URLs
separated by either comma (,) or pipe (|) characters, which control error
fallback behavior. For each request, the go command tries each proxy in
sequence. If there is an error, the go command will try the next proxy in the
list if the error is a 404 or 410 HTTP response or if the current proxy is
followed by a pipe character, indicating it is safe to fall back on any error.

The GOPRIVATE and GONOPROXY environment variables allow bypassing
the proxy for selected modules. See 'go help module-private' for details.

No matter the source of the modules, the go command checks downloads against
known checksums, to detect unexpected changes in the content of any specific
module version from one day to the next. This check first consults the current
module's go.sum file but falls back to the Go checksum database, controlled by
the GOSUMDB and GONOSUMDB environment variables. See 'go help module-auth'
for details.

Test Plan

This issue bit me, with enough NAT rules to allow poudriere jail to "escape".

Golang kindly retrieves all the missing modules in the build phase, the port works locally via poudriere, until it reaches the FreeBSD build cluster when it dies in a horrible fire of failed
connects.

tested with / without pf.conf NAT enabled, on sysutils/rest-server port with missing modules.

Diff Detail

Repository
rP FreeBSD ports repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

dch requested review of this revision.Oct 19 2020, 3:01 PM
dch created this revision.
dch edited the test plan for this revision. (Show Details)
dch added a reviewer: dmgk.
Mk/Uses/go.mk
82 ↗(On Diff #78428)

I'm OK with this, but GOPROXY is an environment variable so it should probably go into GO_ENV,

.if ${go_ARGS:Mmodules}
...
GO_ENV+=        GOPATH="" \
                GOBIN="${GO_WRKDIR_BIN}" \
                GO_NO_VENDOR_CHECKS=1 \
                GOPROXY=off
...
dmgk requested changes to this revision.Oct 19 2020, 6:16 PM
This revision now requires changes to proceed.Oct 19 2020, 6:16 PM

incorporate GO_ENV feedback

dch marked an inline comment as done.Nov 1 2020, 12:10 PM

LGTM - does this need a portmgr approval as well?

LGTM. I don't believe this also requires portmgr involvement.

This revision is now accepted and ready to land.Nov 1 2020, 4:14 PM