Commit Graph

163 Commits

Author SHA1 Message Date
Piotr Sarnacki
260c46181d Add hack to allow handling redirect to logs on the client properly.
This hack is temporary and should be removed when we find better
solution.

TL;DR: we can't handle redirects to S3 using CORS, so in case we want to
get logs from S3 without additional requests to API, we need to return
status that will not be automatically redirected (in this case 204 seems
like the best answer).

Longer rationale:

Old logs are hosted on S3 now and in case log is not available in the
database, we would like to redirect to the archived log. Although S3
support CORS, our use case breaks on some browsers:

  * when request is triggered to /jobs/:id/log and log is archived, api
    returns 302 redirect, Location header points to the log on S3
  * browser transparently redirects to given url, but it sets Origin to
    null, for security reasons
  * "Origin: null" is ok, because we allow every origin by setting
    AllowedOrigin to "*"
  * S3 returns "Access-Control-Allow-Origin: null" header, which breaks
    some browsers (I confirmed it for webkit based browsers)

In order to fix this, S3 would need to return * in
Access-Control-Allow-Origin header or we would need to tell the browser
to not follow redirect. Both solutions are not achiveable.

Another option would be to return log information in job payload - we
could send log_url field which should be either log url on amazon or
null, but in such case we would need to query artifacts table in each
job request. This is something that should be avoided as archived logs
are not frequently requested - slowing down every request to get info
for it would be a waste.
2013-01-29 03:51:22 +01:00
Piotr Sarnacki
a565522f41 Redirect to full amazon url
Amazon can't work properly with SSL and CNAME for subdomains. For now we
can use full amazon url.
2013-01-28 03:43:28 +01:00
Piotr Sarnacki
31371686c9 Redirect to archive logs 2013-01-28 03:04:36 +01:00
Sven Fuchs
7b4712c32c fix after rebase 2013-01-26 20:54:58 +01:00
Sven Fuchs
d441336573 expose logs on /job/:id/log.txt 2013-01-26 20:43:54 +01:00
Piotr Sarnacki
f2d768080f Return last builds on each branch for /builds?branches=true
This is a hack to fix travis-ci/travis-web#123 easier. A proper solution
would be to refactor how /branches work.
2013-01-26 01:12:47 +01:00
Piotr Sarnacki
c6e3c29a57 Load the data for integration tests upfront
We can do it, because we use :transaction strategy with DatabaseCleaner,
which starts transaction before each test and rollbacks after it. That
way data before each test is consistent.

The big advantage of such approach is that tests are fast now - we need
to only load Scenario data once.

One of the drawbacks, on the other hand, is that we need to always load
this data, even if no integration tests need running.

We can try to be smart about it and check if any integration tests are
loaded.
2013-01-26 00:00:42 +01:00
Piotr Sarnacki
36c40da55d Fix workers tests 2013-01-24 14:37:05 +01:00
Konstantin Haase
07c5f6b61f add extension that keeps track of route pattern 2013-01-23 15:22:06 +01:00
Piotr Sarnacki
e6899b3ce6 Allow to remove ansi chars from plain text log 2013-01-15 02:27:06 +01:00
Piotr Sarnacki
70cd6ef092 Allow to download logs in plain text 2013-01-15 02:23:02 +01:00
Konstantin Haase
01fe983a0c pass if scope does not match 2013-01-13 20:08:56 +01:00
Konstantin Haase
cc2a1cd50e do not require user scope for /auth/github 2013-01-11 17:48:30 +01:00
Konstantin Haase
3d6defe3b1 do not store token from /auth/github 2013-01-11 16:49:08 +01:00
Konstantin Haase
ada6ee0f2c fix scope check 2013-01-11 16:20:53 +01:00
Konstantin Haase
94d8a3cd2e fix failing spec 2013-01-07 21:02:00 +01:00
Konstantin Haase
b005047d95 rename token parameter to github_token for /auth/github 2012-12-12 18:30:55 +01:00
Konstantin Haase
bc1c960c20 add travis_token scope 2012-12-12 17:11:25 +01:00
Sven Fuchs
de16fb07f8 test result images based on the content-disposition header, fix content-disposition header 2012-12-12 15:19:27 +01:00
Sven Fuchs
d113833e9a fix xml responder and result image specs 2012-12-09 16:02:00 +01:00
Sven Fuchs
751e88411b adapt most specs for new states api, some stuff still failing 2012-12-09 15:16:50 +01:00
Piotr Sarnacki
440dacece3 Add endpoints for key regeneration
Enpoints are:

    POST /repos/:id/key

and

    POST /repos/:owner/:name/key

