Gitlab FAQ
约 2 分钟阅读
标签:FAQ
go get 不支持子群组
# 会指向 gitlab.com/random/xyz 而不是 gitlab.com/random/xyz/something
curl "https://gitlab.com/random/xyz/something?go-get=1"- go get 能识别 gitlab.com/random/xyz/something.git
- 但要求 module 名字也得匹配
- 可以使用 deploy token + .netrc 添加 auth
- 但无法绕开 ssh 的问题
- 参考
badage
https://gitlab.com/%{project_path}/badges/%{default_branch}/pipeline.svg- /pipeline.svg
- /coverage.svg
- style=flat-square,flat
- job=karma&key_text=Frontend+Coverage&key_width=130
- 可能状态 pending, running, passed, failed, skipped, canceled, unknown
- Pipeline status badge
覆盖度
- CI/CD 通用设置 - 配置检测 log 的规则
| tool | conf |
|---|---|
| go test -cover | coverage: \d+.\d+% of statements |
覆盖可视化
- 只有在 MR 可见
- 需要等全部 pipeline 跑完才可见 gitlab.com/gitlab-org/gitlab/-/issues/236248
- docs.gitlab.com/ee/user/project/merge_requests/test_coverage_visualization.html
- 需要输出为 cobertura/coberturaGitHubcobertura/cobertura
go install github.com/boumenot/gocover-cobertura@latest
gocover-cobertura < coverage.txt > coverage.xmlPackagesgithub.com/boumenot/gocover-coberturaGo Packagegithub.com/boumenot/gocover-coberturaGo
test:
script:
- npm install
- npx nyc --reporter cobertura mocha
artifacts:
reports:
cobertura: coverage/cobertura-coverage.xml手动触发部署
deploy:prod:manually:
extends:
- .deploy
when: manual2FA SSH 生成恢复码
ssh [email protected] 2fa_recovery_codesgitlab runner 缓存耗时长
不缓存,不做 git clean -ffdx。非常适用于大仓库或生成非常多文件的时候。
variables:
GIT_STRATEGY: fetch
GIT_CLEAN_FLAGS: none- GIT_CLEAN_FLAGS - GitLab Runner 11.10
- 问题
Docker build cache
Build:
extends: .docker
stage: build
script:
- docker pull $CI_REGISTRY_IMAGE:build || true
- >
docker build
--pull
--cache-from $CI_REGISTRY_IMAGE:build
--tag build-env
-f Dockerfile.build
.
- docker tag build-env $CI_REGISTRY_IMAGE:build
- docker push $CI_REGISTRY_IMAGE:buildRBAC
- Developer 默认不可以操作保护分支
- 可配置允许操作
- Guest
- Reporter
- Developer
- Maintainer
- Owner
- docs.gitlab.com/ee/user/permissions.html
pipeline failed due to the user not being verified
- 使用共享 Runner
- 需要用户验证 - 设置信用卡、不会收费
- 使用自己的 Runner,可以关闭共享
- Setting -> CICD -> Runner (Expand) -> disable Shared runner.
关联信息
反向链接、本文链接的其他页面和外部资料。
References
GitHub2 条
- cobertura/coberturagithub.com/cobertura/cobertura
- golang/go#34094github.com/golang/go/issues/34094
其他外链10 条
- docs.gitlab.com/ee/ci/pipelines/settings.htmldocs.gitlab.com/ee/ci/pipelines/settings.html
- docs.gitlab.com/ee/ci/large_repositoriesdocs.gitlab.com/ee/ci/large_repositories
- docs.gitlab.com/ee/ci/yamldocs.gitlab.com/ee/ci/yaml
- docs.gitlab.com/ee/user/permissions.htmldocs.gitlab.com/ee/user/permissions.html
- docs.gitlab.com/ee/user/project/merge_requests/test_coverage_visualization.htmldocs.gitlab.com/ee/user/project/merge_requests/test_coverage_visualization.html
- gitlab.com/gitlab-org/gitlab-foss/-/issues/30785gitlab.com/gitlab-org/gitlab-foss/-/issues/30785
- gitlab.com/gitlab-org/gitlab-runner/-/issues/280gitlab.com/gitlab-org/gitlab-runner/-/issues/280
- gitlab.com/gitlab-org/gitlab-runner/-/merge_requests/1281gitlab.com/gitlab-org/gitlab-runner/-/merge_requests/1281
- gitlab.com/gitlab-org/gitlab/-/issues/196007gitlab.com/gitlab-org/gitlab/-/issues/196007
- gitlab.com/gitlab-org/gitlab/-/issues/236248gitlab.com/gitlab-org/gitlab/-/issues/236248