Is it possible to access the username running the 'cap deploy' task to use it from a cap task in the Capfile?

17 views
Skip to first unread message

Simón Muñoz

unread,
Jun 5, 2014, 7:30:09 AM6/5/14
to capis...@googlegroups.com
Hi all,

Do you know if it's possible to access the username running the 'cap deploy' task to use it from a cap task in the Capfile?

For example, we need to mark a deploy in newrelic after doing a deploy, so I added a task "mark_deploy" in the capfile that does the work. The problem is that it will be nice to register the user running the 'cap deploy', but for that I need to know the username at the time the "mark" task is invoked.

Thanks in advance!

Lee Hambley

unread,
Jun 5, 2014, 8:42:33 AM6/5/14
to capistrano

--
You received this message because you are subscribed to the Google Groups "Capistrano" group.
To unsubscribe from this group and stop receiving emails from it, send an email to capistrano+...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/capistrano/7ee3cb20-4a5b-4e4c-8e30-557ae3e75415%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Simón Muñoz

unread,
Jun 5, 2014, 10:45:03 AM6/5/14
to capis...@googlegroups.com
Thanks for the help,

I finally discovered that there is a Capistrano global variable just for this:

#{local_user}

Cheers, Simon!

Donovan Bray

unread,
Jun 5, 2014, 10:47:15 AM6/5/14
to capis...@googlegroups.com
if it's informational just use the ruby environment accessor. If you need to trust it more you should use Lee's method. 

puts "Running user: #{ENV['USER']}"
Reply all
Reply to author
Forward
0 new messages