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

travis encrypt --add destroys file formatting #651

WhoMeNope opened this issue Jan 20, 2019 · 2 comments

travis encrypt --add destroys file formatting #651

WhoMeNope opened this issue Jan 20, 2019 · 2 comments


Copy link

@WhoMeNope WhoMeNope commented Jan 20, 2019

I know this has been already discussed in #316, #144 and travis-ci/travis-ci#9248

But it's really annoying and completely beats the purpose of automated writing to the file if it destroys the formatting in the process.

Since it only has to check if the given field is present and overwrite it, or if not present append the field to the end of file, I don't think this needs a full parser reimplementation, and probably should be handled as its own case.

Let me now if this sounds reasonable to you.


This comment has been minimized.

Copy link

@jensenak jensenak commented Jul 11, 2019

This is a serious problem. If nothing else, the --add option should simply be removed. If you can't do it nicely, don't do it at all.

The documentation says nothing about this behavior, and it's really problematic. I think the number of issues that have been opened about it should be a decent indicator of how serious this is to people.

In my case, I had some blocks written, but commented out (temporarily). I hadn't yet committed my changes, and travis encrypt --add deleted all of the comments from the file! Saving your work doesn't help you much if a script's undocumented behavior overwrites your saved file.

And to those who think, "well you should have committed first", you may be right. I still think that it's unacceptable for travis to delete content like it does.


This comment has been minimized.

Copy link

@Jay-Plumb Jay-Plumb commented Mar 18, 2020

It's quite surprising that a command to --add a secure key would result in modifications to other parts of the code that have comments attached.

For individuals that are setting up and committing what a given secure key does within travis.yml for the first time, with multiple secure keys, the behaviour to strip out comments is very annoying.

If you are unable to write your own parser to preserve the comments then just have a command such as travis encrypt --add KEY=SECRET_KEY and just output the result for others to manually add to travis.yml file...

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

Successfully merging a pull request may close this issue.

3 participants
You can’t perform that action at this time.