Skip to content

Commit

Permalink
Update GOPROXY to use default with fallback
Browse files Browse the repository at this point in the history
Use the default proxy, to assist with LTS distros that use old git versions
but fallback on any error (instead of only on 404 and 410).

From the Go documentation; https://go.dev/ref/mod#goproxy-protocol

> List elements may be separated by commas (,) or pipes (|), which determine error
> fallback behavior. When a URL is followed by a comma, the go command falls back
> to later sources only after a 404 (Not Found) or 410 (Gone) response. When a URL
> is followed by a pipe, the go command falls back to later sources after any error,
> including non-HTTP errors such as timeouts. This error handling behavior lets a
> proxy act as a gatekeeper for unknown modules. For example, a proxy could respond
> with error 403 (Forbidden) for modules not on an approved list (see Private proxy
> serving private modules).

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
  • Loading branch information
thaJeztah committed Aug 20, 2022
1 parent 8ab917b commit 72d51db
Show file tree
Hide file tree
Showing 18 changed files with 18 additions and 28 deletions.
1 change: 0 additions & 1 deletion deb/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ BUILD?=DOCKER_BUILDKIT=1 \
RUN_FLAGS=
RUN?=docker run --rm \
-e PLATFORM \
-e GOPROXY=https://proxy.golang.org \
-e EPOCH='$(EPOCH)' \
-e DEB_VERSION=$(word 1, $(GEN_DEB_VER)) \
-e VERSION=$(word 2, $(GEN_DEB_VER)) \
Expand Down
6 changes: 2 additions & 4 deletions deb/common/rules
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,10 @@ override_dh_auto_build:
&& CGO_ENABLED=0 GO111MODULE=on go build -mod=vendor -o /usr/libexec/docker/cli-plugins/docker-buildx -ldflags "-X github.com/docker/buildx/version.Version=$(BUILDX_VERSION) -X github.com/docker/buildx/version.Revision=$(git rev-parse HEAD) -X github.com/docker/buildx/version.Package=github.com/docker/buildx" ./cmd/buildx

# Build the compose plugin
# FIXME: using GOPROXY, to work around:
# go: github.com/Azure/azure-sdk-for-go@v48.2.0+incompatible: reading github.com/Azure/azure-sdk-for-go/go.mod at revision v48.2.0: unknown revision v48.2.0
cd /go/src/github.com/docker/compose \
&& GOPROXY="https://proxy.golang.org" GO111MODULE=on go mod download \
&& GO111MODULE=on go mod download \
&& mkdir -p /usr/libexec/docker/cli-plugins/ \
&& GOPROXY="https://proxy.golang.org" GO111MODULE=on \
&& GO111MODULE=on \
CGO_ENABLED=0 \
go build \
-trimpath \
Expand Down
2 changes: 1 addition & 1 deletion deb/debian-bullseye/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ FROM ${BUILD_IMAGE}
ARG DEBIAN_FRONTEND=noninteractive
RUN apt-get update && apt-get install -y curl devscripts equivs git

ENV GOPROXY=direct
ENV GOPROXY=https://proxy.golang.org|direct
ENV GO111MODULE=off
ENV GOPATH /go
ENV PATH $PATH:/usr/local/go/bin:$GOPATH/bin
Expand Down
2 changes: 1 addition & 1 deletion deb/debian-buster/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ FROM ${BUILD_IMAGE}
ARG DEBIAN_FRONTEND=noninteractive
RUN apt-get update && apt-get install -y curl devscripts equivs git

ENV GOPROXY=direct
ENV GOPROXY=https://proxy.golang.org|direct
ENV GO111MODULE=off
ENV GOPATH /go
ENV PATH $PATH:/usr/local/go/bin:$GOPATH/bin
Expand Down
2 changes: 1 addition & 1 deletion deb/raspbian-bullseye/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ FROM ${BUILD_IMAGE}
ARG DEBIAN_FRONTEND=noninteractive
RUN apt-get update && apt-get install -y curl devscripts equivs git

ENV GOPROXY=direct
ENV GOPROXY=https://proxy.golang.org|direct
ENV GO111MODULE=off
ENV GOPATH /go
ENV PATH $PATH:/usr/local/go/bin:$GOPATH/bin
Expand Down
2 changes: 1 addition & 1 deletion deb/raspbian-buster/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ FROM ${BUILD_IMAGE}
ARG DEBIAN_FRONTEND=noninteractive
RUN apt-get update && apt-get install -y curl devscripts equivs git

ENV GOPROXY=direct
ENV GOPROXY=https://proxy.golang.org|direct
ENV GO111MODULE=off
ENV GOPATH /go
ENV PATH $PATH:/usr/local/go/bin:$GOPATH/bin
Expand Down
2 changes: 1 addition & 1 deletion deb/ubuntu-bionic/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ FROM ${BUILD_IMAGE}
ARG DEBIAN_FRONTEND=noninteractive
RUN apt-get update && apt-get install -y curl devscripts equivs git

ENV GOPROXY=direct
ENV GOPROXY=https://proxy.golang.org|direct
ENV GO111MODULE=off
ENV GOPATH /go
ENV PATH $PATH:/usr/local/go/bin:$GOPATH/bin
Expand Down
2 changes: 1 addition & 1 deletion deb/ubuntu-focal/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ RUN if [ "$(dpkg-divert --truename /usr/bin/man)" = "/usr/bin/man.REAL" ]; then
ARG DEBIAN_FRONTEND=noninteractive
RUN apt-get update && apt-get install -y curl devscripts equivs git

