安装无人机与github持续集成

我正在尝试在无人机(开放源代码版本)的公司networking中设置CI服务器。 它的作者将无人驾驶飞机描述为非常简单的解决scheme,即使对于程序员来说(尽pipe我是这样),虽然有些时候我不清楚(可能是官方文档忽略了它们)。

首先,我为我的rails应用程序构build了一个docker镜像:rails-qna。 接下来,撰写无人机图像:

泊坞窗,compose.yml:

version: '2' services: drone-server: image: drone/drone:0.5 ports: - 80:8000 volumes: - ./drone:/var/lib/drone/ restart: always environment: - DRONE_OPEN=true - DRONE_ADMIN=khataev - DRONE_GITHUB_CLIENT=github-client-string - DRONE_GITHUB_SECRET=github-secret-string - DRONE_SECRET=drone-secret-string drone-agent: image: drone/drone:0.5 command: agent restart: always depends_on: [ drone-server ] volumes: - /var/run/docker.sock:/var/run/docker.sock environment: - DRONE_SERVER=ws://drone-server:8000/ws/broker - DRONE_SECRET=drone-secret-string 

应用程序在Github上注册并提供秘密/客户端string。

我把.drone.yml文件放到我的项目库中:

 pipeline: build: image: rails-qna commands: - bundle exec rake db:drop - bundle exec rake db:create - bundle exec rake db:migrate - bundle exec rspec 

不清楚的时刻:1)在github上注册OAuth应用程序时,我们应该指定首页URL和授权callbackURL。 他们应该指向哪里? 无人机服务器容器? 猜测是这样的,我指定mycorporatedomain.com:3005和mycorporatedomain.com:3005/authorize并设置端口从3005端口转发到主机的80端口,无人驾驶docker正在运行。 也许我错了?

2)我应该在关键字DRONE_GITHUB_URL中指定什么? https://github.com或完整的path到我的项目存储库,即https://github.com/khataev/qna ?

3)如果我想要build立一个分支以外的分支呢? 我应该指定它吗? 现在无人机就绪分支(与.drone.yml)不是一个主分支 – 它会工作吗?

4)为什么DRONE_GITHUB_GIT_USERNAME和DRONE_GITHUB_GIT_PASSWORD是可选的 ? 如果我没有为我的github账户指定用户名和密码,它应该如何工作?

5)当我用Docker启动无人机图像时,出现以下错误:

 → docker-compose up Starting drone_drone-server_1 Starting drone_drone-agent_1 Attaching to drone_drone-server_1, drone_drone-agent_1 drone-server_1 | time="2017-03-04T17:00:33Z" level=fatal msg="version control system not configured" drone-agent_1 | 1:M 04 Mar 17:00:35.208 * connecting to server ws://drone-server:8000/ws/broker drone-agent_1 | 1:M 04 Mar 17:00:35.229 # connection failed, retry in 15s. websocket.Dial ws://drone-server:8000/ws/broker: dial tcp: lookup drone-server on 127.0.0.11:53: no such host drone_drone-server_1 exited with code 1 drone-server_1 | time="2017-03-04T16:53:38Z" level=fatal msg="version control system not configured" 

UPD 5)这是解决 – 忘了指定

 DRONE_GITHUB=true 

  1. 主页URL是运行无人机的服务器的地址。 例如http://155.200.100.0授权URL是由/ authorize附加的相同地址例如。 http://155.200.100.0/authorize

  2. 你不必指定。 DRONE_GITHUB = true表示无人机使用githuburl。

  3. 您可以将单个部分限制为分支或整个无人机构build。

单节:

 pipeline: build: image: node:latest commands: - npm install - npm test when: branch: master 

整个构build过程:

 pipeline: build: image: node:latest commands: - npm install - npm test branches: master 
  1. 使用OAuth时,您不需要用户名和密码。

资源:

http://readme.drone.io/admin/setup-github/

http://readme.drone.io/usage/skipping-builds/

http://readme.drone.io/usage/skipping-build-steps/

更新:

由于Drone 0.6的版本,文档被转移到http://docs.drone.io/