2

I'm trying to setup a CI server inside a corporate network with drone (open source edition). Its author describes drone as very simple solution even for programmer (as I am), though some moments are not clear for me (may be official documentation misses them).

First, I've made up an docker image for my rails application: rails-qna. Next, composing drone images:

docker-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

Application is registered on Github and secret/client strings are provided.

I placed .drone.yml file into my project repository:

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

Unclear moments: 1) While registering OAuth application on github, we should specify Homepage URL and authorization callback URL. Where should they point to? Drone server container? Guessing that so, I specified mycorporatedomain.com:3005 and mycorporatedomain.com:3005/authorize and setup port forwarding from 3005 port to 80 port of host, where drone docker is running. May be I'm wrong?

2) What should I specify in key DRONE_GITHUB_URL? https://github.com or full path to my project repository, i.e. https://github.com/khataev/qna?

3) What if I want to build some branch other than master? Were should I specify it? For now drone ready branch (with .drone.yml) is not a master branch - would it work?

4) Why DRONE_GITHUB_GIT_USERNAME and DRONE_GITHUB_GIT_PASSWORD are optional? How it is supposed to work if, I don't specify username and password for my github account?

5) When I start drone images with docker up, I get this errors:

→ 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) this was solved - forgot to specify

DRONE_GITHUB=true
Andrey Khataev
  • 1,303
  • 6
  • 20
  • 46

1 Answers1

3
  1. Homepage URL is the address of the server where drone is running on. E.g. http://155.200.100.0 Authorize URL is the same address appended by /authorize Eg. http://155.200.100.0/authorize

  2. You dont have to specify that. DRONE_GITHUB=true says drone to use github url.

  3. You can limit a single section to a branch or the whole drone build.

Single Section:

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

Whole build process:

pipeline:
  build:
    image: node:latest
    commands:
      - npm install
      - npm test

branches: master
  1. You don't need username and password when using OAuth.

Source:

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

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

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

UPDATE:

Documentation is shifted to http://docs.drone.io/ due to version 0.6 of Drone

Plus Ultra
  • 1,112
  • 1
  • 9
  • 19
  • Thanks, almost done - finished Oauth authorization on github, added .drone.yml (https://github.com/khataev/qna/blob/master/.drone.yml#), added project within drone web-console settings, but its build is not being triggered, when I push commit to master branch. Why? – Andrey Khataev Mar 05 '17 at 17:08
  • Are you using https? – Plus Ultra Mar 05 '17 at 17:14
  • Hmm, how can I check this? Maybe you mean this setting DRONE_GITHUB_URL=https://github.com ? I have it, with https protocol – Andrey Khataev Mar 05 '17 at 17:18
  • You can remove the DRONE_GITHUB_URL completely. Check http://readme.drone.io/admin/installation-guide/ to see a docker-compose example configuration. – Plus Ultra Mar 05 '17 at 17:36
  • I removed this key now. But no success. My docker-compose.yml is just identical to one from readme, except of secrets. You can see it in my initial question. I'm using HTTP (my application and authorization URLs). BTW, is it possible to manually trigger build? http://screenshot.ru/upload/image/zkLe – Andrey Khataev Mar 05 '17 at 19:33
  • Found issue that prevented build triggering - github could not send webhooks to my server due network settings – Andrey Khataev Mar 07 '17 at 09:19