drone convert
command is failed to parse .drone.yml when “matrix”'s “include” or “exclude” is used at the step condition.
drone-cli’s version: 1.1.2
$ drone --version
drone version 1.1.2
Failure case 1
.drone.yml
---
pipeline:
test:
image: alpine:3.9.4
commands:
- echo ${NAME}
when:
matrix:
include:
NAME: main
matrix:
NAME:
- main
- foo
$ drone convert
yaml: unmarshal errors:
line 7: cannot unmarshal !!map into string
Failure case 2
.drone.yml
---
pipeline:
test:
image: alpine:3.9.4
commands:
- echo ${NAME}
when:
matrix:
exclude:
NAME: main
matrix:
NAME:
- main
- foo
$ drone convert
yaml: unmarshal errors:
line 7: cannot unmarshal !!map into string
Success case
.drone.yml
---
pipeline:
test:
image: alpine:3.9.4
commands:
- echo ${NAME}
when:
matrix:
NAME: main
matrix:
NAME:
- main
- foo
$ drone convert
---
kind: pipeline
name: matrix-1
platform:
os: linux
arch: amd64
steps:
- name: test
pull: default
image: alpine:3.9.4
commands:
- echo main
---
kind: pipeline
name: matrix-2
platform:
os: linux
arch: amd64
...
The type of Constraints.Matrix
is map[string]string
, so it is failed to unmarshal the step condtion such as
when:
matrix:
exclude:
NAME: main
I try to fix this bug.
It seems to work well.
Best regards.