ansistrano / deploy

Ansible role to deploy scripting applications like PHP, Python, Ruby, etc. in a capistrano style
https://ansistrano.com
MIT License
2.37k stars 343 forks source link

How to know what exactly version of code was deployed with Git strategy #285

Closed bocharsky-bw closed 6 years ago

bocharsky-bw commented 6 years ago

Hi there!

If I use Git deploy strategy, is there a way to know what exactly hash was deployed in what releases, i.e. what was the latest hash commit in the repo of the release? Sounds like a good feature I think, because 20100509145325 folder name gives me info about when it was deployed, but not what was deployed. Well, I can find out this info but only for the latest release in this way:

cd /path/to/the/cloned/repo
git log

But what about previous releases? Is it possible to cache latest repo hash for them too somehow? Probably I can implement it by myself... but, of course, I'd like to see this feature out of the box.

Cheers!

ricardclau commented 6 years ago

IMHO, this should be a hook so that you can publish it (or create a tmp file) elsewhere

This is why we register ansistrano_git_result at https://github.com/ansistrano/deploy/blob/master/tasks/update-code/git.yml#L45

It is up to you to decide what to do with the deployed version, perhaps send it to rollbar, to some grafana / kibana setup or store a local file to check it out afterwards

ricardclau commented 6 years ago

You can also do a dirty trick

Supply your tag at ansistrano_release_version and this will become the contents of the REVISION file

However, this would also be the folder where code is deployed which might not be what you want

ricardclau commented 6 years ago

Reopening as this is related to #272 and we may consider changing this as it makes sense

ricardclau commented 6 years ago

Fixed in #288