Re:Time to hand over the reins before Capistrano costs me my...
by drags on Sunday October 06, 2013 @07:45PM
(#6505924)
This is where triggering deploys through Jenkins is really helpful. Now you have a record of which SHA was deployed, when it was deployed and a copy of the console log for the deploy. Can't do much better than that.
Re:Time to hand over the reins before Capistrano costs me my...
by sjtgraham on Sunday October 06, 2013 @05:07PM
(#6505447)
Thanks it's not for my benefit, it's for the engineers that might not know better and blindly follow something you say because of your standing in this community. Cargo-culting is not a good habit to encourage in software engineering.
FWIW dates in tags are redundant because the tag itself has a time stamp. Re: environment names in tags, IMO they don't belong in the repo.
Thanks for replying.
Re:Time to hand over the reins before Capistrano costs me my...
by Sujan on Sunday October 06, 2013 @05:27PM
(#6505514)
> FWIW dates in tags are redundant because the tag itself has a time stamp.
Having them in the tagname makes it much easier and more visible.
Re:Time to hand over the reins before Capistrano costs me my...
by sjtgraham on Sunday October 06, 2013 @05:32PM
(#6505535)
Times are in the git log. Same as the commit message/tag name/etc.
Re:Time to hand over the reins before Capistrano costs me my...
by mynameisvlad on Sunday October 06, 2013 @06:22PM
(#6505686)
It's still much easier to scroll down a list of tags and find the right one by date than to look through the git log and look at both a tag name and timestamp.
Re:Time to hand over the reins before Capistrano costs me my...
by Dylan16807 on Monday October 07, 2013 @02:01PM
(#6509989)
Personally I find git log easier to handle than an enormous list of tags.
Re:Time to hand over the reins before Capistrano costs me my...
by Poiesis on Sunday October 06, 2013 @05:42PM
(#6505567)
"Good judgement comes from experience; experience comes from bad judgement."
Re:Time to hand over the reins before Capistrano costs me my...
by enko on Sunday October 06, 2013 @10:57PM
(#6506331)
after "deploy:restart", "deploy:tag_release"
desc 'Tag release'
task :tag_release do
`git checkout #{rails_env}`
`git tag #{rails_env}_#{DateTime.now.strftime "%Y_%m_%d-%H_%M"}`
`git push --tags`
`git checkout master`
end
Boom!
Re:Time to hand over the reins before Capistrano costs me my...
by dnr on Monday October 07, 2013 @02:42AM
(#6506798)
That's not going to match the release name that capistrano chose, right? Seems like you'd want to use latest_release or something.
Re:Time to hand over the reins before Capistrano costs me my...
by bradleyland on Monday October 07, 2013 @02:33PM
(#6510234)
We do the inverse. We tag first, then instruct Capistrano to grab the latest release (with a prompt). We have a release plan though, where software goes through QA before it's tagged. Only software ready for production gets a tag. Everything up to that point is done on a release branch.
set :branch do
default_tag = `git tag`.split("\n").last
tag = Capistrano::CLI.ui.ask "Tag to deploy (make sure to push the tag first): [#{default_tag}] "
tag = default_tag if tag.empty?
tag
end
Re:Time to hand over the reins before Capistrano costs me my...
by enko on Monday October 07, 2013 @03:18AM
(#6506879)
Yeah, modify to taste. I only wanted to post some example code to show how easy it is to automate tagging.
My code won't be appropriate if you don't use master/staging/production branches, either.
Tags, plus sufficiently advanced dependency management and database migrations (n.b. not trivial!), allow you to track and reproduce past states of the deployed software.
For example: A customer reports a problem. You verify the problem exists. The customer reports that the system didn't have the problem last week Tuesday. If you want to know why, tagged releases (and a record of them -- incidentally, another one of the 643 things to know is "All deploys should be recorded somewhere") let you travel in time back to the software in use last Tuesday, verify if the customer's recollection is accurate (well, sorta), and then compare just what has changed rather than trying to run down the bug without any historical context.
Naming things also lets you talk about them, which is helpful, because you'll want to talk about individual releases of the software. (I mean, sure, you could use random hexadecimal numbers, but for whatever reason people find production_release_20131007_3 a bit more informative than 066630de00d242137efab6bf21b8ea04aeee7a1d. One glance at the first one tells you that it's the 3rd deploy from October 7th, assuming you've used the company's naming convention for more than a minute. The second one tells you nothing and is difficult to pull useful information out of without having to manually cross-tabulate it with you git repository, which would be unfortunate if it were e.g. attached to a log file, customer support request, or Wiki article about known-good releases for interacting with external systems.)