Skip to content

Files

Latest commit

 

History

History

gitlabci

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 

GitlabCI

How it works (CI/CD process overview)

If you don’t have a runner, install GitLab Runner and register a runner for your instance, project, or group.

Core Concepts

Script synatx

Use special characters with script

Varibles

Jobs Rules

FAQ

1. Git Submodule - Permission Denied

  • 错误描述(类似如下):
$ git submodule update --init --recursive
Submodule 'lib/urlgrabber' (git@gitlab.colynn.com:linux/urlgrabber.git) registered for path 'lib/urlgrabber'
Cloning into 'lib/urlgrabber'...
Host key verification failed.
fatal: Could not read from remote repository.
  • 解决方案: 方案1)使用相对路径:I had to change the paths in .gitmodules to relative
[submodule "lib/urlgrabber"]
        path = lib/urlgrabber
-       url = git@gitlab.deif.com:linux/urlgrabber.git
+       url = ../../linux/urlgrabber.git

方案2)通过前置脚本修改git config 替换掉git@gitlab.colynn.com:linux/urlgrabber.git

a. 通过为gitlab-ci.yml添加before_script的方式实现替换

before_script:
  - git config --global --add url."https://${GITLAB_USERNAME}:${GITLAB_TOKEN}@gitlab.colynn.com/linux/urlgrabber.git".insteadOf "git@gitlab.colynn.com:linux/urlgrabber.git"

b. 通过runner的配置文件,添加pre_clone_script的方式实现替换

  pre_clone_script="git config --global --add url.\"https://${GITLAB_USERNAME}:${GITLAB_TOKEN}@gitlab.colynn.com/linux/urlgrabber.git\".insteadOf \"git@gitlab.colynn.com:linux/urlgrabber.git\"\n"