我使用 gitlab auto dev ops 来部署我的项目。我的自动测试有问题(https://docs.gitlab.com/ee/topics/autodevops/stages.html#auto-test)。在我的项目中,我使用私有模块。
错误是:
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.
我已经看到 gitlab 使用构建包,并且可以使用带有
BUILDPACK_URL
变量的自定义构建包。
我还看到您可以修改 git url 以使用基本身份验证来拉取私有项目(https://github.com/heroku/heroku-buildpack-go#private-git-repos)。 但是,如果我理解正确的话,heroku 配置用于在 heroku 中启动应用程序,而不是在构建中启动应用程序。
heroku config:set GO_GIT_CRED__HTTPS__GITHUB__COM=FakePersonalAccessTokenHere
我发现了一个 gitlab 问题,讨论直接用 /bin/test build pack 替换 herokuish 测试包,但问题似乎从未得到解决。 (https://gitlab.com/gitlab-org/gitlab/-/issues/212689)
该项目似乎总是使用herokuish(https://gitlab.com/gitlab-org/gitlab/blob/master/lib/gitlab/ci/templates/Jobs/Test.gitlab-ci.yml)
有人有想法吗?还是我必须重写作业才能制作自定义 CI?
这是为以下开发者提供的答案。 事实上已被弃用,所有内容都在这里描述:https://www.reddit.com/r/gitlab/comments/1atryl2/autodevops_still_maintained/?rdt=50911