YAML group merging breaks in drone-cli

Hi,

Some of the .drone.yml files used by my team take advantage of YAML group merging to simplify some repeated sections. This works great on the Drone server but breaks drone exec with an “Invalid or missing image” error message.

Following is an example of a .drone.yml file I’ve verified as working on Drone server 0.8.2 but fails with drone build using Drone CLI 0.8.6.

default_node_setup: &node_lts_carbon_build
  image: node
  pull: true

pipeline:
  lint-client-js:
    <<: *node_lts_carbon_build
    group: checks
    commands:
      - npm run lint:client:js

The build succeeds when run with the following, equivalent, YAML file.

pipeline:
  lint-client-js:
    image: node
    pull: true
    group: checks
    commands:
      - npm run lint:client:js

From a brief glance at Drone server and Drone CLI’s YAML parsing code (linked), it seems the only difference is that Drone CLI performs additional preprocessing using envsubst (see L310 in previous link).

This is a known issue with the go-yaml parser (the yaml library we use). See https://github.com/go-yaml/yaml/issues/184

We are also tracking the upstream yaml issue in the Drone issue tracker, but not much we can do until they have a fix available: https://github.com/drone/drone/issues/2323

1 Like