• 博客园logo
  • 会员
  • 众包
  • 新闻
  • 博问
  • 闪存
  • 赞助商
  • HarmonyOS
  • Chat2DB
    • 搜索
      所有博客
    • 搜索
      当前博客
  • 写随笔 我的博客 短消息 简洁模式
    用户头像
    我的博客 我的园子 账号设置 会员中心 简洁模式 ... 退出登录
    注册 登录

Still_Walking

  • 博客园
  • 联系
  • 订阅
  • 管理

公告

View Post

用centos和gitlab的CI做持续集成

用centos和gitlab的CI做持续集成

1、安装runner

sudo yum install gitlab-ci-multi-runner

2、注册runner
 sudo gitlab-ci-multi-runner register

  Running in system-mode.                                                    
  Please enter the gitlab-ci coordinator URL (e.g. https://gitlab.com/):

  #这里输入gitlab-ci 服务的运行地址,如:https://gitlab.com/, 回车后

  Please enter the gitlab-ci token for this runner

  #这里输入gitlab-ci的token,这个token在gitlab的后台,找到runners,里面有个token

  Please enter the gitlab-ci description for this runner

  #这里输入runner的描述

  Registering runner... succeeded

  Please enter the executor: shell, docker, docker-ssh, ssh?

  #这里选择shell吧

  Runner registered successfully.

3、启动runner

   单次运行:gitlab-ci-multi-runner run

   作为服务运行:

  gitlab-runner install --user "root" --service "shell-001" --working-directory="/data" # 这里安装一个服务

  gitlab-runner start --service shell-001 #启动这个服务

在gitlab的后台能够查看有runner运行。

4、.gitlab-ci.yml 编辑

这是一个ruby on rails的例子:

before_script:
  - git submodule update --init --recursive
  - cp /data/database.yml config/database.yml
  - sudo chmod +777 /usr/local/rvm/gems/ruby-2.3.0
  - gem install bundler
  - bundle install
  - RAILS_ENV=test bundle exec rake db:migrate
job:
  script: "bundle exec rspec"

提交代码应该能够自动运行测试了。

 

 



posted on 2017-06-04 09:37  limanxian  阅读(815)  评论(0)    收藏  举报

刷新页面返回顶部
 
博客园  ©  2004-2025
浙公网安备 33010602011771号 浙ICP备2021040463号-3