Open rjocoleman opened 11 years ago
Yeah! That would be great. Do you know their algorithm? I think it's:
if status is failed or status is not lastrun.status
email
else
no email
We'd probably have to create some kind of REST endpoint; the deployment wrapper script running on your test VM is the only thing that knows the exit status at this point. Maybe a POST back to deployasaurus with the exit code when the run finishes?
I'm more than open to pull requests!
I took a look at this and after_success
doesn't fail on non-zeros, so you're correct there would need to be some kind of wrapper and that approach starts to pull away from the "use any language that Travis will understand" thing.
Eugh, scratch that comment. Hadn't had my coffee.
I'm on the same page. Lemme dig in to the code.
Continuing the discussion from #7, to get access to a user's private email addresses is a special OAuth scope: http://developer.github.com/v3/oauth/#scopes
I haven't found a way to force a failure with after_* scripts. There are two options I see. Move the deployasaurus script into the script section like thus:
script:
- rake
- curl -s "http://www.deployasaur.us/deploy.sh" | bash
Thing is, I can't find anything that suggests whether the second script will be executed on failure. I'll test this out shortly.
Second, invoke your own endpoint to send the email like @adunkman suggested above.
The question is; do you want to a travis test failure if the deployment doesn't work?
I'd venture that you don't because the testing and the deployment are (potentially) two discrete processes. Sure you could be using Travis for straight deployment, then script
is the right place for the process.
However if you're actually testing too then you want the right feedback from Travis about your tests. You want your collaborators to get the correct notifications and hooks into things like GH PRs get the status they deserve.
If the deploy subsequently fails that's a separate issue that deployasaur.us should handle/notify about.
What about after_script
, it runs for every build in the matrix and on both success and failure but AFAIK it still fails on non-zero. TRAVIS_TEST_RESULT
env variable can be parsed to make sure deploy is only happening on a passed test. Ref
There are also webhook notifications but it's preferable to deploy directly from Travis without double handling.
Cool project.
What happens if a deployment fails? Grabbing a non-zero exit status and sending a Travis-style email would be great.