Both versions will replace current ssl key for given repo with the new
one.
2012-12-03 02:54:01 +01:00
Piotr Sarnacki
65637c5731 Add endpoint for getting repo public key 2012-11-26 02:26:34 +01:00
Sven Fuchs
353b5fa502 use registered services 2012-11-23 21:16:10 +01:00
Piotr Sarnacki
f0f471f1c6 Fix updating github oauth token after signing in 2012-11-12 17:15:28 +01:00
Sven Fuchs
5d257b69be fix service hook spec 2012-11-11 02:47:35 +01:00
Sven Fuchs
ab841a0a23 fix tests for cc.xml 2012-11-08 14:47:50 +01:00
Konstantin Haase
f7fdfaa96a enable test 2012-11-08 14:37:32 +01:00
Piotr Sarnacki
1097eaec7e Update travis-core, which fixes PUT /hooks/:id 2012-11-08 03:13:48 +01:00
Piotr Sarnacki
2f87153df9 Move CORS middleware in front of the stack
If there is an error somewhere along the line (like in DB connection
management), it should not interfere with returning proper result for
OPTIONS request. Otherwise it's hard to guess why the actual request in
the browser was not properly sent.
2012-11-05 21:48:13 +01:00
Sven Fuchs
7695788aae rename EVENTS back after reverting stuff in core 2012-11-05 16:17:47 +01:00
Sven Fuchs
889f042cd7 bump travis-core 2012-11-05 02:45:22 +01:00
Piotr Sarnacki
505b2fb911 No need to revalidate if resource is final 2012-11-01 16:15:06 +01:00
Sven Fuchs
28b3099bd0 add specs for build status image urls that filter by multiple branches 2012-10-21 16:21:13 +02:00
Sven Fuchs
270c2fb82d re-add flash messages 2012-10-14 15:11:05 +02:00
Brian Ford
51a07c892b Update spec/support/matchers.rb
Rubinius does not yet destructure block (or method) arguments in 1.9 mode. This change makes the specs pass on Rubinius. It's not clear to me why destructering is being used here. Ruby will already destructure a single Array-ish argument into separate block argument locals. In this case, unless you want, give `a, b` passed, `name, content = a` and NOT `name, content = a, b`, the unparenthesized (ie non-extra-level-destructuring) should work fine. If that makes any sense. :)
2012-10-11 14:58:45 -07:00
Sven Fuchs
7b28ce05cb try fixing rbx 2012-10-11 21:06:28 +02:00
Sven Fuchs
1b9bc9b039 fix specs for cors 2012-10-11 14:07:51 +02:00
Piotr Sarnacki
b53286fe52 Fix syncing and add integration test for it 2012-10-11 13:27:44 +02:00
Piotr Sarnacki
02c503ae19 Make sure that PUT /users/:id returns user hash 2012-10-11 01:30:57 +02:00
Piotr Sarnacki
4f33a93769 Fix PUT /users/:id and add integration test for it 2012-10-11 01:00:53 +02:00
Sven Fuchs
8abd6fa150 manual redirects and rewrite rules for supporting v1 style resources 2012-10-10 01:48:22 +02:00
Sven Fuchs
f8bd49e88b on 404 redirect for /owner/name paths on v1 2012-10-10 01:47:12 +02:00
Sven Fuchs
903f249cfb moar refactoring on responders, fix specs 2012-10-09 18:28:46 +02:00
Sven Fuchs
4328ba8649 adapt services changes from travis-core 2012-10-05 13:06:50 +02:00
Sven Fuchs
c9c9dc61d8 add notes about travis-ci routes 2012-10-03 15:05:17 +02:00
Sven Fuchs
44c9b35421 backup routing specs from travis-ci 2012-10-03 14:57:58 +02:00
Sven Fuchs
6bda358786 cleanup and some notes 2012-10-03 13:14:01 +02:00
Sven Fuchs
f6957636fb refactor to responders, add the cc.xml stuff 2012-10-03 02:19:16 +02:00
Sven Fuchs
5a6f34005c comment out result images for now since i cant get this to work 2012-10-02 21:12:41 +02:00
Sven Fuchs
7eceeb2842 moar work on acceptance tests 2012-10-02 19:10:29 +02:00
Sven Fuchs
289f7c1486 start porting api integration tests 2012-10-02 16:39:38 +02:00
Sven Fuchs
49d428dee1 rbx does't like debugger 2012-10-01 15:23:26 +02:00
Sven Fuchs
da01eba035 fix failing specs 2012-10-01 15:17:18 +02:00
Sven Fuchs
81022ea7b4 rename endpoint to users and fix endpoint specs 2012-09-27 18:49:37 +02:00
Konstantin Haase
ddf404416e fix test 2012-09-20 14:23:18 +02:00
Sven Fuchs
e5ed22843f fix profile endpoint spec 2012-09-19 13:28:24 +02:00
Konstantin Haase
d708b79e13 fix access token related tests 2012-09-19 10:23:57 +02:00
Konstantin Haase
4a59e2286e fix some of the tests 2012-09-19 00:21:53 +02:00
Konstantin Haase
8e179dde4d implement profile endpoint 2012-08-15 01:19:13 +02:00
Konstantin Haase
f05ea7198b fully implement access tokens 2012-08-15 00:52:22 +02:00
Piotr Sarnacki
159a8e105b Implement a few missing endpoints 2012-08-10 13:41:25 +02:00
Konstantin Haase
7baf61054c rewrite all the things 2012-07-27 15:55:57 +02:00