Commit 71777a4a authored by Lin Jen-Shin's avatar Lin Jen-Shin

Rename BuildsController to JobsController

Rename other URL generators

admin_builds_path -> admin_jobs_path

Fix tests and more renaming

Fix more tests

Also change build_id to job_id in the controller
parent a5f06563
class Admin::BuildsController < Admin::ApplicationController class Admin::JobsController < Admin::ApplicationController
def index def index
@scope = params[:scope] @scope = params[:scope]
@all_builds = Ci::Build @all_builds = Ci::Build
...@@ -20,6 +20,6 @@ class Admin::BuildsController < Admin::ApplicationController ...@@ -20,6 +20,6 @@ class Admin::BuildsController < Admin::ApplicationController
def cancel_all def cancel_all
Ci::Build.running_or_pending.each(&:cancel) Ci::Build.running_or_pending.each(&:cancel)
redirect_to admin_builds_path redirect_to admin_jobs_path
end end
end end
...@@ -46,7 +46,7 @@ class Projects::ArtifactsController < Projects::ApplicationController ...@@ -46,7 +46,7 @@ class Projects::ArtifactsController < Projects::ApplicationController
def keep def keep
build.keep_artifacts! build.keep_artifacts!
redirect_to namespace_project_build_path(project.namespace, project, build) redirect_to namespace_project_job_path(project.namespace, project, build)
end end
def latest_succeeded def latest_succeeded
...@@ -79,7 +79,7 @@ class Projects::ArtifactsController < Projects::ApplicationController ...@@ -79,7 +79,7 @@ class Projects::ArtifactsController < Projects::ApplicationController
end end
def build_from_id def build_from_id
project.builds.find_by(id: params[:build_id]) if params[:build_id] project.builds.find_by(id: params[:job_id]) if params[:job_id]
end end
def build_from_ref def build_from_ref
......
class Projects::BuildsController < Projects::ApplicationController class Projects::JobsController < Projects::ApplicationController
before_action :build, except: [:index, :cancel_all] before_action :build, except: [:index, :cancel_all]
before_action :authorize_read_build!, before_action :authorize_read_build!,
...@@ -38,7 +38,7 @@ class Projects::BuildsController < Projects::ApplicationController ...@@ -38,7 +38,7 @@ class Projects::BuildsController < Projects::ApplicationController
build.cancel if can?(current_user, :update_build, build) build.cancel if can?(current_user, :update_build, build)
end end
redirect_to namespace_project_builds_path(project.namespace, project) redirect_to namespace_project_jobs_path(project.namespace, project)
end end
def show def show
...@@ -97,7 +97,7 @@ class Projects::BuildsController < Projects::ApplicationController ...@@ -97,7 +97,7 @@ class Projects::BuildsController < Projects::ApplicationController
def erase def erase
if @build.erase(erased_by: current_user) if @build.erase(erased_by: current_user)
redirect_to namespace_project_build_path(project.namespace, project, @build), redirect_to namespace_project_job_path(project.namespace, project, @build),
notice: "Build has been successfully erased!" notice: "Build has been successfully erased!"
else else
respond_422 respond_422
...@@ -126,6 +126,6 @@ class Projects::BuildsController < Projects::ApplicationController ...@@ -126,6 +126,6 @@ class Projects::BuildsController < Projects::ApplicationController
end end
def build_path(build) def build_path(build)
namespace_project_build_path(build.project.namespace, build.project, build) namespace_project_job_path(build.project.namespace, build.project, build)
end end
end end
...@@ -120,7 +120,7 @@ module BlobHelper ...@@ -120,7 +120,7 @@ module BlobHelper
def blob_raw_url def blob_raw_url
if @build && @entry if @build && @entry
raw_namespace_project_build_artifacts_path(@project.namespace, @project, @build, path: @entry.path) raw_namespace_project_job_artifacts_path(@project.namespace, @project, @build, path: @entry.path)
elsif @snippet elsif @snippet
if @snippet.project_id if @snippet.project_id
raw_namespace_project_snippet_path(@project.namespace, @project, @snippet) raw_namespace_project_snippet_path(@project.namespace, @project, @snippet)
......
...@@ -2,7 +2,7 @@ module BuildsHelper ...@@ -2,7 +2,7 @@ module BuildsHelper
def build_summary(build, skip: false) def build_summary(build, skip: false)
if build.has_trace? if build.has_trace?
if skip if skip
link_to "View job trace", pipeline_build_url(build.pipeline, build) link_to "View job trace", pipeline_job_url(build.pipeline, build)
else else
build.trace.html(last_lines: 10).html_safe build.trace.html(last_lines: 10).html_safe
end end
...@@ -20,8 +20,8 @@ module BuildsHelper ...@@ -20,8 +20,8 @@ module BuildsHelper
def javascript_build_options def javascript_build_options
{ {
page_url: namespace_project_build_url(@project.namespace, @project, @build), page_url: namespace_project_job_url(@project.namespace, @project, @build),
build_url: namespace_project_build_url(@project.namespace, @project, @build, :json), build_url: namespace_project_job_url(@project.namespace, @project, @build, :json),
build_status: @build.status, build_status: @build.status,
build_stage: @build.stage, build_stage: @build.stage,
log_state: '' log_state: ''
...@@ -31,7 +31,7 @@ module BuildsHelper ...@@ -31,7 +31,7 @@ module BuildsHelper
def build_failed_issue_options def build_failed_issue_options
{ {
title: "Build Failed ##{@build.id}", title: "Build Failed ##{@build.id}",
description: namespace_project_build_url(@project.namespace, @project, @build) description: namespace_project_job_url(@project.namespace, @project, @build)
} }
end end
end end
...@@ -50,8 +50,8 @@ module GitlabRoutingHelper ...@@ -50,8 +50,8 @@ module GitlabRoutingHelper
namespace_project_cycle_analytics_path(project.namespace, project, *args) namespace_project_cycle_analytics_path(project.namespace, project, *args)
end end
def project_builds_path(project, *args) def project_jobs_path(project, *args)
namespace_project_builds_path(project.namespace, project, *args) namespace_project_jobs_path(project.namespace, project, *args)
end end
def project_ref_path(project, ref_name, *args) def project_ref_path(project, ref_name, *args)
...@@ -110,8 +110,8 @@ module GitlabRoutingHelper ...@@ -110,8 +110,8 @@ module GitlabRoutingHelper
namespace_project_pipeline_url(pipeline.project.namespace, pipeline.project, pipeline.id, *args) namespace_project_pipeline_url(pipeline.project.namespace, pipeline.project, pipeline.id, *args)
end end
def pipeline_build_url(pipeline, build, *args) def pipeline_job_url(pipeline, build, *args)
namespace_project_build_url(pipeline.project.namespace, pipeline.project, build.id, *args) namespace_project_job_url(pipeline.project.namespace, pipeline.project, build.id, *args)
end end
def commits_url(entity, *args) def commits_url(entity, *args)
...@@ -215,13 +215,13 @@ module GitlabRoutingHelper ...@@ -215,13 +215,13 @@ module GitlabRoutingHelper
case action case action
when 'download' when 'download'
download_namespace_project_build_artifacts_path(*args) download_namespace_project_job_artifacts_path(*args)
when 'browse' when 'browse'
browse_namespace_project_build_artifacts_path(*args) browse_namespace_project_job_artifacts_path(*args)
when 'file' when 'file'
file_namespace_project_build_artifacts_path(*args) file_namespace_project_job_artifacts_path(*args)
when 'raw' when 'raw'
raw_namespace_project_build_artifacts_path(*args) raw_namespace_project_job_artifacts_path(*args)
end end
end end
......
...@@ -51,6 +51,12 @@ module Ci ...@@ -51,6 +51,12 @@ module Ci
after_destroy :update_project_statistics after_destroy :update_project_statistics
class << self class << self
# This is needed for url_for to work,
# as the controller is JobsController
def model_name
ActiveModel::Name.new(self, nil, 'job')
end
def first_pending def first_pending
pending.unstarted.order('created_at ASC').first pending.unstarted.order('created_at ASC').first
end end
......
...@@ -25,7 +25,7 @@ class AnalyticsBuildEntity < Grape::Entity ...@@ -25,7 +25,7 @@ class AnalyticsBuildEntity < Grape::Entity
end end
expose :url do |build| expose :url do |build|
url_to(:namespace_project_build, build) url_to(:namespace_project_job, build)
end end
expose :commit_url do |build| expose :commit_url do |build|
......
...@@ -6,7 +6,7 @@ class BuildActionEntity < Grape::Entity ...@@ -6,7 +6,7 @@ class BuildActionEntity < Grape::Entity
end end
expose :path do |build| expose :path do |build|
play_namespace_project_build_path( play_namespace_project_job_path(
build.project.namespace, build.project.namespace,
build.project, build.project,
build) build)
......
...@@ -6,7 +6,7 @@ class BuildArtifactEntity < Grape::Entity ...@@ -6,7 +6,7 @@ class BuildArtifactEntity < Grape::Entity
end end
expose :path do |build| expose :path do |build|
download_namespace_project_build_artifacts_path( download_namespace_project_job_artifacts_path(
build.project.namespace, build.project.namespace,
build.project, build.project,
build) build)
......
...@@ -5,15 +5,15 @@ class BuildEntity < Grape::Entity ...@@ -5,15 +5,15 @@ class BuildEntity < Grape::Entity
expose :name expose :name
expose :build_path do |build| expose :build_path do |build|
path_to(:namespace_project_build, build) path_to(:namespace_project_job, build)
end end
expose :retry_path do |build| expose :retry_path do |build|
path_to(:retry_namespace_project_build, build) path_to(:retry_namespace_project_job, build)
end end
expose :play_path, if: -> (*) { playable? } do |build| expose :play_path, if: -> (*) { playable? } do |build|
path_to(:play_namespace_project_build, build) path_to(:play_namespace_project_job, build)
end end
expose :playable?, as: :playable expose :playable?, as: :playable
......
...@@ -97,6 +97,7 @@ class DynamicPathValidator < ActiveModel::EachValidator ...@@ -97,6 +97,7 @@ class DynamicPathValidator < ActiveModel::EachValidator
find_file find_file
gitlab-lfs/objects gitlab-lfs/objects
info/lfs/objects info/lfs/objects
jobs
new new
preview preview
raw raw
......
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
%span %span
Groups Groups
= nav_link path: 'builds#index' do = nav_link path: 'builds#index' do
= link_to admin_builds_path, title: 'Jobs' do = link_to admin_jobs_path, title: 'Jobs' do
%span %span
Jobs Jobs
= nav_link path: ['runners#index', 'runners#show'] do = nav_link path: ['runners#index', 'runners#show'] do
......
...@@ -4,15 +4,15 @@ ...@@ -4,15 +4,15 @@
%div{ class: container_class } %div{ class: container_class }
.top-area .top-area
- build_path_proc = ->(scope) { admin_builds_path(scope: scope) } - build_path_proc = ->(scope) { admin_jobs_path(scope: scope) }
= render "shared/builds/tabs", build_path_proc: build_path_proc, all_builds: @all_builds, scope: @scope = render "shared/builds/tabs", build_path_proc: build_path_proc, all_builds: @all_builds, scope: @scope
.nav-controls .nav-controls
- if @all_builds.running_or_pending.any? - if @all_builds.running_or_pending.any?
= link_to 'Cancel all', cancel_all_admin_builds_path, data: { confirm: 'Are you sure?' }, class: 'btn btn-danger', method: :post = link_to 'Cancel all', cancel_all_admin_jobs_path, data: { confirm: 'Are you sure?' }, class: 'btn btn-danger', method: :post
.row-content-block.second-block .row-content-block.second-block
#{(@scope || 'all').capitalize} jobs #{(@scope || 'all').capitalize} jobs
%ul.content-list.builds-content-list.admin-builds-table %ul.content-list.builds-content-list.admin-builds-table
= render "projects/builds/table", builds: @builds, admin: true = render "projects/jobs/table", builds: @builds, admin: true
...@@ -85,7 +85,7 @@ ...@@ -85,7 +85,7 @@
%tr.build %tr.build
%td.id %td.id
- if project - if project
= link_to namespace_project_build_path(project.namespace, project, build) do = link_to namespace_project_job_path(project.namespace, project, build) do
%strong ##{build.id} %strong ##{build.id}
- else - else
%strong ##{build.id} %strong ##{build.id}
......
...@@ -92,7 +92,7 @@ ...@@ -92,7 +92,7 @@
-# Shortcut to Pipelines > Jobs -# Shortcut to Pipelines > Jobs
- if project_nav_tab? :builds - if project_nav_tab? :builds
%li.hidden %li.hidden
= link_to project_builds_path(@project), title: 'Jobs', class: 'shortcuts-builds' do = link_to project_jobs_path(@project), title: 'Jobs', class: 'shortcuts-builds' do
Jobs Jobs
-# Shortcut to commits page -# Shortcut to commits page
......
%a{ href: pipeline_build_url(pipeline, build), style: "color:#3777b0;text-decoration:none;" } %a{ href: pipeline_job_url(pipeline, build), style: "color:#3777b0;text-decoration:none;" }
= build.name = build.name
Job #<%= build.id %> ( <%= pipeline_build_url(pipeline, build) %> ) Job #<%= build.id %> ( <%= pipeline_job_url(pipeline, build) %> )
- path_to_directory = browse_namespace_project_build_artifacts_path(@project.namespace, @project, @build, path: directory.path) - path_to_directory = browse_namespace_project_job_artifacts_path(@project.namespace, @project, @build, path: directory.path)
%tr.tree-item{ 'data-link' => path_to_directory } %tr.tree-item{ 'data-link' => path_to_directory }
%td.tree-item-file-name %td.tree-item-file-name
......
- path_to_file = file_namespace_project_build_artifacts_path(@project.namespace, @project, @build, path: file.path) - path_to_file = file_namespace_project_job_artifacts_path(@project.namespace, @project, @build, path: file.path)
%tr.tree-item{ 'data-link' => path_to_file } %tr.tree-item{ 'data-link' => path_to_file }
- blob = file.blob - blob = file.blob
......
- page_title @path.presence, 'Artifacts', "#{@build.name} (##{@build.id})", 'Jobs' - page_title @path.presence, 'Artifacts', "#{@build.name} (##{@build.id})", 'Jobs'
= render "projects/pipelines/head" = render "projects/pipelines/head"
= render "projects/builds/header", show_controls: false = render "projects/jobs/header", show_controls: false
.tree-holder .tree-holder
.nav-block .nav-block
.tree-controls .tree-controls
= link_to download_namespace_project_build_artifacts_path(@project.namespace, @project, @build), = link_to download_namespace_project_job_artifacts_path(@project.namespace, @project, @build),
rel: 'nofollow', download: '', class: 'btn btn-default download' do rel: 'nofollow', download: '', class: 'btn btn-default download' do
= icon('download') = icon('download')
Download artifacts archive Download artifacts archive
%ul.breadcrumb.repo-breadcrumb %ul.breadcrumb.repo-breadcrumb
%li %li
= link_to 'Artifacts', browse_namespace_project_build_artifacts_path(@project.namespace, @project, @build) = link_to 'Artifacts', browse_namespace_project_job_artifacts_path(@project.namespace, @project, @build)
- path_breadcrumbs do |title, path| - path_breadcrumbs do |title, path|
%li %li
= link_to truncate(title, length: 40), browse_namespace_project_build_artifacts_path(@project.namespace, @project, @build, path) = link_to truncate(title, length: 40), browse_namespace_project_job_artifacts_path(@project.namespace, @project, @build, path)
.tree-content-holder .tree-content-holder
%table.table.tree-table %table.table.tree-table
......
- page_title @path, 'Artifacts', "#{@build.name} (##{@build.id})", 'Jobs' - page_title @path, 'Artifacts', "#{@build.name} (##{@build.id})", 'Jobs'
= render "projects/pipelines/head" = render "projects/pipelines/head"
= render "projects/builds/header", show_controls: false = render "projects/jobs/header", show_controls: false
#tree-holder.tree-holder #tree-holder.tree-holder
.nav-block .nav-block
%ul.breadcrumb.repo-breadcrumb %ul.breadcrumb.repo-breadcrumb
%li %li
= link_to 'Artifacts', browse_namespace_project_build_artifacts_path(@project.namespace, @project, @build) = link_to 'Artifacts', browse_namespace_project_job_artifacts_path(@project.namespace, @project, @build)
- path_breadcrumbs do |title, path| - path_breadcrumbs do |title, path|
- title = truncate(title, length: 40) - title = truncate(title, length: 40)
%li %li
- if path == @path - if path == @path
= link_to file_namespace_project_build_artifacts_path(@project.namespace, @project, @build, path) do = link_to file_namespace_project_job_artifacts_path(@project.namespace, @project, @build, path) do
%strong= title %strong= title
- else - else
= link_to title, browse_namespace_project_build_artifacts_path(@project.namespace, @project, @build, path) = link_to title, browse_namespace_project_job_artifacts_path(@project.namespace, @project, @build, path)
%article.file-holder %article.file-holder
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
%td.branch-commit %td.branch-commit
- if can?(current_user, :read_build, job) - if can?(current_user, :read_build, job)
= link_to namespace_project_build_url(job.project.namespace, job.project, job) do = link_to namespace_project_job_url(job.project.namespace, job.project, job) do
%span.build-link ##{job.id} %span.build-link ##{job.id}
- else - else
%span.build-link ##{job.id} %span.build-link ##{job.id}
...@@ -95,16 +95,16 @@ ...@@ -95,16 +95,16 @@
%td %td
.pull-right .pull-right
- if can?(current_user, :read_build, job) && job.artifacts? - if can?(current_user, :read_build, job) && job.artifacts?
= link_to download_namespace_project_build_artifacts_path(job.project.namespace, job.project, job), rel: 'nofollow', download: '', title: 'Download artifacts', class: 'btn btn-build' do = link_to download_namespace_project_job_artifacts_path(job.project.namespace, job.project, job), rel: 'nofollow', download: '', title: 'Download artifacts', class: 'btn btn-build' do
= icon('download') = icon('download')
- if can?(current_user, :update_build, job) - if can?(current_user, :update_build, job)
- if job.active? - if job.active?
= link_to cancel_namespace_project_build_path(job.project.namespace, job.project, job, return_to: request.original_url), method: :post, title: 'Cancel', class: 'btn btn-build' do = link_to cancel_namespace_project_job_path(job.project.namespace, job.project, job, return_to: request.original_url), method: :post, title: 'Cancel', class: 'btn btn-build' do
= icon('remove', class: 'cred') = icon('remove', class: 'cred')
- elsif allow_retry - elsif allow_retry
- if job.playable? && !admin && can?(current_user, :update_build, job) - if job.playable? && !admin && can?(current_user, :update_build, job)
= link_to play_namespace_project_build_path(job.project.namespace, job.project, job, return_to: request.original_url), method: :post, title: 'Play', class: 'btn btn-build' do = link_to play_namespace_project_job_path(job.project.namespace, job.project, job, return_to: request.original_url), method: :post, title: 'Play', class: 'btn btn-build' do
= custom_icon('icon_play') = custom_icon('icon_play')
- elsif job.retryable? - elsif job.retryable?
= link_to retry_namespace_project_build_path(job.project.namespace, job.project, job, return_to: request.original_url), method: :post, title: 'Retry', class: 'btn btn-build' do = link_to retry_namespace_project_job_path(job.project.namespace, job.project, job, return_to: request.original_url), method: :post, title: 'Retry', class: 'btn btn-build' do
= icon('repeat') = icon('repeat')
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
= render 'ci/status/badge', status: @build.detailed_status(current_user), link: false, title: @build.status_title = render 'ci/status/badge', status: @build.detailed_status(current_user), link: false, title: @build.status_title
%strong %strong
Job Job
= link_to "##{@build.id}", namespace_project_build_path(@project.namespace, @project, @build), class: 'js-build-id' = link_to "##{@build.id}", namespace_project_job_path(@project.namespace, @project, @build), class: 'js-build-id'
in pipeline in pipeline
%strong %strong
= link_to "##{pipeline.id}", pipeline_path(pipeline) = link_to "##{pipeline.id}", pipeline_path(pipeline)
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
%strong %strong
= link_to @build.ref, project_ref_path(@project, @build.ref), class: 'ref-name' = link_to @build.ref, project_ref_path(@project, @build.ref), class: 'ref-name'
= render "projects/builds/user" if @build.user = render "projects/jobs/user" if @build.user
= time_ago_with_tooltip(@build.created_at) = time_ago_with_tooltip(@build.created_at)
...@@ -26,6 +26,6 @@ ...@@ -26,6 +26,6 @@
- if can?(current_user, :create_issue, @project) && @build.failed? - if can?(current_user, :create_issue, @project) && @build.failed?
= link_to "New issue", new_namespace_project_issue_path(@project.namespace, @project, issue: build_failed_issue_options), class: 'btn btn-new btn-inverted' = link_to "New issue", new_namespace_project_issue_path(@project.namespace, @project, issue: build_failed_issue_options), class: 'btn btn-new btn-inverted'
- if can?(current_user, :update_build, @build) && @build.retryable? - if can?(current_user, :update_build, @build) && @build.retryable?
= link_to "Retry job", retry_namespace_project_build_path(@project.namespace, @project, @build), class: 'btn btn-inverted-secondary', method: :post = link_to "Retry job", retry_namespace_project_job_path(@project.namespace, @project, @build), class: 'btn btn-inverted-secondary', method: :post
%button.btn.btn-default.pull-right.visible-xs-block.visible-sm-block.build-gutter-toggle.js-sidebar-build-toggle{ role: "button", type: "button" } %button.btn.btn-default.pull-right.visible-xs-block.visible-sm-block.build-gutter-toggle.js-sidebar-build-toggle{ role: "button", type: "button" }
= icon('angle-double-left') = icon('angle-double-left')
...@@ -30,21 +30,21 @@ ...@@ -30,21 +30,21 @@
- if @build.artifacts? - if @build.artifacts?
.btn-group.btn-group-justified{ role: :group } .btn-group.btn-group-justified{ role: :group }
- if @build.has_expiring_artifacts? && can?(current_user, :update_build, @build) - if @build.has_expiring_artifacts? && can?(current_user, :update_build, @build)
= link_to keep_namespace_project_build_artifacts_path(@project.namespace, @project, @build), class: 'btn btn-sm btn-default', method: :post do = link_to keep_namespace_project_job_artifacts_path(@project.namespace, @project, @build), class: 'btn btn-sm btn-default', method: :post do
Keep Keep
= link_to download_namespace_project_build_artifacts_path(@project.namespace, @project, @build), rel: 'nofollow', download: '', class: 'btn btn-sm btn-default' do = link_to download_namespace_project_job_artifacts_path(@project.namespace, @project, @build), rel: 'nofollow', download: '', class: 'btn btn-sm btn-default' do
Download Download
- if @build.artifacts_metadata? - if @build.artifacts_metadata?
= link_to browse_namespace_project_build_artifacts_path(@project.namespace, @project, @build), class: 'btn btn-sm btn-default' do = link_to browse_namespace_project_job_artifacts_path(@project.namespace, @project, @build), class: 'btn btn-sm btn-default' do
Browse Browse
.block{ class: ("block-first" if !@build.coverage && !(can?(current_user, :read_build, @project) && (@build.artifacts? || @build.artifacts_expired?))) } .block{ class: ("block-first" if !@build.coverage && !(can?(current_user, :read_build, @project) && (@build.artifacts? || @build.artifacts_expired?))) }
.title .title
Job details Job details
- if can?(current_user, :update_build, @build) && @build.retryable? - if can?(current_user, :update_build, @build) && @build.retryable?
= link_to "Retry job", retry_namespace_project_build_path(@project.namespace, @project, @build), class: 'pull-right retry-link', method: :post = link_to "Retry job", retry_namespace_project_job_path(@project.namespace, @project, @build), class: 'pull-right retry-link', method: :post
- if @build.merge_request - if @build.merge_request
%p.build-detail-row %p.build-detail-row
%span.build-light-text Merge Request: %span.build-light-text Merge Request:
...@@ -69,11 +69,11 @@ ...@@ -69,11 +69,11 @@
\##{@build.runner.id} \##{@build.runner.id}
.btn-group.btn-group-justified{ role: :group } .btn-group.btn-group-justified{ role: :group }
- if @build.has_trace? - if @build.has_trace?
= link_to 'Raw', raw_namespace_project_build_path(@project.namespace, @project, @build), class: 'btn btn-sm btn-default' = link_to 'Raw', raw_namespace_project_job_path(@project.namespace, @project, @build), class: 'btn btn-sm btn-default'
- if @build.active? - if @build.active?
= link_to "Cancel", cancel_namespace_project_build_path(@project.namespace, @project, @build), class: 'btn btn-sm btn-default', method: :post = link_to "Cancel", cancel_namespace_project_job_path(@project.namespace, @project, @build), class: 'btn btn-sm btn-default', method: :post
- if can?(current_user, :update_build, @project) && @build.erasable? - if can?(current_user, :update_build, @project) && @build.erasable?
= link_to erase_namespace_project_build_path(@project.namespace, @project, @build), = link_to erase_namespace_project_job_path(@project.namespace, @project, @build),
class: "btn btn-sm btn-default", method: :post, class: "btn btn-sm btn-default", method: :post,
data: { confirm: "Are you sure you want to erase this build?" } do data: { confirm: "Are you sure you want to erase this build?" } do
Erase Erase
...@@ -126,7 +126,7 @@ ...@@ -126,7 +126,7 @@
- HasStatus::ORDERED_STATUSES.each do |build_status| - HasStatus::ORDERED_STATUSES.each do |build_status|
- builds.select{|build| build.status == build_status}.each do |build| - builds.select{|build| build.status == build_status}.each do |build|
.build-job{ class: sidebar_build_class(build, @build), data: { stage: build.stage } } .build-job{ class: sidebar_build_class(build, @build), data: { stage: build.stage } }
= link_to namespace_project_build_path(@project.namespace, @project, build) do = link_to namespace_project_job_path(@project.namespace, @project, build) do
= icon('arrow-right') = icon('arrow-right')
%span{ class: "ci-status-icon-#{build.status}" } %span{ class: "ci-status-icon-#{build.status}" }
= ci_icon_for_status(build.status) = ci_icon_for_status(build.status)
......
...@@ -4,13 +4,13 @@ ...@@ -4,13 +4,13 @@
%div{ class: container_class } %div{ class: container_class }
.top-area .top-area
- build_path_proc = ->(scope) { project_builds_path(@project, scope: scope) } - build_path_proc = ->(scope) { project_jobs_path(@project, scope: scope) }
= render "shared/builds/tabs", build_path_proc: build_path_proc, all_builds: @all_builds, scope: @scope = render "shared/builds/tabs", build_path_proc: build_path_proc, all_builds: @all_builds, scope: @scope
.nav-controls .nav-controls
- if can?(current_user, :update_build, @project) - if can?(current_user, :update_build, @project)
- if @all_builds.running_or_pending.any? - if @all_builds.running_or_pending.any?
= link_to 'Cancel running', cancel_all_namespace_project_builds_path(@project.namespace, @project), = link_to 'Cancel running', cancel_all_namespace_project_jobs_path(@project.namespace, @project),
data: { confirm: 'Are you sure?' }, class: 'btn btn-danger', method: :post data: { confirm: 'Are you sure?' }, class: 'btn btn-danger', method: :post
- unless @repository.gitlab_ci_yml - unless @repository.gitlab_ci_yml
......
...@@ -75,7 +75,7 @@ ...@@ -75,7 +75,7 @@
Showing last Showing last
%span.js-truncated-info-size.truncated-info-size>< %span.js-truncated-info-size.truncated-info-size><
KiB of log - KiB of log -
%a.js-raw-link.raw-link{ :href => raw_namespace_project_build_path(@project.namespace, @project, @build) }>< Complete Raw %a.js-raw-link.raw-link{ :href => raw_namespace_project_job_path(@project.namespace, @project, @build) }>< Complete Raw
%code.bash.js-build-output %code.bash.js-build-output
.build-loader-animation.js-build-refresh .build-loader-animation.js-build-refresh
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
- if project_nav_tab? :builds - if project_nav_tab? :builds
= nav_link(controller: [:builds, :artifacts]) do = nav_link(controller: [:builds, :artifacts]) do
= link_to project_builds_path(@project), title: 'Jobs', class: 'shortcuts-builds' do = link_to project_jobs_path(@project), title: 'Jobs', class: 'shortcuts-builds' do
%span %span
Jobs Jobs
......
...@@ -55,5 +55,5 @@ ...@@ -55,5 +55,5 @@
%span.stage %span.stage
= build.stage.titleize = build.stage.titleize
%span.build-name %span.build-name
= link_to build.name, pipeline_build_url(pipeline, build) = link_to build.name, pipeline_job_url(pipeline, build)
%pre.build-log= build_summary(build, skip: index >= 10) %pre.build-log= build_summary(build, skip: index >= 10)
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
# - [project.namespace, project, build] # - [project.namespace, project, build]
# #
# instead of: # instead of:
# - namespace_project_build_path(project.namespace, project, build) # - namespace_project_job_path(project.namespace, project, build)
# #
# Without that, Ci:: namespace is used for resolving routes: # Without that, Ci:: namespace is used for resolving routes:
# - namespace_project_ci_build_path(project.namespace, project, build) # - namespace_project_ci_build_path(project.namespace, project, build)
......
...@@ -110,7 +110,7 @@ namespace :admin do ...@@ -110,7 +110,7 @@ namespace :admin do
resources :cohorts, only: :index resources :cohorts, only: :index
resources :builds, only: :index do resources :jobs, only: :index do
collection do collection do
post :cancel_all post :cancel_all
end end
......
...@@ -166,7 +166,7 @@ constraints(ProjectUrlConstrainer.new) do ...@@ -166,7 +166,7 @@ constraints(ProjectUrlConstrainer.new) do
end end
end end
resources :builds, only: [:index, :show], constraints: { id: /\d+/ } do resources :jobs, only: [:index, :show], constraints: { id: /\d+/ } do
collection do collection do
post :cancel_all post :cancel_all
......
...@@ -27,11 +27,11 @@ module SharedBuilds ...@@ -27,11 +27,11 @@ module SharedBuilds
end end
step 'I visit recent build details page' do step 'I visit recent build details page' do
visit namespace_project_build_path(@project.namespace, @project, @build) visit namespace_project_job_path(@project.namespace, @project, @build)
end end
step 'I visit project builds page' do step 'I visit project builds page' do
visit namespace_project_builds_path(@project.namespace, @project) visit namespace_project_jobs_path(@project.namespace, @project)
end end
step 'recent build has artifacts available' do step 'recent build has artifacts available' do
...@@ -56,7 +56,7 @@ module SharedBuilds ...@@ -56,7 +56,7 @@ module SharedBuilds
end end
step 'I access artifacts download page' do step 'I access artifacts download page' do
visit download_namespace_project_build_artifacts_path(@project.namespace, @project, @build) visit download_namespace_project_job_artifacts_path(@project.namespace, @project, @build)
end end
step 'I see details of a build' do step 'I see details of a build' do
......
...@@ -12,7 +12,7 @@ module Gitlab ...@@ -12,7 +12,7 @@ module Gitlab
end end
def action_path def action_path
cancel_namespace_project_build_path(subject.project.namespace, cancel_namespace_project_job_path(subject.project.namespace,
subject.project, subject.project,
subject) subject)
end end
......
...@@ -8,7 +8,7 @@ module Gitlab ...@@ -8,7 +8,7 @@ module Gitlab
end end
def details_path def details_path
namespace_project_build_path(subject.project.namespace, namespace_project_job_path(subject.project.namespace,
subject.project, subject.project,
subject) subject)
end end
......
...@@ -20,7 +20,7 @@ module Gitlab ...@@ -20,7 +20,7 @@ module Gitlab
end end
def action_path def action_path
play_namespace_project_build_path(subject.project.namespace, play_namespace_project_job_path(subject.project.namespace,
subject.project, subject.project,
subject) subject)
end end
......
...@@ -16,7 +16,7 @@ module Gitlab ...@@ -16,7 +16,7 @@ module Gitlab
end end
def action_path def action_path
retry_namespace_project_build_path(subject.project.namespace, retry_namespace_project_job_path(subject.project.namespace,
subject.project, subject.project,
subject) subject)
end end
......
...@@ -20,7 +20,7 @@ module Gitlab ...@@ -20,7 +20,7 @@ module Gitlab
end end
def action_path def action_path
play_namespace_project_build_path(subject.project.namespace, play_namespace_project_job_path(subject.project.namespace,
subject.project, subject.project,
subject) subject)
end end
......
...@@ -12,7 +12,7 @@ describe Projects::ArtifactsController do ...@@ -12,7 +12,7 @@ describe Projects::ArtifactsController do
status: 'success') status: 'success')
end end
let(:build) { create(:ci_build, :success, :artifacts, pipeline: pipeline) } let(:job) { create(:ci_build, :success, :artifacts, pipeline: pipeline) }
before do before do
project.team << [user, :developer] project.team << [user, :developer]
...@@ -22,16 +22,16 @@ describe Projects::ArtifactsController do ...@@ -22,16 +22,16 @@ describe Projects::ArtifactsController do
describe 'GET download' do describe 'GET download' do
it 'sends the artifacts file' do it 'sends the artifacts file' do
expect(controller).to receive(:send_file).with(build.artifacts_file.path, disposition: 'attachment').and_call_original expect(controller).to receive(:send_file).with(job.artifacts_file.path, disposition: 'attachment').and_call_original
get :download, namespace_id: project.namespace, project_id: project, build_id: build get :download, namespace_id: project.namespace, project_id: project, job_id: job
end end
end end
describe 'GET browse' do describe 'GET browse' do
context 'when the directory exists' do context 'when the directory exists' do
it 'renders the browse view' do it 'renders the browse view' do
get :browse, namespace_id: project.namespace, project_id: project, build_id: build, path: 'other_artifacts_0.1.2' get :browse, namespace_id: project.namespace, project_id: project, job_id: job, path: 'other_artifacts_0.1.2'
expect(response).to render_template('projects/artifacts/browse') expect(response).to render_template('projects/artifacts/browse')
end end
...@@ -39,7 +39,7 @@ describe Projects::ArtifactsController do ...@@ -39,7 +39,7 @@ describe Projects::ArtifactsController do
context 'when the directory does not exist' do context 'when the directory does not exist' do
it 'responds Not Found' do it 'responds Not Found' do
get :browse, namespace_id: project.namespace, project_id: project, build_id: build, path: 'unknown' get :browse, namespace_id: project.namespace, project_id: project, job_id: job, path: 'unknown'
expect(response).to be_not_found expect(response).to be_not_found
end end
...@@ -49,7 +49,7 @@ describe Projects::ArtifactsController do ...@@ -49,7 +49,7 @@ describe Projects::ArtifactsController do
describe 'GET file' do describe 'GET file' do
context 'when the file exists' do context 'when the file exists' do
it 'renders the file view' do it 'renders the file view' do
get :file, namespace_id: project.namespace, project_id: project, build_id: build, path: 'ci_artifacts.txt' get :file, namespace_id: project.namespace, project_id: project, job_id: job, path: 'ci_artifacts.txt'
expect(response).to render_template('projects/artifacts/file') expect(response).to render_template('projects/artifacts/file')
end end
...@@ -57,7 +57,7 @@ describe Projects::ArtifactsController do ...@@ -57,7 +57,7 @@ describe Projects::ArtifactsController do
context 'when the file does not exist' do context 'when the file does not exist' do
it 'responds Not Found' do it 'responds Not Found' do
get :file, namespace_id: project.namespace, project_id: project, build_id: build, path: 'unknown' get :file, namespace_id: project.namespace, project_id: project, job_id: job, path: 'unknown'
expect(response).to be_not_found expect(response).to be_not_found
end end
...@@ -67,7 +67,7 @@ describe Projects::ArtifactsController do ...@@ -67,7 +67,7 @@ describe Projects::ArtifactsController do
describe 'GET raw' do describe 'GET raw' do
context 'when the file exists' do context 'when the file exists' do
it 'serves the file using workhorse' do it 'serves the file using workhorse' do
get :raw, namespace_id: project.namespace, project_id: project, build_id: build, path: 'ci_artifacts.txt' get :raw, namespace_id: project.namespace, project_id: project, job_id: job, path: 'ci_artifacts.txt'
send_data = response.headers[Gitlab::Workhorse::SEND_DATA_HEADER] send_data = response.headers[Gitlab::Workhorse::SEND_DATA_HEADER]
...@@ -84,7 +84,7 @@ describe Projects::ArtifactsController do ...@@ -84,7 +84,7 @@ describe Projects::ArtifactsController do
context 'when the file does not exist' do context 'when the file does not exist' do
it 'responds Not Found' do it 'responds Not Found' do
get :raw, namespace_id: project.namespace, project_id: project, build_id: build, path: 'unknown' get :raw, namespace_id: project.namespace, project_id: project, job_id: job, path: 'unknown'
expect(response).to be_not_found expect(response).to be_not_found
end end
...@@ -92,29 +92,29 @@ describe Projects::ArtifactsController do ...@@ -92,29 +92,29 @@ describe Projects::ArtifactsController do
end end
describe 'GET latest_succeeded' do describe 'GET latest_succeeded' do
def params_from_ref(ref = pipeline.ref, job = build.name, path = 'browse') def params_from_ref(ref = pipeline.ref, job_name = job.name, path = 'browse')
{ {
namespace_id: project.namespace, namespace_id: project.namespace,
project_id: project, project_id: project,
ref_name_and_path: File.join(ref, path), ref_name_and_path: File.join(ref, path),
job: job job: job_name
} }
end end
context 'cannot find the build' do context 'cannot find the job' do
shared_examples 'not found' do shared_examples 'not found' do
it { expect(response).to have_http_status(:not_found) } it { expect(response).to have_http_status(:not_found) }
end end
context 'has no such ref' do context 'has no such ref' do
before do before do
get :latest_succeeded, params_from_ref('TAIL', build.name) get :latest_succeeded, params_from_ref('TAIL', job.name)
end end
it_behaves_like 'not found' it_behaves_like 'not found'
end end
context 'has no such build' do context 'has no such job' do
before do before do
get :latest_succeeded, params_from_ref(pipeline.ref, 'NOBUILD') get :latest_succeeded, params_from_ref(pipeline.ref, 'NOBUILD')
end end
...@@ -124,20 +124,20 @@ describe Projects::ArtifactsController do ...@@ -124,20 +124,20 @@ describe Projects::ArtifactsController do
context 'has no path' do context 'has no path' do
before do before do
get :latest_succeeded, params_from_ref(pipeline.sha, build.name, '') get :latest_succeeded, params_from_ref(pipeline.sha, job.name, '')
end end
it_behaves_like 'not found' it_behaves_like 'not found'
end end
end end
context 'found the build and redirect' do context 'found the job and redirect' do
shared_examples 'redirect to the build' do shared_examples 'redirect to the job' do
it 'redirects' do it 'redirects' do
path = browse_namespace_project_build_artifacts_path( path = browse_namespace_project_job_artifacts_path(
project.namespace, project.namespace,
project, project,
build) job)
expect(response).to redirect_to(path) expect(response).to redirect_to(path)
end end
...@@ -151,7 +151,7 @@ describe Projects::ArtifactsController do ...@@ -151,7 +151,7 @@ describe Projects::ArtifactsController do
get :latest_succeeded, params_from_ref('master') get :latest_succeeded, params_from_ref('master')
end end
it_behaves_like 'redirect to the build' it_behaves_like 'redirect to the job'
end end
context 'with branch name containing slash' do context 'with branch name containing slash' do
...@@ -162,7 +162,7 @@ describe Projects::ArtifactsController do ...@@ -162,7 +162,7 @@ describe Projects::ArtifactsController do
get :latest_succeeded, params_from_ref('improve/awesome') get :latest_succeeded, params_from_ref('improve/awesome')
end end
it_behaves_like 'redirect to the build' it_behaves_like 'redirect to the job'
end end
context 'with branch name and path containing slashes' do context 'with branch name and path containing slashes' do
...@@ -170,14 +170,14 @@ describe Projects::ArtifactsController do ...@@ -170,14 +170,14 @@ describe Projects::ArtifactsController do
pipeline.update(ref: 'improve/awesome', pipeline.update(ref: 'improve/awesome',
sha: project.commit('improve/awesome').sha) sha: project.commit('improve/awesome').sha)
get :latest_succeeded, params_from_ref('improve/awesome', build.name, 'file/README.md') get :latest_succeeded, params_from_ref('improve/awesome', job.name, 'file/README.md')
end end
it 'redirects' do it 'redirects' do
path = file_namespace_project_build_artifacts_path( path = file_namespace_project_job_artifacts_path(
project.namespace, project.namespace,
project, project,
build, job,
'README.md') 'README.md')
expect(response).to redirect_to(path) expect(response).to redirect_to(path)
......
...@@ -172,7 +172,7 @@ describe Projects::EnvironmentsController do ...@@ -172,7 +172,7 @@ describe Projects::EnvironmentsController do
expect(response).to have_http_status(200) expect(response).to have_http_status(200)
expect(json_response).to eq( expect(json_response).to eq(
{ 'redirect_url' => { 'redirect_url' =>
"http://test.host/#{project.path_with_namespace}/builds/#{action.id}" }) "http://test.host/#{project.path_with_namespace}/jobs/#{action.id}" })
end end
end end
......
require 'spec_helper' require 'spec_helper'
describe Projects::BuildsController do describe Projects::JobsController do
include ApiHelpers include ApiHelpers
let(:project) { create(:empty_project, :public) } let(:project) { create(:empty_project, :public) }
...@@ -240,7 +240,7 @@ describe Projects::BuildsController do ...@@ -240,7 +240,7 @@ describe Projects::BuildsController do
it 'redirects to the retried build page' do it 'redirects to the retried build page' do
expect(response).to have_http_status(:found) expect(response).to have_http_status(:found)
expect(response).to redirect_to(namespace_project_build_path(id: Ci::Build.last.id)) expect(response).to redirect_to(namespace_project_job_path(id: Ci::Build.last.id))
end end
end end
...@@ -272,7 +272,7 @@ describe Projects::BuildsController do ...@@ -272,7 +272,7 @@ describe Projects::BuildsController do
it 'redirects to the played build page' do it 'redirects to the played build page' do
expect(response).to have_http_status(:found) expect(response).to have_http_status(:found)
expect(response).to redirect_to(namespace_project_build_path(id: build.id)) expect(response).to redirect_to(namespace_project_job_path(id: build.id))
end end
it 'transits to pending' do it 'transits to pending' do
...@@ -308,7 +308,7 @@ describe Projects::BuildsController do ...@@ -308,7 +308,7 @@ describe Projects::BuildsController do
it 'redirects to the canceled build page' do it 'redirects to the canceled build page' do
expect(response).to have_http_status(:found) expect(response).to have_http_status(:found)
expect(response).to redirect_to(namespace_project_build_path(id: build.id)) expect(response).to redirect_to(namespace_project_job_path(id: build.id))
end end
it 'transits to canceled' do it 'transits to canceled' do
...@@ -346,7 +346,7 @@ describe Projects::BuildsController do ...@@ -346,7 +346,7 @@ describe Projects::BuildsController do
it 'redirects to a index page' do it 'redirects to a index page' do
expect(response).to have_http_status(:found) expect(response).to have_http_status(:found)
expect(response).to redirect_to(namespace_project_builds_path) expect(response).to redirect_to(namespace_project_jobs_path)
end end
it 'transits to canceled' do it 'transits to canceled' do
...@@ -363,7 +363,7 @@ describe Projects::BuildsController do ...@@ -363,7 +363,7 @@ describe Projects::BuildsController do
it 'redirects to a index page' do it 'redirects to a index page' do
expect(response).to have_http_status(:found) expect(response).to have_http_status(:found)
expect(response).to redirect_to(namespace_project_builds_path) expect(response).to redirect_to(namespace_project_jobs_path)
end end
end end
...@@ -386,7 +386,7 @@ describe Projects::BuildsController do ...@@ -386,7 +386,7 @@ describe Projects::BuildsController do
it 'redirects to the erased build page' do it 'redirects to the erased build page' do
expect(response).to have_http_status(:found) expect(response).to have_http_status(:found)
expect(response).to redirect_to(namespace_project_build_path(id: build.id)) expect(response).to redirect_to(namespace_project_job_path(id: build.id))
end end
it 'erases artifacts' do it 'erases artifacts' do
......
...@@ -16,7 +16,7 @@ describe 'Admin Builds' do ...@@ -16,7 +16,7 @@ describe 'Admin Builds' do
create(:ci_build, pipeline: pipeline, status: :success) create(:ci_build, pipeline: pipeline, status: :success)
create(:ci_build, pipeline: pipeline, status: :failed) create(:ci_build, pipeline: pipeline, status: :failed)
visit admin_builds_path visit admin_jobs_path
expect(page).to have_selector('.nav-links li.active', text: 'All') expect(page).to have_selector('.nav-links li.active', text: 'All')
expect(page).to have_selector('.row-content-block', text: 'All jobs') expect(page).to have_selector('.row-content-block', text: 'All jobs')
...@@ -27,7 +27,7 @@ describe 'Admin Builds' do ...@@ -27,7 +27,7 @@ describe 'Admin Builds' do
context 'when have no jobs' do context 'when have no jobs' do
it 'shows a message' do it 'shows a message' do
visit admin_builds_path visit admin_jobs_path
expect(page).to have_selector('.nav-links li.active', text: 'All') expect(page).to have_selector('.nav-links li.active', text: 'All')
expect(page).to have_content 'No jobs to show' expect(page).to have_content 'No jobs to show'
...@@ -44,7 +44,7 @@ describe 'Admin Builds' do ...@@ -44,7 +44,7 @@ describe 'Admin Builds' do
build3 = create(:ci_build, pipeline: pipeline, status: :success) build3 = create(:ci_build, pipeline: pipeline, status: :success)
build4 = create(:ci_build, pipeline: pipeline, status: :failed) build4 = create(:ci_build, pipeline: pipeline, status: :failed)
visit admin_builds_path(scope: :pending) visit admin_jobs_path(scope: :pending)
expect(page).to have_selector('.nav-links li.active', text: 'Pending') expect(page).to have_selector('.nav-links li.active', text: 'Pending')
expect(page.find('.build-link')).to have_content(build1.id) expect(page.find('.build-link')).to have_content(build1.id)
...@@ -59,7 +59,7 @@ describe 'Admin Builds' do ...@@ -59,7 +59,7 @@ describe 'Admin Builds' do
it 'shows a message' do it 'shows a message' do
create(:ci_build, pipeline: pipeline, status: :success) create(:ci_build, pipeline: pipeline, status: :success)
visit admin_builds_path(scope: :pending) visit admin_jobs_path(scope: :pending)
expect(page).to have_selector('.nav-links li.active', text: 'Pending') expect(page).to have_selector('.nav-links li.active', text: 'Pending')
expect(page).to have_content 'No jobs to show' expect(page).to have_content 'No jobs to show'
...@@ -76,7 +76,7 @@ describe 'Admin Builds' do ...@@ -76,7 +76,7 @@ describe 'Admin Builds' do
build3 = create(:ci_build, pipeline: pipeline, status: :failed) build3 = create(:ci_build, pipeline: pipeline, status: :failed)
build4 = create(:ci_build, pipeline: pipeline, status: :pending) build4 = create(:ci_build, pipeline: pipeline, status: :pending)
visit admin_builds_path(scope: :running) visit admin_jobs_path(scope: :running)
expect(page).to have_selector('.nav-links li.active', text: 'Running') expect(page).to have_selector('.nav-links li.active', text: 'Running')
expect(page.find('.build-link')).to have_content(build1.id) expect(page.find('.build-link')).to have_content(build1.id)
...@@ -91,7 +91,7 @@ describe 'Admin Builds' do ...@@ -91,7 +91,7 @@ describe 'Admin Builds' do
it 'shows a message' do it 'shows a message' do
create(:ci_build, pipeline: pipeline, status: :success) create(:ci_build, pipeline: pipeline, status: :success)
visit admin_builds_path(scope: :running) visit admin_jobs_path(scope: :running)
expect(page).to have_selector('.nav-links li.active', text: 'Running') expect(page).to have_selector('.nav-links li.active', text: 'Running')
expect(page).to have_content 'No jobs to show' expect(page).to have_content 'No jobs to show'
...@@ -107,7 +107,7 @@ describe 'Admin Builds' do ...@@ -107,7 +107,7 @@ describe 'Admin Builds' do
build2 = create(:ci_build, pipeline: pipeline, status: :running) build2 = create(:ci_build, pipeline: pipeline, status: :running)
build3 = create(:ci_build, pipeline: pipeline, status: :success) build3 = create(:ci_build, pipeline: pipeline, status: :success)
visit admin_builds_path(scope: :finished) visit admin_jobs_path(scope: :finished)
expect(page).to have_selector('.nav-links li.active', text: 'Finished') expect(page).to have_selector('.nav-links li.active', text: 'Finished')
expect(page.find('.build-link')).not_to have_content(build1.id) expect(page.find('.build-link')).not_to have_content(build1.id)
...@@ -121,7 +121,7 @@ describe 'Admin Builds' do ...@@ -121,7 +121,7 @@ describe 'Admin Builds' do
it 'shows a message' do it 'shows a message' do
create(:ci_build, pipeline: pipeline, status: :running) create(:ci_build, pipeline: pipeline, status: :running)
visit admin_builds_path(scope: :finished) visit admin_jobs_path(scope: :finished)
expect(page).to have_selector('.nav-links li.active', text: 'Finished') expect(page).to have_selector('.nav-links li.active', text: 'Finished')
expect(page).to have_content 'No jobs to show' expect(page).to have_content 'No jobs to show'
......
...@@ -85,7 +85,7 @@ feature 'Mini Pipeline Graph', :js, :feature do ...@@ -85,7 +85,7 @@ feature 'Mini Pipeline Graph', :js, :feature do
build_item.click build_item.click
find('.build-page') find('.build-page')
expect(current_path).to eql(namespace_project_build_path(project.namespace, project, build)) expect(current_path).to eql(namespace_project_job_path(project.namespace, project, build))
end end
it 'should show tooltip when hovered' do it 'should show tooltip when hovered' do
......
...@@ -6,7 +6,7 @@ feature 'Artifact file', :js, feature: true do ...@@ -6,7 +6,7 @@ feature 'Artifact file', :js, feature: true do
let(:build) { create(:ci_build, :artifacts, pipeline: pipeline) } let(:build) { create(:ci_build, :artifacts, pipeline: pipeline) }
def visit_file(path) def visit_file(path)
visit file_namespace_project_build_artifacts_path(project.namespace, project, build, path) visit file_namespace_project_job_artifacts_path(project.namespace, project, build, path)
end end
context 'Text file' do context 'Text file' do
......
This diff is collapsed.
...@@ -334,7 +334,7 @@ describe "Internal Project Access", feature: true do ...@@ -334,7 +334,7 @@ describe "Internal Project Access", feature: true do
end end
describe "GET /:project_path/builds" do describe "GET /:project_path/builds" do
subject { namespace_project_builds_path(project.namespace, project) } subject { namespace_project_jobs_path(project.namespace, project) }
context "when allowed for public and internal" do context "when allowed for public and internal" do
before { project.update(public_builds: true) } before { project.update(public_builds: true) }
...@@ -368,7 +368,7 @@ describe "Internal Project Access", feature: true do ...@@ -368,7 +368,7 @@ describe "Internal Project Access", feature: true do
describe "GET /:project_path/builds/:id" do describe "GET /:project_path/builds/:id" do
let(:pipeline) { create(:ci_pipeline, project: project) } let(:pipeline) { create(:ci_pipeline, project: project) }
let(:build) { create(:ci_build, pipeline: pipeline) } let(:build) { create(:ci_build, pipeline: pipeline) }
subject { namespace_project_build_path(project.namespace, project, build.id) } subject { namespace_project_job_path(project.namespace, project, build.id) }
context "when allowed for public and internal" do context "when allowed for public and internal" do
before { project.update(public_builds: true) } before { project.update(public_builds: true) }
...@@ -402,7 +402,7 @@ describe "Internal Project Access", feature: true do ...@@ -402,7 +402,7 @@ describe "Internal Project Access", feature: true do
describe 'GET /:project_path/builds/:id/trace' do describe 'GET /:project_path/builds/:id/trace' do
let(:pipeline) { create(:ci_pipeline, project: project) } let(:pipeline) { create(:ci_pipeline, project: project) }
let(:build) { create(:ci_build, pipeline: pipeline) } let(:build) { create(:ci_build, pipeline: pipeline) }
subject { trace_namespace_project_build_path(project.namespace, project, build.id) } subject { trace_namespace_project_job_path(project.namespace, project, build.id) }
context 'when allowed for public and internal' do context 'when allowed for public and internal' do
before do before do
......
...@@ -330,7 +330,7 @@ describe "Private Project Access", feature: true do ...@@ -330,7 +330,7 @@ describe "Private Project Access", feature: true do
end end
describe "GET /:project_path/builds" do describe "GET /:project_path/builds" do
subject { namespace_project_builds_path(project.namespace, project) } subject { namespace_project_jobs_path(project.namespace, project) }
it { is_expected.to be_allowed_for(:admin) } it { is_expected.to be_allowed_for(:admin) }
it { is_expected.to be_allowed_for(:owner).of(project) } it { is_expected.to be_allowed_for(:owner).of(project) }
...@@ -358,7 +358,7 @@ describe "Private Project Access", feature: true do ...@@ -358,7 +358,7 @@ describe "Private Project Access", feature: true do
describe "GET /:project_path/builds/:id" do describe "GET /:project_path/builds/:id" do
let(:pipeline) { create(:ci_pipeline, project: project) } let(:pipeline) { create(:ci_pipeline, project: project) }
let(:build) { create(:ci_build, pipeline: pipeline) } let(:build) { create(:ci_build, pipeline: pipeline) }
subject { namespace_project_build_path(project.namespace, project, build.id) } subject { namespace_project_job_path(project.namespace, project, build.id) }
it { is_expected.to be_allowed_for(:admin) } it { is_expected.to be_allowed_for(:admin) }
it { is_expected.to be_allowed_for(:owner).of(project) } it { is_expected.to be_allowed_for(:owner).of(project) }
...@@ -391,7 +391,7 @@ describe "Private Project Access", feature: true do ...@@ -391,7 +391,7 @@ describe "Private Project Access", feature: true do
describe 'GET /:project_path/builds/:id/trace' do describe 'GET /:project_path/builds/:id/trace' do
let(:pipeline) { create(:ci_pipeline, project: project) } let(:pipeline) { create(:ci_pipeline, project: project) }
let(:build) { create(:ci_build, pipeline: pipeline) } let(:build) { create(:ci_build, pipeline: pipeline) }
subject { trace_namespace_project_build_path(project.namespace, project, build.id) } subject { trace_namespace_project_job_path(project.namespace, project, build.id) }
it { is_expected.to be_allowed_for(:admin) } it { is_expected.to be_allowed_for(:admin) }
it { is_expected.to be_allowed_for(:owner).of(project) } it { is_expected.to be_allowed_for(:owner).of(project) }
......
...@@ -154,7 +154,7 @@ describe "Public Project Access", feature: true do ...@@ -154,7 +154,7 @@ describe "Public Project Access", feature: true do
end end
describe "GET /:project_path/builds" do describe "GET /:project_path/builds" do
subject { namespace_project_builds_path(project.namespace, project) } subject { namespace_project_jobs_path(project.namespace, project) }
context "when allowed for public" do context "when allowed for public" do
before { project.update(public_builds: true) } before { project.update(public_builds: true) }
...@@ -188,7 +188,7 @@ describe "Public Project Access", feature: true do ...@@ -188,7 +188,7 @@ describe "Public Project Access", feature: true do
describe "GET /:project_path/builds/:id" do describe "GET /:project_path/builds/:id" do
let(:pipeline) { create(:ci_pipeline, project: project) } let(:pipeline) { create(:ci_pipeline, project: project) }
let(:build) { create(:ci_build, pipeline: pipeline) } let(:build) { create(:ci_build, pipeline: pipeline) }
subject { namespace_project_build_path(project.namespace, project, build.id) } subject { namespace_project_job_path(project.namespace, project, build.id) }
context "when allowed for public" do context "when allowed for public" do
before { project.update(public_builds: true) } before { project.update(public_builds: true) }
...@@ -222,7 +222,7 @@ describe "Public Project Access", feature: true do ...@@ -222,7 +222,7 @@ describe "Public Project Access", feature: true do
describe 'GET /:project_path/builds/:id/trace' do describe 'GET /:project_path/builds/:id/trace' do
let(:pipeline) { create(:ci_pipeline, project: project) } let(:pipeline) { create(:ci_pipeline, project: project) }
let(:build) { create(:ci_build, pipeline: pipeline) } let(:build) { create(:ci_build, pipeline: pipeline) }
subject { trace_namespace_project_build_path(project.namespace, project, build.id) } subject { trace_namespace_project_job_path(project.namespace, project, build.id) }
context 'when allowed for public' do context 'when allowed for public' do
before do before do
......
...@@ -8,7 +8,7 @@ import '~/breakpoints'; ...@@ -8,7 +8,7 @@ import '~/breakpoints';
import 'vendor/jquery.nicescroll'; import 'vendor/jquery.nicescroll';
describe('Build', () => { describe('Build', () => {
const BUILD_URL = `${gl.TEST_HOST}/frontend-fixtures/builds-project/builds/1`; const BUILD_URL = `${gl.TEST_HOST}/frontend-fixtures/builds-project/jobs/1`;
preloadFixtures('builds/build-with-artifacts.html.raw'); preloadFixtures('builds/build-with-artifacts.html.raw');
......
require 'spec_helper' require 'spec_helper'
describe Projects::BuildsController, '(JavaScript fixtures)', type: :controller do describe Projects::JobsController, '(JavaScript fixtures)', type: :controller do
include JavaScriptFixturesHelpers include JavaScriptFixturesHelpers
let(:admin) { create(:admin) } let(:admin) { create(:admin) }
......
...@@ -356,7 +356,7 @@ require('~/lib/utils/common_utils'); ...@@ -356,7 +356,7 @@ require('~/lib/utils/common_utils');
describe('gl.utils.setCiStatusFavicon', () => { describe('gl.utils.setCiStatusFavicon', () => {
it('should set page favicon to CI status favicon based on provided status', () => { it('should set page favicon to CI status favicon based on provided status', () => {
const BUILD_URL = `${gl.TEST_HOST}/frontend-fixtures/builds-project/builds/1/status.json`; const BUILD_URL = `${gl.TEST_HOST}/frontend-fixtures/builds-project/jobs/1/status.json`;
const FAVICON_PATH = '//icon_status_success'; const FAVICON_PATH = '//icon_status_success';
const spySetFavicon = spyOn(gl.utils, 'setFavicon').and.stub(); const spySetFavicon = spyOn(gl.utils, 'setFavicon').and.stub();
const spyResetFavicon = spyOn(gl.utils, 'resetFavicon').and.stub(); const spyResetFavicon = spyOn(gl.utils, 'resetFavicon').and.stub();
......
...@@ -31,7 +31,7 @@ describe Gitlab::Ci::Status::Build::Common do ...@@ -31,7 +31,7 @@ describe Gitlab::Ci::Status::Build::Common do
describe '#details_path' do describe '#details_path' do
it 'links to the build details page' do it 'links to the build details page' do
expect(subject.details_path).to include "builds/#{build.id}" expect(subject.details_path).to include "jobs/#{build.id}"
end end
end end
end end
require 'spec_helper' require 'spec_helper'
describe BuildActionEntity do describe BuildActionEntity do
let(:build) { create(:ci_build, name: 'test_build') } let(:job) { create(:ci_build, name: 'test_job') }
let(:request) { double('request') } let(:request) { double('request') }
let(:entity) do let(:entity) do
described_class.new(build, request: spy('request')) described_class.new(job, request: spy('request'))
end end
describe '#as_json' do describe '#as_json' do
subject { entity.as_json } subject { entity.as_json }
it 'contains original build name' do it 'contains original job name' do
expect(subject[:name]).to eq 'test_build' expect(subject[:name]).to eq 'test_job'
end end
it 'contains path to the action play' do it 'contains path to the action play' do
expect(subject[:path]).to include "builds/#{build.id}/play" expect(subject[:path]).to include "jobs/#{job.id}/play"
end end
it 'contains whether it is playable' do it 'contains whether it is playable' do
expect(subject[:playable]).to eq build.playable? expect(subject[:playable]).to eq job.playable?
end end
end end
end end
require 'spec_helper' require 'spec_helper'
describe BuildArtifactEntity do describe BuildArtifactEntity do
let(:build) { create(:ci_build, name: 'test:build') } let(:job) { create(:ci_build, name: 'test:job') }
let(:entity) do let(:entity) do
described_class.new(build, request: double) described_class.new(job, request: double)
end end
describe '#as_json' do describe '#as_json' do
subject { entity.as_json } subject { entity.as_json }
it 'contains build name' do it 'contains job name' do
expect(subject[:name]).to eq 'test:build' expect(subject[:name]).to eq 'test:job'
end end
it 'contains path to the artifacts' do it 'contains path to the artifacts' do
expect(subject[:path]) expect(subject[:path])
.to include "builds/#{build.id}/artifacts/download" .to include "jobs/#{job.id}/artifacts/download"
end end
end end
end end
...@@ -16,7 +16,7 @@ describe 'ci/status/_badge', :view do ...@@ -16,7 +16,7 @@ describe 'ci/status/_badge', :view do
end end
it 'has link to build details page' do it 'has link to build details page' do
details_path = namespace_project_build_path( details_path = namespace_project_job_path(
project.namespace, project, build) project.namespace, project, build)
render_status(build) render_status(build)
......
require 'spec_helper' require 'spec_helper'
describe 'projects/ci/builds/_build' do describe 'projects/ci/jobs/_build' do
include Devise::Test::ControllerHelpers include Devise::Test::ControllerHelpers
let(:project) { create(:project, :repository) } let(:project) { create(:project, :repository) }
......
require 'spec_helper' require 'spec_helper'
describe 'projects/builds/show', :view do describe 'projects/jobs/show', :view do
let(:project) { create(:project, :repository) } let(:project) { create(:project, :repository) }
let(:build) { create(:ci_build, pipeline: pipeline) } let(:build) { create(:ci_build, pipeline: pipeline) }
...@@ -278,7 +278,7 @@ describe 'projects/builds/show', :view do ...@@ -278,7 +278,7 @@ describe 'projects/builds/show', :view do
it 'links to issues/new with the title and description filled in' do it 'links to issues/new with the title and description filled in' do
title = "Build Failed ##{build.id}" title = "Build Failed ##{build.id}"
build_url = namespace_project_build_url(project.namespace, project, build) build_url = namespace_project_job_url(project.namespace, project, build)
href = new_namespace_project_issue_path( href = new_namespace_project_issue_path(
project.namespace, project.namespace,
project, project,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment