Log:
client.go:14:2: reading gitlab.ts.gitlab.aws.de/ds/l2/clients/go.mod at revision clients/v1.0.1: git ls-remote -q origin in /go/pkg/mod/cache/vcs/ad4f553af57fde4fbbbf8d60479616afffd6533ec6a1e4523ec2c79b31b16845: exit status 128:
remote: The project you were looking for could not be found or you don't have permission to view it.
fatal: repository 'https://gitlab.ts.gitlab.aws.de/ds/l2.git/' not found
Locally I have no problems to load my private Go-Package:
require gitlab.ts.gitlab.aws.de/ds/l2/clients v1.0.1
But once I want to run tests in the GitLab Pipeline it starts to point to the wrong repository. This is the changes I have made in my gitlab-ci.yml:
GOPRIVATE: gitlab.ts.gitlab.aws.de
test:
image: golang:1.24
stage: test
before_script:
- git config --global url."https://gitlab-ci-token:${PROJECT_ACCESS_TOKEN}@gitlab.ts.gitlab.aws.de/".insteadOf "https://gitlab.ts.gitlab.aws.de/"
I tried clearing the mod cache but somehow the runner tries to clone from https://gitlab.ts.gitlab.aws.de/ds/l2.git/, do you know why?
go.modinside your clients repo is declaringmodule gitlab.ts.gitlab.aws.de/ds/l2instead ofgitlab.ts.gitlab.aws.de/ds/l2/clients. That why Go drops the/clientspart and tries to fetch from.../ds/l2.git. Locally it is working only because of cache. Fix by updating themoduleline inclients/go.modto match the full import path (gitlab.ts.gitlab.aws.de/ds/l2/clients) and retagging, or use areplacedirective in your rootgo.modas a temporary workaround.