diff options
author | Kamil Trzciński <ayufan@ayufan.eu> | 2015-10-05 17:42:50 +0000 |
---|---|---|
committer | Kamil Trzciński <ayufan@ayufan.eu> | 2015-10-05 17:42:50 +0000 |
commit | 3eef0e18e0d4561c320b4a5d9c17d7ae7aaa3d42 (patch) | |
tree | 4cc8a625cb1baebfbc7864ff8eb7746d99610e76 /app/views/ci | |
parent | 97f7edf37a7c3c17d5038a6cb83d007aa026664c (diff) | |
parent | 97a11136d3e7d7ed57c7571d296d7b50617dce16 (diff) | |
download | gitlab-ce-3eef0e18e0d4561c320b4a5d9c17d7ae7aaa3d42.tar.gz |
Merge branch 'refactor-build-service' into 'master'
Refactor Ci::Commit and Ci::Build to have all builds for same :sha on single page
This makes Ci::Commit to have only :sha and simplifies routing to have only :sha in path. The :ref and :push_data is now parameter of Ci::Build.
All commit related data (git author, message and .gitlab-ci.yml) is read directly from repository.
All code related for creating builds is moved to CreateBuildsService.
Status deduction is rewritten to make if more efficient and easier to integrate with Commit Status API.
This is partially working, tests are not yet touched.
This slightly changes view of Commit:
![Screen_Shot_2015-10-02_at_15.21.47](https://gitlab.com/gitlab-org/gitlab-ce/uploads/ad3f1ccdcc87659ea437d8db6c5b9f94/Screen_Shot_2015-10-02_at_15.21.47.png)
@dzaporozhets What do you think?
See merge request !1502
Diffstat (limited to 'app/views/ci')
-rw-r--r-- | app/views/ci/builds/_build.html.haml | 4 | ||||
-rw-r--r-- | app/views/ci/builds/show.html.haml | 11 | ||||
-rw-r--r-- | app/views/ci/commits/_commit.html.haml | 4 | ||||
-rw-r--r-- | app/views/ci/commits/show.html.haml | 68 | ||||
-rw-r--r-- | app/views/ci/notify/build_fail_email.html.haml | 2 | ||||
-rw-r--r-- | app/views/ci/notify/build_fail_email.text.erb | 2 | ||||
-rw-r--r-- | app/views/ci/notify/build_success_email.html.haml | 2 | ||||
-rw-r--r-- | app/views/ci/notify/build_success_email.text.erb | 2 |
8 files changed, 44 insertions, 51 deletions
diff --git a/app/views/ci/builds/_build.html.haml b/app/views/ci/builds/_build.html.haml index 515b862e992..8ccc0dff2fb 100644 --- a/app/views/ci/builds/_build.html.haml +++ b/app/views/ci/builds/_build.html.haml @@ -6,6 +6,10 @@ = link_to ci_project_build_path(build.project, build) do %strong Build ##{build.id} + - if defined?(ref) + %td + = build.ref + %td = build.stage diff --git a/app/views/ci/builds/show.html.haml b/app/views/ci/builds/show.html.haml index 839dbf5c554..c42d11bf05d 100644 --- a/app/views/ci/builds/show.html.haml +++ b/app/views/ci/builds/show.html.haml @@ -1,7 +1,7 @@ #up-build-trace -- if @commit.matrix? +- if @commit.matrix_for_ref?(@build.ref) %ul.center-top-menu - - @commit.builds_without_retry_sorted.each do |build| + - @commit.builds_without_retry_for_ref(build.ref).each do |build| %li{class: ('active' if build == @build) } = link_to ci_project_build_url(@project, build) do = ci_icon_for_status(build.status) @@ -12,7 +12,7 @@ = build.id - - unless @commit.builds_without_retry.include?(@build) + - unless @commit.builds_without_retry_for_ref(@build.ref).include?(@build) %li.active %a Build ##{@build.id} @@ -122,11 +122,6 @@ Commit .pull-right %small #{build_commit_link @build} - - - if @build.commit.compare? - %p - %span.attr-name Compare: - #{build_compare_link @build} %p %span.attr-name Branch: #{build_ref_link @build} diff --git a/app/views/ci/commits/_commit.html.haml b/app/views/ci/commits/_commit.html.haml index 1eacfca944f..f8a1fa50851 100644 --- a/app/views/ci/commits/_commit.html.haml +++ b/app/views/ci/commits/_commit.html.haml @@ -7,7 +7,7 @@ %td.build-link - = link_to ci_project_ref_commits_path(commit.project, commit.ref, commit.sha) do + = link_to ci_project_commits_path(commit.project, commit.sha) do %strong #{commit.short_sha} %td.build-message @@ -16,7 +16,7 @@ %td.build-branch - unless @ref %span - = link_to truncate(commit.ref, length: 25), ci_project_path(@project, ref: commit.ref) + = link_to truncate(commit.last_ref, length: 25), ci_project_path(@project, ref: commit.last_ref) %td.duration - if commit.duration > 0 diff --git a/app/views/ci/commits/show.html.haml b/app/views/ci/commits/show.html.haml index 8f38aa84676..7217671fe95 100644 --- a/app/views/ci/commits/show.html.haml +++ b/app/views/ci/commits/show.html.haml @@ -9,22 +9,14 @@ .gray-content-block.second-block .row .col-sm-6 - - if @commit.compare? - %p - %span.attr-name Compare: - #{gitlab_compare_link(@project, @commit.short_before_sha, @commit.short_sha)} - - else - %p - %span.attr-name Commit: - #{gitlab_commit_link(@project, @commit.sha)} - - %p - %span.attr-name Branch: - #{gitlab_ref_link(@project, @commit.ref)} + %p + %span.attr-name Commit: + #{gitlab_commit_link(@project, @commit.sha)} .col-sm-6 - %p - %span.attr-name Author: - #{@commit.git_author_name} (#{@commit.git_author_email}) + - if @commit.git_author_name || @commit.git_author_email + %p + %span.attr-name Author: + #{@commit.git_author_name} (#{@commit.git_author_email}) - if @commit.created_at %p %span.attr-name Created at: @@ -33,7 +25,7 @@ - if current_user && can?(current_user, :manage_builds, gl_project) .pull-right - if @commit.builds.running_or_pending.any? - = link_to "Cancel", cancel_ci_project_ref_commits_path(@project, @commit.ref, @commit.sha), class: 'btn btn-sm btn-danger' + = link_to "Cancel", cancel_ci_project_commits_path(@project, @commit), class: 'btn btn-sm btn-danger' - if @commit.yaml_errors.present? @@ -43,30 +35,31 @@ - @commit.yaml_errors.split(",").each do |error| %li= error -- unless @commit.push_data[:ci_yaml_file] +- unless @commit.ci_yaml_file .bs-callout.bs-callout-warning \.gitlab-ci.yml not found in this commit -%h3 - Builds - - if @commit.duration > 0 - %small.pull-right - %i.fa.fa-time - #{time_interval_in_words @commit.duration} +- @commit.refs.each do |ref| + %h3 + Builds for #{ref} + - if @commit.duration_for_ref(ref) > 0 + %small.pull-right + %i.fa.fa-time + #{time_interval_in_words @commit.duration_for_ref(ref)} -%table.table.builds - %thead - %tr - %th Status - %th Build ID - %th Stage - %th Name - %th Duration - %th Finished at - - if @project.coverage_enabled? - %th Coverage - %th - = render @commit.builds_without_retry_sorted, controls: true + %table.table.builds + %thead + %tr + %th Status + %th Build ID + %th Stage + %th Name + %th Duration + %th Finished at + - if @project.coverage_enabled? + %th Coverage + %th + = render @commit.builds_without_retry.for_ref(ref), controls: true - if @commit.retried_builds.any? %h3 @@ -77,6 +70,7 @@ %tr %th Status %th Build ID + %th Ref %th Stage %th Name %th Duration @@ -84,4 +78,4 @@ - if @project.coverage_enabled? %th Coverage %th - = render @commit.retried_builds + = render @commit.retried_builds, ref: true diff --git a/app/views/ci/notify/build_fail_email.html.haml b/app/views/ci/notify/build_fail_email.html.haml index d818e8b6756..4ebdfa1b6c0 100644 --- a/app/views/ci/notify/build_fail_email.html.haml +++ b/app/views/ci/notify/build_fail_email.html.haml @@ -11,7 +11,7 @@ %p Author: #{@build.commit.git_author_name} %p - Branch: #{@build.commit.ref} + Branch: #{@build.ref} %p Message: #{@build.commit.git_commit_message} diff --git a/app/views/ci/notify/build_fail_email.text.erb b/app/views/ci/notify/build_fail_email.text.erb index 1add215a1c8..177827f9a3c 100644 --- a/app/views/ci/notify/build_fail_email.text.erb +++ b/app/views/ci/notify/build_fail_email.text.erb @@ -3,7 +3,7 @@ Build failed for <%= @project.name %> Status: <%= @build.status %> Commit: <%= @build.commit.short_sha %> Author: <%= @build.commit.git_author_name %> -Branch: <%= @build.commit.ref %> +Branch: <%= @build.ref %> Message: <%= @build.commit.git_commit_message %> Url: <%= ci_project_build_url(@build.project, @build) %> diff --git a/app/views/ci/notify/build_success_email.html.haml b/app/views/ci/notify/build_success_email.html.haml index a20dcaee24e..7cc43300e88 100644 --- a/app/views/ci/notify/build_success_email.html.haml +++ b/app/views/ci/notify/build_success_email.html.haml @@ -12,7 +12,7 @@ %p Author: #{@build.commit.git_author_name} %p - Branch: #{@build.commit.ref} + Branch: #{@build.ref} %p Message: #{@build.commit.git_commit_message} diff --git a/app/views/ci/notify/build_success_email.text.erb b/app/views/ci/notify/build_success_email.text.erb index 7ebd17e7270..4d55c39b0fb 100644 --- a/app/views/ci/notify/build_success_email.text.erb +++ b/app/views/ci/notify/build_success_email.text.erb @@ -3,7 +3,7 @@ Build successful for <%= @project.name %> Status: <%= @build.status %> Commit: <%= @build.commit.short_sha %> Author: <%= @build.commit.git_author_name %> -Branch: <%= @build.commit.ref %> +Branch: <%= @build.ref %> Message: <%= @build.commit.git_commit_message %> Url: <%= ci_project_build_url(@build.project, @build) %> |