I’m not 100% sure this is a bug, but If you make a comment in the bitrise.yml file and save, the comment is deleted.
I found this out by commenting out a step and saving the file only to find out that the step was now removed.
Unfortunately this is an issue with YAML itself. There’s no “comment” in the data structure you get if you parse a YML/YAML input, the YAML comments will simply be skipped when you parse YAML.
This means that if any tool reads in the YAML and then writes it out again as YAML, it can’t preserve the comments, as those are simply ignored at read / during the parsing.
For general comments in the bitrise.yml
you should use the description
properties, it’s supported on almost all levels, along with title
and summary
: https://github.com/bitrise-io/bitrise/blob/master/_docs/bitrise-yml-format-spec.md
We also have plans to add some kind of “meta” tag to the bitrise.yml
format, where you could store anything else, not just a string, but so far we didn’t see a significant demand for this.
For this the best solution is to use a backup of the yml. You can do this two ways:
- In the Workflow Editor switch to
bitrise.yml
mode and download the yml from there - You can also get a build’s
bitrise.yml
right from the build’s page, and you can restore that yml any time you want to (e.g. by pasting it intobitrise.yml
in the Workflow Editor).
One more thing : if you want to disable a step you can do that by adding a run_if: false
flag to the step. Related docs : http://devcenter.bitrise.io/tips-and-tricks/disable-a-step-by-condition/#disable-a-step
I haven’t checked parser used by Bitrise however, parsers preserving comments do exist. For example: ruamel.yaml · PyPI
ruamel.yaml is a YAML parser/emitter that supports roundtrip preservation of comments, seq/map flow style, and map key order
So it might be a feature that comments are preserved if workflow is edited in bitrise.yml
tab.
Hi @koral, you’re right, some parsers might keep it. That said neither the Ruby nor the Go parser we use does.
To keep comments in the config please use the description, summary and where available meta
tags in the yml. Those are guaranteed to be kept by every parser as those are part of the data.