Commit 603ac55e authored by Stan Hu's avatar Stan Hu

Merge branch 'ce-to-ee-2018-03-14' into 'master'

CE upstream - 2018-03-14 12:24 UTC

See merge request gitlab-org/gitlab-ee!4967
parents be52e4bb 8d3bfd24
......@@ -311,7 +311,7 @@ group :metrics do
end
group :development do
gem 'foreman', '~> 0.78.0'
gem 'foreman', '~> 0.84.0'
gem 'brakeman', '~> 3.6.0', require: false
gem 'letter_opener_web', '~> 1.3.0'
......
......@@ -290,7 +290,7 @@ GEM
nokogiri (>= 1.5.11, < 2.0.0)
font-awesome-rails (4.7.0.1)
railties (>= 3.2, < 5.1)
foreman (0.78.0)
foreman (0.84.0)
thor (~> 0.19.1)
formatador (0.2.5)
fuubar (2.2.0)
......@@ -1086,7 +1086,7 @@ DEPENDENCIES
fog-openstack (~> 0.1)
fog-rackspace (~> 0.1.1)
font-awesome-rails (~> 4.7)
foreman (~> 0.78.0)
foreman (~> 0.84.0)
fuubar (~> 2.2.0)
gemnasium-gitlab-service (~> 0.2)
gemojione (~> 3.3)
......
......@@ -132,9 +132,8 @@ class GfmAutoComplete {
callbacks: {
...this.getDefaultCallbacks(),
matcher(flag, subtext) {
const relevantText = subtext.trim().split(/\s/).pop();
const regexp = new RegExp(`(?:[^${glRegexp.unicodeLetters}0-9:]|\n|^):([^:]*)$`, 'gi');
const match = regexp.exec(relevantText);
const match = regexp.exec(subtext);
return match && match.length ? match[1] : null;
},
......
......@@ -780,7 +780,6 @@
margin-right: -5px;
}
.mr-widget-icon {
font-size: 22px;
margin: 0 10px 0 0;
......
......@@ -1097,7 +1097,7 @@ class Project < ActiveRecord::Base
# Forked import is handled asynchronously
return if forked? && !force
if gitlab_shell.add_repository(repository_storage, disk_path)
if gitlab_shell.create_repository(repository_storage, disk_path)
repository.after_create
true
else
......
......@@ -183,7 +183,7 @@ class ProjectWiki
private
def create_repo!(raw_repository)
gitlab_shell.add_repository(project.repository_storage, disk_path)
gitlab_shell.create_repository(project.repository_storage, disk_path)
raise CouldNotCreateWikiError unless raw_repository.exists?
......
---
title: Update foreman from 0.78.0 to 0.84.0
merge_request: 17690
author: Takuya Noguchi
type: other
---
title: Hide emoji popup after multiple spaces
merge_request:
author: Jan Beckmann
type: fixed
......@@ -189,6 +189,7 @@ for a real-world example of this exploit.
```sh
sudo gitlab-ctl reconfigure
sudo gitlab-ctl restart
```
1. Verify that everything is configured correctly:
......
......@@ -173,7 +173,7 @@ module Geo
end
def build_temporary_repository
unless gitlab_shell.add_repository(project.repository_storage, disk_path_temp)
unless gitlab_shell.create_repository(project.repository_storage, disk_path_temp)
raise Gitlab::Shell::Error, 'Can not create a temporary repository'
end
......
......@@ -30,7 +30,7 @@ module Projects
repository = (wiki ? project.wiki.repository : project.repository).raw
# Initialize a git repository on the target path
gitlab_shell.add_repository(new_storage_key, repository.relative_path)
gitlab_shell.create_repository(new_storage_key, repository.relative_path)
new_repository = Gitlab::Git::Repository.new(new_storage_key,
repository.relative_path,
repository.gl_repository)
......
Feature: Project Graph
Background:
Given I sign in as a user
And I own project "Shop"
@javascript
Scenario: I should see project graphs
When I visit project "Shop" graph page
Then page should have graphs
@javascript
Scenario: I should see project languages & commits graphs on commits graph url
When I visit project "Shop" commits graph page
Then page should have commits graphs
Then page should have languages graphs
@javascript
Scenario: I should see project ci graphs
Given project "Shop" has CI enabled
When I visit project "Shop" CI graph page
Then page should have CI graphs
@javascript
Scenario: I should see project languages & commits graphs on language graph url
When I visit project "Shop" languages graph page
Then page should have languages graphs
Then page should have commits graphs
@javascript
Scenario: I should see project languages & commits graphs on charts url
When I visit project "Shop" chart page
Then page should have languages graphs
Then page should have commits graphs
Feature: Project Redirects
Background:
Given public project "Community"
And private project "Enterprise"
Scenario: I visit public project page
When I visit project "Community" page
Then I should see project "Community" home page
Scenario: I visit private project page
When I visit project "Enterprise" page
Then I should be redirected to sign in page
Scenario: I visit a non-existent project page
When I visit project "CommunityDoesNotExist" page
Then I should be redirected to sign in page
Scenario: I visit a non-existent project page as user
Given I sign in as a user
When I visit project "CommunityDoesNotExist" page
Then page status code should be 404
Scenario: I visit unauthorized project page as user
Given I sign in as a user
When I visit project "Enterprise" page
Then page status code should be 404
Scenario: I visit a public project without signing in
When I visit project "Community" page
And I should see project "Community" home page
And I click on "Sign In"
And Authenticate
Then I should be redirected to "Community" page
Scenario: I visit private project page without signing in
When I visit project "Enterprise" page
And I get redirected to signin page where I sign in
Then I should be redirected to "Enterprise" page
class Spinach::Features::ProjectGraph < Spinach::FeatureSteps
include SharedAuthentication
include SharedProject
step 'page should have graphs' do
expect(page).to have_selector ".stat-graph"
end
When 'I visit project "Shop" graph page' do
visit project_graph_path(project, "master")
end
step 'I visit project "Shop" commits graph page' do
visit commits_project_graph_path(project, "master")
end
step 'I visit project "Shop" languages graph page' do
visit languages_project_graph_path(project, "master")
end
step 'I visit project "Shop" chart page' do
visit charts_project_graph_path(project, "master")
end
step 'page should have languages graphs' do
expect(page).to have_content /Ruby 66.* %/
expect(page).to have_content /JavaScript 22.* %/
end
step 'page should have commits graphs' do
expect(page).to have_content "Commit statistics for master"
expect(page).to have_content "Commits per day of month"
end
step 'I visit project "Shop" CI graph page' do
visit ci_project_graph_path(project, 'master')
end
step 'page should have CI graphs' do
expect(page).to have_content 'Overall'
expect(page).to have_content 'Pipelines for last week'
expect(page).to have_content 'Pipelines for last month'
expect(page).to have_content 'Pipelines for last year'
expect(page).to have_content 'Commit duration in minutes for last 30 commits'
end
def project
@project ||= Project.find_by(name: "Shop")
end
end
class Spinach::Features::ProjectRedirects < Spinach::FeatureSteps
include SharedAuthentication
include SharedPaths
include SharedProject
step 'public project "Community"' do
create(:project, :public, name: 'Community')
end
step 'private project "Enterprise"' do
create(:project, :private, name: 'Enterprise')
end
step 'I visit project "Community" page' do
project = Project.find_by(name: 'Community')
visit project_path(project)
end
step 'I should see project "Community" home page' do
Gitlab.config.gitlab.should_receive(:host).and_return("www.example.com")
page.within '.breadcrumbs .breadcrumb-item-text' do
expect(page).to have_content 'Community'
end
end
step 'I visit project "Enterprise" page' do
project = Project.find_by(name: 'Enterprise')
visit project_path(project)
end
step 'I visit project "CommunityDoesNotExist" page' do
project = Project.find_by(name: 'Community')
visit project_path(project) + 'DoesNotExist'
end
step 'I click on "Sign In"' do
first(:link, "Sign in").click
end
step 'Authenticate' do
admin = create(:admin)
fill_in "user_login", with: admin.email
fill_in "user_password", with: admin.password
click_button "Sign in"
Thread.current[:current_user] = admin
end
step 'I should be redirected to "Community" page' do
project = Project.find_by(name: 'Community')
expect(current_path).to eq "/#{project.full_path}"
expect(status_code).to eq 200
end
step 'I get redirected to signin page where I sign in' do
admin = create(:admin)
fill_in "user_login", with: admin.email
fill_in "user_password", with: admin.password
click_button "Sign in"
Thread.current[:current_user] = admin
end
step 'I should be redirected to "Enterprise" page' do
project = Project.find_by(name: 'Enterprise')
expect(current_path).to eq "/#{project.full_path}"
expect(status_code).to eq 200
end
end
......@@ -69,13 +69,14 @@ module Gitlab
# name - project disk path
#
# Ex.
# add_repository("/path/to/storage", "gitlab/gitlab-ci")
# create_repository("/path/to/storage", "gitlab/gitlab-ci")
#
def add_repository(storage, name)
def create_repository(storage, name)
relative_path = name.dup
relative_path << '.git' unless relative_path.end_with?('.git')
gitaly_migrate(:create_repository) do |is_enabled|
gitaly_migrate(:create_repository,
status: Gitlab::GitalyClient::MigrationStatus::OPT_OUT) do |is_enabled|
if is_enabled
repository = Gitlab::Git::Repository.new(storage, relative_path, '')
repository.gitaly_repository_client.create_repository
......@@ -85,7 +86,7 @@ module Gitlab
Gitlab::Git::Repository.create(repo_path, bare: true, symlink_hooks_to: gitlab_shell_hooks_path)
end
end
rescue => err
rescue => err # Once the Rugged codes gets removes this can be improved
Rails.logger.error("Failed to add repository #{storage}/#{name}: #{err}")
false
end
......@@ -487,8 +488,8 @@ module Gitlab
Gitlab.config.gitlab_shell.git_timeout
end
def gitaly_migrate(method, &block)
Gitlab::GitalyClient.migrate(method, &block)
def gitaly_migrate(method, status: Gitlab::GitalyClient::MigrationStatus::OPT_IN, &block)
Gitlab::GitalyClient.migrate(method, status: status, &block)
rescue GRPC::NotFound, GRPC::BadStatus => e
# Old Popen code returns [Error, output] to the caller, so we
# need to do the same here...
......
......@@ -69,7 +69,7 @@ namespace :gitlab do
if File.exist?(path_to_repo)
print '-'
else
if Gitlab::Shell.new.add_repository(project.repository_storage,
if Gitlab::Shell.new.create_repository(project.repository_storage,
project.disk_path)
print '.'
else
......
require 'spec_helper'
describe 'Project Graph', :js do
let(:user) { create :user }
let(:project) { create(:project, :repository, namespace: user.namespace) }
before do
project.add_master(user)
sign_in(user)
end
shared_examples 'page should have commits graphs' do
it 'renders commits' do
expect(page).to have_content('Commit statistics for master')
expect(page).to have_content('Commits per day of month')
end
end
shared_examples 'page should have languages graphs' do
it 'renders languages' do
expect(page).to have_content(/Ruby 66.* %/)
expect(page).to have_content(/JavaScript 22.* %/)
end
end
it 'renders graphs' do
visit project_graph_path(project, 'master')
expect(page).to have_selector('.stat-graph', visible: false)
end
context 'commits graph' do
before do
visit commits_project_graph_path(project, 'master')
end
it_behaves_like 'page should have commits graphs'
it_behaves_like 'page should have languages graphs'
end
context 'languages graph' do
before do
visit languages_project_graph_path(project, 'master')
end
it_behaves_like 'page should have commits graphs'
it_behaves_like 'page should have languages graphs'
end
context 'charts graph' do
before do
visit charts_project_graph_path(project, 'master')
end
it_behaves_like 'page should have commits graphs'
it_behaves_like 'page should have languages graphs'
end
context 'when CI enabled' do
before do
project.enable_ci
visit ci_project_graph_path(project, 'master')
end
it 'renders CI graphs' do
expect(page).to have_content 'Overall'
expect(page).to have_content 'Pipelines for last week'
expect(page).to have_content 'Pipelines for last month'
expect(page).to have_content 'Pipelines for last year'
expect(page).to have_content 'Commit duration in minutes for last 30 commits'
end
end
end
require 'spec_helper'
describe 'Project redirects' do
let(:user) { create :user }
let(:public_project) { create :project, :public }
let(:private_project) { create :project, :private }
before do
allow(Gitlab.config.gitlab).to receive(:host).and_return('www.example.com')
end
it 'shows public project page' do
visit project_path(public_project)
page.within '.breadcrumbs .breadcrumb-item-text' do
expect(page).to have_content(public_project.name)
end
end
it 'redirects to sign in page when project is private' do
visit project_path(private_project)
expect(current_path).to eq(new_user_session_path)
end
it 'redirects to sign in page when project does not exist' do
visit project_path(build(:project, :public))
expect(current_path).to eq(new_user_session_path)
end
it 'redirects to public project page after signing in' do
visit project_path(public_project)
first(:link, 'Sign in').click
fill_in 'user_login', with: user.email
fill_in 'user_password', with: user.password
click_button 'Sign in'
expect(status_code).to eq(200)
expect(current_path).to eq("/#{public_project.full_path}")
end
it 'redirects to private project page after sign in' do
visit project_path(private_project)
owner = private_project.owner
fill_in 'user_login', with: owner.email
fill_in 'user_password', with: owner.password
click_button 'Sign in'
expect(status_code).to eq(200)
expect(current_path).to eq("/#{private_project.full_path}")
end
context 'when signed in' do
before do
sign_in(user)
end
it 'returns 404 status when project does not exist' do
visit project_path(build(:project, :public))
expect(status_code).to eq(404)
end
it 'returns 404 when project is private' do
visit project_path(private_project)
expect(status_code).to eq(404)
end
end
end
......@@ -61,7 +61,7 @@ describe ::Gitlab::BareRepositoryImport::Repository do
let(:wiki_path) { File.join(root_path, "#{hashed_path}.wiki.git") }
before do
gitlab_shell.add_repository(repository_storage, hashed_path)
gitlab_shell.create_repository(repository_storage, hashed_path)
repository = Rugged::Repository.new(repo_path)
repository.config['gitlab.fullpath'] = 'to/repo'
end
......
......@@ -681,7 +681,7 @@ describe Gitlab::Git::Repository, seed_helper: true do
subject { new_repository.fetch_repository_as_mirror(repository) }
before do
Gitlab::Shell.new.add_repository('default', 'my_project')
Gitlab::Shell.new.create_repository('default', 'my_project')
end
after do
......
......@@ -20,7 +20,7 @@ describe Gitlab::Shell do
it { is_expected.to respond_to :add_key }
it { is_expected.to respond_to :remove_key }
it { is_expected.to respond_to :add_repository }
it { is_expected.to respond_to :create_repository }
it { is_expected.to respond_to :remove_repository }
it { is_expected.to respond_to :fork_repository }
......@@ -402,8 +402,8 @@ describe Gitlab::Shell do
allow(Gitlab.config.gitlab_shell).to receive(:git_timeout).and_return(800)
end
describe '#add_repository' do
shared_examples '#add_repository' do
describe '#create_repository' do
shared_examples '#create_repository' do
let(:repository_storage) { 'default' }
let(:repository_storage_path) { Gitlab.config.repositories.storages[repository_storage]['path'] }
let(:repo_name) { 'project/path' }
......@@ -414,7 +414,7 @@ describe Gitlab::Shell do
end
it 'creates a repository' do
expect(gitlab_shell.add_repository(repository_storage, repo_name)).to be_truthy
expect(gitlab_shell.create_repository(repository_storage, repo_name)).to be_truthy
expect(File.stat(created_path).mode & 0o777).to eq(0o770)
......@@ -426,19 +426,19 @@ describe Gitlab::Shell do
it 'returns false when the command fails' do
FileUtils.mkdir_p(File.dirname(created_path))
# This file will block the creation of the repo's .git directory. That
# should cause #add_repository to fail.
# should cause #create_repository to fail.
FileUtils.touch(created_path)
expect(gitlab_shell.add_repository(repository_storage, repo_name)).to be_falsy
expect(gitlab_shell.create_repository(repository_storage, repo_name)).to be_falsy
end
end
context 'with gitaly' do
it_behaves_like '#add_repository'
it_behaves_like '#create_repository'
end
context 'without gitaly', :skip_gitaly_mock do
it_behaves_like '#add_repository'
it_behaves_like '#create_repository'
end
end
......
......@@ -1511,7 +1511,7 @@ describe Project do
context 'using a regular repository' do
it 'creates the repository' do
expect(shell).to receive(:add_repository)
expect(shell).to receive(:create_repository)
.with(project.repository_storage, project.disk_path)
.and_return(true)
......@@ -1521,7 +1521,7 @@ describe Project do
end
it 'adds an error if the repository could not be created' do
expect(shell).to receive(:add_repository)
expect(shell).to receive(:create_repository)
.with(project.repository_storage, project.disk_path)
.and_return(false)
......@@ -1535,7 +1535,7 @@ describe Project do
context 'using a forked repository' do
it 'does nothing' do
expect(project).to receive(:forked?).and_return(true)
expect(shell).not_to receive(:add_repository)
expect(shell).not_to receive(:create_repository)
project.create_repository
end
......@@ -1554,7 +1554,7 @@ describe Project do
allow(project).to receive(:repository_exists?)
.and_return(false)
allow(shell).to receive(:add_repository)
allow(shell).to receive(:create_repository)
.with(project.repository_storage_path, project.disk_path)
.and_return(true)
......@@ -1578,7 +1578,7 @@ describe Project do
allow(project).to receive(:repository_exists?)
.and_return(false)
expect(shell).to receive(:add_repository)
expect(shell).to receive(:create_repository)
.with(project.repository_storage, project.disk_path)
.and_return(true)
......
......@@ -82,7 +82,7 @@ describe ProjectWiki do
# Create a fresh project which will not have a wiki
project_wiki = described_class.new(create(:project), user)
gitlab_shell = double(:gitlab_shell)
allow(gitlab_shell).to receive(:add_repository)
allow(gitlab_shell).to receive(:create_repository)
allow(project_wiki).to receive(:gitlab_shell).and_return(gitlab_shell)
expect { project_wiki.send(:wiki) }.to raise_exception(ProjectWiki::CouldNotCreateWikiError)
......
......@@ -164,7 +164,7 @@ describe Projects::CreateService, '#execute' do
context 'with legacy storage' do
before do
gitlab_shell.add_repository(repository_storage, "#{user.namespace.full_path}/existing")
gitlab_shell.create_repository(repository_storage, "#{user.namespace.full_path}/existing")
end
after do
......@@ -200,7 +200,7 @@ describe Projects::CreateService, '#execute' do
end
before do
gitlab_shell.add_repository(repository_storage, hashed_path)
gitlab_shell.create_repository(repository_storage, hashed_path)
end
after do
......
......@@ -108,7 +108,7 @@ describe Projects::ForkService do
let(:repository_storage_path) { Gitlab.config.repositories.storages[repository_storage]['path'] }
before do
gitlab_shell.add_repository(repository_storage, "#{@to_user.namespace.full_path}/#{@from_project.path}")
gitlab_shell.create_repository(repository_storage, "#{@to_user.namespace.full_path}/#{@from_project.path}")
end
after do
......
......@@ -151,7 +151,7 @@ describe Projects::TransferService do
before do
group.add_owner(user)
unless gitlab_shell.add_repository(repository_storage, "#{group.full_path}/#{project.path}")
unless gitlab_shell.create_repository(repository_storage, "#{group.full_path}/#{project.path}")
raise 'failed to add repository'
end
......
......@@ -197,7 +197,7 @@ describe Projects::UpdateService, '#execute' do
let(:project) { create(:project, :legacy_storage, :repository, creator: user, namespace: user.namespace) }
before do
gitlab_shell.add_repository(repository_storage, "#{user.namespace.full_path}/existing")
gitlab_shell.create_repository(repository_storage, "#{user.namespace.full_path}/existing")
end
after 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