Commit Graph

200 Commits

Author SHA1 Message Date
Henrik Hodne
b103a7ccb1 Add GET /jobs/:job_id/metadata endpoint 2013-07-09 18:15:32 -07:00
Piotr Sarnacki
3508f25bdf Nullify logins and rename repos owner when updating/creating user 2013-07-10 01:38:10 +02:00
Piotr Sarnacki
b6a351c766 Convert params['ids'] to array
Services like find_builds can accept :ids as a param, but it needs to be
an array, string will be passed to find and converted into integer.
2013-07-09 15:18:31 +02:00
Josh Kalderimis
cf66b6bb6d raise_error(Error) is deprecated 2013-07-08 13:38:50 +02:00
Mathias Meyer
162bf4e3ef Merge branch 'master' into rkh-metrics 2013-06-18 09:51:13 +02:00
Piotr Sarnacki
29fb7292cb Fix tests 2013-06-13 15:54:19 +02:00
Mathias Meyer
49015050c1 Merge branch 'master' into rkh-metrics
Conflicts:
	Gemfile.lock
2013-06-10 08:23:42 +02:00
Henrik Hodne
5f1f189c74 Remove references to "result" in specs
This column has now been removed in favor of the state columns.
2013-05-23 15:48:41 +02:00
Mathias Meyer
c75f76aefb Remove spec for auto-using custom middlewares. 2013-05-18 11:19:15 +02:00
Mathias Meyer
0cd89de38a Merge branch 'master' into rkh-metrics
Conflicts:
	Gemfile.lock
2013-05-09 13:37:28 +02:00
Piotr Sarnacki
cdabec540d Fix scopes and access token specs 2013-05-08 14:11:03 +02:00
Piotr Sarnacki
3b299cfec7 Allow to pass required_params to token
required_params will be matched with actual params to check if the token
may be used for authorization. For example if { job_id: 44 } is passed
as a required param, the token will be rejected for GET /jobs/33
2013-05-08 14:11:03 +02:00
Piotr Sarnacki
56d61ed461 Allow to pass extra params for tokens 2013-05-08 14:11:02 +02:00
Piotr Sarnacki
ee64af14d5 Allow to specify more than one scope for an endpoint 2013-05-08 14:11:02 +02:00
Piotr Sarnacki
1340fdb316 Allow to pass additional responders to respond_with 2013-05-08 14:11:02 +02:00
Piotr Sarnacki
01356df26f Implement expiring access tokens 2013-05-08 14:11:02 +02:00
Konstantin Haase
0d2188b5b2 fix specs 2013-04-24 16:59:26 +02:00
Piotr Sarnacki
be22ff6eda Ensure that we properly handle 404 formats 2013-04-11 14:47:00 +02:00
Piotr Sarnacki
887c835bd4 Use client_domain instead of domain for url in CC.xml 2013-03-25 16:53:20 +01:00
Piotr Sarnacki
15dd13ba02 Merge branch 'pr/46' 2013-03-25 16:40:08 +01:00
Piotr Sarnacki
f3ceee9b28 Always set content_type in responder 2013-03-25 16:39:37 +01:00
Andre Arko
637af8aa44 oh and the spec cares too 2013-03-25 16:16:42 +01:00
Andre Arko
c57e9cbcc6 valid URLs in cc.xml Project webUrl 2013-03-25 16:09:37 +01:00
Andre Arko
6940532994 Ensure proper content type for cc.xml 2013-03-25 16:09:15 +01:00
Piotr Sarnacki
61142c7cf6 Return 404 unless we can find API builder for resource
In order to protect us from rendering a resource simply converted to
json, without processing it with API data class, this commit changes
JSON responder behavior to render 404 if we can't find associated data
class. The only exception to that rule is when resource is already a
Hash, meaning that it was processed before - we sometimes return for
example simple Hash responses like { result: true }.

The Hash exception could allow to accidentally pass resource.as_json to
responder, but in travis-ci/travis-support@124b8b6 I disabled default
as_json method on AR::Base classes, so the risk of such mistake is
lowered.
2013-03-24 19:49:28 +01:00
Konstantin Haase
92be2a3fcd fix test for new autosync 2013-03-20 19:53:38 +01:00
Piotr Sarnacki
705927ff74 Don't error out if xml is requested with something else than repo 2013-03-12 12:08:43 +01:00
Piotr Sarnacki
c0b9a468d6 Forgot to delete one of the tests 2013-03-11 23:58:58 +01:00
Piotr Sarnacki
54a6926aaf Properly handle non existent resources
This commit changes travis-api to always return 404 response if resource
is not available. Previously we were returning image/png with "unknown"
status instead if user used "*/*" Accept header, which was confusing.
2013-03-11 23:52:57 +01:00
Piotr Sarnacki
04bb751b02 When serving image, return proper Last-Modified header 2013-03-11 20:54:24 +01:00
Piotr Sarnacki
5345ef818e Use version from each of the accept headers, not only first one 2013-02-25 17:28:24 +01:00
Piotr Sarnacki
5f91706e64 Allow to pass version as Accept param 2013-02-25 17:28:24 +01:00
Piotr Sarnacki
36783e6359 Handle chunked=true param in Accept header 2013-02-25 17:28:24 +01:00
Piotr Sarnacki
65b1e6b988 Respond with 406 if we can't return requested formats 2013-02-25 17:27:56 +01:00
Piotr Sarnacki
212eb6d9d3 Allow passing more than one mime type in Accept 2013-02-25 17:27:56 +01:00
Piotr Sarnacki
1d7be066cb Make it easy to check if Accept::Entry accepts given mime type 2013-02-25 17:27:56 +01:00
Piotr Sarnacki
c9e99cf2cf Allow more than one type in Accept header 2013-02-25 17:27:56 +01:00
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