Initialisation step for concurrent builds

I have an installation of Drone 0.5 with one server and one agent. I see that sqlite3 database contains two nodes for this single host. I added a project with a large configuration – build matrix contains 27 variants. When I start a build, I see that two variants are being built concurrently. I assume this is due to two nodes. So far so good.

How can I build a particular variant before all others are built? Specifically, in the example above the first variant initializes cache, which is then used by all other variants.

I see that sqlite3 database contains two nodes for this single host

(just an fyi) the node table in the drone database is deprecated and will be removed before the final release. The list of connected nodes will be sourced from the message broker, as described at meta-data endpoints · Issue #6 · drone/mq · GitHub

How can I build a particular variant before all others are built? Specifically, in the example above the first variant initializes cache, which is then used by all other variants.

Sorry, there is no guaranteed ordering for matrix parameters, which means there is no way to guarantee a specific axis in a matrix will execute before all others.

(just an fyi) the node table in the drone database is deprecated and will be removed before the final release.

So if I want to increase parallelism now I have to add rows to nodes, and in the future I should run more agents?
agents table will be dropped too?

Sorry, there is no guaranteed ordering for matrix parameters, which means there is no way to guarantee a specific axis in a matrix will execute before all others.

So I figured out a workaround… and then decided not to use it. :slight_smile: For future readers: the workaround is to use flock and sleep. Small example:

pipeline:
  init:
    …
    environment:
      - GOPATH=/go:/drone
    volumes:
      - drone_cache:/go/src
    commands:
      - flock -x /go/src/lock make init
    when:
      matrix:
        INIT: 1

  build:
    …
    environment:
      - GOPATH=/go:/drone
    volumes:
      - drone_cache:/go/src:ro
    commands:
      - sleep 5
      - flock -s /go/src/lock make test

matrix:
  include:
    - {
        INIT: 1, …
      }
    - {
        …
      }
    - …

Small sleep is required so init step starts before build step, flock then makes sure it finishes before build starts.

I decided not to use because in my case make init downloaded dependencies which are then built by different Go versions in different matrix configurations, and download time is much less than build time (due to cgo).

So if I want to increase parallelism now I have to add rows to nodes

nope, forget this table even exists. It is deprecated and undocumented and will be removed.

to add agents you simply need to run the below docker command. This starts a new agent that will automatically connect to the server and start processing builds from the queue. There is no registration process or database entry or anything like that

docker run -d \
  -e DRONE_SERVER=... \
  -e DRONE_SECRET=... \
  -v /var/run/docker.sock:/var/run/docker.sock \
  --restart=always \
  --name=drone-agent \
  drone/drone:0.5 agent