Commit 944c5d89 authored by Robert Speicher's avatar Robert Speicher

Merge branch 'ce-to-ee-2018-09-18' into 'master'

CE upstream - 2018-09-18 21:21 UTC

Closes gitlab-org/release/framework#15

See merge request gitlab-org/gitlab-ee!7408
parents 8c7c6613 ffccc4e8
...@@ -7,12 +7,12 @@ ...@@ -7,12 +7,12 @@
= f.hidden_field :reset_password_token = f.hidden_field :reset_password_token
.form-group .form-group
= f.label 'New password', for: "user_password" = 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 .form-group
= f.label 'Confirm new password', for: "user_password_confirmation" = 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 .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 .clearfix.prepend-top-20
%p %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_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 .form-group
= f.label "Username or email", for: "user_login", class: 'label-bold' = 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 .form-group
= f.label :password, class: 'label-bold' = 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? - if devise_mapping.rememberable?
.remember-me .remember-me
%label{ for: "user_remember_me" } %label{ for: "user_remember_me" }
...@@ -17,4 +17,4 @@ ...@@ -17,4 +17,4 @@
= recaptcha_tags = recaptcha_tags
.submit-container.move-submit-down .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_tag(omniauth_callback_path(:user, server['provider_name']), id: 'new_ldap_user', class: "gl-show-field-errors") do
.form-group .form-group
= label_tag :username, "#{server['label']} Username" = 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 .form-group
= label_tag :password = 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? - if devise_mapping.rememberable?
.remember-me .remember-me
%label{ for: "remember_me" } %label{ for: "remember_me" }
= check_box_tag :remember_me, '1', false, id: 'remember_me' = check_box_tag :remember_me, '1', false, id: 'remember_me'
%span 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 @@ ...@@ -7,10 +7,10 @@
= link_to "Kerberos", "#kerberos", class: "nav-link #{active_when(!crowd_enabled? && !ldap_enabled?)}", 'data-toggle' => 'tab' = link_to "Kerberos", "#kerberos", class: "nav-link #{active_when(!crowd_enabled? && !ldap_enabled?)}", 'data-toggle' => 'tab'
- @ldap_servers.each_with_index do |server, i| - @ldap_servers.each_with_index do |server, i|
%li.nav-item %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? - if password_authentication_enabled_for_web?
%li.nav-item %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? - if allow_signup?
%li.nav-item %li.nav-item
= link_to 'Register', '#register-pane', class: 'nav-link', 'data-toggle' => 'tab' = link_to 'Register', '#register-pane', class: 'nav-link', 'data-toggle' => 'tab'
%ul.nav-links.new-session-tabs.nav-tabs.nav{ role: 'tablist' } %ul.nav-links.new-session-tabs.nav-tabs.nav{ role: 'tablist' }
%li.nav-item{ role: 'presentation' } %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? - if allow_signup?
%li.nav-item{ role: 'presentation' } %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 # frozen_string_literal: true
require 'json'
# rubocop: disable Style/SignalException # rubocop: disable Style/SignalException
# rubocop: disable Metrics/CyclomaticComplexity # rubocop: disable Metrics/CyclomaticComplexity
# rubocop: disable Metrics/PerceivedComplexity # rubocop: disable Metrics/PerceivedComplexity
...@@ -8,6 +10,30 @@ ...@@ -8,6 +10,30 @@
# https://github.com/jonallured/danger-commit_lint because its output is not # 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. # 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) def fail_commit(commit, message)
fail("#{commit.sha}: #{message}") fail("#{commit.sha}: #{message}")
end end
...@@ -33,6 +59,7 @@ end ...@@ -33,6 +59,7 @@ end
def lint_commits(commits) def lint_commits(commits)
failures = false failures = false
emoji_checker = EmojiChecker.new
unicode_emoji_regex = %r(( unicode_emoji_regex = %r((
[\u{1F300}-\u{1F5FF}] | [\u{1F300}-\u{1F5FF}] |
...@@ -117,7 +144,7 @@ def lint_commits(commits) ...@@ -117,7 +144,7 @@ def lint_commits(commits)
failures = true failures = true
end end
if commit.message.match?(/:[\+a-z0-9_\-]+:/) if emoji_checker.includes_emoji?(commit.message)
fail_commit( fail_commit(
commit, commit,
'Avoid the use of Markdown Emoji such as `:+1:`. ' \ '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 ...@@ -170,7 +170,7 @@ ActiveRecord::Schema.define(version: 20180907015926) do
t.boolean "allow_group_owners_to_manage_ldap", default: true, null: false t.boolean "allow_group_owners_to_manage_ldap", default: true, null: false
t.boolean "hashed_storage_enabled", default: false, null: false t.boolean "hashed_storage_enabled", default: false, null: false
t.boolean "project_export_enabled", default: true, 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_count_threshold", default: 3
t.integer "circuitbreaker_failure_reset_time", default: 1800 t.integer "circuitbreaker_failure_reset_time", default: 1800
t.integer "circuitbreaker_storage_timeout", default: 15 t.integer "circuitbreaker_storage_timeout", default: 15
......
...@@ -55,11 +55,14 @@ description: 'Learn how to contribute to GitLab.' ...@@ -55,11 +55,14 @@ description: 'Learn how to contribute to GitLab.'
## Performance guides ## Performance guides
- [Instrumentation](instrumentation.md) - [Instrumentation](instrumentation.md) for Ruby code running in production
- [Performance guidelines](performance.md) environments
- [Performance guidelines](performance.md) for writing code, benchmarks, and
certain patterns to avoid
- [Merge request performance guidelines](merge_request_performance_guidelines.md) - [Merge request performance guidelines](merge_request_performance_guidelines.md)
for ensuring merge requests do not negatively impact GitLab performance 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 ## Database guides
......
...@@ -3,31 +3,31 @@ module QA ...@@ -3,31 +3,31 @@ module QA
module Main module Main
class Login < Page::Base class Login < Page::Base
view 'app/views/devise/passwords/edit.html.haml' do view 'app/views/devise/passwords/edit.html.haml' do
element :password_field, 'password_field :password' element :password_field
element :password_confirmation, 'password_field :password_confirmation' element :password_confirmation
element :change_password_button, 'submit "Change your password"' element :change_password_button
end end
view 'app/views/devise/sessions/_new_base.html.haml' do view 'app/views/devise/sessions/_new_base.html.haml' do
element :login_field, 'text_field :login' element :login_field
element :password_field, 'password_field :password' element :password_field
element :sign_in_button, 'submit "Sign in"' element :sign_in_button
end end
view 'app/views/devise/sessions/_new_ldap.html.haml' do view 'app/views/devise/sessions/_new_ldap.html.haml' do
element :username_field, 'text_field_tag :username' element :username_field
element :password_field, 'password_field_tag :password' element :password_field
element :sign_in_button, 'submit_tag "Sign in"' element :sign_in_button
end end
view 'app/views/devise/shared/_tabs_ldap.html.haml' do view 'app/views/devise/shared/_tabs_ldap.html.haml' do
element :ldap_tab, "link_to server['label']" element :ldap_tab
element :standard_tab, "link_to 'Standard'" element :standard_tab
end end
view 'app/views/devise/shared/_tabs_normal.html.haml' do view 'app/views/devise/shared/_tabs_normal.html.haml' do
element :sign_in_tab, /nav-link.*login-pane.*Sign in/ element :sign_in_tab
element :register_tab, /nav-link.*register-pane.*Register/ element :register_tab
end end
def initialize def initialize
...@@ -87,19 +87,19 @@ module QA ...@@ -87,19 +87,19 @@ module QA
end end
def switch_to_sign_in_tab def switch_to_sign_in_tab
click_on 'Sign in' click_element :sign_in_tab
end end
def switch_to_register_tab def switch_to_register_tab
click_on 'Register' click_element :register_tab
end end
def switch_to_ldap_tab def switch_to_ldap_tab
click_on 'LDAP' click_element :ldap_tab
end end
def switch_to_standard_tab def switch_to_standard_tab
click_on 'Standard' click_element :standard_tab
end end
private private
...@@ -107,26 +107,26 @@ module QA ...@@ -107,26 +107,26 @@ module QA
def sign_in_using_ldap_credentials def sign_in_using_ldap_credentials
switch_to_ldap_tab switch_to_ldap_tab
fill_in :username, with: Runtime::User.ldap_username fill_element :username_field, Runtime::User.ldap_username
fill_in :password, with: Runtime::User.ldap_password fill_element :password_field, Runtime::User.ldap_password
click_button 'Sign in' click_element :sign_in_button
end end
def sign_in_using_gitlab_credentials(user) def sign_in_using_gitlab_credentials(user)
switch_to_sign_in_tab unless sign_in_tab? switch_to_sign_in_tab unless sign_in_tab?
switch_to_standard_tab if ldap_tab? switch_to_standard_tab if ldap_tab?
fill_in :user_login, with: user.username fill_element :login_field, user.username
fill_in :user_password, with: user.password fill_element :password_field, user.password
click_button 'Sign in' click_element :sign_in_button
end end
def set_initial_password_if_present def set_initial_password_if_present
return unless page.has_content?('Change your password') return unless page.has_content?('Change your password')
fill_in :user_password, with: Runtime::User.password fill_element :password_field, Runtime::User.password
fill_in :user_password_confirmation, with: Runtime::User.password fill_element :password_confirmation, Runtime::User.password
click_button 'Change your password' click_element :change_password_button
end end
end end
end end
......
...@@ -9,6 +9,7 @@ describe 'Pipelines', :js do ...@@ -9,6 +9,7 @@ describe 'Pipelines', :js do
before do before do
sign_in(user) sign_in(user)
project.add_developer(user) project.add_developer(user)
project.update!(auto_devops_attributes: { enabled: false })
end end
describe 'GET /:project/pipelines' do describe 'GET /:project/pipelines' do
...@@ -641,6 +642,7 @@ describe 'Pipelines', :js do ...@@ -641,6 +642,7 @@ describe 'Pipelines', :js do
context 'when user is not logged in' do context 'when user is not logged in' do
before do before do
project.update!(auto_devops_attributes: { enabled: false })
visit project_pipelines_path(project) visit project_pipelines_path(project)
end end
......
...@@ -16,7 +16,15 @@ describe AutoDevopsHelper do ...@@ -16,7 +16,15 @@ describe AutoDevopsHelper do
subject { helper.show_auto_devops_callout?(project) } 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) } it { is_expected.to eq(true) }
end end
......
...@@ -1160,7 +1160,11 @@ describe Ci::Pipeline, :mailer do ...@@ -1160,7 +1160,11 @@ describe Ci::Pipeline, :mailer do
end end
describe '#set_config_source' do 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 it 'defines source to be unknown' do
pipeline.set_config_source pipeline.set_config_source
...@@ -1205,7 +1209,6 @@ describe Ci::Pipeline, :mailer do ...@@ -1205,7 +1209,6 @@ describe Ci::Pipeline, :mailer do
context 'auto devops enabled' do context 'auto devops enabled' do
before do before do
stub_application_setting(auto_devops_enabled: true)
allow(project).to receive(:ci_config_path) { 'custom' } allow(project).to receive(:ci_config_path) { 'custom' }
end end
......
...@@ -3521,17 +3521,17 @@ describe Project do ...@@ -3521,17 +3521,17 @@ describe Project do
expect(repository).to receive(:gitlab_ci_yml) { nil } expect(repository).to receive(:gitlab_ci_yml) { nil }
end end
it "CI is not available" do it "CI is available" do
expect(project).not_to have_ci expect(project).to have_ci
end end
context 'when auto devops is enabled' do context 'when auto devops is disabled' do
before do before do
stub_application_setting(auto_devops_enabled: true) stub_application_setting(auto_devops_enabled: false)
end end
it "CI is available" do it "CI is not available" do
expect(project).to have_ci expect(project).not_to have_ci
end end
end end
end end
......
...@@ -370,12 +370,18 @@ describe API::Pipelines do ...@@ -370,12 +370,18 @@ describe API::Pipelines do
end end
context 'without gitlab-ci.yml' do context 'without gitlab-ci.yml' do
it 'fails to create pipeline' do context 'without auto devops enabled' do
post api("/projects/#{project.id}/pipeline", user), ref: project.default_branch before do
project.update!(auto_devops_attributes: { enabled: false })
end
expect(response).to have_gitlab_http_status(400) it 'fails to create pipeline' do
expect(json_response['message']['base'].first).to eq 'Missing .gitlab-ci.yml file' post api("/projects/#{project.id}/pipeline", user), ref: project.default_branch
expect(json_response).not_to be_an Array
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 end
end end
......
...@@ -268,13 +268,15 @@ describe GitPushService do ...@@ -268,13 +268,15 @@ describe GitPushService do
describe 'system hooks' do describe 'system hooks' do
let!(:push_data) { push_data_from_service(project, user, oldrev, newrev, ref) } 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 it "sends a system hook after pushing a branch" do
expect(SystemHooksService).to receive(:new).and_return(system_hooks_service) allow(SystemHooksService).to receive(:new).and_return(system_hooks_service)
expect(system_hooks_service).to receive(:execute_hooks).with(push_data, :push_hooks) allow(system_hooks_service).to receive(:execute_hooks)
execute_service(project, user, oldrev, newrev, ref) execute_service(project, user, oldrev, newrev, ref)
expect(system_hooks_service).to have_received(:execute_hooks).with(push_data, :push_hooks)
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