diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2015-01-23 20:03:22 -0800 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2015-01-23 20:03:22 -0800 |
commit | 389cdbb28c6a5c8fcd432d7cc2ca5a41e0521c2c (patch) | |
tree | 0bb362cf5a61af09af40d304bcb78ca127502b2b | |
parent | 889e86bc0e20e6304e6154f8402dc7ba9e8ad12e (diff) | |
parent | 58513675b69b523f9dd384090148010e69aa96af (diff) | |
download | gitlab-ci-389cdbb28c6a5c8fcd432d7cc2ca5a41e0521c2c.tar.gz |
Merge branch 'master' of dev.gitlab.org:gitlab/gitlab-ci
-rw-r--r-- | CHANGELOG | 3 | ||||
-rw-r--r-- | app/controllers/builds_controller.rb | 4 | ||||
-rw-r--r-- | app/controllers/user_sessions_controller.rb | 4 | ||||
-rw-r--r-- | app/models/project_services/slack_service.rb | 2 | ||||
-rw-r--r-- | app/views/builds/_build.html.haml | 2 | ||||
-rw-r--r-- | app/views/builds/show.html.haml | 2 | ||||
-rw-r--r-- | doc/README.md | 2 | ||||
-rw-r--r-- | lib/api/runners.rb | 4 | ||||
-rw-r--r-- | spec/factories/builds.rb | 1 | ||||
-rw-r--r-- | spec/requests/api/runners_spec.rb | 7 |
10 files changed, 22 insertions, 9 deletions
@@ -1,5 +1,6 @@ v5.5.0 - - + - Fix OAuth login with GitLab installed in relative URL + - v5.4.1 - Fix 500 if on builds page if build has no job diff --git a/app/controllers/builds_controller.rb b/app/controllers/builds_controller.rb index d8ebcc0..93c44e9 100644 --- a/app/controllers/builds_controller.rb +++ b/app/controllers/builds_controller.rb @@ -34,6 +34,10 @@ class BuildsController < ApplicationController end def retry + if @build.commands.blank? + return page_404 + end + build = Build.retry(@build) if params[:return_to] diff --git a/app/controllers/user_sessions_controller.rb b/app/controllers/user_sessions_controller.rb index 044849b..891bbb8 100644 --- a/app/controllers/user_sessions_controller.rb +++ b/app/controllers/user_sessions_controller.rb @@ -43,8 +43,8 @@ class UserSessionsController < ApplicationController GitlabCi.config.gitlab_server.app_secret, { site: GitlabCi.config.gitlab_server.url, - authorize_url: '/oauth/authorize', - token_url: '/oauth/token' + authorize_url: 'oauth/authorize', + token_url: 'oauth/token' } ) end diff --git a/app/models/project_services/slack_service.rb b/app/models/project_services/slack_service.rb index e187a9f..44f0cd4 100644 --- a/app/models/project_services/slack_service.rb +++ b/app/models/project_services/slack_service.rb @@ -50,7 +50,7 @@ class SlackService < Service def can_test? # slack notification is useful only for builds either successful or failed - project.commits.order(id: desc).any? do |commit| + project.commits.order(id: :desc).any? do |commit| case commit.status.to_sym when :failed true diff --git a/app/views/builds/_build.html.haml b/app/views/builds/_build.html.haml index 2cd3d7c..271ceed 100644 --- a/app/views/builds/_build.html.haml +++ b/app/views/builds/_build.html.haml @@ -44,6 +44,6 @@ - if build.active? = link_to cancel_project_build_path(build.project, build, return_to: request.original_url), title: 'Cancel build' do %i.icon-remove.cred - - else + - elsif build.commands.present? = link_to retry_project_build_path(build.project, build, return_to: request.original_url), method: :post, title: 'Retry build' do %i.icon-repeat diff --git a/app/views/builds/show.html.haml b/app/views/builds/show.html.haml index d1a0844..9d8a933 100644 --- a/app/views/builds/show.html.haml +++ b/app/views/builds/show.html.haml @@ -86,7 +86,7 @@ .pull-right - if @build.active? = link_to "Cancel", cancel_project_build_path(@project, @build), class: 'btn btn-sm btn-danger' - - else + - elsif @build.commands.present? = link_to "Retry", retry_project_build_path(@project, @build), class: 'btn btn-sm btn-primary', method: :post - if @build.duration diff --git a/doc/README.md b/doc/README.md index 717f704..9892d6f 100644 --- a/doc/README.md +++ b/doc/README.md @@ -1,6 +1,6 @@ ## The GitLab Documentation covers the following subjects -+ [API](api/api.md) ++ [API](api/README.md) + [Examples](examples/README.md) + [Install](install/installation.md) + [Update](update/README.md) diff --git a/lib/api/runners.rb b/lib/api/runners.rb index f8239a1..79d0b56 100644 --- a/lib/api/runners.rb +++ b/lib/api/runners.rb @@ -33,10 +33,10 @@ module API runner = if params[:token] == GitlabCi::REGISTRATION_TOKEN # Create shared runner. Requires admin access - Runner.create + Runner.create(description: params[:hostname]) elsif project = Project.find_by(token: params[:token]) # Create a specific runner for project. - project.runners.create + project.runners.create(description: params[:hostname]) end return forbidden! unless runner diff --git a/spec/factories/builds.rb b/spec/factories/builds.rb index eacdd76..369f4ee 100644 --- a/spec/factories/builds.rb +++ b/spec/factories/builds.rb @@ -28,5 +28,6 @@ FactoryGirl.define do factory :build do started_at 'Di 29. Okt 09:51:28 CET 2013' finished_at 'Di 29. Okt 09:53:28 CET 2013' + commands 'ls -a' end end diff --git a/spec/requests/api/runners_spec.rb b/spec/requests/api/runners_spec.rb index 7e35e5b..eb5e0ae 100644 --- a/spec/requests/api/runners_spec.rb +++ b/spec/requests/api/runners_spec.rb @@ -45,6 +45,13 @@ describe API::API do it { response.status.should == 201 } end + describe "should create a runner with description" do + before { post api("/runners/register"), token: GitlabCi::REGISTRATION_TOKEN, hostname: "server.hostname" } + + it { response.status.should == 201 } + it { Runner.first.description.should == "server.hostname" } + end + describe "should create a runner if project token provided" do let(:project) { FactoryGirl.create(:project) } before { post api("/runners/register"), token: project.token } |