Multiple YAML errors cause internal database error

If there are too many errors in YAML, the error message gets too long, which fails in the database.

Whether this YAML should parse is another question, for example PyYAML’s safe_load loads it fine.

Repro:

kind: pipeline
type: docker
name: default
steps:
  - name: step
    image: alpine
    commands:
      # starts at line 11 for ease of counting
      # each line accounts for a 'line <LINENO>: cannot unmarshal !!map into string', that plus initial 'yaml: unmarshal errors: ' and a space between each error gives us 24 + 43 * N + N - 1 = 23 + 44 * N characters
      # the error column limit is 500 characters so 23 + 44 * N = 500 ; (500 - 23) / 44 = N; N ~= 10.84, so 10 errors will work but 11 will cause an error.
      - echo "Moo: Min"
      - echo "Moo: Min"
      - echo "Moo: Min"
      - echo "Moo: Min"
      - echo "Moo: Min"
      - echo "Moo: Min"
      - echo "Moo: Min"
      - echo "Moo: Min"
      - echo "Moo: Min"
      - echo "Moo: Min"
      # - echo "Moo: Min"  # Uncomment to break Drone.

webhook response: {"message":"pq: value too long for type character varying(500)"}

Postgres statement:

2020-12-31 10:47:41 UTC:10.240.7.252(50612):[email protected]:[2335]:ERROR: value too long for type character varying(500)
2020-12-31 10:47:41 UTC:10.240.7.252(50612):[email protected]:[2335]:STATEMENT:
INSERT INTO builds (
build_repo_id
... snip - nothing relevant, values not there

I don’t know the Drone version cause it’s another team that maintains it and for some reason Drone no longer has its version in the footer but it’s fairly recent.