Skip to content

Commit 4b8bdfd

Browse files
committed
ci: fix mod-check
GitLab probably blocked GitHub's CI runner IP address. So we can't download packages from GitLab directly during this check. Workaround applied: download these particular packages from proxy.golang.org which works in CI.
1 parent 12ef083 commit 4b8bdfd

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

Makefile

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,15 @@ GOBUILD := CGO_ENABLED=0 GO111MODULE=on go build -v
1515
GOINSTALL := CGO_ENABLED=0 GO111MODULE=on go install -v
1616
GOMOD := GO111MODULE=on go mod
1717

18+
# GitLab-backed module sources can reject CI runner traffic. Seed GitLab and
19+
# modernc.org modules through the public Go proxy before the direct check.
20+
MOD_CHECK_FILES := go.mod go.sum swapserverrpc/go.mod swapserverrpc/go.sum \
21+
looprpc/go.mod looprpc/go.sum tools/go.mod tools/go.sum
22+
MOD_CHECK_PREFETCH := $(shell awk '($$1 ~ /^(gitlab\.com\/|modernc\.org\/)/) { \
23+
version=$$2; sub("/go.mod$$", "", version); \
24+
if (version ~ /^v/) print $$1 "@" version; \
25+
}' $(MOD_CHECK_FILES) | sort -u)
26+
1827
COMMIT := $(shell git describe --abbrev=40 --dirty --tags)
1928
COMMIT_HASH := $(shell git rev-parse HEAD)
2029
DIRTY := $(shell git diff-index --quiet HEAD -- || echo dirty)
@@ -156,6 +165,9 @@ mod-tidy:
156165

157166
mod-check:
158167
@$(call print, "Checking modules.")
168+
ifneq ($(MOD_CHECK_PREFETCH),)
169+
@GOPROXY=https://proxy.golang.org $(GOMOD) download $(MOD_CHECK_PREFETCH)
170+
endif
159171
GOPROXY=direct $(GOMOD) tidy
160172
cd swapserverrpc/ && GOPROXY=direct $(GOMOD) tidy
161173
cd looprpc/ && GOPROXY=direct $(GOMOD) tidy

0 commit comments

Comments
 (0)