Setup CI on the Gitlab

Source: Internet
Author: User
Tags dotnet docker run gitlab runner

Installing Gitlab Runner

Docker Pull Gitlab/gitlab-runner

Start Gitlab Runner
Docker run-d--name Gitlab-runner--restart   always-v/var/run/docker.sock:/var/run/docker.sock    -v/srv/gitlab-runner/config:/etc/gitlab-runner   Gitlab/gitlab-runner:latest
Configuring Gitlab Runner
Docker exec-it Gitlab-runner Gitlab-runner Register

Enter the Gitlab CI address, for example: Http://gitlab.com/ci

Input token: Can be found in Gitlab admin area->overview->runners

Enter description information

Enter tag

INPUT type: Docker

Input Image: Ruby2.1

Configuring the CI Script

On the Gitlab Project home page, there are options: Setup CI, which will create a. gitlab-ci.yml file after clicking,

Simple input test script:

image:registry.cn-hangzhou.aliyuncs.com/cjx/tutorialbuild:  stage:build  script:     -  dotnet Restore    -dotnet Run

When finished, runner will automatically run the script.

The pits encountered:

In the beginning, there is a custom Gitlab hosts:gitlab.cjx.com, when the test script is run with runner, even if the host is added when the runner is started, the port 80:connection refused error is reported. Seemingly container inside of the runner at all did not parse this hosts file, finally the hosts removed all with IP access done.

Docker run  --name gitlab-runner--restart   always--add-host gitlab.cjx.com:192.168.  30.129  -v/var/run/docker.sock:/var/run/docker.sock   -v/srv/gitlab-runner/config:/etc /gitlab-runner   Gitlab/gitlab-runner:latest

The specific reasons need to be studied again.

Setup CI on the Gitlab

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.