fix(deploy): honor configured Go module proxy
This commit is contained in:
@@ -2,6 +2,8 @@ FROM golang:1.26.5-bookworm AS build
|
|||||||
|
|
||||||
WORKDIR /src
|
WORKDIR /src
|
||||||
COPY go.mod go.sum ./
|
COPY go.mod go.sum ./
|
||||||
|
ARG GOPROXY=https://proxy.golang.org,direct
|
||||||
|
ENV GOPROXY=${GOPROXY}
|
||||||
RUN go mod download
|
RUN go mod download
|
||||||
COPY . ./
|
COPY . ./
|
||||||
|
|
||||||
|
|||||||
@@ -40,6 +40,22 @@ func TestRootInstallerBuildsImageWithoutOperatorImageArgument(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestDockerfilePropagatesConfiguredGoProxyToModuleDownload(t *testing.T) {
|
||||||
|
data, err := os.ReadFile("../Dockerfile")
|
||||||
|
if err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
source := string(data)
|
||||||
|
for _, required := range []string{"ARG GOPROXY=", "ENV GOPROXY=${GOPROXY}", "RUN go mod download"} {
|
||||||
|
if !strings.Contains(source, required) {
|
||||||
|
t.Errorf("Dockerfile missing %q", required)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if !(strings.Index(source, "ENV GOPROXY=${GOPROXY}") < strings.Index(source, "RUN go mod download")) {
|
||||||
|
t.Fatal("Dockerfile must set GOPROXY before downloading modules")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func TestRDSInitializerOnlyInitializesEmptySchemaAndRejectsInconsistentSchema(t *testing.T) {
|
func TestRDSInitializerOnlyInitializesEmptySchemaAndRejectsInconsistentSchema(t *testing.T) {
|
||||||
data, err := os.ReadFile("../deploy/dobotai-dingtalk/rds-schema-init.sh")
|
data, err := os.ReadFile("../deploy/dobotai-dingtalk/rds-schema-init.sh")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
Reference in New Issue
Block a user