Commit 1b9249eb authored by Stan Hu's avatar Stan Hu

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

parents 1fe04329 26ed2d2a
...@@ -85,19 +85,6 @@ ...@@ -85,19 +85,6 @@
= link_to project_path_locks_path(@project) do = link_to project_path_locks_path(@project) do
#{ _('Locked Files') } #{ _('Locked Files') }
- if project_nav_tab? :container_registry
= nav_link(controller: %w[projects/registry/repositories]) do
= link_to project_container_registry_index_path(@project), class: 'shortcuts-container-registry' do
.nav-icon-container
= sprite_icon('disk')
%span.nav-item-name
Registry
%ul.sidebar-sub-level-items.is-fly-out-only
= nav_link(controller: %w[projects/registry/repositories], html_options: { class: "fly-out-top-item" } ) do
= link_to project_container_registry_index_path(@project) do
%strong.fly-out-top-item-name
#{ _('Registry') }
- if project_nav_tab? :issues - if project_nav_tab? :issues
= nav_link(controller: @project.issues_enabled? ? [:issues, :labels, :milestones, :boards] : :issues) do = nav_link(controller: @project.issues_enabled? ? [:issues, :labels, :milestones, :boards] : :issues) do
= link_to project_issues_path(@project), class: 'shortcuts-issues' do = link_to project_issues_path(@project), class: 'shortcuts-issues' do
...@@ -245,6 +232,19 @@ ...@@ -245,6 +232,19 @@
%span %span
Charts Charts
- if project_nav_tab? :container_registry
= nav_link(controller: %w[projects/registry/repositories]) do
= link_to project_container_registry_index_path(@project), class: 'shortcuts-container-registry' do
.nav-icon-container
= sprite_icon('disk')
%span.nav-item-name
Registry
%ul.sidebar-sub-level-items.is-fly-out-only
= nav_link(controller: %w[projects/registry/repositories], html_options: { class: "fly-out-top-item" } ) do
= link_to project_container_registry_index_path(@project) do
%strong.fly-out-top-item-name
#{ _('Registry') }
- if project_nav_tab? :wiki - if project_nav_tab? :wiki
= nav_link(controller: :wikis) do = nav_link(controller: :wikis) do
= link_to get_project_wiki_path(@project), class: 'shortcuts-wiki' do = link_to get_project_wiki_path(@project), class: 'shortcuts-wiki' do
......
---
title: Move 'Registry' after 'CI/CD' in project navigation sidebar
merge_request: 18018
author: Elias Werberich
type: changed
...@@ -33,6 +33,26 @@ rest of the code should be as close to the CE files as possible. ...@@ -33,6 +33,26 @@ rest of the code should be as close to the CE files as possible.
[single code base]: https://gitlab.com/gitlab-org/gitlab-ee/issues/2952#note_41016454 [single code base]: https://gitlab.com/gitlab-org/gitlab-ee/issues/2952#note_41016454
### EE-specific comments
When complete separation can't be achieved with the `ee/` directory, you can wrap
code in EE specific comments to designate the difference from CE/EE and add
some context for someone resolving a conflict.
```rb
# EE-specific start
stub_licensed_features(variable_environment_scope: true)
# EE specific end
```
```haml
-# EE-specific start
= render 'ci/variables/environment_scope', form_field: form_field, variable: variable
-# EE-specific end
```
EE-specific comments should not be backported to CE.
### Detection of EE-only files ### Detection of EE-only files
For each commit (except on `master`), the `ee-files-location-check` CI job tries For each commit (except on `master`), the `ee-files-location-check` CI job tries
...@@ -405,12 +425,13 @@ to avoid conflicts during CE to EE merge. ...@@ -405,12 +425,13 @@ to avoid conflicts during CE to EE merge.
} }
} }
/* EE-specific styles */ // EE-specific start
.section-body.ee-section-body { .section-body.ee-section-body {
.section-title { .section-title {
background: $gl-header-color-cyan; background: $gl-header-color-cyan;
} }
} }
// EE-specific end
``` ```
## gitlab-svgs ## gitlab-svgs
......
...@@ -14,12 +14,17 @@ module EE ...@@ -14,12 +14,17 @@ module EE
end end
should_remove_old_approvers = params.delete(:remove_old_approvers) should_remove_old_approvers = params.delete(:remove_old_approvers)
wiki_was_enabled = project.wiki_enabled?
result = super result = super
cleanup_approvers(project) if should_remove_old_approvers && result[:status] == :success if result[:status] == :success
cleanup_approvers(project) if should_remove_old_approvers
log_audit_events if result[:status] == :success log_audit_events
sync_wiki_on_enable if !wiki_was_enabled && project.wiki_enabled?
end
result result
end end
...@@ -36,6 +41,10 @@ module EE ...@@ -36,6 +41,10 @@ module EE
def log_audit_events def log_audit_events
EE::Audit::ProjectChangesAuditor.new(current_user, project).execute EE::Audit::ProjectChangesAuditor.new(current_user, project).execute
end end
def sync_wiki_on_enable
::Geo::RepositoryUpdatedService.new(project, source: ::Geo::RepositoryUpdatedEvent::WIKI).execute
end
end end
end end
end end
...@@ -178,7 +178,7 @@ module Geo ...@@ -178,7 +178,7 @@ module Geo
log_info("Created temporary repository") log_info("Created temporary repository")
repository.clone.tap { |repo| repo.disk_path = disk_path_temp } ::Repository.new(repository.full_path, repository.project, disk_path: disk_path_temp, is_wiki: repository.is_wiki)
end end
def clean_up_temporary_repository def clean_up_temporary_repository
......
---
title: 'Geo: Sync wiki when it is enabled'
merge_request: 5139
author:
type: fixed
require 'spec_helper' require 'spec_helper'
describe Projects::UpdateService, '#execute' do describe Projects::UpdateService, '#execute' do
include EE::GeoHelpers
let(:user) { create(:user) } let(:user) { create(:user) }
let(:project) { create(:project, :repository, creator: user, namespace: user.namespace) } let(:project) { create(:project, :repository, creator: user, namespace: user.namespace) }
...@@ -123,6 +125,77 @@ describe Projects::UpdateService, '#execute' do ...@@ -123,6 +125,77 @@ describe Projects::UpdateService, '#execute' do
end end
end end
context 'triggering wiki Geo syncs', :geo do
context 'on a Geo primary' do
set(:primary) { create(:geo_node, :primary) }
set(:secondary) { create(:geo_node) }
before do
stub_current_geo_node(primary)
end
context 'when enabling a wiki' do
it 'creates a RepositoryUpdatedEvent' do
project.project_feature.update(wiki_access_level: ProjectFeature::DISABLED)
project.reload
expect do
result = update_project(project, user, project_feature_attributes: { wiki_access_level: ProjectFeature::ENABLED })
expect(result).to eq({ status: :success })
end.to change { Geo::RepositoryUpdatedEvent.count }.by(1)
expect(project.wiki_enabled?).to be true
end
end
context 'when we update project but not enabling a wiki' do
context 'when the wiki is disabled' do
it 'does not create a RepositoryUpdatedEvent' do
project.project_feature.update(wiki_access_level: ProjectFeature::DISABLED)
expect do
result = update_project(project, user, { name: 'test1' })
expect(result).to eq({ status: :success })
end.not_to change { Geo::RepositoryUpdatedEvent.count }
expect(project.wiki_enabled?).to be false
end
end
context 'when the wiki was already enabled' do
it 'does not create a RepositoryUpdatedEvent' do
project.project_feature.update(wiki_access_level: ProjectFeature::ENABLED)
expect do
result = update_project(project, user, { name: 'test1' })
expect(result).to eq({ status: :success })
end.not_to change { Geo::RepositoryUpdatedEvent.count }
expect(project.wiki_enabled?).to be true
end
end
end
end
context 'not on a Geo node' do
before do
allow(::Gitlab::Geo).to receive(:current_node).and_return(nil)
end
it 'does not create a RepositoryUpdatedEvent when enabling a wiki' do
project.project_feature.update(wiki_access_level: ProjectFeature::DISABLED)
project.reload
expect do
result = update_project(project, user, project_feature_attributes: { wiki_access_level: ProjectFeature::ENABLED })
expect(result).to eq({ status: :success })
end.not_to change { Geo::RepositoryUpdatedEvent.count }
expect(project.wiki_enabled?).to be true
end
end
end
def update_project(project, user, opts) def update_project(project, user, opts)
Projects::UpdateService.new(project, user, opts).execute Projects::UpdateService.new(project, user, opts).execute
end end
......
...@@ -11,8 +11,8 @@ module QA ...@@ -11,8 +11,8 @@ module QA
attribute :geo_secondary_name, '--secondary-name SECONDARY_NAME' attribute :geo_secondary_name, '--secondary-name SECONDARY_NAME'
attribute :geo_skip_setup?, '--without-setup' attribute :geo_skip_setup?, '--without-setup'
def perform(**args) def perform(options, *files)
unless args[:geo_skip_setup?] unless options[:geo_skip_setup?]
Geo::Primary.act do Geo::Primary.act do
add_license add_license
enable_hashed_storage enable_hashed_storage
......
...@@ -23,7 +23,7 @@ module QA ...@@ -23,7 +23,7 @@ module QA
arguments.parse!(argv) arguments.parse!(argv)
self.perform(**Runtime::Scenario.attributes) self.perform(Runtime::Scenario.attributes, *arguments.default_argv)
end end
private private
......
...@@ -11,7 +11,7 @@ module QA ...@@ -11,7 +11,7 @@ module QA
tags :core tags :core
def perform(address, *files) def perform(address, *rspec_options)
Runtime::Scenario.define(:gitlab_address, address) Runtime::Scenario.define(:gitlab_address, address)
## ##
...@@ -22,9 +22,9 @@ module QA ...@@ -22,9 +22,9 @@ module QA
Specs::Runner.perform do |specs| Specs::Runner.perform do |specs|
specs.tty = true specs.tty = true
specs.tags = self.class.focus specs.tags = self.class.focus
specs.files = specs.options =
if files.any? if rspec_options.any?
files rspec_options
else else
File.expand_path('../../specs/features', __dir__) File.expand_path('../../specs/features', __dir__)
end end
......
...@@ -9,10 +9,10 @@ module QA ...@@ -9,10 +9,10 @@ module QA
class Mattermost < Test::Instance class Mattermost < Test::Instance
tags :core, :mattermost tags :core, :mattermost
def perform(address, mattermost, *files) def perform(address, mattermost, *rspec_options)
Runtime::Scenario.define(:mattermost_address, mattermost) Runtime::Scenario.define(:mattermost_address, mattermost)
super(address, *files) super(address, *rspec_options)
end end
end end
end end
......
...@@ -3,19 +3,19 @@ require 'rspec/core' ...@@ -3,19 +3,19 @@ require 'rspec/core'
module QA module QA
module Specs module Specs
class Runner < Scenario::Template class Runner < Scenario::Template
attr_accessor :tty, :tags, :files attr_accessor :tty, :tags, :options
def initialize def initialize
@tty = false @tty = false
@tags = [] @tags = []
@files = [File.expand_path('./features', __dir__)] @options = [File.expand_path('./features', __dir__)]
end end
def perform def perform
args = [] args = []
args.push('--tty') if tty args.push('--tty') if tty
tags.to_a.each { |tag| args.push(['-t', tag.to_s]) } tags.to_a.each { |tag| args.push(['-t', tag.to_s]) }
args.push(files) args.push(options)
Runtime::Browser.configure! Runtime::Browser.configure!
......
...@@ -29,7 +29,7 @@ describe QA::Scenario::Test::Instance do ...@@ -29,7 +29,7 @@ describe QA::Scenario::Test::Instance do
it 'should call runner with default arguments' do it 'should call runner with default arguments' do
subject.perform("test") subject.perform("test")
expect(runner).to have_received(:files=) expect(runner).to have_received(:options=)
.with(File.expand_path('../../../qa/specs/features', __dir__)) .with(File.expand_path('../../../qa/specs/features', __dir__))
end end
end end
...@@ -38,7 +38,7 @@ describe QA::Scenario::Test::Instance do ...@@ -38,7 +38,7 @@ describe QA::Scenario::Test::Instance do
it 'should call runner with paths' do it 'should call runner with paths' do
subject.perform('test', 'path1', 'path2') subject.perform('test', 'path1', 'path2')
expect(runner).to have_received(:files=).with(%w[path1 path2]) expect(runner).to have_received(:options=).with(%w[path1 path2])
end end
end end
end end
......
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