fix(deploy): honor configured Go module proxy

This commit is contained in:
姚章浩
2026-09-11 17:27:20 +08:00
parent a615693bd0
commit d77fbd675b
2 changed files with 18 additions and 0 deletions
+2
View File
@@ -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 . ./
+16
View File
@@ -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 {