Drone.io CI setup

Drone.io CI setup

Drone.io is a Continuous Integration for Github and Bitbucket that monitors your code for bugs. It uses GitHub (or some other online service) to fetch repositories and Docker containers to run the build process.
It can be used as a service (free for public projects), or set up on a custom server for free.
On this page it is described how Drone was configured to build OpenWrt project hosted on GitHub.

Steps

Install and start Docker

This step depends on your build machine so it is not going to be covered here. Please refer to official Docker documentation and see how to install Docker on your machine.

Create Github application

Click the link and create a new application. In this example we are using:
Homepage URL: http://tango.drone.openwrt.ninja/ 
Authorization callback URL: http://tango.drone.openwrt.ninja/authorize
There you will get Client ID and Client Secret. You will use that in the next step.

Create Drone config file

On the host create the file /etc/drone/dronerc with the following content:
REMOTE_DRIVER=github
REMOTE_CONFIG=https://github.com?client_id=&client_secret=

DATABASE_DRIVER=sqlite3
DATABASE_CONFIG=/var/lib/drone/drone.sqlite

Create //.drone.yml// file

In this customized version the .drone.yml must be located on the path /var/lib/drone/.drone.yml. This path is now hard-coded. An example .drone.yml is given as follows:
build:
  image: "sartura/drone-openwrt-builder:arch"
  commands:
    - export FORCE_UNSAFE_CONFIGURE=1
    - make defconfig
    - make -j8
Or to build with a customized configuration:
build:
  image: "owrt/drone-openwrt-builder:arch"
  commands:
    - export FORCE_UNSAFE_CONFIGURE=1
    - make defconfig
    - wget 'https://raw.githubusercontent.com/openwrt-ninja/openwrt-configs/master/default-x86.config' -O .config
    - ./scripts/config/conf --alldefconfig Config.in
    - make -j8

Run Drone Docker container

We are hosting prebuilt Drone Docker images in Docker Hub using the owrt id. That said, if you have followed the above instructions and have Docker up and running this should bring up your own Drone instance:
docker run \\
  --volume /var/lib/drone:/var/lib/drone \\
  --volume /var/run/docker.sock:/var/run/docker.sock \\
  --env-file /etc/drone/dronerc \\
  --restart=always \\
  --publish=80:8000 \\
  --detach=true \\
  --name=drone \\
  owrt/drone:v42-static-recipe

Drone customization

Since OpenWrt builds take a while to complete make sure to increase Timeout in Minutes to a maximum value of 900 minutes.

TODOs

Builds for all architectures

At the moment only the defconfig is built. We should change it so every supported architecture is build tested with Drone CI.

Customization of the drone "continuous-integration/drone" string per architecture and donation

In the Drone CI version 0.4.2 shows hardcoded string on GitHub builds ("continuous-integration/drone"). We are going to chage this so it is clearly visisible which drone build what and if it was sucessful.

Package builds

When a pull request is made for a certain package we should build this minimal version of OpenWrt with the package in question and its dependencies. This can be done but additional scripting inside Drone CI system is needed.

Optimization of the build process

Now, on every pull request everything is built from scratch. We should optimize the process so it does not build the entire toolchain every time and that we use a mirror close to the build servers to download all 3rd party sources.

Popular posts from this blog

Hidden Wiki

[SOLVED] IDM WAS REGISTERED WITH A FAKE SERIAL NUMBER

Mouse, touchpad, and keyboard problems in Windows