Open koral-- opened 7 years ago
This is unfortunately due to how the YAML lib works. We don't get any errors or indication, only a hash, and as a hash can contain a key at a level only once one of those workflows are just lost before the CLI gets the data (hash).
I think a regex based workaround could be applied, but I don't think we'll have the time in the near future. If anyone wants to send a PR we'd be glad to review it!
OK, indeed it seems that YAML parser should be responsible for validating this. There are even (at least) 2 open PRs for that: https://github.com/go-yaml/yaml/pull/248 and https://github.com/go-yaml/yaml/pull/186 Moreover according to this issue: https://github.com/go-yaml/yaml/issues/154 current behavior is invalid and first (not last) mapping should be chosen.
current behavior is invalid and first (not last) mapping should be chosen.
to be honest I don't think it should drop either, or at least it should definitely return an error so that the caller side (e.g. our CLI) can decide whether it's a critical issue (we definitely would consider this an error / validation fail)
Inspired by https://github.com/bitrise-io/bitrise-workflow-editor/issues/172 and https://github.com/bitrise-io/bitrise-workflow-editor/issues/173#issuecomment-311123000.
Currently, CLI allows duplicated names but "sees" only last one (it is listed by
bitrise workflows
and run bybitrise run
).Triggers validation is already there (e.g. error is thrown immediately if non-existent workflow is triggered), so it seems that workflow names can also be validated.