drone.iotmpfs

setting up drone agents to have custom /dev/shm


The default drone-agent in 0.5 has a fixed size /dev/shm but I'd like to customise the size of this to be about 1GB.

Is this possible? I tried mounting the host's /dev/shm but that is ignored.

I am quite happy for the /dev/shm to be thrown away after the build but I would expect it to remain persistent within a stage, e.g. all commands in build: should see the same mounted /dev/shm.


Solution

  • Drone supports the shm_size parameter in the .drone.yml file. This is modeled after the Docker compose specification, of which Drone is a super-set.

    The shm_size is customized per container:

    pipeline:
      build:
        image: golang
        commands:
          - go build
          - go test
        shm_size: 1024000000
    

    Note that setting this variable also requires the build to be trusted. This is controlled in the repository settings screen in Drone, and can be toggled by a Drone administrator.

    Disclaimer: I am not familiar with this setting and it was community contributed. You may want to get in touch with olymk2 who authored the pull request to add this setting to Drone.