We eventually got Perforce to consider the script successful by having
the trigger run a shell script which runs the capistrano recipe and
capturing all stderr output.  Yes, not the prettiest of solutions, but
it seems to work.

Perforce Trigger:
staging-sync change-commit //depot/main/... /sha/common/scripts/update-
staging.sh

update-staging.sh:
#!/bin/sh
/usr/local/bin/cap -f /sha/common/scripts/capfile
update_staging_server > /dev/null 2>&1

This brings up the original question: does anyone know a way to
control the absolute and final output of recipes run via Capistrano?

Thanks again,
Casey

On Jun 17, 9:16 am, daphonz <[email protected]> wrote:
> The commit-hook is just the cap recipe:
>
> task :update_staging_server, :roles => :staging_server do
>   run "export P4PORT=perforce.ad.serveraddress:1666;export
> P4USER=username;sudo -u apache p4 sync"
>
>   # We also have to make sure the files can be written by the apache
> user (by default perforce keeps them locked) #
>   run "sudo chmod -R u+w /weblive/wwwroot/"
> end
>
> The trigger in Perforce:
>
> staging-sync change-commit //depot/main/... "sudo -u sha /usr/local/
> bin/cap -f /sha/common/scripts/capfile update_contribute_dev"
>
> When I make a commit in Perforce, this is the message that is
> returned:
>
> 'staging-sync' validation failed: no error message
>
> -casey
>
> On Jun 16, 5:18 pm, Lee Hambley <[email protected]> wrote:
>
> > Casey, you could always (hack, I know) but throw something in the perforce
> > post-commit to return something that you can get on with.
> > What language have you written the Perforce commit hook in?
>
> > - Lee
>
> > 2009/6/16 daphonz <[email protected]>
>
> > > So I'm doing something that's a little backward from a standard
> > > implementation of a capistrano script.
>
> > > First, it's not for deploying a Rails app.  Second, the cap script
> > > *gets* triggered by something else, in this case, after a successful
> > > commit to a Perforce repository.
>
> > > What the script does (successfully) is hop onto one of our sandbox
> > > servers and update the perforce repository there after a developer
> > > makes a commit to the main Perforce repository.  The capistrano file
> > > works fine when executed from the command line by hand.
>
> > > The problem is that we'd like this to be used by the Perforce after-
> > > commit trigger.  The problem that arises from this is that Perforce
> > > considers a trigger script to be "successful" only if it returns 0 at
> > > completion.
>
> > > For whatever reason, Perforce believes that the cap script does not
> > > finish successfully (it does).
>
> > > Does anyone know how to control the final output of a capistrano
> > > script, to be able to return a 0, or anything else that might be
> > > useful in figuring out this problem?
>
> > > (This problem also occurs when running "cap -q" on the script as
> > > well.)
>
> > > Thanks for your help,
> > > Casey

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Capistrano" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.co.uk/group/capistrano?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to