Closed halida closed 8 years ago
Do you mean like the git sha or a tag or?
@phallstrom Yes. I read the source code, looks like slackistrano runs on the local, the only way to get version is from remote server, like Airbrake, it runs on the server: https://github.com/airbrake/airbrake/blob/master/lib/airbrake/capistrano/tasks.rb#L10
Ok. I think that is going to be the "date string" capistrano uses. Do you want that or do you want the most recent git sha or something else?
@phallstrom Use git sha is accurate. So we can know which version is deployed.
@phallstrom As you can see the link above, Airbrake implement deploy notification by add an rake task, then trigger it on the server side, so it can fetch git sha and log it. you may consider this method.
Probably the best thing is to make your own custom messenger class and add something like this (or whatever works from your local machine to get the right value)
`git rev-parse origin/#{fetch(:branch)}`.strip!
See https://github.com/phallstrom/slackistrano#customizing-the-messaging
@phallstrom Yes, this is an good idea. maybe you can update helper.rb to add this? Also, I really think make this as default is a good idea:
def payload_for_updated
{attachments: [
{color: 'good',
title: "[#{application}] Deployed",
fields: [
{title: 'Environment',
value: stage,
short: true
},
{title: 'Branch',
value: branch,
short: true
},
{title: 'Deployer',
value: deployer,
short: true
},
{title: 'Time',
value: elapsed_time,
short: true
},
{title: 'Version',
value: `git rev-parse origin/#{branch}`.strip!,
short: false,
}
],
fallback: super[:text],
}]
}
end
@phallstrom Also, run this code may not accurate, local origin cache may not sync with remote origin.
If you can figure out how to utilize Capistrano's SCM class to get this information generically I'd be willing to add it. I don't want to add the above as it's Git specific and not everyone uses it. However, the above is exactly why I broke out the ability to set a custom messaging class so you can do this sort of thing locally.
Is there any way to add git version to the deploy message? so we will know which version is deployed.