Commit Graph

561 Commits

Author SHA1 Message Date
Hiro Asari
06ae9bd1fa Fix typo [skip ci] 2013-11-15 11:27:44 -05:00
Hiro Asari
f875a3f3d4 Fix auto-generated endpoints text
Before:
    /endpoints:prefi

After:
    /endpoints/:prefix
2013-11-15 11:05:26 -05:00
Hiro Asari
4556fdf8e1 Account for absence of pretty parameter 2013-11-15 09:43:07 -05:00
Hiro Asari
0e406b3ed1 Accept pretty parameter for pretty formatting
If the parameter is equal to `true` (in any case--`TRUE`, `True`) or
a positive integer, return pretty formatted JSON data.

No tests are necessary.
2013-11-15 09:19:25 -05:00
Hiro Asari
da62a6ce3c Pretty print JSON data
See travis-ci/travis-ci#1555.

JSON data are pretty-formatted for humans.
2013-11-14 21:29:33 -05:00
Piotr Sarnacki
d170b611b0 Connect logs to a different DB if config is present 2013-11-12 22:05:54 +01:00
Hiro Asari
fbf98f9ceb Tweak feed and entry's IDs 2013-11-11 15:43:47 -05:00
Hiro Asari
2645422fd3 Atom feed's date should conform to RFC 3339. 2013-11-11 15:32:41 -05:00
Hiro Asari
3b20120c72 Accept .atom extension
And return Atom feed for builds.
Specs look different, because it needs to explicitly handle the common
case where the client sends `Accept: */*`.
2013-11-11 15:21:14 -05:00
Hiro Asari
ea3a5a7a0d Encode commit message
So that HTML/XML tags in messages don't break the feed.
2013-11-11 14:14:56 -05:00
Hiro Asari
53d2e950b9 Set update element to RFC3339 format
This is required by the RFC.

http://tools.ietf.org/html/rfc4287#section-3.3
2013-11-11 13:56:10 -05:00
Hiro Asari
e945476c8d Prefer JSON to Atom feed
We should not break the current behavior when the client sends
`Accept: */*` HTTP header.
2013-11-11 11:42:48 -05:00
Hiro Asari
26bdd84ae6 Eradicate @builds
Unclear if ivar is beneficial here.
2013-11-11 11:39:06 -05:00
Hiro Asari
30b60283f8 Construct build result URL from parts
Currently, there is no easy way to grab this information from
the Build model.
So we need to construct it from various parts at our disposal.
2013-11-11 09:39:13 -05:00
Hiro Asari
148f2477e8 Use here-doc for Atom feed template
Rather than unnaturally re-reading __FILE__ and splitting,
use a here-doc to clarify the intent.
(Should also consider splitting it to a file.)
2013-11-11 09:03:23 -05:00
Hiro Asari
3fa96de682 WIP: Atom feed for /repos/:owner_name/:name/builds
See travis-ci/travis-core#82

