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 @@
= 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
......
......@@ -28,8 +28,6 @@ describe 'Projects > Show > User sees setup shortcut buttons' do
end
it '"Auto DevOps enabled" button not linked' do
project.create_auto_devops!(enabled: true)
visit project_path(project)
page.within('.project-stats') do
......@@ -65,19 +63,23 @@ describe 'Projects > Show > User sees setup shortcut buttons' do
end
describe 'Auto DevOps button' do
it '"Enable Auto DevOps" button linked to settings page' do
context 'when Auto DevOps is enabled' do
it '"Auto DevOps enabled" anchor linked to settings page' do
visit project_path(project)
page.within('.project-stats') do
expect(page).to have_link('Enable Auto DevOps', href: project_settings_ci_cd_path(project, anchor: 'autodevops-settings'))
expect(page).to have_link('Auto DevOps enabled', href: project_settings_ci_cd_path(project, anchor: 'autodevops-settings'))
end
end
end
it '"Auto DevOps enabled" anchor linked to settings page' do
project.create_auto_devops!(enabled: true)
visit project_path(project)
context 'when Auto DevOps is not enabled' do
let(:project) { create(:project, :public, :empty_repo, auto_devops_attributes: { enabled: false }) }
it '"Enable Auto DevOps" button linked to settings page' do
page.within('.project-stats') do
expect(page).to have_link('Auto DevOps enabled', href: project_settings_ci_cd_path(project, anchor: 'autodevops-settings'))
expect(page).to have_link('Enable Auto DevOps', href: project_settings_ci_cd_path(project, anchor: 'autodevops-settings'))
end
end
end
end
......@@ -113,20 +115,23 @@ describe 'Projects > Show > User sees setup shortcut buttons' do
visit project_path(project)
end
it 'no Auto DevOps button if can not manage pipelines' do
context 'when Auto DevOps is enabled' do
it '"Auto DevOps enabled" button not linked' do
visit project_path(project)
page.within('.project-stats') do
expect(page).not_to have_link('Enable Auto DevOps')
expect(page).not_to have_link('Auto DevOps enabled')
expect(page).to have_text('Auto DevOps enabled')
end
end
end
it '"Auto DevOps enabled" button not linked' do
project.create_auto_devops!(enabled: true)
visit project_path(project)
context 'when Auto DevOps is not enabled' do
let(:project) { create(:project, :public, :repository, auto_devops_attributes: { enabled: false }) }
it 'no Auto DevOps button if can not manage pipelines' do
page.within('.project-stats') do
expect(page).to have_text('Auto DevOps enabled')
expect(page).not_to have_link('Enable Auto DevOps')
expect(page).not_to have_link('Auto DevOps enabled')
end
end
......@@ -137,6 +142,7 @@ describe 'Projects > Show > User sees setup shortcut buttons' do
end
end
end
end
describe 'as a maintainer' do
before do
......@@ -222,6 +228,19 @@ describe 'Projects > Show > User sees setup shortcut buttons' do
end
describe 'GitLab CI configuration button' do
context 'when Auto DevOps is enabled' do
it 'no "Set up CI/CD" button if the project has Auto DevOps enabled' do
visit project_path(project)
page.within('.project-stats') do
expect(page).not_to have_link('Set up CI/CD')
end
end
end
context 'when Auto DevOps is not enabled' do
let(:project) { create(:project, :public, :repository, auto_devops_attributes: { enabled: false }) }
it '"Set up CI/CD" button linked to new file populated for a .gitlab-ci.yml' do
visit project_path(project)
......@@ -251,34 +270,28 @@ describe 'Projects > Show > User sees setup shortcut buttons' do
expect(page).not_to have_link('Set up CI/CD')
end
end
it 'no "Set up CI/CD" button if the project has Auto DevOps enabled' do
project.create_auto_devops!(enabled: true)
visit project_path(project)
page.within('.project-stats') do
expect(page).not_to have_link('Set up CI/CD')
end
end
end
describe 'Auto DevOps button' do
it '"Enable Auto DevOps" button linked to settings page' do
context 'when Auto DevOps is enabled' do
it '"Auto DevOps enabled" anchor linked to settings page' do
visit project_path(project)
page.within('.project-stats') do
expect(page).to have_link('Enable Auto DevOps', href: project_settings_ci_cd_path(project, anchor: 'autodevops-settings'))
expect(page).to have_link('Auto DevOps enabled', href: project_settings_ci_cd_path(project, anchor: 'autodevops-settings'))
end
end
end
it '"Enable Auto DevOps" button linked to settings page' do
project.create_auto_devops!(enabled: true)
context 'when Auto DevOps is not enabled' do
let(:project) { create(:project, :public, :repository, auto_devops_attributes: { enabled: false }) }
it '"Enable Auto DevOps" button linked to settings page' do
visit project_path(project)
page.within('.project-stats') do
expect(page).to have_link('Auto DevOps enabled', href: project_settings_ci_cd_path(project, anchor: 'autodevops-settings'))
expect(page).to have_link('Enable Auto DevOps', href: project_settings_ci_cd_path(project, anchor: 'autodevops-settings'))
end
end
......@@ -316,6 +329,7 @@ describe 'Projects > Show > User sees setup shortcut buttons' do
end
end
end
end
describe 'Kubernetes cluster button' do
it '"Add Kubernetes cluster" button linked to clusters page' do
......
......@@ -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,6 +370,11 @@ describe API::Pipelines do
end
context 'without gitlab-ci.yml' do
context 'without auto devops enabled' do
before do
project.update!(auto_devops_attributes: { enabled: false })
end
it 'fails to create pipeline' do
post api("/projects/#{project.id}/pipeline", user), ref: project.default_branch
......@@ -379,6 +384,7 @@ describe API::Pipelines do
end
end
end
end
context 'unauthorized user' do
it 'does not create pipeline' do
......
......@@ -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