Don't reformat and reorder the entire bitrise.yml file
GrahamBorland opened this issue · 2 comments
When you save a file using the offline workflow editor, it reformats and reorders everything in the file. It gives completely different output from the online version of the editor at https://app.bitrise.io/.
This makes it impossible to do a meaningful code-review of the changes you make.
We have to use the offline editor to make changes to our bitrise.yml on a branch, to be reviewed and merged in a PR. The online editor only works on the repo's default branch which is why we can't use it.
For example, here's the result of taking a file which was originally generated by the online editor, and then making a tiny change in the offline editor.
It's reformatted and reordered EVERYTHING.
The root cause for this seems to be that the GET /api/bitrise-yml.json
endpoint of the local API server doesn't do a YAML to JSON conversion but parses the data into a models.BitriseDataModel
structure which it then serializes to JSON.
bitrise-workflow-editor/apiserver/service/bitrise_config.go
Lines 97 to 102 in f7a00bc
The order of the fields inside the BitriseDataModel
is not the same as the one that's used for the Bitrise production server.
Two ways out of this situation that come to mind:
- Convert YAML directly to JSON, or
- reorder the fields inside
BitriseDataModel
and its substructures to match whatever the prod server does.
We recently ran into this issue as well. Some of our devs use the editor on bitrise.io and others run the editor locally. This usually causes large and messy diffs when committing the yml file back to our repo.