TODO: Link to indivisual build.
TODO: Add specs.
TODO: Review `#apply?`
2013-11-11 09:03:23 -05:00
Piotr Sarnacki
82ceb4fd1f Require states_cache explicitly 2013-11-08 11:23:22 +01:00
Piotr Sarnacki
4c89e067ae Require models and amqp explicitly 2013-11-08 11:05:18 +01:00
Mathias Meyer
1462df6a7e Revert "Hide the /uptime endpoint in the docs."
This reverts commit 477f39a000.
2013-11-07 16:31:29 +01:00
Mathias Meyer
477f39a000 Hide the /uptime endpoint in the docs. 2013-11-07 15:53:59 +01:00
Mathias Meyer
65a806261c It's Travis CI. 2013-11-07 15:10:40 +01:00
Josh Kalderimis
f7450cdb6b removed the branches endpoint
we already have branch info accessible via the repos endpoints, having this at the root level doesn't make sense.
2013-11-06 01:40:42 +01:00
Josh Kalderimis
4deddc5843 add deprecation notice 2013-11-06 01:22:54 +01:00
Josh Kalderimis
92dc3f55ec add 'restart' to the build and job endpoints 2013-11-06 01:18:54 +01:00
Piotr Sarnacki
58f1284244 Merge pull request #85 from travis-ci/insufficient-oauth-redirect
Redirect to web client on insufficient oauth scopes
2013-11-05 05:31:25 -08:00
Josh Kalderimis
609a35ecc3 disabled for over a year, removed from api 2013-11-05 13:42:37 +01:00
Konstantin Haase
6f92f122b0 Merge pull request #90 from travis-ci/jk_remove_artifacts_endpoint
Remove deprecated artifacts endpoint
2013-11-05 04:23:04 -08:00
Konstantin Haase
419fe6fdf9 Merge pull request #88 from travis-ci/jk_remove_workers_endpoints
Remove old workers endpoints
2013-11-05 04:22:44 -08:00
Konstantin Haase
28c019c18d Merge pull request #89 from travis-ci/jk_remove_events_endpoints
Remove the events endpoint
2013-11-05 00:27:52 -08:00
Henrik Hodne
5f3e53da28 Update API docs to use new styles 2013-11-04 21:06:38 -06:00
Josh Kalderimis
26edaf644f remove deprecated artifacts endpoint 2013-11-05 01:05:21 +01:00
Josh Kalderimis
54060dbfc6 removed the events endpoint
it isn't used, and there are no tests, i think it's safe to remove
2013-11-05 00:18:14 +01:00
Josh Kalderimis
342df12b14 remove old workers endpoints 2013-11-04 19:24:17 +01:00
Konstantin Haase
44e1db3944 add API endpoints for listing and deleting caches 2013-11-04 10:23:22 +01:00
Piotr Sarnacki
87674f52bb Redirect to web client on insufficient oauth scopes 2013-10-29 14:27:21 +01:00
Josh Kalderimis
0c3b4d60eb Merge pull request #79 from travis-ci/hh-xml-responder-nil-last-build
Only allow XML response if repo has a build
2013-10-27 10:02:10 -07:00
Josh Kalderimis
542b1ffc80 Merge pull request #83 from travis-ci/hh-cancel-job-wrong-namespac
Move /jobs/:id/cancel to /jobs
2013-10-27 10:01:02 -07:00
Henrik Hodne
824f9cd21d Move /jobs/:id/cancel to /jobs 2013-10-27 01:06:26 -05:00
Konstantin Haase
02c10fe7cb Merge pull request #81 from travis-ci/hh-auth-race-condition
Handle race condition with creating users more nicely
2013-10-26 06:48:12 -07:00
Konstantin Haase
3c8721eac3 Merge pull request #82 from travis-ci/hh-handle-json-parsererrors
Handle JSON parsing errors
2013-10-26 06:47:52 -07:00
Henrik Hodne
dd5cf36eee Handle JSON parsing errors 2013-10-26 08:39:31 -05:00
Henrik Hodne
c64a006f1d Handle race condition with creating users more nicely 2013-10-26 08:33:57 -05:00
Henrik Hodne
65267795f1 Only allow image responses for repositories 2013-10-26 08:19:01 -05:00
Henrik Hodne
44f274d306 Only allow XML response if repo has a build 2013-10-26 08:14:40 -05:00
Henrik Hodne
8f4dd0d2df Respond with 422 if /auth/github does not get a token
Fix #77
2013-10-23 19:35:03 -05:00
Piotr Sarnacki
0cdfa8240c Add source to cancel_build/job 2013-10-16 17:39:31 +02:00
Konstantin Haase
096d08c102 add /repos/:owner_name, fixes travis-ci/travis-ci#1496 2013-10-15 12:24:07 +02:00
Josh Kalderimis
8ccf48fa2a remove the log PUT endpoint, no longer needed 2013-10-05 19:10:09 +02:00
Konstantin Haase
6f72b2cb6b find_branch(es) expects parameter to be called repository_id 2013-10-03 17:25:40 +02:00
Konstantin Haase
93277035cd add repo endpoints for fetching branches 2013-10-03 16:32:30 +02:00
Piotr Sarnacki
d7d2fd5149 Merge pull request #74 from halorgium/fix-error-response
Use valid JSON for error responses
2013-09-23 09:53:55 -07:00
Piotr Sarnacki
cbb99afe89 Check for development rather than production to make it work on staging 2013-09-20 14:09:23 +02:00
Piotr Sarnacki
0681e54cf1 Run CORS middleware in development 2013-09-20 12:47:14 +02:00
Piotr Sarnacki
a49265f872 Disable follower for now 2013-09-10 12:05:18 +02:00
Piotr Sarnacki
1a3ab7f2a7 Always use follower if it's available 2013-09-06 19:49:16 +02:00
Piotr Sarnacki
e587ef0b7f Add nginx config with CORS support 2013-09-05 22:48:42 +02:00
Piotr Sarnacki
fc13284591 Revert "We don't need Rack::Deflater, nginx is doing the job"
This reverts commit 59cd6bac8f.
2013-09-04 21:39:41 +02:00
Piotr Sarnacki
b484a19f27 Prefer follower also for /repos/id and repos list 2013-09-04 20:32:30 +02:00
Piotr Sarnacki
59cd6bac8f We don't need Rack::Deflater, nginx is doing the job 2013-09-04 20:31:36 +02:00
Piotr Sarnacki
2492d710e1 Use new follower API added to Travis::Model 2013-09-04 16:22:32 +02:00
Piotr Sarnacki
d133528893 Use follower for /builds and /jobs 2013-09-03 14:45:12 +02:00
Piotr Sarnacki
dae72e62a8 Use memcachier gem 2013-09-02 13:46:32 +02:00
Piotr Sarnacki
85275895e7 Require dalli before rack/cache 2013-09-02 13:43:14 +02:00
Piotr Sarnacki
d1a6ff7b49 Use MEMCACHIER_SERVERS 2013-09-02 13:41:13 +02:00
Piotr Sarnacki
d549ead325 Fix wrong memcache servers code 2013-09-02 13:23:50 +02:00
Piotr Sarnacki
94922cd625 Start new relic manually 2013-09-02 12:29:13 +02:00
Piotr Sarnacki
0c3e12dfa3 Revert "Disable new relic"
This reverts commit 6412a07ad1.
2013-09-02 11:54:00 +02:00
Piotr Sarnacki
97958a4ce4 Try nginx 2013-09-02 09:52:26 +02:00
Piotr Sarnacki
6412a07ad1 Disable new relic 2013-09-02 09:51:45 +02:00
Tim Carey-Smith
7e8e212321 Use valid JSON for error responses 2013-09-01 23:55:11 +12:00
Mathias Meyer
9d26844eaa Add tests for /uptime. 2013-08-26 17:29:10 +02:00
Mathias Meyer
618241a458 Add an uptime endpoint for Pingdom.
Sends a simple database query to see if we can still connect
to the database. Should help us detect issues like yesterday's
EC2 issues earlier.
2013-08-26 15:30:07 +02:00
Konstantin Haase
c7c33ed2aa also treat empty content type as no content type 2013-08-23 17:39:47 +02:00
Konstantin Haase
60d37634b2 handle missing content-type 2013-08-23 17:10:51 +02:00
Konstantin Haase
e1bcd8d2b1 use timer 2013-08-23 16:59:25 +02:00
Konstantin Haase
d7d6ffc4da meter content-type 2013-08-23 16:53:49 +02:00
Mathias Meyer
d141256671 Revert my puny changes for now.
Will be fixed in travis-web.
2013-08-22 15:21:09 +02:00
Mathias Meyer
8bde2ddb10 blank 2013-08-22 15:05:45 +02:00
Mathias Meyer
7fb90f3975 end end 2013-08-22 15:02:39 +02:00
Mathias Meyer
c711002577 Only return empty builds hash when there are no ids present. 2013-08-22 14:59:19 +02:00
Mathias Meyer
3a90f08d3b Disable the /builds endpoint for now. 2013-08-22 14:49:24 +02:00
Piotr Sarnacki
37ca20b61c Measure cancel request on the beginning of the request 2013-08-21 11:57:00 +02:00
Piotr Sarnacki
526129b5be Add more metriks (cancel build/job and restart build/job) 2013-08-21 11:38:29 +02:00
Piotr Sarnacki
4387867d46 Update encryption task
Don't encrypt Request#token and do encrytion in smaller batches. I also
added sleep(10).
2013-08-15 13:46:05 +02:00
Piotr Sarnacki
f6f8cd9bff Merge branch 'ps-cancel' 2013-08-14 11:04:14 +02:00
Piotr Sarnacki
f19de9d134 Implement jobs/:id/cancel and builds/:id/cancel endpoints 2013-08-08 14:25:20 +02:00
Henrik Hodne
a87b4238b4 Remove call to Travis::Features.start
This was deprecated in
travis-ci/travis-core@53ab3c39d8.
2013-08-05 15:13:28 -07:00
Piotr Sarnacki
e093fde18c Return error with application/json content type by default 2013-08-05 12:10:02 +02:00
Konstantin Haase
1c149bcdb4 use client_domain in config 2013-08-03 14:36:42 +02:00
Piotr Sarnacki
207a6e3e04 Explicitly use self when using info in Authorization 2013-07-27 01:42:14 +02:00
Piotr Sarnacki
c4ebb3d922 Merge branch 'rename-fixes'
Conflicts:
	Gemfile.lock
	lib/travis/api/app/endpoint.rb
