Add custom docker run flags

It seems that running a build container with custom option such as docker run --ulimits should be supported by the cncd package, but including the ulimits key in my .drone.yml is not actually modifying the limits in the container.

pipeline:
  build:
    image: node:8-alpine
    ulimits:
      stack:
        soft: 10000
        hard: 40000
      nofile:
        soft: 10000
        hard: 40000
    commands:
      - apk add --quiet --no-cache openjdk8-jre
      - npm ci
      - ulimit -n
      - ulimit -s
      - npm test
    when:
      event: [ push, pull_request ]

output from running the build

+ ulimit -n
1048576
+ ulimit -s
8192

Does anyone have insight here? network_mode does seem to work although it’s not documented anywhere. If these are meant to be legitimate keys in the drone config file, they we should document them.

Do all the options listed here work? https://github.com/cncd/pipeline/blob/b03959913369b4e2a6c49be514f52d076ef6b172/pipeline/frontend/yaml/container_test.go

After a little bit of experimentation it seems like most of the options except for ulimits do work. Is it impossible to modify the limits for a docker run in drone? I’m trying to run openjdk8-jre and execute a jar for testing in an alpine container. I’m running into a segmentation fault. It might be a problem with the JRE itself, but thought that the stack limit might be then problem.

-f: file size (blocks)             unlimited
-t: cpu time (seconds)             unlimited
-d: data seg size (kb)             unlimited
-s: stack size (kb)                8192
-c: core file size (blocks)        unlimited
-m: resident set size (kb)         unlimited
-l: locked memory (kb)             64
-p: processes                      unlimited
-n: file descriptors               1048576
-v: address space (kb)             unlimited
-w: locks                          unlimited
-e: scheduling priority            0
-r: real-time priority             0```