BigW Consortium Gitlab

Commit d7bbee75 by Lin Jen-Shin

Update routes based on feedback from:

parent e01c421b
......@@ -61,7 +61,7 @@ class Projects::ArtifactsController < Projects::ApplicationController
def build_from_ref
if params[:ref_name]
builds = project.builds_for(params[:build_name], params[:ref_name])
builds = project.builds_for(params[:job], params[:ref_name])
builds.success.latest.first
end
......
......@@ -733,16 +733,17 @@ Rails.application.routes.draw do
resources :environments, only: [:index, :show, :new, :create, :destroy]
resources :builds, only: [:index, :show], constraints: { id: /\d+/ } do
collection do
post :cancel_all
resources :artifacts, only: [] do
collection do
get :search, path: ':ref_name/:build_name/*path', format: false,
constraints: { ref_name: /.+/ } # ref could have /
get :search, path: ':ref_name/*path',
format: false,
constraints: { ref_name: /.+/ } # could have /
end
end
resources :builds, only: [:index, :show], constraints: { id: /\d+/ } do
collection do
post :cancel_all
end
member do
......
......@@ -2,7 +2,7 @@ require 'spec_helper'
require_relative '../shared/artifacts_context'
describe Projects::ArtifactsController do
describe 'GET /:project/artifacts/:ref/:build_name/browse' do
describe 'GET /:project/builds/artifacts/:ref_name/browse?job=name' do
include_context 'artifacts from ref and build name'
before do
......@@ -10,13 +10,13 @@ describe Projects::ArtifactsController do
end
def path_from_ref(
ref = pipeline.sha, build_name = build.name, path = 'browse')
ref = pipeline.sha, job = build.name, path = 'browse')
search_namespace_project_artifacts_path(
project.namespace,
project,
ref,
build_name,
path)
path,
job: job)
end
context '404' do
......
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