diff options
author | Angelo Lakra <angelo.lakra@gmail.com> | 2013-10-09 01:15:08 -0600 |
---|---|---|
committer | Angelo Lakra <angelo.lakra@gmail.com> | 2013-10-09 01:15:08 -0600 |
commit | b035790a8a39ec6f7d4c1d2f9f097dc9a8ce5aa4 (patch) | |
tree | 7120369dee18eff372777ebafc7a7fcdd391e840 /lib/api | |
parent | 288fda4f5617d3eb6689317267b953d02fd40d1f (diff) | |
download | gitlab-ci-b035790a8a39ec6f7d4c1d2f9f097dc9a8ce5aa4.tar.gz |
Adding further documentation and corrections on builds and runners
Diffstat (limited to 'lib/api')
-rw-r--r-- | lib/api/builds.rb | 8 | ||||
-rw-r--r-- | lib/api/helpers.rb | 8 | ||||
-rw-r--r-- | lib/api/runners.rb | 11 |
3 files changed, 14 insertions, 13 deletions
diff --git a/lib/api/builds.rb b/lib/api/builds.rb index 75ae4e0..3b70a88 100644 --- a/lib/api/builds.rb +++ b/lib/api/builds.rb @@ -1,10 +1,10 @@ module API - # Issues API + # Builds API class Builds < Grape::API resource :builds do - before { authenticate_runner!} + before { authenticate_runner! } - # Register a build by runner + # Runs oldest pending build by runner # # Parameters: # token (required) - The uniq token of runner @@ -28,7 +28,7 @@ module API # Parameters: # id (required) - The ID of a project # state (optional) - The state of a build - # output (optional) - The trace of a build + # trace (optional) - The trace of a build # Example Request: # PUT /builds/:id put ":id" do diff --git a/lib/api/helpers.rb b/lib/api/helpers.rb index 13719b4..4bea5a2 100644 --- a/lib/api/helpers.rb +++ b/lib/api/helpers.rb @@ -13,6 +13,10 @@ module API end end + def current_runner + @runner ||= Runner.find_by_token(params[:token]) + end + def authenticate! forbidden! unless current_user end @@ -25,10 +29,6 @@ module API forbidden! unless current_runner end - def current_runner - @runner ||= Runner.find_by_token(params[:token]) - end - # Checks the occurrences of required attributes, each attribute must be present in the params hash # or a Bad Request error is invoked. # diff --git a/lib/api/runners.rb b/lib/api/runners.rb index ee7b343..8bf2370 100644 --- a/lib/api/runners.rb +++ b/lib/api/runners.rb @@ -1,16 +1,17 @@ module API - # Issues API + # Runners API class Runners < Grape::API resource :runners do - before { authenticate_runners!} + before { authenticate_runners! } - # Register a build by runner + # Register a new runner # # Parameters: - # token (required) - The uniq token of runner + # token (required) - The unique token of runner + # public_key (required) - Deploy key used to get projects # # Example Request: - # POST /builds/register + # POST /runners/register post "register" do required_attributes! [:token, :public_key] |