summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLin Jen-Shin <godfat@godfat.org>2017-05-26 21:55:29 +0800
committerLin Jen-Shin <godfat@godfat.org>2017-05-26 23:06:20 +0800
commitc94db0c2906c5da49acc9addb976b64fd7c7b256 (patch)
tree9db7628da93c0036625a48d985a1778a92a9766e
parent70eb0c6a88ccb4a1d8fe6cc42fa4aa72b7584ffe (diff)
downloadgitlab-ce-c94db0c2906c5da49acc9addb976b64fd7c7b256.tar.gz
Use - as the prefix so we don't conflict with namespaces
The decision was made around: https://gitlab.com/gitlab-org/gitlab-ce/issues/26407#note_30624641
-rw-r--r--config/routes/project.rb2
-rw-r--r--db/post_migrate/20170517101044_rename_projects_named_jobs.rb14
-rw-r--r--lib/gitlab/path_regex.rb1
-rw-r--r--spec/controllers/projects/environments_controller_spec.rb4
-rw-r--r--spec/features/projects/artifacts/browse_spec.rb2
-rw-r--r--spec/features/projects/artifacts/download_spec.rb2
-rw-r--r--spec/features/projects/artifacts/file_spec.rb2
-rw-r--r--spec/features/projects/artifacts/raw_spec.rb2
-rw-r--r--spec/features/projects/jobs_spec.rb6
-rw-r--r--spec/javascripts/build_spec.js2
-rw-r--r--spec/javascripts/lib/utils/common_utils_spec.js2
11 files changed, 13 insertions, 26 deletions
diff --git a/config/routes/project.rb b/config/routes/project.rb
index eb138dcee5a..6f45661c2e3 100644
--- a/config/routes/project.rb
+++ b/config/routes/project.rb
@@ -181,7 +181,7 @@ constraints(ProjectUrlConstrainer.new) do
end
end
- resources :jobs, only: [:index, :show], constraints: { id: /\d+/ } do
+ resources :jobs, path: '-/jobs', only: [:index, :show], constraints: { id: /\d+/ } do
collection do
post :cancel_all
diff --git a/db/post_migrate/20170517101044_rename_projects_named_jobs.rb b/db/post_migrate/20170517101044_rename_projects_named_jobs.rb
deleted file mode 100644
index e5f44d9d7ce..00000000000
--- a/db/post_migrate/20170517101044_rename_projects_named_jobs.rb
+++ /dev/null
@@ -1,14 +0,0 @@
-class RenameProjectsNamedJobs < ActiveRecord::Migration
- include Gitlab::Database::RenameReservedPathsMigration::V1
-
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- def up
- rename_wildcard_paths('jobs')
- end
-
- def down
- end
-end
diff --git a/lib/gitlab/path_regex.rb b/lib/gitlab/path_regex.rb
index 1c0abc9f7cf..9ff6829cd49 100644
--- a/lib/gitlab/path_regex.rb
+++ b/lib/gitlab/path_regex.rb
@@ -80,6 +80,7 @@ module Gitlab
# By rejecting `badges` the router can _count_ on the fact that `badges` will
# be preceded by the `namespace/project`.
PROJECT_WILDCARD_ROUTES = %w[
+ -
badges
blame
blob
diff --git a/spec/controllers/projects/environments_controller_spec.rb b/spec/controllers/projects/environments_controller_spec.rb
index 93d1ddb8836..de13f17012b 100644
--- a/spec/controllers/projects/environments_controller_spec.rb
+++ b/spec/controllers/projects/environments_controller_spec.rb
@@ -177,7 +177,7 @@ describe Projects::EnvironmentsController do
expect(response).to have_http_status(200)
expect(json_response).to eq(
{ 'redirect_url' =>
- "http://test.host/#{project.path_with_namespace}/jobs/#{action.id}" })
+ namespace_project_job_url(project.namespace, project, action) })
end
end
@@ -191,7 +191,7 @@ describe Projects::EnvironmentsController do
expect(response).to have_http_status(200)
expect(json_response).to eq(
{ 'redirect_url' =>
- "http://test.host/#{project.path_with_namespace}/environments/#{environment.id}" })
+ namespace_project_environment_url(project.namespace, project, environment) })
end
end
end
diff --git a/spec/features/projects/artifacts/browse_spec.rb b/spec/features/projects/artifacts/browse_spec.rb
index db9c807a16d..68375956273 100644
--- a/spec/features/projects/artifacts/browse_spec.rb
+++ b/spec/features/projects/artifacts/browse_spec.rb
@@ -15,7 +15,7 @@ feature 'Browse artifact', :js, feature: true do
end
before do
- visit browse_url.sub('jobs', 'builds')
+ visit browse_url.sub('/-/jobs', '/builds')
end
it "redirects to new URL" do
diff --git a/spec/features/projects/artifacts/download_spec.rb b/spec/features/projects/artifacts/download_spec.rb
index f8f13544004..dd9454840ee 100644
--- a/spec/features/projects/artifacts/download_spec.rb
+++ b/spec/features/projects/artifacts/download_spec.rb
@@ -39,7 +39,7 @@ feature 'Download artifact', :js, feature: true do
context 'when visiting old URL' do
before do
- visit download_url.sub('jobs', 'builds')
+ visit download_url.sub('/-/jobs', '/builds')
end
context 'via job id' do
diff --git a/spec/features/projects/artifacts/file_spec.rb b/spec/features/projects/artifacts/file_spec.rb
index 7db77ce275f..25c4f3c87a2 100644
--- a/spec/features/projects/artifacts/file_spec.rb
+++ b/spec/features/projects/artifacts/file_spec.rb
@@ -67,7 +67,7 @@ feature 'Artifact file', :js, feature: true do
end
before do
- visit file_url.sub('jobs', 'builds')
+ visit file_url.sub('/-/jobs', '/builds')
end
it "redirects to new URL" do
diff --git a/spec/features/projects/artifacts/raw_spec.rb b/spec/features/projects/artifacts/raw_spec.rb
index 9c910fe05cd..b589701729d 100644
--- a/spec/features/projects/artifacts/raw_spec.rb
+++ b/spec/features/projects/artifacts/raw_spec.rb
@@ -15,7 +15,7 @@ feature 'Raw artifact', :js, feature: true do
end
before do
- visit raw_url.sub('jobs', 'builds')
+ visit raw_url.sub('/-/jobs', '/builds')
end
it "redirects to new URL" do
diff --git a/spec/features/projects/jobs_spec.rb b/spec/features/projects/jobs_spec.rb
index f8d7b9eccb1..ee968abff6f 100644
--- a/spec/features/projects/jobs_spec.rb
+++ b/spec/features/projects/jobs_spec.rb
@@ -85,7 +85,7 @@ feature 'Jobs', :feature do
end
before do
- visit jobs_url.sub('jobs', 'builds')
+ visit jobs_url.sub('/-/jobs', '/builds')
end
it "redirects to new URL" do
@@ -203,7 +203,7 @@ feature 'Jobs', :feature do
end
before do
- visit job_url.sub('jobs', 'builds')
+ visit job_url.sub('/-/jobs', '/builds')
end
it "redirects to new URL" do
@@ -473,7 +473,7 @@ feature 'Jobs', :feature do
end
before do
- visit raw_job_url.sub('jobs', 'builds')
+ visit raw_job_url.sub('/-/jobs', '/builds')
end
it "redirects to new URL" do
diff --git a/spec/javascripts/build_spec.js b/spec/javascripts/build_spec.js
index 93e96676468..7d02f568ceb 100644
--- a/spec/javascripts/build_spec.js
+++ b/spec/javascripts/build_spec.js
@@ -8,7 +8,7 @@ import '~/breakpoints';
import 'vendor/jquery.nicescroll';
describe('Build', () => {
- const BUILD_URL = `${gl.TEST_HOST}/frontend-fixtures/builds-project/jobs/1`;
+ const BUILD_URL = `${gl.TEST_HOST}/frontend-fixtures/builds-project/-/jobs/1`;
preloadFixtures('builds/build-with-artifacts.html.raw');
diff --git a/spec/javascripts/lib/utils/common_utils_spec.js b/spec/javascripts/lib/utils/common_utils_spec.js
index 5c548a218b2..e3938a77680 100644
--- a/spec/javascripts/lib/utils/common_utils_spec.js
+++ b/spec/javascripts/lib/utils/common_utils_spec.js
@@ -356,7 +356,7 @@ import '~/lib/utils/common_utils';
describe('gl.utils.setCiStatusFavicon', () => {
it('should set page favicon to CI status favicon based on provided status', () => {
- const BUILD_URL = `${gl.TEST_HOST}/frontend-fixtures/builds-project/jobs/1/status.json`;
+ const BUILD_URL = `${gl.TEST_HOST}/frontend-fixtures/builds-project/-/jobs/1/status.json`;
const FAVICON_PATH = '//icon_status_success';
const spySetFavicon = spyOn(gl.utils, 'setFavicon').and.stub();
const spyResetFavicon = spyOn(gl.utils, 'resetFavicon').and.stub();