Search code examples
goherokugitlab-cigo-modulesgitlab-autodevops

Use private go module with gitlab ci Auto-DevOps for auto test


I use gitlab auto dev ops to deploy my project. I have a problem with auto tests(https://docs.gitlab.com/ee/topics/autodevops/stages.html#auto-test). In my project I use a go private module.

The error is :

get "gitlab.com/xxx/libs/xxx": checking for a non-authoritative meta tag
cmd/main.go:8:2: read gitlab.com/xxx/libs/xxx/go.mod at revision xxx/v1.0.0: git ls-remote -q origin in /tmp/build/.heroku/go-path/pkg/mod/cache/vcs/xxx: exit status 128 :
    fatal : could not read Username for 'https://gitlab.com' : terminal prompts disabled
Confirm that the import path has been entered correctly.
If this is a private repository, see https://golang.org/doc/faq#git_https for more information.

I've seen that gitlab uses buildpacks and that it's possible to use a custom build pack with the BUILDPACK_URL variable.

I also saw that you could modify the git url to use basic authentication to pull a private project (https://github.com/heroku/heroku-buildpack-go#private-git-repos). However, if I understand correctly, the heroku config is used to launch the application in heroku, not in the build back.

heroku config:set GO_GIT_CRED__HTTPS__GITHUB__COM=FakePersonalAccessTokenHere

I found a gitlab issue that talks about replacing herokuish test pack directly with /bin/test build pack, but the issue seems never to have been resolved. (https://gitlab.com/gitlab-org/gitlab/-/issues/212689)

The project always seems to use herokuish (https://gitlab.com/gitlab-org/gitlab/blob/master/lib/gitlab/ci/templates/Jobs/Test.gitlab-ci.yml)

Does anyone have an idea or am I going to have to overwrite the jobs to make a custom CI?


Solution

  • Here's the answer for the following developers. Indeed is deprecated, everything is describe here : https://www.reddit.com/r/gitlab/comments/1atryl2/autodevops_still_maintained/?rdt=50911