-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
41 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
# gitlab持续集成部署(CI/CD),使用docker配置gitlab-runner | ||
## 创建gitlab-runner容器: | ||
``` | ||
sudo docker pull gitlab/gitlab-runner | ||
sudo docker run -d --name gitlab-runner --restart always \ | ||
-v /etc/gitlab-runner/config:/etc/gitlab-runner \ | ||
-v /var/run/docker.sock:/var/run/docker.sock \ | ||
gitlab/gitlab-runner:latest | ||
``` | ||
|
||
## 将gitlab上的项目注册到gitlab-runner中: | ||
``` | ||
sudo docker exec -it gitlab-runner gitlab-ci-multi-runner register | ||
``` | ||
过程如下图: | ||
![Image_text](https://github.com/openthos/community-analysis/blob/master/Daily%20Report/docker_gitlab-runner_register.png) | ||
|
||
- url 与 token 和 gitlab中的project的setting->CI/CD->runner中的一致 | ||
- decription: 可以随意 | ||
- tags: 需要与yml中的对应 | ||
- executer: 因为我这里希望在docker中运行,所以选择 docker | ||
- Docker image: 希望你的project在哪个docker image运行,需要和yml中对应 | ||
|
||
|
||
## 注册成功runner: | ||
![Image_text](https://github.com/openthos/community-analysis/blob/master/Daily%20Report/runner_2.png) | ||
|
||
## .gitlab-ci.yml | ||
``` | ||
image: ubuntu:18.04 | ||
test: | ||
stage: test | ||
script: | ||
- ls -l | ||
tags: | ||
- mdx | ||
``` |