2013-07-23 17:08:17 +02:00
Piotr Sarnacki
c194f25a24 Set json content type only when content type is not set 2013-07-16 19:56:53 +02:00
Piotr Sarnacki
8e1a855812 Don't set content type to JSON by default 2013-07-16 19:30:16 +02:00
Konstantin Haase
04ea79ceec fix time parsing 2013-07-11 18:31:29 +02:00
Konstantin Haase
40acdfba4f Revert "also support X-Request-Start"
This reverts commit 63b4ac3338.
2013-07-11 18:28:44 +02:00
Konstantin Haase
63b4ac3338 also support X-Request-Start 2013-07-11 18:22:52 +02:00
Konstantin Haase
03d124d1b7 metrics for request queue 2013-07-11 18:13:23 +02:00
Konstantin Haase
8707f3b357 set X-Middleware-Start for NewRelic 2013-07-11 17:49:21 +02:00
Konstantin Haase
2c361e4292 drop rack-timeout 2013-07-11 17:27:32 +02:00
Konstantin Haase
60af7546a2 add rack-timeout 2013-07-11 16:37:02 +02:00
Henrik Hodne
be2c538d9e Rename metadata => annotations 2013-07-10 16:55:03 -07:00
Henrik Hodne
16a73d9e0b Add PUT /jobs/:id/metadata endpoint 2013-07-09 18:41:47 -07:00
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
Piotr Sarnacki
40430ac34d Encryption rake task - increase batch size, don't be so verbose 2013-07-09 15:18:31 +02:00
Mathias Meyer
e6b61f92f4 Return 420 to a blacklisted client. 2013-07-09 11:37:37 +02:00
Mathias Meyer
a46488078f Add rack-attack, block one client who's hammering us. 2013-07-09 11:02:38 +02:00
Mathias Meyer
ecb60f0050 Extract metric from endpoint and pattern. 2013-06-26 15:06:54 +02:00
Mathias Meyer
d4130312c2 Add a global timer for all requests. 2013-06-26 13:47:38 +02:00
Mathias Meyer
ba97ebcfff Use accept_version. 2013-06-10 14:58:38 +02:00
Mathias Meyer
9e428ea00e Merge branch 'master' into rkh-metrics 2013-06-10 14:52:44 +02:00
Mathias Meyer
1ba02d8e2b Track API version. 2013-06-10 14:50:36 +02:00
Piotr Sarnacki
b5131f94d5 Add rake for encrypting columns in the DB 2013-06-10 11:51:32 +02:00
Mathias Meyer
49015050c1 Merge branch 'master' into rkh-metrics
Conflicts:
	Gemfile.lock
