Commit 8b7f87de authored by GitLab Bot's avatar GitLab Bot

Merge remote-tracking branch 'upstream/master' into ce-to-ee-2018-09-18

# Conflicts:
#	app/models/concerns/protected_ref_access.rb
#	app/models/epic.rb

[ci skip]
parents 8c7c6613 2dac058d
......@@ -2,8 +2,11 @@
module ProtectedRefAccess
extend ActiveSupport::Concern
<<<<<<< HEAD
include EE::ProtectedRefAccess::Scopes
prepend EE::ProtectedRefAccess
=======
>>>>>>> upstream/master
HUMAN_ACCESS_LEVELS = {
Gitlab::Access::MAINTAINER => "Maintainers".freeze,
......
......@@ -3,8 +3,11 @@
# Placeholder class for model that is implemented in EE
# It reserves '&' as a reference prefix, but the table does not exists in CE
class Epic < ActiveRecord::Base
<<<<<<< HEAD
prepend EE::Epic
=======
>>>>>>> upstream/master
def self.link_reference_pattern
nil
end
......
......@@ -7,12 +7,12 @@
= f.hidden_field :reset_password_token
.form-group
= f.label 'New password', for: "user_password"
= f.password_field :password, class: "form-control top", required: true, title: 'This field is required'
= f.password_field :password, class: "form-control top qa-password-field", required: true, title: 'This field is required'
.form-group
= f.label 'Confirm new password', for: "user_password_confirmation"
= f.password_field :password_confirmation, class: "form-control bottom", title: 'This field is required', required: true
= f.password_field :password_confirmation, class: "form-control bottom qa-password-confirmation", title: 'This field is required', required: true
.clearfix
= f.submit "Change your password", class: "btn btn-primary"
= f.submit "Change your password", class: "btn btn-primary qa-change-password-button"
.clearfix.prepend-top-20
%p
......
= form_for(resource, as: resource_name, url: session_path(resource_name), html: { class: 'new_user gl-show-field-errors', 'aria-live' => 'assertive'}) do |f|
.form-group
= f.label "Username or email", for: "user_login", class: 'label-bold'
= f.text_field :login, class: "form-control top", autofocus: "autofocus", autocapitalize: "off", autocorrect: "off", required: true, title: "This field is required."
= f.text_field :login, class: "form-control top qa-login-field", autofocus: "autofocus", autocapitalize: "off", autocorrect: "off", required: true, title: "This field is required."
.form-group
= f.label :password, class: 'label-bold'
= f.password_field :password, class: "form-control bottom", required: true, title: "This field is required."
= f.password_field :password, class: "form-control bottom qa-password-field", required: true, title: "This field is required."
- if devise_mapping.rememberable?
.remember-me
%label{ for: "user_remember_me" }
......@@ -17,4 +17,4 @@
= recaptcha_tags
.submit-container.move-submit-down
= f.submit "Sign in", class: "btn btn-save"
= f.submit "Sign in", class: "btn btn-save qa-sign-in-button"
= form_tag(omniauth_callback_path(:user, server['provider_name']), id: 'new_ldap_user', class: "gl-show-field-errors") do
.form-group
= label_tag :username, "#{server['label']} Username"
= text_field_tag :username, nil, { class: "form-control top", title: "This field is required.", autofocus: "autofocus", required: true }
= text_field_tag :username, nil, { class: "form-control top qa-username-field", title: "This field is required.", autofocus: "autofocus", required: true }
.form-group
= label_tag :password
= password_field_tag :password, nil, { class: "form-control bottom", title: "This field is required.", required: true }
= password_field_tag :password, nil, { class: "form-control bottom qa-password-field", title: "This field is required.", required: true }
- if devise_mapping.rememberable?
.remember-me
%label{ for: "remember_me" }
= check_box_tag :remember_me, '1', false, id: 'remember_me'
%span Remember me
= submit_tag "Sign in", class: "btn-save btn"
= submit_tag "Sign in", class: "btn-save btn qa-sign-in-button"
......@@ -7,10 +7,10 @@
= link_to "Kerberos", "#kerberos", class: "nav-link #{active_when(!crowd_enabled? && !ldap_enabled?)}", 'data-toggle' => 'tab'
- @ldap_servers.each_with_index do |server, i|
%li.nav-item
= link_to server['label'], "##{server['provider_name']}", class: "nav-link #{active_when(i.zero? && !crowd_enabled?)}", 'data-toggle' => 'tab'
= link_to server['label'], "##{server['provider_name']}", class: "nav-link #{active_when(i.zero? && !crowd_enabled?)} qa-ldap-tab", 'data-toggle' => 'tab'
- if password_authentication_enabled_for_web?
%li.nav-item
= link_to 'Standard', '#login-pane', class: 'nav-link', 'data-toggle' => 'tab'
= link_to 'Standard', '#login-pane', class: 'nav-link qa-standard-tab', 'data-toggle' => 'tab'
- if allow_signup?
%li.nav-item
= link_to 'Register', '#register-pane', class: 'nav-link', 'data-toggle' => 'tab'
%ul.nav-links.new-session-tabs.nav-tabs.nav{ role: 'tablist' }
%li.nav-item{ role: 'presentation' }
%a.nav-link.active{ href: '#login-pane', data: { toggle: 'tab' }, role: 'tab' } Sign in
%a.nav-link.qa-sign-in-tab.active{ href: '#login-pane', data: { toggle: 'tab' }, role: 'tab' } Sign in
- if allow_signup?
%li.nav-item{ role: 'presentation' }
%a.nav-link{ href: '#register-pane', data: { toggle: 'tab' }, role: 'tab' } Register
%a.nav-link.qa-register-tab{ href: '#register-pane', data: { toggle: 'tab' }, role: 'tab' } Register
---
title: Enable Auto DevOps Instance Wide Default
merge_request: 21157
author:
type: changed
# frozen_string_literal: true
require 'json'
# rubocop: disable Style/SignalException
# rubocop: disable Metrics/CyclomaticComplexity
# rubocop: disable Metrics/PerceivedComplexity
......@@ -8,6 +10,30 @@
# https://github.com/jonallured/danger-commit_lint because its output is not
# very helpful, and it doesn't offer the means of ignoring merge commits.
class EmojiChecker
DIGESTS = File.expand_path('../../fixtures/emojis/digests.json', __dir__)
ALIASES = File.expand_path('../../fixtures/emojis/aliases.json', __dir__)
# A regex that indicates a piece of text _might_ include an Emoji. The regex
# alone is not enough, as we'd match `:foo:bar:baz`. Instead, we use this
# regex to save us from having to check for all possible emoji names when we
# know one definitely is not included.
LIKELY_EMOJI = /:[\+a-z0-9_\-]+:/
def initialize
names = JSON.parse(File.read(DIGESTS)).keys +
JSON.parse(File.read(ALIASES)).keys
@emoji = names.map { |name| ":#{name}:" }
end
def includes_emoji?(text)
return false unless text.match?(LIKELY_EMOJI)
@emoji.any? { |emoji| text.include?(emoji) }
end
end
def fail_commit(commit, message)
fail("#{commit.sha}: #{message}")
end
......@@ -33,6 +59,7 @@ end
def lint_commits(commits)
failures = false
emoji_checker = EmojiChecker.new
unicode_emoji_regex = %r((
[\u{1F300}-\u{1F5FF}] |
......@@ -117,7 +144,7 @@ def lint_commits(commits)
failures = true
end
if commit.message.match?(/:[\+a-z0-9_\-]+:/)
if emoji_checker.includes_emoji?(commit.message)
fail_commit(
commit,
'Avoid the use of Markdown Emoji such as `:+1:`. ' \
......
# frozen_string_literal: true
class ChangeDefaultOfAutoDevopsInstanceWide < ActiveRecord::Migration
include Gitlab::Database::MigrationHelpers
DOWNTIME = false
def up
change_column_default :application_settings, :auto_devops_enabled, true
end
def down
change_column_default :application_settings, :auto_devops_enabled, false
end
end
# frozen_string_literal: true
class EnableAutoDevopsInstanceWideForEveryone < ActiveRecord::Migration
include Gitlab::Database::MigrationHelpers
DOWNTIME = false
def up
execute "UPDATE application_settings SET auto_devops_enabled = true"
end
def down
# No way to know here what their previous setting was...
end
end
......@@ -170,7 +170,7 @@ ActiveRecord::Schema.define(version: 20180907015926) do
t.boolean "allow_group_owners_to_manage_ldap", default: true, null: false
t.boolean "hashed_storage_enabled", default: false, null: false
t.boolean "project_export_enabled", default: true, null: false
t.boolean "auto_devops_enabled", default: false, null: false
t.boolean "auto_devops_enabled", default: true, null: false
t.integer "circuitbreaker_failure_count_threshold", default: 3
t.integer "circuitbreaker_failure_reset_time", default: 1800
t.integer "circuitbreaker_storage_timeout", default: 15
......
......@@ -55,11 +55,14 @@ description: 'Learn how to contribute to GitLab.'
## Performance guides
- [Instrumentation](instrumentation.md)
- [Performance guidelines](performance.md)
- [Instrumentation](instrumentation.md) for Ruby code running in production
environments
- [Performance guidelines](performance.md) for writing code, benchmarks, and
certain patterns to avoid
- [Merge request performance guidelines](merge_request_performance_guidelines.md)
for ensuring merge requests do not negatively impact GitLab performance
- [Profiling](profiling.md) for profiling a URL
- [Profiling](profiling.md) a URL, measuring performance using Sherlock, or
tracking down N+1 queries using Bullet
## Database guides
......
......@@ -3,31 +3,31 @@ module QA
module Main
class Login < Page::Base
view 'app/views/devise/passwords/edit.html.haml' do
element :password_field, 'password_field :password'
element :password_confirmation, 'password_field :password_confirmation'
element :change_password_button, 'submit "Change your password"'
element :password_field
element :password_confirmation
element :change_password_button
end
view 'app/views/devise/sessions/_new_base.html.haml' do
element :login_field, 'text_field :login'
element :password_field, 'password_field :password'
element :sign_in_button, 'submit "Sign in"'
element :login_field
element :password_field
element :sign_in_button
end
view 'app/views/devise/sessions/_new_ldap.html.haml' do
element :username_field, 'text_field_tag :username'
element :password_field, 'password_field_tag :password'
element :sign_in_button, 'submit_tag "Sign in"'
element :username_field
element :password_field
element :sign_in_button
end
view 'app/views/devise/shared/_tabs_ldap.html.haml' do
element :ldap_tab, "link_to server['label']"
element :standard_tab, "link_to 'Standard'"
element :ldap_tab
element :standard_tab
end
view 'app/views/devise/shared/_tabs_normal.html.haml' do
element :sign_in_tab, /nav-link.*login-pane.*Sign in/
element :register_tab, /nav-link.*register-pane.*Register/
element :sign_in_tab
element :register_tab
end
def initialize
......@@ -87,19 +87,19 @@ module QA
end
def switch_to_sign_in_tab
click_on 'Sign in'
click_element :sign_in_tab
end
def switch_to_register_tab
click_on 'Register'
click_element :register_tab
end
def switch_to_ldap_tab
click_on 'LDAP'
click_element :ldap_tab
end
def switch_to_standard_tab
click_on 'Standard'
click_element :standard_tab
end
private
......@@ -107,26 +107,26 @@ module QA
def sign_in_using_ldap_credentials
switch_to_ldap_tab
fill_in :username, with: Runtime::User.ldap_username
fill_in :password, with: Runtime::User.ldap_password
click_button 'Sign in'
fill_element :username_field, Runtime::User.ldap_username
fill_element :password_field, Runtime::User.ldap_password
click_element :sign_in_button
end
def sign_in_using_gitlab_credentials(user)
switch_to_sign_in_tab unless sign_in_tab?
switch_to_standard_tab if ldap_tab?
fill_in :user_login, with: user.username
fill_in :user_password, with: user.password
click_button 'Sign in'
fill_element :login_field, user.username
fill_element :password_field, user.password
click_element :sign_in_button
end
def set_initial_password_if_present
return unless page.has_content?('Change your password')
fill_in :user_password, with: Runtime::User.password
fill_in :user_password_confirmation, with: Runtime::User.password
click_button 'Change your password'
fill_element :password_field, Runtime::User.password
fill_element :password_confirmation, Runtime::User.password
click_element :change_password_button
end
end
end
......
......@@ -9,6 +9,7 @@ describe 'Pipelines', :js do
before do
sign_in(user)
project.add_developer(user)
project.update!(auto_devops_attributes: { enabled: false })
end
describe 'GET /:project/pipelines' do
......@@ -641,6 +642,7 @@ describe 'Pipelines', :js do
context 'when user is not logged in' do
before do
project.update!(auto_devops_attributes: { enabled: false })
visit project_pipelines_path(project)
end
......
......@@ -16,7 +16,15 @@ describe AutoDevopsHelper do
subject { helper.show_auto_devops_callout?(project) }
context 'when all conditions are met' do
context 'when auto devops is implicitly enabled' do
it { is_expected.to eq(false) }
end
context 'when auto devops is not implicitly enabled' do
before do
Gitlab::CurrentSettings.update!(auto_devops_enabled: false)
end
it { is_expected.to eq(true) }
end
......
......@@ -1160,7 +1160,11 @@ describe Ci::Pipeline, :mailer do
end
describe '#set_config_source' do
context 'when pipelines does not contain needed data' do
context 'when pipelines does not contain needed data and auto devops is disabled' do
before do
stub_application_setting(auto_devops_enabled: false)
end
it 'defines source to be unknown' do
pipeline.set_config_source
......@@ -1205,7 +1209,6 @@ describe Ci::Pipeline, :mailer do
context 'auto devops enabled' do
before do
stub_application_setting(auto_devops_enabled: true)
allow(project).to receive(:ci_config_path) { 'custom' }
end
......
......@@ -3521,17 +3521,17 @@ describe Project do
expect(repository).to receive(:gitlab_ci_yml) { nil }
end
it "CI is not available" do
expect(project).not_to have_ci
it "CI is available" do
expect(project).to have_ci
end
context 'when auto devops is enabled' do
context 'when auto devops is disabled' do
before do
stub_application_setting(auto_devops_enabled: true)
stub_application_setting(auto_devops_enabled: false)
end
it "CI is available" do
expect(project).to have_ci
it "CI is not available" do
expect(project).not_to have_ci
end
end
end
......
......@@ -370,12 +370,18 @@ describe API::Pipelines do
end
context 'without gitlab-ci.yml' do
it 'fails to create pipeline' do
post api("/projects/#{project.id}/pipeline", user), ref: project.default_branch
context 'without auto devops enabled' do
before do
project.update!(auto_devops_attributes: { enabled: false })
end
expect(response).to have_gitlab_http_status(400)
expect(json_response['message']['base'].first).to eq 'Missing .gitlab-ci.yml file'
expect(json_response).not_to be_an Array
it 'fails to create pipeline' do
post api("/projects/#{project.id}/pipeline", user), ref: project.default_branch
expect(response).to have_gitlab_http_status(400)
expect(json_response['message']['base'].first).to eq 'Missing .gitlab-ci.yml file'
expect(json_response).not_to be_an Array
end
end
end
end
......
......@@ -268,13 +268,15 @@ describe GitPushService do
describe 'system hooks' do
let!(:push_data) { push_data_from_service(project, user, oldrev, newrev, ref) }
let(:system_hooks_service) { SystemHooksService.new }
let!(:system_hooks_service) { SystemHooksService.new }
it "sends a system hook after pushing a branch" do
expect(SystemHooksService).to receive(:new).and_return(system_hooks_service)
expect(system_hooks_service).to receive(:execute_hooks).with(push_data, :push_hooks)
allow(SystemHooksService).to receive(:new).and_return(system_hooks_service)
allow(system_hooks_service).to receive(:execute_hooks)
execute_service(project, user, oldrev, newrev, ref)
expect(system_hooks_service).to have_received(:execute_hooks).with(push_data, :push_hooks)
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