Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CLI should throw an error or warning on duplicate workflow names #517

Open
koral-- opened this issue Jun 26, 2017 · 3 comments
Open

CLI should throw an error or warning on duplicate workflow names #517

koral-- opened this issue Jun 26, 2017 · 3 comments

Comments

@koral--
Copy link
Contributor

koral-- commented Jun 26, 2017

Inspired by bitrise-io/bitrise-workflow-editor#172 and bitrise-io/bitrise-workflow-editor#173 (comment).

Currently, CLI allows duplicated names but "sees" only last one (it is listed by bitrise workflows and run by bitrise 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.

@viktorbenei
Copy link
Contributor

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!

@koral--
Copy link
Contributor Author

koral-- commented Jun 26, 2017

OK, indeed it seems that YAML parser should be responsible for validating this.
There are even (at least) 2 open PRs for that: go-yaml/yaml#248 and go-yaml/yaml#186
Moreover according to this issue: go-yaml/yaml#154 current behavior is invalid and first (not last) mapping should be chosen.

@viktorbenei
Copy link
Contributor

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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants