etsy/deployinator

git_bump_version adds a new line to the version.txt file

Closed this issue · 2 comments

This line https://github.com/etsy/deployinator/blob/master/lib/deployinator/helpers/git.rb#L63 adds a newline to the end of version.txt

Then later when I do something like

def some_version
    %x{ssh <host> 'cat version.txt'}
end

The log ends up with a newline in the file like this:

2015-02-27 20:50:20|PROD|cha|stack production deploy: old a9dcb45150, new: a9dcb45150-20150227-205018-UTC|stack|1425070218-cha-stack_production.html
2015-02-28 00:55:06|PROD|cha|stack production deploy: old 7e964ec402-20150228-003437-UTC
, new: 7e964ec402-20150228-005505-UTC
|stack|1425084904-cha-stack_prod.html

And then the main page errors when it tries to parse the time out of this with this error:

ArgumentError - no time information in "UTC":

I'd be happy submit a pull request, but I don't know if that file has a newline for a reason or if I should just chomp my cat command.

@chuckha In our version helpers we chomp this file (https://github.com/etsy/deployinator/blob/master/lib/deployinator/helpers/version.rb#L43). I would recommend you do the same for your cat in the meantime. The newline is on purpose for getting from a web server instead of over ssh.

@jayson cool, will do, thanks for the explanation!