2013-06-10 08:23:42 +02:00
Henrik Hodne
277f0c2f72 Whitelist travis-lite for authentication 2013-06-04 21:57:09 +02:00
Mathias Meyer
5971946d35 Use our own middlewares explicitly. 2013-05-18 11:11:43 +02:00
Mathias Meyer
63d2a69b7d Only track endpoint if an endpoint is set.
For compatibility with the V1 API layer.
2013-05-09 14:18:59 +02:00
Mathias Meyer
78608b81ae Lmao if you Object#method. 2013-05-09 14:13:33 +02:00
Mathias Meyer
729ec6e7fa Require 'metriks'. 2013-05-09 14:04:25 +02:00
Mathias Meyer
c3249a498c Fix Metriks reference. 2013-05-09 13:44:08 +02:00
Mathias Meyer
0cd89de38a Merge branch 'master' into rkh-metrics
Conflicts:
	Gemfile.lock
2013-05-09 13:37:28 +02:00
Piotr Sarnacki
d276cd5b32 Return Oauth headers even if none scope was matched
If an endpoint specifies more than one scope and none of the scopes from
access token matches, return oauth headers for the first of the scopes
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
Piotr Sarnacki
2c23c413ef Save branches in lower groups 2013-05-05 02:46:00 +02:00
Piotr Sarnacki
201e7a3176 Add rake task for updating branch value on builds 2013-05-05 02:15:08 +02:00
Piotr Sarnacki
935288e8e9 Don't load octopus if there is no need 2013-05-05 00:27:10 +02:00
James Dennes
c5b73b1ecc s/autorization/authorization/ 2013-05-03 12:16:12 +02:00
Josh Kalderimis
cd7cce54b5 add some output when the db follower is setup 2013-05-03 10:31:53 +02:00
Josh Kalderimis
a949b58d98 merging all the things 2013-05-03 10:12:16 +02:00
Josh Kalderimis
407a08f644 only use the db follower if use_database_follower is set in the config 2013-05-03 09:42:07 +02:00
Josh Kalderimis
23f3edc60c move the db follower usage to a helper 2013-05-03 09:21:48 +02:00
Piotr Sarnacki
f6d781c248 Enable octopus 2013-05-03 00:43:57 +02:00
Josh Kalderimis
10c8d4b95f hit my head against a wall 2013-05-03 00:43:22 +02:00
Josh Kalderimis
4ea1079d39 turn on octopus in staging 2013-05-03 00:43:22 +02:00
Josh Kalderimis
135008f1ea only add the shards info if in prod mode 2013-05-03 00:43:22 +02:00
Josh Kalderimis
e6f1e22ae8 octopus is on in production by default only 2013-05-03 00:43:22 +02:00
Josh Kalderimis
76e55c0125 i don't think this is the best solution 2013-05-03 00:43:20 +02:00
Josh Kalderimis
a0a92b23fa change the require order 2013-05-03 00:42:30 +02:00
Josh Kalderimis
48c8e8c2a5 merging stuff and fun 2013-05-02 20:06:19 +02:00
Piotr Sarnacki
cd9e089631 Enable octopus 2013-05-02 19:48:23 +02:00
Josh Kalderimis
6feed54684 hit my head against a wall 2013-05-02 19:16:52 +02:00
Josh Kalderimis
1a8b60cc98 turn on octopus in staging 2013-05-02 18:50:59 +02:00
Josh Kalderimis
69b8dff382 only add the shards info if in prod mode 2013-05-02 18:44:27 +02:00
Josh Kalderimis
d72f6ca02d octopus is on in production by default only 2013-05-02 18:23:41 +02:00
Josh Kalderimis
f4132786a6 i don't think this is the best solution 2013-05-02 18:05:32 +02:00
Josh Kalderimis
de6cb2c163 change the require order 2013-05-02 17:21:56 +02:00
Josh Kalderimis
ab2714621f i wonder what i am doing wrong with octopus 2013-05-02 17:08:31 +02:00
Josh Kalderimis
afddbb76ba require octopus 2013-05-02 16:45:34 +02:00
Josh Kalderimis
fa6ea0692d use a follower for one of the repos endpoint 2013-05-02 16:38:20 +02:00
Konstantin Haase
6b2a1a0da8 do not use client credentials for /auth/github 2013-04-24 16:47:52 +02:00
Konstantin Haase
d07f289047 whitespace 2013-04-19 15:52:44 +02:00
Piotr Sarnacki
a830d17554 Fix newrelic
I updated newrelic to beta version, which fixed problems with starting
the dispatcher in some of the environments.
2013-04-17 23:44:51 +02:00
Piotr Sarnacki
426859a7a1 Don't require newrelic in base.rb 2013-04-16 20:37:04 +02:00
Piotr Sarnacki
f4cb2caed0 Try to always require newrelic_rpm 2013-04-16 20:24:18 +02:00
Piotr Sarnacki
2a19cd5bfa Revert "disable new relic"
This reverts commit 48cf45c5f6.
2013-04-16 20:01:14 +02:00
Mathias Meyer
cd98231c42 Add Middle ware for tracking metriks. 2013-04-16 19:47:20 +02:00
Henrik Hodne
6d0aad47ec Update example payloads 2013-04-15 14:11:58 -05:00
Henrik Hodne
a18f211f6f Merge pull request #25 from henrikhodne/add-responses-to-documentation
Add responses to documentation
2013-04-15 02:44:31 -07:00
Henrik Hodne
e38b40e00a Update docs style to look more like the main docs site 2013-04-15 02:04:50 -05:00
Piotr Sarnacki
cc70e15825 Fetch all builds in PR rake task, but skip when it's already filled in 2013-03-27 15:48:47 +01:00
Piotr Sarnacki
0ea7cc3ac4 Update only builds that need to be updated in pull_request_data rake task 2013-03-27 15:04:54 +01:00
Piotr Sarnacki
b4e59caebf Add task to migrate pull request data for builds 2013-03-27 12:58:32 +01:00
Henrik Hodne
6f5f7d0073 Add responses to repository endpoints 2013-03-26 20:41:23 -05:00
Henrik Hodne
c1aaeeee32 Add a way to add responses to documentation
You can add a predefined JSON response by entering
"json(:resource_name)" in the docstring. This will then be replaced
with the resource with the same name, found in
lib/travis/api/app/endpoint/documentation/resources.rb.
2013-03-26 20:40:35 -05: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
2935050395 https is better 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
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
Piotr Sarnacki
2efd1cb9a6 It's .deploy-sha, not .deploy_sha 😡 2013-03-16 16:42:52 +01:00
Piotr Sarnacki
7099331907 Read .deploy-sha file from the proper path 2013-03-16 15:34:59 +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
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
b6f3ef10aa Resource can be nil in Responders::Image 2013-03-11 20:57:45 +01:00
Piotr Sarnacki
04bb751b02 When serving image, return proper Last-Modified header 2013-03-11 20:54:24 +01:00
Henrik Hodne
63155e65b6 Fix link to travis-web
Fix #55
2013-03-03 18:27:29 -06: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
Konstantin Haase
2e6865d55f don't run metrics etc in heroku console 2013-02-14 19:12:26 +01:00
Konstantin Haase
48cf45c5f6 disable new relic 2013-02-13 17:55:11 +01:00
Sven Fuchs
7e005aad1b use travis-core/sf-log-models 2013-02-10 21:30:50 +01:00
Piotr Sarnacki
0eadcfedbd Use redis for sidekiq from config also on staging 2013-02-06 14:20:03 +01:00
Sven Fuchs
b8dfb1cd00 auth PUT to /artifacts/:id 2013-01-30 08:50:27 +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
489a33cbf6 Try 307 redirect on /logs.txt 2013-01-28 19:05:07 +01:00
Konstantin Haase
62b876d2e1 keep query string when redirecting in rewrite middleware 2013-01-28 15:47:28 +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
b81644acba comment out put to /artifacts/:id for now 2013-01-26 20:44:04 +01:00