ENV GOPROXY=direct
ENV GOPROXY=https://proxy.golang.org|direct
ENV GO111MODULE=off
ENV GOPATH /go
ENV PATH $PATH:/usr/local/go/bin:$GOPATH/bin
Expand Down
2 changes: 1 addition & 1 deletion deb/ubuntu-jammy/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ RUN if [ "$(dpkg-divert --truename /usr/bin/man)" = "/usr/bin/man.REAL" ]; then
ARG DEBIAN_FRONTEND=noninteractive
RUN apt-get update && apt-get install -y curl devscripts equivs git

ENV GOPROXY=direct
ENV GOPROXY=https://proxy.golang.org|direct
ENV GO111MODULE=off
ENV GOPATH /go
ENV PATH $PATH:/usr/local/go/bin:$GOPATH/bin
Expand Down
1 change: 0 additions & 1 deletion rpm/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ RPMBUILD_FLAGS?=-ba\
RUN_FLAGS=
RUN?=docker run --rm \
-e PLATFORM \
-e GOPROXY=https://proxy.golang.org \
-v $(CURDIR)/rpmbuild/SOURCES:/root/rpmbuild/SOURCES:ro \
-v $(CURDIR)/rpmbuild/$@/RPMS:/root/rpmbuild/RPMS \
-v $(CURDIR)/rpmbuild/$@/SRPMS:/root/rpmbuild/SRPMS \
Expand Down
6 changes: 2 additions & 4 deletions rpm/SPECS/docker-compose-plugin.spec
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,8 @@ Docker Compose V1 ('docker-compose').

%build
pushd ${RPM_BUILD_DIR}/src/compose
# FIXME: using GOPROXY, to work around:
# go: github.com/Azure/azure-sdk-for-go@v48.2.0+incompatible: reading github.com/Azure/azure-sdk-for-go/go.mod at revision v48.2.0: unknown revision v48.2.0
GOPROXY="https://proxy.golang.org" GO111MODULE=on go mod download
GOPROXY="https://proxy.golang.org" GO111MODULE=on \
GO111MODULE=on go mod download
GO111MODULE=on \
CGO_ENABLED=0 \
go build \
-trimpath \
Expand Down
6 changes: 1 addition & 5 deletions rpm/centos-7/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,7 @@ FROM ${GO_IMAGE} AS golang

FROM ${BUILD_IMAGE}

# Using goproxy instead of "direct" to work around an issue in go mod
# not working with older git versions (default version on CentOS 7 is
# git 1.8), see https://github.com/golang/go/issues/38373, and
# https://github.com/docker/docker-ce-packaging/pull/631#issuecomment-1059363763
ENV GOPROXY=https://proxy.golang.org
ENV GOPROXY=https://proxy.golang.org|direct
ENV GO111MODULE=off
ENV GOPATH=/go
ENV PATH $PATH:/usr/local/go/bin:$GOPATH/bin
Expand Down
2 changes: 1 addition & 1 deletion rpm/centos-8/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ ARG BUILD_IMAGE=quay.io/centos/${DISTRO}:stream${SUITE}
FROM ${GO_IMAGE} AS golang

FROM ${BUILD_IMAGE}
ENV GOPROXY=direct
ENV GOPROXY=https://proxy.golang.org|direct
ENV GO111MODULE=off
ENV GOPATH=/go
ENV PATH $PATH:/usr/local/go/bin:$GOPATH/bin
Expand Down
2 changes: 1 addition & 1 deletion rpm/centos-9/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ ARG BUILD_IMAGE=quay.io/centos/${DISTRO}:stream${SUITE}
FROM ${GO_IMAGE} AS golang

FROM ${BUILD_IMAGE}
ENV GOPROXY=direct
ENV GOPROXY=https://proxy.golang.org|direct
ENV GO111MODULE=off
ENV GOPATH=/go
ENV PATH $PATH:/usr/local/go/bin:$GOPATH/bin
Expand Down
2 changes: 1 addition & 1 deletion rpm/fedora-35/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ ARG BUILD_IMAGE=${DISTRO}:${SUITE}
FROM ${GO_IMAGE} AS golang

FROM ${BUILD_IMAGE}
ENV GOPROXY=direct
ENV GOPROXY=https://proxy.golang.org|direct
ENV GO111MODULE=off
ENV GOPATH /go
ENV PATH $PATH:/usr/local/go/bin:$GOPATH/bin
Expand Down
2 changes: 1 addition & 1 deletion rpm/fedora-36/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ ARG BUILD_IMAGE=${DISTRO}:${SUITE}
FROM ${GO_IMAGE} AS golang

FROM ${BUILD_IMAGE}
ENV GOPROXY=direct
ENV GOPROXY=https://proxy.golang.org|direct
ENV GO111MODULE=off
ENV GOPATH /go
ENV PATH $PATH:/usr/local/go/bin:$GOPATH/bin
Expand Down
2 changes: 1 addition & 1 deletion rpm/fedora-37/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ ARG BUILD_IMAGE=${DISTRO}:${SUITE}
FROM ${GO_IMAGE} AS golang

FROM ${BUILD_IMAGE}
ENV GOPROXY=direct
ENV GOPROXY=https://proxy.golang.org|direct
ENV GO111MODULE=off
ENV GOPATH /go
ENV PATH $PATH:/usr/local/go/bin:$GOPATH/bin
Expand Down
2 changes: 1 addition & 1 deletion rpm/rhel-7/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ ARG BUILD_IMAGE=dockereng/${DISTRO}:${SUITE}-s390x
FROM ${GO_IMAGE} AS golang

FROM ${BUILD_IMAGE}
ENV GOPROXY=direct
ENV GOPROXY=https://proxy.golang.org|direct
ENV GO111MODULE=off
ENV GOPATH=/go
ENV PATH $PATH:/usr/local/go/bin:$GOPATH/bin
Expand Down

0 comments on commit 72d51db

Please sign in to comment.