diff options
| author | Kamil Trzcinski <ayufan@ayufan.eu> | 2015-10-05 13:12:00 +0200 |
|---|---|---|
| committer | Kamil Trzcinski <ayufan@ayufan.eu> | 2015-10-05 13:12:00 +0200 |
| commit | d2d2df0738f3cd8311963c34d90ebc8ce4081aa6 (patch) | |
| tree | d3f342088131b73b62eb0e5cf494693fd80e5557 /app | |
| parent | 361dc3641dd28c4ecefbda94f7a8dad299c349aa (diff) | |
| download | gitlab-ce-d2d2df0738f3cd8311963c34d90ebc8ce4081aa6.tar.gz | |
Fix next round of tests
Diffstat (limited to 'app')
| -rw-r--r-- | app/controllers/ci/commits_controller.rb | 2 | ||||
| -rw-r--r-- | app/helpers/builds_helper.rb | 4 | ||||
| -rw-r--r-- | app/models/project_services/ci/hip_chat_message.rb | 9 | ||||
| -rw-r--r-- | app/models/project_services/ci/slack_message.rb | 23 | ||||
| -rw-r--r-- | app/models/project_services/gitlab_ci_service.rb | 2 | ||||
| -rw-r--r-- | app/services/ci/create_builds_service.rb | 27 | ||||
| -rw-r--r-- | app/services/ci/create_commit_service.rb | 3 | ||||
| -rw-r--r-- | app/views/ci/commits/show.html.haml | 6 |
8 files changed, 30 insertions, 46 deletions
diff --git a/app/controllers/ci/commits_controller.rb b/app/controllers/ci/commits_controller.rb index acf9189572c..887e92f84cf 100644 --- a/app/controllers/ci/commits_controller.rb +++ b/app/controllers/ci/commits_controller.rb @@ -13,7 +13,7 @@ module Ci end def status - commit = Ci::Project.find(params[:project_id]).commits.find_by_sha!(params[:id], params[:ref_id]) + commit = Ci::Project.find(params[:project_id]).commits.find_by_sha!(params[:id]) render json: commit.to_json(only: [:id, :sha], methods: [:status, :coverage]) rescue ActiveRecord::RecordNotFound render json: { status: "not_found" } diff --git a/app/helpers/builds_helper.rb b/app/helpers/builds_helper.rb index b6658e52d09..626f4e2f4c0 100644 --- a/app/helpers/builds_helper.rb +++ b/app/helpers/builds_helper.rb @@ -3,10 +3,6 @@ module BuildsHelper gitlab_ref_link build.project, build.ref end - def build_compare_link build - gitlab_compare_link build.project, build.commit.short_before_sha, build.short_sha - end - def build_commit_link build gitlab_commit_link build.project, build.short_sha end diff --git a/app/models/project_services/ci/hip_chat_message.rb b/app/models/project_services/ci/hip_chat_message.rb index 73fdbe801c0..0bf448d47f2 100644 --- a/app/models/project_services/ci/hip_chat_message.rb +++ b/app/models/project_services/ci/hip_chat_message.rb @@ -11,14 +11,7 @@ module Ci def to_s lines = Array.new lines.push("<a href=\"#{ci_project_url(project)}\">#{project.name}</a> - ") - - if commit.matrix? - lines.push("<a href=\"#{ci_project_commits_url(project, commit.sha)}\">Commit ##{commit.id}</a></br>") - else - first_build = commit.builds_without_retry.first - lines.push("<a href=\"#{ci_project_build_url(project, first_build)}\">Build '#{first_build.name}' ##{first_build.id}</a></br>") - end - + lines.push("<a href=\"#{ci_project_commits_url(project, commit.sha)}\">Commit ##{commit.id}</a></br>") lines.push("#{commit.short_sha} #{commit.git_author_name} - #{commit.git_commit_message}</br>") lines.push("#{humanized_status(commit_status)} in #{commit.duration} second(s).") lines.join('') diff --git a/app/models/project_services/ci/slack_message.rb b/app/models/project_services/ci/slack_message.rb index 7d254836fb5..a89c01517b7 100644 --- a/app/models/project_services/ci/slack_message.rb +++ b/app/models/project_services/ci/slack_message.rb @@ -23,15 +23,13 @@ module Ci def attachments fields = [] - if commit.matrix? - commit.builds_without_retry.each do |build| - next if build.allow_failure? - next unless build.failed? - fields << { - title: build.name, - value: "Build <#{ci_project_build_url(project, build)}|\##{build.id}> failed in #{build.duration.to_i} second(s)." - } - end + commit.builds_without_retry.each do |build| + next if build.allow_failure? + next unless build.failed? + fields << { + title: build.name, + value: "Build <#{ci_project_build_url(project, build)}|\##{build.id}> failed in #{build.duration.to_i} second(s)." + } end [{ @@ -47,12 +45,7 @@ module Ci def attachment_message out = "<#{ci_project_url(project)}|#{project_name}>: " - if commit.matrix? - out << "Commit <#{ci_project_commits_url(project, commit.sha)}|\##{commit.id}> " - else - build = commit.builds_without_retry.first - out << "Build <#{ci_project_build_url(project, build)}|\##{build.id}> " - end + out << "Commit <#{ci_project_commits_url(project, commit.sha)}|\##{commit.id}> " out << "(<#{commit_sha_link}|#{commit.short_sha}>) " out << "of <#{commit_ref_link}|#{commit.ref}> " out << "by #{commit.git_author_name} " if commit.git_author_name diff --git a/app/models/project_services/gitlab_ci_service.rb b/app/models/project_services/gitlab_ci_service.rb index 8e2b395494e..17d1ef71945 100644 --- a/app/models/project_services/gitlab_ci_service.rb +++ b/app/models/project_services/gitlab_ci_service.rb @@ -52,7 +52,7 @@ class GitlabCiService < CiService ci_project = Ci::Project.find_by(gitlab_id: project.id) if ci_project - Ci::CreateCommitService.new.execute(ci_project, data, current_user) + Ci::CreateCommitService.new.execute(ci_project, current_user, data) end end diff --git a/app/services/ci/create_builds_service.rb b/app/services/ci/create_builds_service.rb index 255fdc41103..c420f3268fd 100644 --- a/app/services/ci/create_builds_service.rb +++ b/app/services/ci/create_builds_service.rb @@ -4,20 +4,23 @@ module Ci builds_attrs = commit.config_processor.builds_for_stage_and_ref(stage, ref, tag) builds_attrs.map do |build_attrs| - build_attrs.slice!(:name, - :commands, - :tag_list, - :options, - :allow_failure, - :stage, - :stage_idx) + # don't create the same build twice + unless commit.builds.find_by(ref: ref, tag: tag, trigger_request: trigger_request, name: build_attrs[:name]) + build_attrs.slice!(:name, + :commands, + :tag_list, + :options, + :allow_failure, + :stage, + :stage_idx) - build_attrs.merge!(ref: ref, - tag: tag, - trigger_request: trigger_request, - user: user) + build_attrs.merge!(ref: ref, + tag: tag, + trigger_request: trigger_request, + user: user) - commit.builds.create!(build_attrs) + commit.builds.create!(build_attrs) + end end end end diff --git a/app/services/ci/create_commit_service.rb b/app/services/ci/create_commit_service.rb index edbb07580c9..fc1ae5774d5 100644 --- a/app/services/ci/create_commit_service.rb +++ b/app/services/ci/create_commit_service.rb @@ -1,7 +1,6 @@ module Ci class CreateCommitService - def execute(project, params, user) - before_sha = params[:before] + def execute(project, user, params) sha = params[:checkout_sha] || params[:after] origin_ref = params[:ref] diff --git a/app/views/ci/commits/show.html.haml b/app/views/ci/commits/show.html.haml index 69487320175..7217671fe95 100644 --- a/app/views/ci/commits/show.html.haml +++ b/app/views/ci/commits/show.html.haml @@ -9,9 +9,9 @@ .gray-content-block.second-block .row .col-sm-6 - %p - %span.attr-name Commit: - #{gitlab_commit_link(@project, @commit.sha)} + %p + %span.attr-name Commit: + #{gitlab_commit_link(@project, @commit.sha)} .col-sm-6 - if @commit.git_author_name || @commit.git_author_email %p |
