Using project, stage, status, etc in custom notification

110 views
Skip to first unread message

D Davis

unread,
Mar 16, 2011, 6:08:26 PM3/16/11
to Webistrano
Hi,
I'm brand new to Webistrano and so far so good! I have rails code
successfully deploying to a dozen or so servers.

I apologize if this has been covered in the docs or on this list but I
couldn't find anything. I'm looking to use the project, stage, status
(success, fail), webistrano-user, etc, in a custom notification that
I'm calling from a recipe. Something similar to what is emailed out
but excluding the log. Are any of these variables available to
recipes? I imagine I could customize the underlying code to do this
but I'm not a ruby programmer so I'm hoping someone else has done
something similar or can point me in the right direction.
thx,
dd

Pieter Barrezeele

unread,
Mar 18, 2011, 5:35:34 AM3/18/11
to webis...@googlegroups.com
Hi,

I needed similar variables to be available for my recipes (comment and revision) and modified lib/webistrano/deployer.rb for that:
def set_project_and_stage_names(config)
config.set(:webistrano_project, deployment.stage.project.webistrano_project_name)
config.set(:webistrano_stage, deployment.stage.webistrano_stage_name)
+ config.set(:webistrano_comment, deployment.description)
+ config.set(:webistrano_revision, deployment.revision)
end


I suspect you can do the same for the status, possible for the user as well.

Hope this helps,

Pieter.

Jonathan Weiss

unread,
Mar 19, 2011, 11:09:19 AM3/19/11
to webis...@googlegroups.com, Pieter Barrezeele
> I needed similar variables to be available for my recipes (comment and revision) and modified lib/webistrano/deployer.rb for that:
>     def set_project_and_stage_names(config)
>       config.set(:webistrano_project, deployment.stage.project.webistrano_project_name)
>       config.set(:webistrano_stage, deployment.stage.webistrano_stage_name)
> +      config.set(:webistrano_comment, deployment.description)
> +      config.set(:webistrano_revision, deployment.revision)
>     end
>
> I suspect you can do the same for the status, possible for the user as well.

The stage and project are available by default. The patch above will
give you the comment and revision. The user would work similarly. The
status is a different thing as it is not available yet when those
values are asked for.

Jonathan


--
Jonathan Weiss
http://blog.innerewut.de
http://twitter.com/jweiss

D Davis

unread,
Mar 19, 2011, 7:09:49 PM3/19/11
to Webistrano
Thanks Pieter - I'll give that a shot.

D Davis

unread,
Mar 19, 2011, 8:01:01 PM3/19/11
to Webistrano
Thanks to both of you. Here's my modifications to deployer.rb.
Worked perfectly.

def set_project_and_stage_names(config)
config.set(:webistrano_project,
deployment.stage.project.webistrano_project_name)
config.set(:webistrano_stage,
deployment.stage.webistrano_stage_name)
+ config.set(:webistrano_comment, deployment.description)
+ config.set(:webistrano_revision, deployment.revision)
+ config.set(:webistrano_user, deployment.user.login)
+ config.set(:webistrano_task, deployment.task)
end

dd
Reply all
Reply to author
Forward
0 new messages