Continuous Integration with Gitlab CI

principle

There is a concept called in Gitlab-CI  Runner . According to the official definition, there are three types of Runners.

  • Local Runner (advantages: easy to deploy, disadvantages: using the resources MAC/WIN of the development machine)
  • Runner on an ordinary server (advantages: not found, disadvantages: it is particularly difficult to configure in RHEL series machines, so far it has not been successful)
  • Docker-based Runner (Advantages: This is Docker, so ask if you are afraid, Disadvantages: I haven't studied and understood how to use maven local warehouse, and it is extremely slow to process dependencies during Build)

Note that the following information will appear on your project configuration page

After the Runner is successfully installed, it can be bound to the CI according to the lo URL and Token in the above figure, and then various messages will interact between the two ends, and then automatically Build & return the result

use

Let's install  gitlab-ci-multi-runner first  , just use the latest version of the installation under MAC,  see the official documentationhomebrew  for other systems

$ brew update
$ brew install gitlab-ci-multi-runner

#然后启动Runner去和CI进行绑定
$ gitlab-ci-multi-runner register

#-->然后让你输入上图的CI URL
#-->然后让你输入上图的Token
#-->然后随便给Runner命名
#-->然后类型的话, 请务必选 Shell
#-->完毕

#把Runner当成Service启动
$ cd ~
$ gitlab-ci-multi-runner install
% gitlab-ci-multi-runner start

and  travis-ci similar, please create a file in your project root directory  .gitlab-ci.yml , add the following test code

build:
    script: "pwd & mvn test"

If nothing else, there is already a Build in the project that is starting to run

Precautions

  • The local Runner uses bash to build, so be sure to configure all the environment variables, for example  JAVA_HOMEPATH
  • http://www.jianshu.com/p/315cfa4f9e3e

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326624650&siteId=291194637