Add latest changes from gitlab-org/gitlab@master
This commit is contained in:
parent
2828f81d2a
commit
a0fdcfcdd5
|
@ -7,12 +7,5 @@
|
|||
"app/assets/stylesheets/lazy_bundles/select2.scss",
|
||||
"app/assets/stylesheets/highlight/themes/*.scss",
|
||||
"app/assets/stylesheets/lazy_bundles/cropper.css"
|
||||
],
|
||||
"plugins":[
|
||||
"./scripts/frontend/stylelint/stylelint_duplicate_selectors.js",
|
||||
"./scripts/frontend/stylelint/stylelint_utility_classes.js",
|
||||
],
|
||||
"rules":{
|
||||
"stylelint-gitlab/utility-classes":[true,{ "severity": "warning" }],
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
|
@ -10,6 +10,8 @@ export const displayAndLogError = (error) =>
|
|||
|
||||
const EVENT_ICONS = {
|
||||
comment: 'comment',
|
||||
issues: 'issues',
|
||||
status: 'status',
|
||||
default: 'comment',
|
||||
};
|
||||
|
||||
|
|
|
@ -1,3 +0,0 @@
|
|||
import logsBundle from '~/logs';
|
||||
|
||||
logsBundle();
|
|
@ -1,7 +1,6 @@
|
|||
<script>
|
||||
import { GlSkeletonLoader } from '@gitlab/ui';
|
||||
import { helpPagePath } from '~/helpers/help_page_helper';
|
||||
import { s__ } from '~/locale';
|
||||
|
||||
export default {
|
||||
name: 'UsageBanner',
|
||||
|
@ -15,13 +14,6 @@ export default {
|
|||
default: false,
|
||||
},
|
||||
},
|
||||
i18n: {
|
||||
dependencyProxy: s__('UsageQuota|Dependency proxy'),
|
||||
storageUsed: s__('UsageQuota|Storage used'),
|
||||
dependencyProxyMessage: s__(
|
||||
'UsageQuota|Local proxy used for frequently-accessed upstream Docker images. %{linkStart}More information%{linkEnd}',
|
||||
),
|
||||
},
|
||||
storageUsageQuotaHelpPage: helpPagePath('user/usage_quotas'),
|
||||
};
|
||||
</script>
|
||||
|
|
|
@ -2,8 +2,6 @@
|
|||
|
||||
// Do not use 3-letter hex codes, bgcolor vs css background-color is problematic in emails
|
||||
//
|
||||
// stylelint-disable color-hex-length
|
||||
|
||||
$mailer-font: 'Helvetica Neue', Helvetica, Arial, sans-serif;
|
||||
$mailer-text-color: #333;
|
||||
$mailer-bg-color: #fafafa;
|
||||
|
|
|
@ -1,9 +1,3 @@
|
|||
|
||||
// stylelint-disable selector-class-pattern
|
||||
// stylelint-disable selector-max-compound-selectors
|
||||
// stylelint-disable stylelint-gitlab/duplicate-selectors
|
||||
// stylelint-disable stylelint-gitlab/utility-classes
|
||||
|
||||
.blob-editor-container {
|
||||
flex: 1;
|
||||
height: 0;
|
||||
|
|
|
@ -46,9 +46,7 @@ $tabs-holder-z-index: 250;
|
|||
position: -webkit-sticky;
|
||||
position: sticky;
|
||||
// Unitless zero values are not allowed in calculations
|
||||
// stylelint-disable-next-line length-zero-no-unit
|
||||
top: calc(#{$top-pos} + var(--system-header-height, 0px) + var(--performance-bar-height, 0px));
|
||||
// stylelint-disable-next-line length-zero-no-unit
|
||||
max-height: calc(100vh - #{$top-pos} - var(--system-header-height, 0px) - var(--performance-bar-height, 0px) - var(--review-bar-height, 0px));
|
||||
|
||||
.drag-handle {
|
||||
|
|
|
@ -6,7 +6,6 @@ module Integrations
|
|||
|
||||
ALLOWED_PARAMS_CE = [
|
||||
:active,
|
||||
:add_pusher,
|
||||
:alert_events,
|
||||
:api_key,
|
||||
:api_token,
|
||||
|
|
|
@ -0,0 +1,194 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
# == VerifiesWithEmail
|
||||
#
|
||||
# Controller concern to handle verification by email
|
||||
module VerifiesWithEmail
|
||||
extend ActiveSupport::Concern
|
||||
include ActionView::Helpers::DateHelper
|
||||
|
||||
TOKEN_LENGTH = 6
|
||||
TOKEN_VALID_FOR_MINUTES = 60
|
||||
|
||||
included do
|
||||
prepend_before_action :verify_with_email, only: :create, unless: -> { two_factor_enabled? }
|
||||
end
|
||||
|
||||
def verify_with_email
|
||||
return unless user = find_user || find_verification_user
|
||||
|
||||
if session[:verification_user_id] && token = verification_params[:verification_token].presence
|
||||
# The verification token is submitted, verify it
|
||||
verify_token(user, token)
|
||||
elsif require_email_verification_enabled?
|
||||
# Limit the amount of password guesses, since we now display the email verification page
|
||||
# when the password is correct, which could be a giveaway when brute-forced.
|
||||
return render_sign_in_rate_limited if check_rate_limit!(:user_sign_in, scope: user) { true }
|
||||
|
||||
if user.valid_password?(user_params[:password])
|
||||
# The user has logged in successfully.
|
||||
if user.unlock_token
|
||||
# Prompt for the token if it already has been set
|
||||
prompt_for_email_verification(user)
|
||||
elsif user.access_locked? || !AuthenticationEvent.initial_login_or_known_ip_address?(user, request.ip)
|
||||
# require email verification if:
|
||||
# - their account has been locked because of too many failed login attempts, or
|
||||
# - they have logged in before, but never from the current ip address
|
||||
send_verification_instructions(user)
|
||||
prompt_for_email_verification(user)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def resend_verification_code
|
||||
return unless user = find_verification_user
|
||||
|
||||
send_verification_instructions(user)
|
||||
prompt_for_email_verification(user)
|
||||
end
|
||||
|
||||
def successful_verification
|
||||
session.delete(:verification_user_id)
|
||||
@redirect_url = after_sign_in_path_for(current_user) # rubocop:disable Gitlab/ModuleWithInstanceVariables
|
||||
|
||||
render layout: 'minimal'
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def find_verification_user
|
||||
return unless session[:verification_user_id]
|
||||
|
||||
User.find_by_id(session[:verification_user_id])
|
||||
end
|
||||
|
||||
# After successful verification and calling sign_in, devise redirects the
|
||||
# user to this path. Override it to show the successful verified page.
|
||||
def after_sign_in_path_for(resource)
|
||||
if action_name == 'create' && session[:verification_user_id]
|
||||
return users_successful_verification_path
|
||||
end
|
||||
|
||||
super
|
||||
end
|
||||
|
||||
def send_verification_instructions(user)
|
||||
return if send_rate_limited?(user)
|
||||
|
||||
raw_token, encrypted_token = generate_token
|
||||
user.unlock_token = encrypted_token
|
||||
user.lock_access!({ send_instructions: false })
|
||||
send_verification_instructions_email(user, raw_token)
|
||||
end
|
||||
|
||||
def send_verification_instructions_email(user, token)
|
||||
return unless user.can?(:receive_notifications)
|
||||
|
||||
Notify.verification_instructions_email(
|
||||
user.id,
|
||||
token: token,
|
||||
expires_in: TOKEN_VALID_FOR_MINUTES).deliver_later
|
||||
|
||||
log_verification(user, :instructions_sent)
|
||||
end
|
||||
|
||||
def verify_token(user, token)
|
||||
return handle_verification_failure(user, :rate_limited) if verification_rate_limited?(user)
|
||||
return handle_verification_failure(user, :invalid) unless valid_token?(user, token)
|
||||
return handle_verification_failure(user, :expired) if expired_token?(user)
|
||||
|
||||
handle_verification_success(user)
|
||||
end
|
||||
|
||||
def generate_token
|
||||
raw_token = SecureRandom.random_number(10**TOKEN_LENGTH).to_s.rjust(TOKEN_LENGTH, '0')
|
||||
encrypted_token = digest_token(raw_token)
|
||||
[raw_token, encrypted_token]
|
||||
end
|
||||
|
||||
def digest_token(token)
|
||||
Devise.token_generator.digest(User, :unlock_token, token)
|
||||
end
|
||||
|
||||
def render_sign_in_rate_limited
|
||||
message = s_('IdentityVerification|Maximum login attempts exceeded. '\
|
||||
'Wait %{interval} and try again.') % { interval: user_sign_in_interval }
|
||||
redirect_to new_user_session_path, alert: message
|
||||
end
|
||||
|
||||
def user_sign_in_interval
|
||||
interval_in_seconds = Gitlab::ApplicationRateLimiter.rate_limits[:user_sign_in][:interval]
|
||||
distance_of_time_in_words(interval_in_seconds)
|
||||
end
|
||||
|
||||
def verification_rate_limited?(user)
|
||||
Gitlab::ApplicationRateLimiter.throttled?(:email_verification, scope: user.unlock_token)
|
||||
end
|
||||
|
||||
def send_rate_limited?(user)
|
||||
Gitlab::ApplicationRateLimiter.throttled?(:email_verification_code_send, scope: user)
|
||||
end
|
||||
|
||||
def expired_token?(user)
|
||||
user.locked_at < (Time.current - TOKEN_VALID_FOR_MINUTES.minutes)
|
||||
end
|
||||
|
||||
def valid_token?(user, token)
|
||||
user.unlock_token == digest_token(token)
|
||||
end
|
||||
|
||||
def handle_verification_failure(user, reason)
|
||||
message = case reason
|
||||
when :rate_limited
|
||||
s_("IdentityVerification|You've reached the maximum amount of tries. "\
|
||||
'Wait %{interval} or resend a new code and try again.') % { interval: email_verification_interval }
|
||||
when :expired
|
||||
s_('IdentityVerification|The code has expired. Resend a new code and try again.')
|
||||
when :invalid
|
||||
s_('IdentityVerification|The code is incorrect. Enter it again, or resend a new code.')
|
||||
end
|
||||
|
||||
user.errors.add(:base, message)
|
||||
log_verification(user, :failed_attempt, reason)
|
||||
|
||||
prompt_for_email_verification(user)
|
||||
end
|
||||
|
||||
def email_verification_interval
|
||||
interval_in_seconds = Gitlab::ApplicationRateLimiter.rate_limits[:email_verification][:interval]
|
||||
distance_of_time_in_words(interval_in_seconds)
|
||||
end
|
||||
|
||||
def handle_verification_success(user)
|
||||
user.unlock_access!
|
||||
log_verification(user, :successful)
|
||||
|
||||
sign_in(user)
|
||||
end
|
||||
|
||||
def prompt_for_email_verification(user)
|
||||
session[:verification_user_id] = user.id
|
||||
self.resource = user
|
||||
|
||||
render 'devise/sessions/email_verification'
|
||||
end
|
||||
|
||||
def verification_params
|
||||
params.require(:user).permit(:verification_token)
|
||||
end
|
||||
|
||||
def log_verification(user, event, reason = nil)
|
||||
Gitlab::AppLogger.info(
|
||||
message: 'Email Verification',
|
||||
event: event.to_s.titlecase,
|
||||
username: user.username,
|
||||
ip: request.ip,
|
||||
reason: reason.to_s
|
||||
)
|
||||
end
|
||||
|
||||
def require_email_verification_enabled?
|
||||
Feature.enabled?(:require_email_verification)
|
||||
end
|
||||
end
|
|
@ -17,7 +17,8 @@ class Projects::ServicePingController < Projects::ApplicationController
|
|||
return render_404 unless Gitlab::CurrentSettings.web_ide_clientside_preview_enabled?
|
||||
|
||||
Gitlab::UsageDataCounters::WebIdeCounter.increment_previews_success_count
|
||||
Gitlab::UsageDataCounters::EditorUniqueCounter.track_live_preview_edit_action(author: current_user)
|
||||
Gitlab::UsageDataCounters::EditorUniqueCounter.track_live_preview_edit_action(author: current_user,
|
||||
project: project)
|
||||
|
||||
head(200)
|
||||
end
|
||||
|
|
|
@ -11,6 +11,7 @@ class SessionsController < Devise::SessionsController
|
|||
include Gitlab::Utils::StrongMemoize
|
||||
include OneTrustCSP
|
||||
include BizibleCSP
|
||||
include VerifiesWithEmail
|
||||
|
||||
skip_before_action :check_two_factor_requirement, only: [:destroy]
|
||||
skip_before_action :check_password_expiration, only: [:destroy]
|
||||
|
|
|
@ -54,7 +54,7 @@ module Mutations
|
|||
|
||||
# Only when the user is not an api user and the operation was successful
|
||||
if !api_user? && service_response.success?
|
||||
::Gitlab::UsageDataCounters::EditorUniqueCounter.track_snippet_editor_edit_action(author: current_user)
|
||||
::Gitlab::UsageDataCounters::EditorUniqueCounter.track_snippet_editor_edit_action(author: current_user, project: project)
|
||||
end
|
||||
|
||||
snippet = service_response.payload[:snippet]
|
||||
|
|
|
@ -43,7 +43,7 @@ module Mutations
|
|||
|
||||
# Only when the user is not an api user and the operation was successful
|
||||
if !api_user? && service_response.success?
|
||||
::Gitlab::UsageDataCounters::EditorUniqueCounter.track_snippet_editor_edit_action(author: current_user)
|
||||
::Gitlab::UsageDataCounters::EditorUniqueCounter.track_snippet_editor_edit_action(author: current_user, project: snippet.project)
|
||||
end
|
||||
|
||||
snippet = service_response.payload[:snippet]
|
||||
|
|
|
@ -276,6 +276,14 @@ module EmailsHelper
|
|||
end
|
||||
end
|
||||
|
||||
def link_start(url)
|
||||
'<a href="%{url}" target="_blank" rel="noopener noreferrer">'.html_safe % { url: url }
|
||||
end
|
||||
|
||||
def link_end
|
||||
'</a>'.html_safe
|
||||
end
|
||||
|
||||
def contact_your_administrator_text
|
||||
_('Please contact your administrator with any questions.')
|
||||
end
|
||||
|
|
|
@ -39,4 +39,16 @@ module SessionsHelper
|
|||
# 2. https://github.com/redis-store/redis-store/blob/3acfa95f4eb6260c714fdb00a3d84be8eedc13b2/lib/redis/store/ttl.rb#L32
|
||||
request.env['rack.session.options'][:expire_after] = expiry_s
|
||||
end
|
||||
|
||||
def send_rate_limited?(user)
|
||||
Gitlab::ApplicationRateLimiter.peek(:email_verification_code_send, scope: user)
|
||||
end
|
||||
|
||||
def obfuscated_email(email)
|
||||
regex = ::Gitlab::UntrustedRegexp.new('^(..?)(.*)(@.?)(.*)(\..*)$')
|
||||
match = regex.match(email)
|
||||
return email unless match
|
||||
|
||||
match[1] + '*' * match[2].length + match[3] + '*' * match[4].length + match[5]
|
||||
end
|
||||
end
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
module Emails
|
||||
module IdentityVerification
|
||||
def verification_instructions_email(user_id, token:, expires_in:)
|
||||
@token = token
|
||||
@expires_in_minutes = expires_in
|
||||
@password_link = edit_profile_password_url
|
||||
@two_fa_link = help_page_url('user/profile/account/two_factor_authentication')
|
||||
|
||||
user = User.find(user_id)
|
||||
email_with_layout(to: user.email, subject: s_('IdentityVerification|Verify your identity'))
|
||||
end
|
||||
end
|
||||
end
|
|
@ -23,6 +23,7 @@ class Notify < ApplicationMailer
|
|||
include Emails::ServiceDesk
|
||||
include Emails::InProductMarketing
|
||||
include Emails::AdminNotification
|
||||
include Emails::IdentityVerification
|
||||
|
||||
helper TimeboxesHelper
|
||||
helper MergeRequestsHelper
|
||||
|
|
|
@ -213,6 +213,10 @@ class NotifyPreview < ActionMailer::Preview
|
|||
::Notify.user_auto_banned_email(user.id, user.id, max_project_downloads: 5, within_seconds: 600, group: group).message
|
||||
end
|
||||
|
||||
def verification_instructions_email
|
||||
Notify.verification_instructions_email(user.id, token: '123456', expires_in: 60).message
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def project
|
||||
|
|
|
@ -25,4 +25,9 @@ class AuthenticationEvent < ApplicationRecord
|
|||
def self.providers
|
||||
STATIC_PROVIDERS | Devise.omniauth_providers.map(&:to_s)
|
||||
end
|
||||
|
||||
def self.initial_login_or_known_ip_address?(user, ip_address)
|
||||
!where(user_id: user).exists? ||
|
||||
where(user_id: user, ip_address: ip_address).success.exists?
|
||||
end
|
||||
end
|
||||
|
|
|
@ -0,0 +1,52 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
# == Require Email Verification module
|
||||
#
|
||||
# Contains functionality to handle email verification
|
||||
module RequireEmailVerification
|
||||
extend ActiveSupport::Concern
|
||||
include Gitlab::Utils::StrongMemoize
|
||||
|
||||
# This value is twice the amount we want it to be, because due to a bug in the devise-two-factor
|
||||
# gem every failed login attempt increments the value of failed_attempts by 2 instead of 1.
|
||||
# See: https://github.com/tinfoil/devise-two-factor/issues/127
|
||||
MAXIMUM_ATTEMPTS = 3 * 2
|
||||
UNLOCK_IN = 24.hours
|
||||
|
||||
included do
|
||||
# Virtual attribute for the email verification token form
|
||||
attr_accessor :verification_token
|
||||
end
|
||||
|
||||
# When overridden, do not send Devise unlock instructions when locking access.
|
||||
def lock_access!(opts = {})
|
||||
return super unless override_devise_lockable?
|
||||
|
||||
super({ send_instructions: false })
|
||||
end
|
||||
|
||||
protected
|
||||
|
||||
# We cannot override the class methods `maximum_attempts` and `unlock_in`, because we want to
|
||||
# check for 2FA being enabled on the instance. So instead override the Devise Lockable methods
|
||||
# where those values are used.
|
||||
def attempts_exceeded?
|
||||
return super unless override_devise_lockable?
|
||||
|
||||
failed_attempts >= MAXIMUM_ATTEMPTS
|
||||
end
|
||||
|
||||
def lock_expired?
|
||||
return super unless override_devise_lockable?
|
||||
|
||||
locked_at && locked_at < UNLOCK_IN.ago
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def override_devise_lockable?
|
||||
strong_memoize(:override_devise_lockable) do
|
||||
Feature.enabled?(:require_email_verification) && !two_factor_enabled?
|
||||
end
|
||||
end
|
||||
end
|
|
@ -88,6 +88,7 @@ class User < ApplicationRecord
|
|||
# and should be added after Devise modules are initialized.
|
||||
include AsyncDeviseEmail
|
||||
include ForcedEmailConfirmation
|
||||
include RequireEmailVerification
|
||||
|
||||
MINIMUM_INACTIVE_DAYS = 90
|
||||
MINIMUM_DAYS_CREATED = 7
|
||||
|
@ -1899,7 +1900,7 @@ class User < ApplicationRecord
|
|||
end
|
||||
|
||||
# override, from Devise
|
||||
def lock_access!
|
||||
def lock_access!(opts = {})
|
||||
Gitlab::AppLogger.info("Account Locked: username=#{username}")
|
||||
super
|
||||
end
|
||||
|
|
|
@ -24,6 +24,7 @@ module IncidentManagement
|
|||
def after_update
|
||||
sync_status_to_alert
|
||||
add_status_system_note
|
||||
add_timeline_event
|
||||
end
|
||||
|
||||
def sync_status_to_alert
|
||||
|
@ -43,6 +44,13 @@ module IncidentManagement
|
|||
|
||||
SystemNoteService.change_incident_status(issuable, current_user, params[:status_change_reason])
|
||||
end
|
||||
|
||||
def add_timeline_event
|
||||
return unless escalation_status.status_previously_changed?
|
||||
|
||||
IncidentManagement::TimelineEvents::CreateService
|
||||
.change_incident_status(issuable, current_user, escalation_status)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -4,6 +4,7 @@ module IncidentManagement
|
|||
module TimelineEvents
|
||||
DEFAULT_ACTION = 'comment'
|
||||
DEFAULT_EDITABLE = false
|
||||
DEFAULT_AUTO_CREATED = false
|
||||
|
||||
class CreateService < TimelineEvents::BaseService
|
||||
def initialize(incident, user, params)
|
||||
|
@ -11,6 +12,42 @@ module IncidentManagement
|
|||
@incident = incident
|
||||
@user = user
|
||||
@params = params
|
||||
@auto_created = !!params.fetch(:auto_created, DEFAULT_AUTO_CREATED)
|
||||
end
|
||||
|
||||
class << self
|
||||
def create_incident(incident, user)
|
||||
note = "@#{user.username} created the incident"
|
||||
occurred_at = incident.created_at
|
||||
action = 'issues'
|
||||
|
||||
new(incident, user, note: note, occurred_at: occurred_at, action: action, auto_created: true).execute
|
||||
end
|
||||
|
||||
def reopen_incident(incident, user)
|
||||
note = "@#{user.username} reopened the incident"
|
||||
occurred_at = incident.updated_at
|
||||
action = 'issues'
|
||||
|
||||
new(incident, user, note: note, occurred_at: occurred_at, action: action, auto_created: true).execute
|
||||
end
|
||||
|
||||
def resolve_incident(incident, user)
|
||||
note = "@#{user.username} resolved the incident"
|
||||
occurred_at = incident.updated_at
|
||||
action = 'status'
|
||||
|
||||
new(incident, user, note: note, occurred_at: occurred_at, action: action, auto_created: true).execute
|
||||
end
|
||||
|
||||
def change_incident_status(incident, user, escalation_status)
|
||||
status = escalation_status.status_name.to_s.titleize
|
||||
note = "@#{user.username} changed the incident status to **#{status}**"
|
||||
occurred_at = incident.updated_at
|
||||
action = 'status'
|
||||
|
||||
new(incident, user, note: note, occurred_at: occurred_at, action: action, auto_created: true).execute
|
||||
end
|
||||
end
|
||||
|
||||
def execute
|
||||
|
@ -32,8 +69,8 @@ module IncidentManagement
|
|||
|
||||
if timeline_event.save
|
||||
add_system_note(timeline_event)
|
||||
|
||||
track_usage_event(:incident_management_timeline_event_created, user.id)
|
||||
|
||||
success(timeline_event)
|
||||
else
|
||||
error_in_save(timeline_event)
|
||||
|
@ -42,9 +79,16 @@ module IncidentManagement
|
|||
|
||||
private
|
||||
|
||||
attr_reader :project, :user, :incident, :params
|
||||
attr_reader :project, :user, :incident, :params, :auto_created
|
||||
|
||||
def allowed?
|
||||
return true if auto_created
|
||||
|
||||
super
|
||||
end
|
||||
|
||||
def add_system_note(timeline_event)
|
||||
return if auto_created
|
||||
return unless Feature.enabled?(:incident_timeline, project)
|
||||
|
||||
SystemNoteService.add_timeline_event(timeline_event)
|
||||
|
|
|
@ -97,7 +97,10 @@ module Issues
|
|||
|
||||
status = issue.incident_management_issuable_escalation_status || issue.build_incident_management_issuable_escalation_status
|
||||
|
||||
SystemNoteService.change_incident_status(issue, current_user, ' by closing the incident') if status.resolve
|
||||
return unless status.resolve
|
||||
|
||||
SystemNoteService.change_incident_status(issue, current_user, ' by closing the incident')
|
||||
IncidentManagement::TimelineEvents::CreateService.resolve_incident(issue, current_user)
|
||||
end
|
||||
|
||||
def store_first_mentioned_in_commit_at(issue, merge_request, max_commit_lookup: 100)
|
||||
|
|
|
@ -57,6 +57,7 @@ module Issues
|
|||
handle_add_related_issue(issue)
|
||||
resolve_discussions_with_issue(issue)
|
||||
create_escalation_status(issue)
|
||||
create_timeline_event(issue)
|
||||
try_to_associate_contacts(issue)
|
||||
|
||||
super
|
||||
|
@ -92,6 +93,12 @@ module Issues
|
|||
::IncidentManagement::IssuableEscalationStatuses::CreateService.new(issue).execute if issue.supports_escalation?
|
||||
end
|
||||
|
||||
def create_timeline_event(issue)
|
||||
return unless issue.incident?
|
||||
|
||||
IncidentManagement::TimelineEvents::CreateService.create_incident(issue, current_user)
|
||||
end
|
||||
|
||||
def user_agent_detail_service
|
||||
UserAgentDetailService.new(spammable: @issue, spam_params: spam_params)
|
||||
end
|
||||
|
|
|
@ -32,11 +32,18 @@ module Issues
|
|||
end
|
||||
|
||||
def perform_incident_management_actions(issue)
|
||||
return unless issue.incident?
|
||||
|
||||
create_timeline_event(issue)
|
||||
end
|
||||
|
||||
def create_note(issue, state = issue.state)
|
||||
SystemNoteService.change_status(issue, issue.project, current_user, state, nil)
|
||||
end
|
||||
|
||||
def create_timeline_event(issue)
|
||||
IncidentManagement::TimelineEvents::CreateService.reopen_incident(issue, current_user)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -0,0 +1,19 @@
|
|||
%div
|
||||
= render 'devise/shared/tab_single', tab_title: s_('IdentityVerification|Help us protect your account')
|
||||
.login-box.gl-p-5
|
||||
.login-body
|
||||
= form_for(resource, as: resource_name, url: session_path(resource_name), method: :post, html: { class: 'gl-show-field-errors' }) do |f|
|
||||
%p
|
||||
= s_("IdentityVerification|For added security, you'll need to verify your identity. We've sent a verification code to %{email}").html_safe % { email: "<strong>#{sanitize(obfuscated_email(resource.email))}</strong>".html_safe }
|
||||
%div
|
||||
= f.label :verification_token, s_('IdentityVerification|Verification code')
|
||||
= f.text_field :verification_token, class: 'form-control gl-form-input', required: true, autofocus: true, autocomplete: 'off', title: s_('IdentityVerification|Please enter a valid code'), inputmode: 'numeric', maxlength: 6, pattern: '[0-9]{6}'
|
||||
%p.gl-field-error.gl-mt-2
|
||||
= resource.errors.full_messages.to_sentence
|
||||
.gl-mt-5
|
||||
= f.submit s_('IdentityVerification|Verify code'), class: 'gl-button btn btn-confirm'
|
||||
- unless send_rate_limited?(resource)
|
||||
= link_to s_('IdentityVerification|Resend code'), users_resend_verification_code_path, method: :post, class: 'form-control gl-button btn-link gl-mt-3 gl-mb-0'
|
||||
%p.gl-p-5.gl-text-secondary
|
||||
- support_link_start = '<a href="https://about.gitlab.com/support/" target="_blank" rel="noopener noreferrer">'.html_safe
|
||||
= s_("IdentityVerification|If you've lost access to the email associated to this account or having trouble with the code, %{link_start}here are some other steps you can take.%{link_end}").html_safe % { link_start: support_link_start, link_end: '</a>'.html_safe }
|
|
@ -0,0 +1,11 @@
|
|||
= content_for :meta_tags do
|
||||
%meta{ 'http-equiv': 'refresh', content: "3; url=#{@redirect_url}" }
|
||||
.gl-text-center.gl-max-w-62.gl-mx-auto
|
||||
.svg-content.svg-80
|
||||
= image_tag 'illustrations/success-sm.svg'
|
||||
%h2
|
||||
= s_('IdentityVerification|Verification successful')
|
||||
%p.gl-pt-2
|
||||
- redirect_url_start = '<a href="%{url}"">'.html_safe % { url: @redirect_url }
|
||||
- redirect_url_end = '</a>'.html_safe
|
||||
= html_escape(s_("IdentityVerification|Your account has been successfully verified. You'll be redirected to your account in just a moment or %{redirect_url_start}click here%{redirect_url_end} to refresh.")) % { redirect_url_start: redirect_url_start, redirect_url_end: redirect_url_end }
|
|
@ -0,0 +1,12 @@
|
|||
%div{ style: 'text-align:center;color:#1F1F1F;line-height:1.25em;max-width:400px;margin:0 auto;' }
|
||||
%h3
|
||||
= s_('IdentityVerification|Help us protect your account')
|
||||
%p{ style: 'font-size:0.9em' }
|
||||
= s_('IdentityVerification|Before you sign in, we need to verify your identity. Enter the following code on the sign-in page.')
|
||||
%div{ style: 'margin:26px 0;width:207px;height:53px;background-color:#F0F0F0;line-height:53px;font-weight:700;font-size:1.5em;color:#303030;' }
|
||||
= @token
|
||||
%p{ style: 'font-size:0.75em' }
|
||||
= s_('IdentityVerification|If you have not recently tried to sign into GitLab, we recommend %{password_link_start}changing your password%{link_end} and %{two_fa_link_start}setting up Two-Factor Authentication%{link_end} to keep your account safe. Your verification code expires after %{expires_in_minutes} minutes.').html_safe % { link_end: link_end,
|
||||
password_link_start: link_start(@password_link),
|
||||
two_fa_link_start: link_start(@two_fa_link),
|
||||
expires_in_minutes: @expires_in_minutes }
|
|
@ -0,0 +1,8 @@
|
|||
<%= s_('IdentityVerification|Help us protect your account') %>
|
||||
|
||||
<%= s_('IdentityVerification|Before you sign in, we need to verify your identity. Enter the following code on the sign-in page.') %>
|
||||
|
||||
<%= @token %>
|
||||
|
||||
<%= s_('IdentityVerification|If you have not recently tried to sign into GitLab, we recommend changing your password (%{password_link}) and setting up Two-Factor Authentication (%{two_fa_link}) to keep your account safe.') % { password_link: @password_link, two_fa_link: @two_fa_link } %>
|
||||
<%= s_('IdentityVerification|Your verification code expires after %{expires_in_minutes} minutes.') % { expires_in_minutes: @expires_in_minutes } %>
|
|
@ -1,14 +0,0 @@
|
|||
- page_title _('Logs')
|
||||
|
||||
.row.empty-state
|
||||
.col-sm-12
|
||||
.svg-content
|
||||
= image_tag 'illustrations/operations_log_pods_empty.svg'
|
||||
.col-12
|
||||
.text-content
|
||||
%h4.text-center
|
||||
= s_('Environments|No deployed environments')
|
||||
%p.state-description.text-center
|
||||
= s_('Logs|To see the logs, deploy your code to an environment.')
|
||||
.text-center
|
||||
= link_to s_('Environments|Learn about environments'), help_page_path('ci/environments/index.md'), class: 'gl-button btn btn-confirm'
|
|
@ -1 +0,0 @@
|
|||
#environment-logs{ data: environment_logs_data(@project, @environment) }
|
|
@ -0,0 +1,22 @@
|
|||
---
|
||||
description: Triggered from backend on editing file in web ide
|
||||
category: ide_edit
|
||||
action: g_edit_by_web_ide
|
||||
identifiers:
|
||||
- project
|
||||
- user
|
||||
- namespace
|
||||
product_section: dev
|
||||
product_stage: create
|
||||
product_group: group::editor
|
||||
product_category: web_ide
|
||||
milestone: "15.1"
|
||||
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/90484
|
||||
distributions:
|
||||
- ce
|
||||
- ee
|
||||
tiers:
|
||||
- free
|
||||
- premium
|
||||
- ultimate
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
---
|
||||
description: Triggered from backend on showing a file in live preview
|
||||
category: ide_edit
|
||||
action: g_edit_by_live_preview
|
||||
identifiers:
|
||||
- project
|
||||
- user
|
||||
- namespace
|
||||
product_section: dev
|
||||
product_stage: create
|
||||
product_group: group::editor
|
||||
product_category: web_ide
|
||||
milestone: "15.1"
|
||||
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/90484
|
||||
distributions:
|
||||
- ce
|
||||
- ee
|
||||
tiers:
|
||||
- free
|
||||
- premium
|
||||
- ultimate
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
---
|
||||
description: Triggered from backend on editing file by sfe
|
||||
category: ide_edit
|
||||
action: g_edit_by_sfe
|
||||
identifiers:
|
||||
- project
|
||||
- user
|
||||
- namespace
|
||||
product_section: dev
|
||||
product_stage: create
|
||||
product_group: group::editor
|
||||
product_category: web_ide
|
||||
milestone: "15.1"
|
||||
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/90484
|
||||
distributions:
|
||||
- ce
|
||||
- ee
|
||||
tiers:
|
||||
- free
|
||||
- premium
|
||||
- ultimate
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
---
|
||||
description: Triggered from backend on editing file by ide snippet
|
||||
category: ide_edit
|
||||
action: g_edit_by_snippet_ide
|
||||
identifiers:
|
||||
- project
|
||||
- user
|
||||
- namespace
|
||||
product_section: dev
|
||||
product_stage: create
|
||||
product_group: group::editor
|
||||
product_category: web_ide
|
||||
milestone: "15.1"
|
||||
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/90484
|
||||
distributions:
|
||||
- ce
|
||||
- ee
|
||||
tiers:
|
||||
- free
|
||||
- premium
|
||||
- ultimate
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
---
|
||||
name: require_email_verification
|
||||
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/86352
|
||||
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/364835
|
||||
milestone: "15.2"
|
||||
type: development
|
||||
group: group::anti-abuse
|
||||
default_enabled: false
|
|
@ -661,12 +661,6 @@ production: &base
|
|||
|
||||
gitlab_ci:
|
||||
# Default project notifications settings:
|
||||
#
|
||||
# Send emails only on broken builds (default: true)
|
||||
# all_broken_builds: true
|
||||
#
|
||||
# Add pusher to recipients list (default: false)
|
||||
# add_pusher: true
|
||||
|
||||
# The location where build traces are stored (default: builds/). Relative paths are relative to Rails.root
|
||||
# builds_path: builds/
|
||||
|
|
|
@ -241,8 +241,6 @@ end
|
|||
#
|
||||
Settings['gitlab_ci'] ||= Settingslogic.new({})
|
||||
Settings.gitlab_ci['shared_runners_enabled'] = true if Settings.gitlab_ci['shared_runners_enabled'].nil?
|
||||
Settings.gitlab_ci['all_broken_builds'] = true if Settings.gitlab_ci['all_broken_builds'].nil?
|
||||
Settings.gitlab_ci['add_pusher'] = false if Settings.gitlab_ci['add_pusher'].nil?
|
||||
Settings.gitlab_ci['builds_path'] = Settings.absolute(Settings.gitlab_ci['builds_path'] || "builds/")
|
||||
Settings.gitlab_ci['url'] ||= Settings.__send__(:build_gitlab_ci_url)
|
||||
|
||||
|
|
|
@ -53,6 +53,8 @@ end
|
|||
|
||||
devise_scope :user do
|
||||
get '/users/almost_there' => 'confirmations#almost_there'
|
||||
post '/users/resend_verification_code', to: 'sessions#resend_verification_code'
|
||||
get '/users/successful_verification', to: 'sessions#successful_verification'
|
||||
end
|
||||
|
||||
scope '-/users', module: :users do
|
||||
|
|
|
@ -0,0 +1,18 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class AddUserIdAndIpAddressSuccessIndexToAuthenticationEvents < Gitlab::Database::Migration[2.0]
|
||||
OLD_INDEX_NAME = 'index_authentication_events_on_user_id'
|
||||
NEW_INDEX_NAME = 'index_authentication_events_on_user_and_ip_address_and_result'
|
||||
|
||||
disable_ddl_transaction!
|
||||
|
||||
def up
|
||||
add_concurrent_index :authentication_events, [:user_id, :ip_address, :result], name: NEW_INDEX_NAME
|
||||
remove_concurrent_index_by_name :authentication_events, OLD_INDEX_NAME
|
||||
end
|
||||
|
||||
def down
|
||||
add_concurrent_index :authentication_events, :user_id, name: OLD_INDEX_NAME
|
||||
remove_concurrent_index_by_name :authentication_events, NEW_INDEX_NAME
|
||||
end
|
||||
end
|
|
@ -0,0 +1 @@
|
|||
f460407888e289580dec15ea27e19fa5cc2d2116a831105b71b980c617971743
|
|
@ -27282,7 +27282,7 @@ CREATE INDEX index_authentication_events_on_provider ON authentication_events US
|
|||
|
||||
CREATE INDEX index_authentication_events_on_provider_user_id_created_at ON authentication_events USING btree (provider, user_id, created_at) WHERE (result = 1);
|
||||
|
||||
CREATE INDEX index_authentication_events_on_user_id ON authentication_events USING btree (user_id);
|
||||
CREATE INDEX index_authentication_events_on_user_and_ip_address_and_result ON authentication_events USING btree (user_id, ip_address, result);
|
||||
|
||||
CREATE INDEX index_award_emoji_on_awardable_type_and_awardable_id ON award_emoji USING btree (awardable_type, awardable_id);
|
||||
|
||||
|
|
|
@ -60,8 +60,8 @@ Alternatively, you can [back up](../../../raketasks/backup_restore.md#back-up-gi
|
|||
the container registry on the primary site and restore it onto the secondary
|
||||
site:
|
||||
|
||||
1. On your primary site, back up only the registry and [exclude specific directories
|
||||
from the backup](../../../raketasks/backup_restore.md#excluding-specific-directories-from-the-backup):
|
||||
1. On your primary site, back up only the registry and
|
||||
[exclude specific directories from the backup](../../../raketasks/backup_gitlab.md#excluding-specific-directories-from-the-backup):
|
||||
|
||||
```shell
|
||||
# Create a backup in the /var/opt/gitlab/backups folder
|
||||
|
|
|
@ -16,13 +16,13 @@ You must use a [GitLab Premium](https://about.gitlab.com/pricing/) license or hi
|
|||
but you only need one license for all the sites.
|
||||
|
||||
WARNING:
|
||||
The steps below should be followed in the order they appear. **Make sure the GitLab version is the same on all sites.**
|
||||
The steps below should be followed in the order they appear. **Make sure the GitLab version is the same on all sites. Do not create an account or log in to the new secondary.**
|
||||
|
||||
## Using Omnibus GitLab
|
||||
|
||||
If you installed GitLab using the Omnibus packages (highly recommended):
|
||||
|
||||
1. [Install GitLab Enterprise Edition](https://about.gitlab.com/install/) on the nodes that serve as the **secondary** site. Do not create an account or log in to the new **secondary** site. The **GitLab version must match** across primary and secondary sites.
|
||||
1. [Install GitLab Enterprise Edition](https://about.gitlab.com/install/) on the nodes that serve as the **secondary** site. **Do not create an account or log in** to the new **secondary** site. The **GitLab version must match** across primary and secondary sites.
|
||||
1. [Add the GitLab License](../../../user/admin_area/license.md) on the **primary** site to unlock Geo. The license must be for [GitLab Premium](https://about.gitlab.com/pricing/) or higher.
|
||||
1. [Set up the database replication](database.md) (`primary (read-write) <-> secondary (read-only)` topology).
|
||||
1. [Configure fast lookup of authorized SSH keys in the database](../../operations/fast_ssh_key_lookup.md). This step is required and needs to be done on **both** the **primary** and **secondary** sites.
|
||||
|
|
|
@ -76,7 +76,7 @@ because it does not require a shared folder.
|
|||
|
||||
Consolidated object storage configuration can't be used for backups or
|
||||
Mattermost. See the [full table for a complete list](#storage-specific-configuration).
|
||||
However, backups can be configured with [server side encryption](../raketasks/backup_restore.md#s3-encrypted-buckets) separately.
|
||||
However, backups can be configured with [server side encryption](../raketasks/backup_gitlab.md#s3-encrypted-buckets) separately.
|
||||
|
||||
Enabling consolidated object storage enables object storage for all object
|
||||
types. If not all buckets are specified, `sudo gitlab-ctl reconfigure` may fail with the error like:
|
||||
|
@ -528,7 +528,7 @@ supported by consolidated configuration form, refer to the following guides:
|
|||
|
||||
| Object storage type | Supported by consolidated configuration? |
|
||||
|---------------------|------------------------------------------|
|
||||
| [Backups](../raketasks/backup_restore.md#uploading-backups-to-a-remote-cloud-storage) | **{dotted-circle}** No |
|
||||
| [Backups](../raketasks/backup_gitlab.md#uploading-backups-to-a-remote-cloud-storage) | **{dotted-circle}** No |
|
||||
| [Job artifacts](job_artifacts.md#using-object-storage) including archived job logs | **{check-circle}** Yes |
|
||||
| [LFS objects](lfs/index.md#storing-lfs-objects-in-remote-object-storage) | **{check-circle}** Yes |
|
||||
| [Uploads](uploads.md#using-object-storage) | **{check-circle}** Yes |
|
||||
|
@ -587,7 +587,7 @@ Helm-based installs require separate buckets to
|
|||
|
||||
### S3 API compatibility issues
|
||||
|
||||
Not all S3 providers [are fully compatible](../raketasks/backup_restore.md#other-s3-providers)
|
||||
Not all S3 providers [are fully compatible](../raketasks/backup_gitlab.md#other-s3-providers)
|
||||
with the Fog library that GitLab uses. Symptoms include an error in `production.log`:
|
||||
|
||||
```plaintext
|
||||
|
|
|
@ -189,9 +189,9 @@ should be used. Git repositories are accessed, managed, and stored on GitLab ser
|
|||
can result from directly accessing and copying Gitaly's files using tools like `rsync`.
|
||||
|
||||
- From GitLab 13.3, backup performance can be improved by
|
||||
[processing multiple repositories concurrently](../../raketasks/backup_restore.md#back-up-git-repositories-concurrently).
|
||||
[processing multiple repositories concurrently](../../raketasks/backup_gitlab.md#back-up-git-repositories-concurrently).
|
||||
- Backups can be created of just the repositories using the
|
||||
[skip feature](../../raketasks/backup_restore.md#excluding-specific-directories-from-the-backup).
|
||||
[skip feature](../../raketasks/backup_gitlab.md#excluding-specific-directories-from-the-backup).
|
||||
|
||||
No other method works for Gitaly Cluster targets.
|
||||
|
||||
|
|
|
@ -2202,7 +2202,7 @@ on what features you intend to use:
|
|||
|
||||
|Object storage type|Supported by consolidated configuration?|
|
||||
|-------------------|----------------------------------------|
|
||||
| [Backups](../../raketasks/backup_restore.md#uploading-backups-to-a-remote-cloud-storage) | No |
|
||||
| [Backups](../../raketasks/backup_gitlab.md#uploading-backups-to-a-remote-cloud-storage) | No |
|
||||
| [Job artifacts](../job_artifacts.md#using-object-storage) including archived job logs | Yes |
|
||||
| [LFS objects](../lfs/index.md#storing-lfs-objects-in-remote-object-storage) | Yes |
|
||||
| [Uploads](../uploads.md#using-object-storage) | Yes |
|
||||
|
|
|
@ -2206,7 +2206,7 @@ on what features you intend to use:
|
|||
|
||||
|Object storage type|Supported by consolidated configuration?|
|
||||
|-------------------|----------------------------------------|
|
||||
| [Backups](../../raketasks/backup_restore.md#uploading-backups-to-a-remote-cloud-storage) | No |
|
||||
| [Backups](../../raketasks/backup_gitlab.md#uploading-backups-to-a-remote-cloud-storage) | No |
|
||||
| [Job artifacts](../job_artifacts.md#using-object-storage) including archived job logs | Yes |
|
||||
| [LFS objects](../lfs/index.md#storing-lfs-objects-in-remote-object-storage) | Yes |
|
||||
| [Uploads](../uploads.md#using-object-storage) | Yes |
|
||||
|
|
|
@ -916,7 +916,7 @@ on what features you intend to use:
|
|||
|
||||
|Object storage type|Supported by consolidated configuration?|
|
||||
|-------------------|----------------------------------------|
|
||||
| [Backups](../../raketasks/backup_restore.md#uploading-backups-to-a-remote-cloud-storage) | No |
|
||||
| [Backups](../../raketasks/backup_gitlab.md#uploading-backups-to-a-remote-cloud-storage) | No |
|
||||
| [Job artifacts](../job_artifacts.md#using-object-storage) including archived job logs | Yes |
|
||||
| [LFS objects](../lfs/index.md#storing-lfs-objects-in-remote-object-storage) | Yes |
|
||||
| [Uploads](../uploads.md#using-object-storage) | Yes |
|
||||
|
|
|
@ -2141,7 +2141,7 @@ on what features you intend to use:
|
|||
|
||||
|Object storage type|Supported by consolidated configuration?|
|
||||
|-------------------|----------------------------------------|
|
||||
| [Backups](../../raketasks/backup_restore.md#uploading-backups-to-a-remote-cloud-storage) | No |
|
||||
| [Backups](../../raketasks/backup_gitlab.md#uploading-backups-to-a-remote-cloud-storage) | No |
|
||||
| [Job artifacts](../job_artifacts.md#using-object-storage) including archived job logs | Yes |
|
||||
| [LFS objects](../lfs/index.md#storing-lfs-objects-in-remote-object-storage) | Yes |
|
||||
| [Uploads](../uploads.md#using-object-storage) | Yes |
|
||||
|
|
|
@ -2222,7 +2222,7 @@ on what features you intend to use:
|
|||
|
||||
|Object storage type|Supported by consolidated configuration?|
|
||||
|-------------------|----------------------------------------|
|
||||
| [Backups](../../raketasks/backup_restore.md#uploading-backups-to-a-remote-cloud-storage) | No |
|
||||
| [Backups](../../raketasks/backup_gitlab.md#uploading-backups-to-a-remote-cloud-storage) | No |
|
||||
| [Job artifacts](../job_artifacts.md#using-object-storage) including archived job logs | Yes |
|
||||
| [LFS objects](../lfs/index.md#storing-lfs-objects-in-remote-object-storage) | Yes |
|
||||
| [Uploads](../uploads.md#using-object-storage) | Yes |
|
||||
|
|
|
@ -2141,7 +2141,7 @@ on what features you intend to use:
|
|||
|
||||
|Object storage type|Supported by consolidated configuration?|
|
||||
|-------------------|----------------------------------------|
|
||||
| [Backups](../../raketasks/backup_restore.md#uploading-backups-to-a-remote-cloud-storage) | No |
|
||||
| [Backups](../../raketasks/backup_gitlab.md#uploading-backups-to-a-remote-cloud-storage) | No |
|
||||
| [Job artifacts](../job_artifacts.md#using-object-storage) including archived job logs | Yes |
|
||||
| [LFS objects](../lfs/index.md#storing-lfs-objects-in-remote-object-storage) | Yes |
|
||||
| [Uploads](../uploads.md#using-object-storage) | Yes |
|
||||
|
|
|
@ -401,7 +401,7 @@ have more actual perceived uptime for your users.
|
|||
This solution is appropriate for many teams that have the default GitLab installation.
|
||||
With automatic backups of the GitLab repositories, configuration, and the database,
|
||||
this can be an optimal solution if you don't have strict requirements.
|
||||
[Automated backups](../../raketasks/backup_restore.md#configuring-cron-to-make-daily-backups)
|
||||
[Automated backups](../../raketasks/backup_gitlab.md#configuring-cron-to-make-daily-backups)
|
||||
is the least complex to setup. This provides a point-in-time recovery of a predetermined schedule.
|
||||
|
||||
### Traffic load balancer **(PREMIUM SELF)**
|
||||
|
|
|
@ -13,7 +13,7 @@ the [reference architectures](index.md#reference-architectures).
|
|||
|
||||
### S3 API compatibility issues
|
||||
|
||||
Not all S3 providers [are fully compatible](../../raketasks/backup_restore.md#other-s3-providers)
|
||||
Not all S3 providers [are fully compatible](../../raketasks/backup_gitlab.md#other-s3-providers)
|
||||
with the Fog library that GitLab uses. Symptoms include:
|
||||
|
||||
```plaintext
|
||||
|
|
|
@ -1033,7 +1033,6 @@ Parameters:
|
|||
| Parameter | Type | Required | Description |
|
||||
| --------- | ---- | -------- | ----------- |
|
||||
| `recipients` | string | yes | Comma-separated list of recipient email addresses |
|
||||
| `add_pusher` | boolean | no | Add pusher to recipients list |
|
||||
| `notify_only_broken_pipelines` | boolean | no | Notify only broken pipelines |
|
||||
| `branches_to_be_notified` | string | false | Branches to send notifications for. Valid options are "all", "default", "protected", and "default_and_protected. The default value is "default" |
|
||||
| `notify_only_default_branch` | boolean | no | Send notifications only for the default branch ([introduced in GitLab 12.0](https://gitlab.com/gitlab-org/gitlab-foss/-/merge_requests/28271)) |
|
||||
|
|
|
@ -252,7 +252,7 @@ To use [Review Apps](../../../development/testing_guide/review_apps.md) with ECS
|
|||
|
||||
1. Set up a new [service](#create-an-ecs-service).
|
||||
1. Use the `CI_AWS_ECS_SERVICE` variable to set the name.
|
||||
1. Set the environment scope to `review/*`.
|
||||
1. Set the environment scope to `review/*`.
|
||||
|
||||
Only one Review App at a time can be deployed because this service is shared by all review apps.
|
||||
|
||||
|
@ -282,9 +282,9 @@ include:
|
|||
To use DAST on the default branch:
|
||||
|
||||
1. Set up a new [service](#create-an-ecs-service). This service will be used to deploy a temporary
|
||||
DAST environment.
|
||||
DAST environment.
|
||||
1. Use the `CI_AWS_ECS_SERVICE` variable to set the name.
|
||||
1. Set the scope to the `dast-default` environment.
|
||||
1. Set the scope to the `dast-default` environment.
|
||||
1. Add the following to your `.gitlab-ci.yml` file:
|
||||
|
||||
```yaml
|
||||
|
|
|
@ -570,12 +570,12 @@ end
|
|||
|
||||
### Resources cleanup
|
||||
|
||||
We have a mechanism to [collect](https://gitlab.com/gitlab-org/gitlab/-/blob/44345381e89d6bbd440f7b4c680d03e8b75b86de/qa/qa/tools/test_resource_data_processor.rb#L32)
|
||||
all resources created during test executions, and another to [handle](https://gitlab.com/gitlab-org/gitlab/-/blob/44345381e89d6bbd440f7b4c680d03e8b75b86de/qa/qa/tools/test_resources_handler.rb#L44)
|
||||
these resources. On [dotcom environments](https://about.gitlab.com/handbook/engineering/infrastructure/environments/#environments), after a test suite finishes in the [QA pipelines](https://about.gitlab.com/handbook/engineering/quality/quality-engineering/debugging-qa-test-failures/#scheduled-qa-test-pipelines), resources from all passing test are
|
||||
automatically deleted in the same pipeline run. Resources from all failed tests are reserved for investigation,
|
||||
We have a mechanism to [collect](https://gitlab.com/gitlab-org/gitlab/-/blob/44345381e89d6bbd440f7b4c680d03e8b75b86de/qa/qa/tools/test_resource_data_processor.rb#L32)
|
||||
all resources created during test executions, and another to [handle](https://gitlab.com/gitlab-org/gitlab/-/blob/44345381e89d6bbd440f7b4c680d03e8b75b86de/qa/qa/tools/test_resources_handler.rb#L44)
|
||||
these resources. On [dotcom environments](https://about.gitlab.com/handbook/engineering/infrastructure/environments/#environments), after a test suite finishes in the [QA pipelines](https://about.gitlab.com/handbook/engineering/quality/quality-engineering/debugging-qa-test-failures/#scheduled-qa-test-pipelines), resources from all passing test are
|
||||
automatically deleted in the same pipeline run. Resources from all failed tests are reserved for investigation,
|
||||
and won't be deleted until the following Saturday by a scheduled pipeline. When introducing new resources, please
|
||||
also make sure to add any resource that cannot be deleted to the [IGNORED_RESOURCES](https://gitlab.com/gitlab-org/gitlab/-/blob/44345381e89d6bbd440f7b4c680d03e8b75b86de/qa/qa/tools/test_resources_handler.rb#L29)
|
||||
also make sure to add any resource that cannot be deleted to the [IGNORED_RESOURCES](https://gitlab.com/gitlab-org/gitlab/-/blob/44345381e89d6bbd440f7b4c680d03e8b75b86de/qa/qa/tools/test_resources_handler.rb#L29)
|
||||
list.
|
||||
|
||||
## Where to ask for help?
|
||||
|
|
|
@ -754,10 +754,10 @@ and restore its Git data, database, attachments, LFS objects, and so on.
|
|||
Some important things to know:
|
||||
|
||||
- The backup/restore tool **does not** store some configuration files, like secrets; you
|
||||
must [configure this yourself](../../raketasks/backup_restore.md#storing-configuration-files).
|
||||
must [configure this yourself](../../raketasks/backup_gitlab.md#storing-configuration-files).
|
||||
- By default, the backup files are stored locally, but you can
|
||||
[backup GitLab using S3](../../raketasks/backup_restore.md#using-amazon-s3).
|
||||
- You can [exclude specific directories form the backup](../../raketasks/backup_restore.md#excluding-specific-directories-from-the-backup).
|
||||
[backup GitLab using S3](../../raketasks/backup_gitlab.md#using-amazon-s3).
|
||||
- You can [exclude specific directories form the backup](../../raketasks/backup_gitlab.md#excluding-specific-directories-from-the-backup).
|
||||
|
||||
### Backing up GitLab
|
||||
|
||||
|
@ -777,7 +777,7 @@ For GitLab 12.1 and earlier, use `gitlab-rake gitlab:backup:create`.
|
|||
|
||||
To restore GitLab, first review the [restore documentation](../../raketasks/backup_restore.md#restore-gitlab),
|
||||
and primarily the restore prerequisites. Then, follow the steps under the
|
||||
[Omnibus installations section](../../raketasks/backup_restore.md#restore-for-omnibus-gitlab-installations).
|
||||
[Omnibus installations section](../../raketasks/restore_gitlab.md#restore-for-omnibus-gitlab-installations).
|
||||
|
||||
## Updating GitLab
|
||||
|
||||
|
|
|
@ -0,0 +1,908 @@
|
|||
---
|
||||
stage: Systems
|
||||
group: Geo
|
||||
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#assignments
|
||||
---
|
||||
|
||||
# Back up GitLab
|
||||
|
||||
GitLab provides a command line interface to back up your entire instance,
|
||||
including:
|
||||
|
||||
- Database
|
||||
- Attachments
|
||||
- Git repositories data
|
||||
- CI/CD job output logs
|
||||
- CI/CD job artifacts
|
||||
- LFS objects
|
||||
- Terraform states ([introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/331806) in GitLab 14.7)
|
||||
- Container Registry images
|
||||
- GitLab Pages content
|
||||
- Packages ([introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/332006) in GitLab 14.7)
|
||||
- Snippets
|
||||
- [Group wikis](../user/project/wiki/group.md)
|
||||
|
||||
Backups do not include:
|
||||
|
||||
- [Mattermost data](https://docs.mattermost.com/administration/config-settings.html#file-storage)
|
||||
- Redis (and thus Sidekiq jobs)
|
||||
|
||||
WARNING:
|
||||
GitLab does not back up any configuration files (`/etc/gitlab`), TLS keys and certificates, or system
|
||||
files. You are highly advised to read about [storing configuration files](#storing-configuration-files).
|
||||
|
||||
WARNING:
|
||||
The backup command requires [additional parameters](backup_restore.md#back-up-and-restore-for-installations-using-pgbouncer) when
|
||||
your installation is using PgBouncer, for either performance reasons or when using it with a Patroni cluster.
|
||||
|
||||
Depending on your version of GitLab, use the following command if you installed
|
||||
GitLab using the Omnibus package:
|
||||
|
||||
- GitLab 12.2 or later:
|
||||
|
||||
```shell
|
||||
sudo gitlab-backup create
|
||||
```
|
||||
|
||||
- GitLab 12.1 and earlier:
|
||||
|
||||
```shell
|
||||
gitlab-rake gitlab:backup:create
|
||||
```
|
||||
|
||||
If you installed GitLab from source, use the following command:
|
||||
|
||||
```shell
|
||||
sudo -u git -H bundle exec rake gitlab:backup:create RAILS_ENV=production
|
||||
```
|
||||
|
||||
If you're running GitLab from within a Docker container, run the backup from
|
||||
the host, based on your installed version of GitLab:
|
||||
|
||||
- GitLab 12.2 or later:
|
||||
|
||||
```shell
|
||||
docker exec -t <container name> gitlab-backup create
|
||||
```
|
||||
|
||||
- GitLab 12.1 and earlier:
|
||||
|
||||
```shell
|
||||
docker exec -t <container name> gitlab-rake gitlab:backup:create
|
||||
```
|
||||
|
||||
If you're using the [GitLab Helm chart](https://gitlab.com/gitlab-org/charts/gitlab)
|
||||
on a Kubernetes cluster, you can run the backup task by using `kubectl` to run the `backup-utility`
|
||||
script on the GitLab toolbox pod. For more details, see the
|
||||
[charts backup documentation](https://docs.gitlab.com/charts/backup-restore/backup.html).
|
||||
|
||||
Similar to the Kubernetes case, if you have scaled out your GitLab cluster to
|
||||
use multiple application servers, you should pick a designated node (that isn't
|
||||
auto-scaled away) for running the backup Rake task. Because the backup Rake
|
||||
task is tightly coupled to the main Rails application, this is typically a node
|
||||
on which you're also running Puma or Sidekiq.
|
||||
|
||||
Example output:
|
||||
|
||||
```plaintext
|
||||
Dumping database tables:
|
||||
- Dumping table events... [DONE]
|
||||
- Dumping table issues... [DONE]
|
||||
- Dumping table keys... [DONE]
|
||||
- Dumping table merge_requests... [DONE]
|
||||
- Dumping table milestones... [DONE]
|
||||
- Dumping table namespaces... [DONE]
|
||||
- Dumping table notes... [DONE]
|
||||
- Dumping table projects... [DONE]
|
||||
- Dumping table protected_branches... [DONE]
|
||||
- Dumping table schema_migrations... [DONE]
|
||||
- Dumping table services... [DONE]
|
||||
- Dumping table snippets... [DONE]
|
||||
- Dumping table taggings... [DONE]
|
||||
- Dumping table tags... [DONE]
|
||||
- Dumping table users... [DONE]
|
||||
- Dumping table users_projects... [DONE]
|
||||
- Dumping table web_hooks... [DONE]
|
||||
- Dumping table wikis... [DONE]
|
||||
Dumping repositories:
|
||||
- Dumping repository abcd... [DONE]
|
||||
Creating backup archive: $TIMESTAMP_gitlab_backup.tar [DONE]
|
||||
Deleting tmp directories...[DONE]
|
||||
Deleting old backups... [SKIPPING]
|
||||
```
|
||||
|
||||
## Storing configuration files
|
||||
|
||||
The [backup Rake task](#back-up-gitlab) GitLab provides does _not_ store your
|
||||
configuration files. The primary reason for this is that your database contains
|
||||
items including encrypted information for two-factor authentication and the
|
||||
CI/CD _secure variables_. Storing encrypted information in the same location
|
||||
as its key defeats the purpose of using encryption in the first place.
|
||||
|
||||
WARNING:
|
||||
The secrets file is essential to preserve your database encryption key.
|
||||
|
||||
At the very **minimum**, you must back up:
|
||||
|
||||
For Omnibus:
|
||||
|
||||
- `/etc/gitlab/gitlab-secrets.json`
|
||||
- `/etc/gitlab/gitlab.rb`
|
||||
|
||||
For installation from source:
|
||||
|
||||
- `/home/git/gitlab/config/secrets.yml`
|
||||
- `/home/git/gitlab/config/gitlab.yml`
|
||||
|
||||
For [Docker installations](https://docs.gitlab.com/omnibus/docker/), you must
|
||||
back up the volume where the configuration files are stored. If you created
|
||||
the GitLab container according to the documentation, it should be in the
|
||||
`/srv/gitlab/config` directory.
|
||||
|
||||
For [GitLab Helm chart installations](https://gitlab.com/gitlab-org/charts/gitlab)
|
||||
on a Kubernetes cluster, you must follow the
|
||||
[Back up the secrets](https://docs.gitlab.com/charts/backup-restore/backup.html#backup-the-secrets)
|
||||
instructions.
|
||||
|
||||
You may also want to back up any TLS keys and certificates (`/etc/gitlab/ssl`, `/etc/gitlab/trusted-certs`), and your
|
||||
[SSH host keys](https://superuser.com/questions/532040/copy-ssh-keys-from-one-server-to-another-server/532079#532079)
|
||||
to avoid man-in-the-middle attack warnings if you have to perform a full machine restore.
|
||||
|
||||
If you use Omnibus GitLab, review additional information to
|
||||
[backup your configuration](https://docs.gitlab.com/omnibus/settings/backups.html).
|
||||
|
||||
In the unlikely event that the secrets file is lost, see the
|
||||
[troubleshooting section](backup_restore.md#when-the-secrets-file-is-lost).
|
||||
|
||||
## Backup options
|
||||
|
||||
The command line tool GitLab provides to backup your instance can accept more
|
||||
options.
|
||||
|
||||
### Backup strategy option
|
||||
|
||||
The default backup strategy is to essentially stream data from the respective
|
||||
data locations to the backup using the Linux command `tar` and `gzip`. This works
|
||||
fine in most cases, but can cause problems when data is rapidly changing.
|
||||
|
||||
When data changes while `tar` is reading it, the error `file changed as we read
|
||||
it` may occur, and causes the backup process to fail. To combat this, 8.17
|
||||
introduces a new backup strategy called `copy`. The strategy copies data files
|
||||
to a temporary location before calling `tar` and `gzip`, avoiding the error.
|
||||
|
||||
A side-effect is that the backup process takes up to an additional 1X disk
|
||||
space. The process does its best to clean up the temporary files at each stage
|
||||
so the problem doesn't compound, but it could be a considerable change for large
|
||||
installations. This is why the `copy` strategy is not the default in 8.17.
|
||||
|
||||
To use the `copy` strategy instead of the default streaming strategy, specify
|
||||
`STRATEGY=copy` in the Rake task command. For example:
|
||||
|
||||
```shell
|
||||
sudo gitlab-backup create STRATEGY=copy
|
||||
```
|
||||
|
||||
Users of GitLab 12.1 and earlier should use the command `gitlab-rake gitlab:backup:create` instead.
|
||||
|
||||
### Backup filename
|
||||
|
||||
WARNING:
|
||||
If you use a custom backup filename, you can't
|
||||
[limit the lifetime of the backups](#limit-backup-lifetime-for-local-files-prune-old-backups).
|
||||
|
||||
By default, a backup file is created according to the specification in the
|
||||
previous [Backup timestamp](backup_restore.md#backup-timestamp) section. You can, however,
|
||||
override the `[TIMESTAMP]` portion of the filename by setting the `BACKUP`
|
||||
environment variable. For example:
|
||||
|
||||
```shell
|
||||
sudo gitlab-backup create BACKUP=dump
|
||||
```
|
||||
|
||||
Users of GitLab 12.1 and earlier should use the command `gitlab-rake gitlab:backup:create` instead.
|
||||
|
||||
The resulting file is named `dump_gitlab_backup.tar`. This is useful for
|
||||
systems that make use of rsync and incremental backups, and results in
|
||||
considerably faster transfer speeds.
|
||||
|
||||
### Confirm archive can be transferred
|
||||
|
||||
To ensure the generated archive is transferable by rsync, you can set the `GZIP_RSYNCABLE=yes`
|
||||
option. This sets the `--rsyncable` option to `gzip`, which is useful only in
|
||||
combination with setting [the Backup filename option](#backup-filename).
|
||||
|
||||
Note that the `--rsyncable` option in `gzip` isn't guaranteed to be available
|
||||
on all distributions. To verify that it's available in your distribution, run
|
||||
`gzip --help` or consult the man pages.
|
||||
|
||||
```shell
|
||||
sudo gitlab-backup create BACKUP=dump GZIP_RSYNCABLE=yes
|
||||
```
|
||||
|
||||
Users of GitLab 12.1 and earlier should use the command `gitlab-rake gitlab:backup:create` instead.
|
||||
|
||||
### Excluding specific directories from the backup
|
||||
|
||||
You can exclude specific directories from the backup by adding the environment variable `SKIP`, whose values are a comma-separated list of the following options:
|
||||
|
||||
- `db` (database)
|
||||
- `uploads` (attachments)
|
||||
- `builds` (CI job output logs)
|
||||
- `artifacts` (CI job artifacts)
|
||||
- `lfs` (LFS objects)
|
||||
- `terraform_state` (Terraform states)
|
||||
- `registry` (Container Registry images)
|
||||
- `pages` (Pages content)
|
||||
- `repositories` (Git repositories data)
|
||||
- `packages` (Packages)
|
||||
|
||||
All wikis are backed up as part of the `repositories` group. Non-existent wikis are skipped during a backup.
|
||||
|
||||
NOTE:
|
||||
When [backing up and restoring Helm Charts](https://docs.gitlab.com/charts/architecture/backup-restore.html), there is an additional option `packages`, which refers to any packages managed by the GitLab [package registry](../user/packages/package_registry/index.md).
|
||||
For more information see [command line arguments](https://docs.gitlab.com/charts/architecture/backup-restore.html#command-line-arguments).
|
||||
|
||||
All wikis are backed up as part of the `repositories` group. Non-existent
|
||||
wikis are skipped during a backup.
|
||||
|
||||
For Omnibus GitLab packages:
|
||||
|
||||
```shell
|
||||
sudo gitlab-backup create SKIP=db,uploads
|
||||
```
|
||||
|
||||
Users of GitLab 12.1 and earlier should use the command `gitlab-rake gitlab:backup:create` instead.
|
||||
|
||||
For installations from source:
|
||||
|
||||
```shell
|
||||
sudo -u git -H bundle exec rake gitlab:backup:create SKIP=db,uploads RAILS_ENV=production
|
||||
```
|
||||
|
||||
### Skipping tar creation
|
||||
|
||||
NOTE:
|
||||
It is not possible to skip the tar creation when using [object storage](#uploading-backups-to-a-remote-cloud-storage) for backups.
|
||||
|
||||
The last part of creating a backup is generation of a `.tar` file containing
|
||||
all the parts. In some cases (for example, if the backup is picked up by other
|
||||
backup software) creating a `.tar` file might be wasted effort or even directly
|
||||
harmful, so you can skip this step by adding `tar` to the `SKIP` environment
|
||||
variable.
|
||||
|
||||
Adding `tar` to the `SKIP` variable leaves the files and directories containing the
|
||||
backup in the directory used for the intermediate files. These files are
|
||||
overwritten when a new backup is created, so you should make sure they are copied
|
||||
elsewhere, because you can only have one backup on the system.
|
||||
|
||||
For Omnibus GitLab packages:
|
||||
|
||||
```shell
|
||||
sudo gitlab-backup create SKIP=tar
|
||||
```
|
||||
|
||||
For installations from source:
|
||||
|
||||
```shell
|
||||
sudo -u git -H bundle exec rake gitlab:backup:create SKIP=tar RAILS_ENV=production
|
||||
```
|
||||
|
||||
### Back up Git repositories concurrently
|
||||
|
||||
> - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/37158) in GitLab 13.3.
|
||||
> - [Concurrent restore introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/69330) in GitLab 14.3
|
||||
|
||||
When using [multiple repository storages](../administration/repository_storage_paths.md),
|
||||
repositories can be backed up or restored concurrently to help fully use CPU time. The
|
||||
following variables are available to modify the default behavior of the Rake
|
||||
task:
|
||||
|
||||
- `GITLAB_BACKUP_MAX_CONCURRENCY`: The maximum number of projects to back up at
|
||||
the same time. Defaults to the number of logical CPUs (in GitLab 14.1 and
|
||||
earlier, defaults to `1`).
|
||||
- `GITLAB_BACKUP_MAX_STORAGE_CONCURRENCY`: The maximum number of projects to
|
||||
back up at the same time on each storage. This allows the repository backups
|
||||
to be spread across storages. Defaults to `2` (in GitLab 14.1 and earlier,
|
||||
defaults to `1`).
|
||||
|
||||
For example, for Omnibus GitLab installations with 4 repository storages:
|
||||
|
||||
```shell
|
||||
sudo gitlab-backup create GITLAB_BACKUP_MAX_CONCURRENCY=4 GITLAB_BACKUP_MAX_STORAGE_CONCURRENCY=1
|
||||
```
|
||||
|
||||
For example, for installations from source:
|
||||
|
||||
```shell
|
||||
sudo -u git -H bundle exec rake gitlab:backup:create GITLAB_BACKUP_MAX_CONCURRENCY=4 GITLAB_BACKUP_MAX_STORAGE_CONCURRENCY=1
|
||||
```
|
||||
|
||||
### Incremental repository backups
|
||||
|
||||
> - Introduced in GitLab 14.9 [with a flag](../administration/feature_flags.md) named `incremental_repository_backup`. Disabled by default.
|
||||
> - [Enabled on self-managed](https://gitlab.com/gitlab-org/gitlab/-/issues/355945) in GitLab 14.10.
|
||||
> - `PREVIOUS_BACKUP` option [introduced](https://gitlab.com/gitlab-org/gitaly/-/issues/4184) in GitLab 15.0.
|
||||
|
||||
FLAG:
|
||||
On self-managed GitLab, by default this feature is available. To hide the feature, ask an administrator to [disable the feature flag](../administration/feature_flags.md) named `incremental_repository_backup`.
|
||||
On GitLab.com, this feature is not available.
|
||||
|
||||
Incremental backups can be faster than full backups because they only pack changes since the last backup into the backup
|
||||
bundle for each repository. There must be an existing backup to create an incremental backup from:
|
||||
|
||||
- In GitLab 14.9 and 14.10, use the `BACKUP=<timestamp_of_backup>` option to choose the backup to use. The chosen previous backup is overwritten.
|
||||
- In GitLab 15.0 and later, use the `PREVIOUS_BACKUP=<timestamp_of_backup>` option to choose the backup to use. By default, a backup file is created
|
||||
as documented in the [Backup timestamp](backup_restore.md#backup-timestamp) section. You can override the `[TIMESTAMP]` portion of the filename by setting the
|
||||
[`BACKUP` environment variable](#backup-filename).
|
||||
|
||||
To create an incremental backup, run:
|
||||
|
||||
```shell
|
||||
sudo gitlab-backup create INCREMENTAL=yes PREVIOUS_BACKUP=<timestamp_of_backup>
|
||||
```
|
||||
|
||||
Incremental backups can also be created from [an untarred backup](#skipping-tar-creation) by using `SKIP=tar`:
|
||||
|
||||
```shell
|
||||
sudo gitlab-backup create INCREMENTAL=yes SKIP=tar
|
||||
```
|
||||
|
||||
### Back up specific repository storages
|
||||
|
||||
> [Introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/86896) in GitLab 15.0.
|
||||
|
||||
When using [multiple repository storages](../administration/repository_storage_paths.md),
|
||||
repositories from specific repository storages can be backed up separately
|
||||
using the `REPOSITORIES_STORAGES` option. The option accepts a comma-separated list of
|
||||
storage names.
|
||||
|
||||
For example, for Omnibus GitLab installations:
|
||||
|
||||
```shell
|
||||
sudo gitlab-backup create REPOSITORIES_STORAGES=storage1,storage2
|
||||
```
|
||||
|
||||
For example, for installations from source:
|
||||
|
||||
```shell
|
||||
sudo -u git -H bundle exec rake gitlab:backup:create REPOSITORIES_STORAGES=storage1,storage2
|
||||
```
|
||||
|
||||
### Back up specific repositories
|
||||
|
||||
> [Introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/88094) in GitLab 15.1.
|
||||
|
||||
You can back up a specific repositories using the `REPOSITORIES_PATHS` option.
|
||||
The option accepts a comma-separated list of project and group paths. If you
|
||||
specify a group path, all repositories in all projects in the group and
|
||||
descendent groups are included.
|
||||
|
||||
For example, to back up all repositories for all projects in **Group A** (`group-a`), and the repository for **Project C** in **Group B** (`group-b/project-c`):
|
||||
|
||||
- Omnibus GitLab installations:
|
||||
|
||||
```shell
|
||||
sudo gitlab-backup create REPOSITORIES_PATHS=group-a,group-b/project-c
|
||||
```
|
||||
|
||||
- Installations from source:
|
||||
|
||||
```shell
|
||||
sudo -u git -H bundle exec rake gitlab:backup:create REPOSITORIES_PATHS=group-a,group-b/project-c
|
||||
```
|
||||
|
||||
### Uploading backups to a remote (cloud) storage
|
||||
|
||||
NOTE:
|
||||
It is not possible to [skip the tar creation](#skipping-tar-creation) when using object storage for backups.
|
||||
|
||||
You can let the backup script upload (using the [Fog library](https://fog.io/))
|
||||
the `.tar` file it creates. In the following example, we use Amazon S3 for
|
||||
storage, but Fog also lets you use [other storage providers](https://fog.io/storage/).
|
||||
GitLab also [imports cloud drivers](https://gitlab.com/gitlab-org/gitlab/-/blob/da46c9655962df7d49caef0e2b9f6bbe88462a02/Gemfile#L113)
|
||||
for AWS, Google, OpenStack Swift, Rackspace, and Aliyun. A local driver is
|
||||
[also available](#uploading-to-locally-mounted-shares).
|
||||
|
||||
[Read more about using object storage with GitLab](../administration/object_storage.md).
|
||||
|
||||
#### Using Amazon S3
|
||||
|
||||
For Omnibus GitLab packages:
|
||||
|
||||
1. Add the following to `/etc/gitlab/gitlab.rb`:
|
||||
|
||||
```ruby
|
||||
gitlab_rails['backup_upload_connection'] = {
|
||||
'provider' => 'AWS',
|
||||
'region' => 'eu-west-1',
|
||||
'aws_access_key_id' => 'AKIAKIAKI',
|
||||
'aws_secret_access_key' => 'secret123'
|
||||
# If using an IAM Profile, don't configure aws_access_key_id & aws_secret_access_key
|
||||
# 'use_iam_profile' => true
|
||||
}
|
||||
gitlab_rails['backup_upload_remote_directory'] = 'my.s3.bucket'
|
||||
```
|
||||
|
||||
1. [Reconfigure GitLab](../administration/restart_gitlab.md#omnibus-gitlab-reconfigure)
|
||||
for the changes to take effect
|
||||
|
||||
#### S3 Encrypted Buckets
|
||||
|
||||
> [Introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/64765) in GitLab 14.3.
|
||||
|
||||
AWS supports these [modes for server side encryption](https://docs.aws.amazon.com/AmazonS3/latest/userguide/serv-side-encryption.html):
|
||||
|
||||
- Amazon S3-Managed Keys (SSE-S3)
|
||||
- Customer Master Keys (CMKs) Stored in AWS Key Management Service (SSE-KMS)
|
||||
- Customer-Provided Keys (SSE-C)
|
||||
|
||||
Use your mode of choice with GitLab. Each mode has similar, but slightly
|
||||
different, configuration methods.
|
||||
|
||||
##### SSE-S3
|
||||
|
||||
To enable SSE-S3, in the backup storage options set the `server_side_encryption`
|
||||
field to `AES256`. For example, in Omnibus GitLab:
|
||||
|
||||
```ruby
|
||||
gitlab_rails['backup_upload_storage_options'] = {
|
||||
'server_side_encryption' => 'AES256'
|
||||
}
|
||||
```
|
||||
|
||||
##### SSE-KMS
|
||||
|
||||
To enable SSE-KMS, you'll need the [KMS key via its Amazon Resource Name (ARN)
|
||||
in the `arn:aws:kms:region:acct-id:key/key-id` format](https://docs.aws.amazon.com/AmazonS3/latest/userguide/UsingKMSEncryption.html). Under the `backup_upload_storage_options` configuration setting, set:
|
||||
|
||||
- `server_side_encryption` to `aws:kms`.
|
||||
- `server_side_encryption_kms_key_id` to the ARN of the key.
|
||||
|
||||
For example, in Omnibus GitLab:
|
||||
|
||||
```ruby
|
||||
gitlab_rails['backup_upload_storage_options'] = {
|
||||
'server_side_encryption' => 'aws:kms',
|
||||
'server_side_encryption_kms_key_id' => 'arn:aws:<YOUR KMS KEY ID>:'
|
||||
}
|
||||
```
|
||||
|
||||
##### SSE-C
|
||||
|
||||
SSE-C requires you to set these encryption options:
|
||||
|
||||
- `backup_encryption`: AES256.
|
||||
- `backup_encryption_key`: Unencoded, 32-byte (256 bits) key. The upload fails if this isn't exactly 32 bytes.
|
||||
|
||||
For example, in Omnibus GitLab:
|
||||
|
||||
```ruby
|
||||
gitlab_rails['backup_encryption'] = 'AES256'
|
||||
gitlab_rails['backup_encryption_key'] = '<YOUR 32-BYTE KEY HERE>'
|
||||
```
|
||||
|
||||
If the key contains binary characters and cannot be encoded in UTF-8,
|
||||
instead, specify the key with the `GITLAB_BACKUP_ENCRYPTION_KEY` environment variable.
|
||||
For example:
|
||||
|
||||
```ruby
|
||||
gitlab_rails['env'] = { 'GITLAB_BACKUP_ENCRYPTION_KEY' => "\xDE\xAD\xBE\xEF" * 8 }
|
||||
```
|
||||
|
||||
#### Digital Ocean Spaces
|
||||
|
||||
This example can be used for a bucket in Amsterdam (AMS3):
|
||||
|
||||
1. Add the following to `/etc/gitlab/gitlab.rb`:
|
||||
|
||||
```ruby
|
||||
gitlab_rails['backup_upload_connection'] = {
|
||||
'provider' => 'AWS',
|
||||
'region' => 'ams3',
|
||||
'aws_access_key_id' => 'AKIAKIAKI',
|
||||
'aws_secret_access_key' => 'secret123',
|
||||
'endpoint' => 'https://ams3.digitaloceanspaces.com'
|
||||
}
|
||||
gitlab_rails['backup_upload_remote_directory'] = 'my.s3.bucket'
|
||||
```
|
||||
|
||||
1. [Reconfigure GitLab](../administration/restart_gitlab.md#omnibus-gitlab-reconfigure)
|
||||
for the changes to take effect
|
||||
|
||||
If you see a `400 Bad Request` error message when using Digital Ocean Spaces,
|
||||
the cause may be the use of backup encryption. Because Digital Ocean Spaces
|
||||
doesn't support encryption, remove or comment the line that contains
|
||||
`gitlab_rails['backup_encryption']`.
|
||||
|
||||
#### Other S3 Providers
|
||||
|
||||
Not all S3 providers are fully compatible with the Fog library. For example,
|
||||
if you see a `411 Length Required` error message after attempting to upload,
|
||||
you may need to downgrade the `aws_signature_version` value from the default
|
||||
value to `2`, [due to this issue](https://github.com/fog/fog-aws/issues/428).
|
||||
|
||||
For installations from source:
|
||||
|
||||
1. Edit `home/git/gitlab/config/gitlab.yml`:
|
||||
|
||||
```yaml
|
||||
backup:
|
||||
# snip
|
||||
upload:
|
||||
# Fog storage connection settings, see https://fog.io/storage/ .
|
||||
connection:
|
||||
provider: AWS
|
||||
region: eu-west-1
|
||||
aws_access_key_id: AKIAKIAKI
|
||||
aws_secret_access_key: 'secret123'
|
||||
# If using an IAM Profile, leave aws_access_key_id & aws_secret_access_key empty
|
||||
# ie. aws_access_key_id: ''
|
||||
# use_iam_profile: 'true'
|
||||
# The remote 'directory' to store your backups. For S3, this would be the bucket name.
|
||||
remote_directory: 'my.s3.bucket'
|
||||
# Specifies Amazon S3 storage class to use for backups, this is optional
|
||||
# storage_class: 'STANDARD'
|
||||
#
|
||||
# Turns on AWS Server-Side Encryption with Amazon Customer-Provided Encryption Keys for backups, this is optional
|
||||
# 'encryption' must be set in order for this to have any effect.
|
||||
# 'encryption_key' should be set to the 256-bit encryption key for Amazon S3 to use to encrypt or decrypt.
|
||||
# To avoid storing the key on disk, the key can also be specified via the `GITLAB_BACKUP_ENCRYPTION_KEY` your data.
|
||||
# encryption: 'AES256'
|
||||
# encryption_key: '<key>'
|
||||
#
|
||||
#
|
||||
# Turns on AWS Server-Side Encryption with Amazon S3-Managed keys (optional)
|
||||
# https://docs.aws.amazon.com/AmazonS3/latest/userguide/serv-side-encryption.html
|
||||
# For SSE-S3, set 'server_side_encryption' to 'AES256'.
|
||||
# For SS3-KMS, set 'server_side_encryption' to 'aws:kms'. Set
|
||||
# 'server_side_encryption_kms_key_id' to the ARN of customer master key.
|
||||
# storage_options:
|
||||
# server_side_encryption: 'aws:kms'
|
||||
# server_side_encryption_kms_key_id: 'arn:aws:kms:YOUR-KEY-ID-HERE'
|
||||
```
|
||||
|
||||
1. [Restart GitLab](../administration/restart_gitlab.md#installations-from-source)
|
||||
for the changes to take effect
|
||||
|
||||
If you're uploading your backups to S3, you should create a new
|
||||
IAM user with restricted access rights. To give the upload user access only for
|
||||
uploading backups create the following IAM profile, replacing `my.s3.bucket`
|
||||
with the name of your bucket:
|
||||
|
||||
```json
|
||||
{
|
||||
"Version": "2012-10-17",
|
||||
"Statement": [
|
||||
{
|
||||
"Sid": "Stmt1412062044000",
|
||||
"Effect": "Allow",
|
||||
"Action": [
|
||||
"s3:AbortMultipartUpload",
|
||||
"s3:GetBucketAcl",
|
||||
"s3:GetBucketLocation",
|
||||
"s3:GetObject",
|
||||
"s3:GetObjectAcl",
|
||||
"s3:ListBucketMultipartUploads",
|
||||
"s3:PutObject",
|
||||
"s3:PutObjectAcl"
|
||||
],
|
||||
"Resource": [
|
||||
"arn:aws:s3:::my.s3.bucket/*"
|
||||
]
|
||||
},
|
||||
{
|
||||
"Sid": "Stmt1412062097000",
|
||||
"Effect": "Allow",
|
||||
"Action": [
|
||||
"s3:GetBucketLocation",
|
||||
"s3:ListAllMyBuckets"
|
||||
],
|
||||
"Resource": [
|
||||
"*"
|
||||
]
|
||||
},
|
||||
{
|
||||
"Sid": "Stmt1412062128000",
|
||||
"Effect": "Allow",
|
||||
"Action": [
|
||||
"s3:ListBucket"
|
||||
],
|
||||
"Resource": [
|
||||
"arn:aws:s3:::my.s3.bucket"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
#### Using Google Cloud Storage
|
||||
|
||||
To use Google Cloud Storage to save backups, you must first create an
|
||||
access key from the Google console:
|
||||
|
||||
1. Go to the [Google storage settings page](https://console.cloud.google.com/storage/settings).
|
||||
1. Select **Interoperability**, and then create an access key.
|
||||
1. Make note of the **Access Key** and **Secret** and replace them in the
|
||||
following configurations.
|
||||
1. In the buckets advanced settings ensure the Access Control option
|
||||
**Set object-level and bucket-level permissions** is selected.
|
||||
1. Ensure you have already created a bucket.
|
||||
|
||||
For Omnibus GitLab packages:
|
||||
|
||||
1. Edit `/etc/gitlab/gitlab.rb`:
|
||||
|
||||
```ruby
|
||||
gitlab_rails['backup_upload_connection'] = {
|
||||
'provider' => 'Google',
|
||||
'google_storage_access_key_id' => 'Access Key',
|
||||
'google_storage_secret_access_key' => 'Secret',
|
||||
|
||||
## If you have CNAME buckets (foo.example.com), you might run into SSL issues
|
||||
## when uploading backups ("hostname foo.example.com.storage.googleapis.com
|
||||
## does not match the server certificate"). In that case, uncomnent the following
|
||||
## setting. See: https://github.com/fog/fog/issues/2834
|
||||
#'path_style' => true
|
||||
}
|
||||
gitlab_rails['backup_upload_remote_directory'] = 'my.google.bucket'
|
||||
```
|
||||
|
||||
1. [Reconfigure GitLab](../administration/restart_gitlab.md#omnibus-gitlab-reconfigure)
|
||||
for the changes to take effect
|
||||
|
||||
For installations from source:
|
||||
|
||||
1. Edit `home/git/gitlab/config/gitlab.yml`:
|
||||
|
||||
```yaml
|
||||
backup:
|
||||
upload:
|
||||
connection:
|
||||
provider: 'Google'
|
||||
google_storage_access_key_id: 'Access Key'
|
||||
google_storage_secret_access_key: 'Secret'
|
||||
remote_directory: 'my.google.bucket'
|
||||
```
|
||||
|
||||
1. [Restart GitLab](../administration/restart_gitlab.md#installations-from-source)
|
||||
for the changes to take effect
|
||||
|
||||
#### Using Azure Blob storage
|
||||
|
||||
> [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/25877) in GitLab 13.4.
|
||||
|
||||
For Omnibus GitLab packages:
|
||||
|
||||
1. Edit `/etc/gitlab/gitlab.rb`:
|
||||
|
||||
```ruby
|
||||
gitlab_rails['backup_upload_connection'] = {
|
||||
'provider' => 'AzureRM',
|
||||
'azure_storage_account_name' => '<AZURE STORAGE ACCOUNT NAME>',
|
||||
'azure_storage_access_key' => '<AZURE STORAGE ACCESS KEY>',
|
||||
'azure_storage_domain' => 'blob.core.windows.net', # Optional
|
||||
}
|
||||
gitlab_rails['backup_upload_remote_directory'] = '<AZURE BLOB CONTAINER>'
|
||||
```
|
||||
|
||||
1. [Reconfigure GitLab](../administration/restart_gitlab.md#omnibus-gitlab-reconfigure)
|
||||
for the changes to take effect
|
||||
|
||||
For installations from source:
|
||||
|
||||
1. Edit `home/git/gitlab/config/gitlab.yml`:
|
||||
|
||||
```yaml
|
||||
backup:
|
||||
upload:
|
||||
connection:
|
||||
provider: 'AzureRM'
|
||||
azure_storage_account_name: '<AZURE STORAGE ACCOUNT NAME>'
|
||||
azure_storage_access_key: '<AZURE STORAGE ACCESS KEY>'
|
||||
remote_directory: '<AZURE BLOB CONTAINER>'
|
||||
```
|
||||
|
||||
1. [Restart GitLab](../administration/restart_gitlab.md#installations-from-source)
|
||||
for the changes to take effect
|
||||
|
||||
For more details, see the [table of Azure parameters](../administration/object_storage.md#azure-blob-storage).
|
||||
|
||||
#### Specifying a custom directory for backups
|
||||
|
||||
This option works only for remote storage. If you want to group your backups,
|
||||
you can pass a `DIRECTORY` environment variable:
|
||||
|
||||
```shell
|
||||
sudo gitlab-backup create DIRECTORY=daily
|
||||
sudo gitlab-backup create DIRECTORY=weekly
|
||||
```
|
||||
|
||||
Users of GitLab 12.1 and earlier should use the command `gitlab-rake gitlab:backup:create` instead.
|
||||
|
||||
### Skip uploading backups to remote storage
|
||||
|
||||
If you have configured GitLab to [upload backups in a remote storage](#uploading-backups-to-a-remote-cloud-storage),
|
||||
you can use the `SKIP=remote` option to skip uploading your backups to the remote storage.
|
||||
|
||||
For Omnibus GitLab packages:
|
||||
|
||||
```shell
|
||||
sudo gitlab-backup create SKIP=remote
|
||||
```
|
||||
|
||||
For installations from source:
|
||||
|
||||
```shell
|
||||
sudo -u git -H bundle exec rake gitlab:backup:create SKIP=remote RAILS_ENV=production
|
||||
```
|
||||
|
||||
### Uploading to locally mounted shares
|
||||
|
||||
You may also send backups to a mounted share (for example, `NFS`,`CIFS`, or
|
||||
`SMB`) by using the Fog [`Local`](https://github.com/fog/fog-local#usage)
|
||||
storage provider. The directory pointed to by the `local_root` key _must_ be
|
||||
owned by the `git` user _when mounted_ (mounting with the `uid=` of the `git`
|
||||
user for `CIFS` and `SMB`) or the user that you are executing the backup tasks
|
||||
as (for Omnibus packages, this is the `git` user).
|
||||
|
||||
The `backup_upload_remote_directory` _must_ be set in addition to the
|
||||
`local_root` key. This is the sub directory inside the mounted directory that
|
||||
backups are copied to, and is created if it does not exist. If the
|
||||
directory that you want to copy the tarballs to is the root of your mounted
|
||||
directory, use `.` instead.
|
||||
|
||||
Because file system performance may affect overall GitLab performance,
|
||||
[GitLab doesn't recommend using cloud-based file systems for storage](../administration/nfs.md#avoid-using-cloud-based-file-systems).
|
||||
|
||||
For Omnibus GitLab packages:
|
||||
|
||||
1. Edit `/etc/gitlab/gitlab.rb`:
|
||||
|
||||
```ruby
|
||||
gitlab_rails['backup_upload_connection'] = {
|
||||
:provider => 'Local',
|
||||
:local_root => '/mnt/backups'
|
||||
}
|
||||
|
||||
# The directory inside the mounted folder to copy backups to
|
||||
# Use '.' to store them in the root directory
|
||||
gitlab_rails['backup_upload_remote_directory'] = 'gitlab_backups'
|
||||
```
|
||||
|
||||
1. [Reconfigure GitLab](../administration/restart_gitlab.md#omnibus-gitlab-reconfigure)
|
||||
for the changes to take effect.
|
||||
|
||||
For installations from source:
|
||||
|
||||
1. Edit `home/git/gitlab/config/gitlab.yml`:
|
||||
|
||||
```yaml
|
||||
backup:
|
||||
upload:
|
||||
# Fog storage connection settings, see https://fog.io/storage/ .
|
||||
connection:
|
||||
provider: Local
|
||||
local_root: '/mnt/backups'
|
||||
# The directory inside the mounted folder to copy backups to
|
||||
# Use '.' to store them in the root directory
|
||||
remote_directory: 'gitlab_backups'
|
||||
```
|
||||
|
||||
1. [Restart GitLab](../administration/restart_gitlab.md#installations-from-source)
|
||||
for the changes to take effect.
|
||||
|
||||
### Backup archive permissions
|
||||
|
||||
The backup archives created by GitLab (`1393513186_2014_02_27_gitlab_backup.tar`)
|
||||
have the owner/group `git`/`git` and 0600 permissions by default. This is
|
||||
meant to avoid other system users reading GitLab data. If you need the backup
|
||||
archives to have different permissions, you can use the `archive_permissions`
|
||||
setting.
|
||||
|
||||
For Omnibus GitLab packages:
|
||||
|
||||
1. Edit `/etc/gitlab/gitlab.rb`:
|
||||
|
||||
```ruby
|
||||
gitlab_rails['backup_archive_permissions'] = 0644 # Makes the backup archives world-readable
|
||||
```
|
||||
|
||||
1. [Reconfigure GitLab](../administration/restart_gitlab.md#omnibus-gitlab-reconfigure)
|
||||
for the changes to take effect.
|
||||
|
||||
For installations from source:
|
||||
|
||||
1. Edit `/home/git/gitlab/config/gitlab.yml`:
|
||||
|
||||
```yaml
|
||||
backup:
|
||||
archive_permissions: 0644 # Makes the backup archives world-readable
|
||||
```
|
||||
|
||||
1. [Restart GitLab](../administration/restart_gitlab.md#installations-from-source)
|
||||
for the changes to take effect.
|
||||
|
||||
### Configuring cron to make daily backups
|
||||
|
||||
WARNING:
|
||||
The following cron jobs do not [back up your GitLab configuration files](#storing-configuration-files)
|
||||
or [SSH host keys](https://superuser.com/questions/532040/copy-ssh-keys-from-one-server-to-another-server/532079#532079).
|
||||
|
||||
You can schedule a cron job that backs up your repositories and GitLab metadata.
|
||||
|
||||
For Omnibus GitLab packages:
|
||||
|
||||
1. Edit the crontab for the `root` user:
|
||||
|
||||
```shell
|
||||
sudo su -
|
||||
crontab -e
|
||||
```
|
||||
|
||||
1. There, add the following line to schedule the backup for everyday at 2 AM:
|
||||
|
||||
```plaintext
|
||||
0 2 * * * /opt/gitlab/bin/gitlab-backup create CRON=1
|
||||
```
|
||||
|
||||
Users of GitLab 12.1 and earlier should use the command `gitlab-rake gitlab:backup:create` instead.
|
||||
|
||||
For installations from source:
|
||||
|
||||
1. Edit the crontab for the `git` user:
|
||||
|
||||
```shell
|
||||
sudo -u git crontab -e
|
||||
```
|
||||
|
||||
1. Add the following lines at the bottom:
|
||||
|
||||
```plaintext
|
||||
# Create a full backup of the GitLab repositories and SQL database every day at 2am
|
||||
0 2 * * * cd /home/git/gitlab && PATH=/usr/local/bin:/usr/bin:/bin bundle exec rake gitlab:backup:create RAILS_ENV=production CRON=1
|
||||
```
|
||||
|
||||
The `CRON=1` environment setting directs the backup script to hide all progress
|
||||
output if there aren't any errors. This is recommended to reduce cron spam.
|
||||
When troubleshooting backup problems, however, replace `CRON=1` with `--trace` to log verbosely.
|
||||
|
||||
## Limit backup lifetime for local files (prune old backups)
|
||||
|
||||
WARNING:
|
||||
The process described in this section don't work if you used a [custom filename](#backup-filename)
|
||||
for your backups.
|
||||
|
||||
To prevent regular backups from using all your disk space, you may want to set a limited lifetime
|
||||
for backups. The next time the backup task runs, backups older than the `backup_keep_time` are
|
||||
pruned.
|
||||
|
||||
This configuration option manages only local files. GitLab doesn't prune old
|
||||
files stored in a third-party [object storage](#uploading-backups-to-a-remote-cloud-storage)
|
||||
because the user may not have permission to list and delete files. It's
|
||||
recommended that you configure the appropriate retention policy for your object
|
||||
storage (for example, [AWS S3](https://docs.aws.amazon.com/AmazonS3/latest/user-guide/create-lifecycle.html)).
|
||||
|
||||
For Omnibus GitLab packages:
|
||||
|
||||
1. Edit `/etc/gitlab/gitlab.rb`:
|
||||
|
||||
```ruby
|
||||
## Limit backup lifetime to 7 days - 604800 seconds
|
||||
gitlab_rails['backup_keep_time'] = 604800
|
||||
```
|
||||
|
||||
1. [Reconfigure GitLab](../administration/restart_gitlab.md#omnibus-gitlab-reconfigure)
|
||||
for the changes to take effect.
|
||||
|
||||
For installations from source:
|
||||
|
||||
1. Edit `/home/git/gitlab/config/gitlab.yml`:
|
||||
|
||||
```yaml
|
||||
backup:
|
||||
## Limit backup lifetime to 7 days - 604800 seconds
|
||||
keep_time: 604800
|
||||
```
|
||||
|
||||
1. [Restart GitLab](../administration/restart_gitlab.md#installations-from-source)
|
||||
for the changes to take effect.
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,367 @@
|
|||
---
|
||||
stage: Systems
|
||||
group: Geo
|
||||
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#assignments
|
||||
---
|
||||
|
||||
# Restore GitLab
|
||||
|
||||
GitLab provides a command line interface to restore your entire installation,
|
||||
and is flexible enough to fit your needs.
|
||||
|
||||
The [restore prerequisites section](#restore-prerequisites) includes crucial
|
||||
information. Be sure to read and test the complete restore process at least
|
||||
once before attempting to perform it in a production environment.
|
||||
|
||||
You can restore a backup only to _the exact same version and type (CE/EE)_ of
|
||||
GitLab that you created it on (for example CE 9.1.0).
|
||||
|
||||
If your backup is a different version than the current installation, you must
|
||||
[downgrade your GitLab installation](../update/package/downgrade.md)
|
||||
before restoring the backup.
|
||||
|
||||
## Restore prerequisites
|
||||
|
||||
You need to have a working GitLab installation before you can perform a
|
||||
restore. This is because the system user performing the restore actions (`git`)
|
||||
is usually not allowed to create or delete the SQL database needed to import
|
||||
data into (`gitlabhq_production`). All existing data is either erased
|
||||
(SQL) or moved to a separate directory (such as repositories and uploads).
|
||||
|
||||
To restore a backup, you must restore `/etc/gitlab/gitlab-secrets.json`
|
||||
(for Omnibus packages) or `/home/git/gitlab/.secret` (for installations from
|
||||
source). This file contains the database encryption key,
|
||||
[CI/CD variables](../ci/variables/index.md), and
|
||||
variables used for [two-factor authentication](../user/profile/account/two_factor_authentication.md).
|
||||
If you fail to restore this encryption key file along with the application data
|
||||
backup, users with two-factor authentication enabled and GitLab Runner
|
||||
loses access to your GitLab server.
|
||||
|
||||
You may also want to restore your previous `/etc/gitlab/gitlab.rb` (for Omnibus packages)
|
||||
or `/home/git/gitlab/config/gitlab.yml` (for installations from source) and
|
||||
any TLS keys, certificates (`/etc/gitlab/ssl`, `/etc/gitlab/trusted-certs`), or
|
||||
[SSH host keys](https://superuser.com/questions/532040/copy-ssh-keys-from-one-server-to-another-server/532079#532079).
|
||||
|
||||
Starting with GitLab 12.9, if an untarred backup (like the ones made with
|
||||
`SKIP=tar`) is found, and no backup is chosen with `BACKUP=<timestamp>`, the
|
||||
untarred backup is used.
|
||||
|
||||
Depending on your case, you might want to run the restore command with one or
|
||||
more of the following options:
|
||||
|
||||
- `BACKUP=timestamp_of_backup`: Required if more than one backup exists.
|
||||
Read what the [backup timestamp is about](backup_restore.md#backup-timestamp).
|
||||
- `force=yes`: Doesn't ask if the `authorized_keys` file should get regenerated,
|
||||
and assumes 'yes' for warning about database tables being removed,
|
||||
enabling the `Write to authorized_keys file` setting, and updating LDAP
|
||||
providers.
|
||||
|
||||
If you're restoring into directories that are mount points, you must ensure these directories are
|
||||
empty before attempting a restore. Otherwise, GitLab attempts to move these directories before
|
||||
restoring the new data, which causes an error.
|
||||
|
||||
Read more about [configuring NFS mounts](../administration/nfs.md)
|
||||
|
||||
## Restore for Omnibus GitLab installations
|
||||
|
||||
This procedure assumes that:
|
||||
|
||||
- You have installed the **exact same version and type (CE/EE)** of GitLab
|
||||
Omnibus with which the backup was created.
|
||||
- You have run `sudo gitlab-ctl reconfigure` at least once.
|
||||
- GitLab is running. If not, start it using `sudo gitlab-ctl start`.
|
||||
|
||||
First ensure your backup tar file is in the backup directory described in the
|
||||
`gitlab.rb` configuration `gitlab_rails['backup_path']`. The default is
|
||||
`/var/opt/gitlab/backups`. The backup file needs to be owned by the `git` user.
|
||||
|
||||
```shell
|
||||
sudo cp 11493107454_2018_04_25_10.6.4-ce_gitlab_backup.tar /var/opt/gitlab/backups/
|
||||
sudo chown git:git /var/opt/gitlab/backups/11493107454_2018_04_25_10.6.4-ce_gitlab_backup.tar
|
||||
```
|
||||
|
||||
Stop the processes that are connected to the database. Leave the rest of GitLab
|
||||
running:
|
||||
|
||||
```shell
|
||||
sudo gitlab-ctl stop puma
|
||||
sudo gitlab-ctl stop sidekiq
|
||||
# Verify
|
||||
sudo gitlab-ctl status
|
||||
```
|
||||
|
||||
Next, restore the backup, specifying the timestamp of the backup you wish to
|
||||
restore:
|
||||
|
||||
```shell
|
||||
# This command will overwrite the contents of your GitLab database!
|
||||
sudo gitlab-backup restore BACKUP=11493107454_2018_04_25_10.6.4-ce
|
||||
```
|
||||
|
||||
Users of GitLab 12.1 and earlier should use the command `gitlab-rake gitlab:backup:restore` instead.
|
||||
Some [known non-blocking error messages may appear](backup_restore.md#restoring-database-backup-using-omnibus-packages-outputs-warnings).
|
||||
|
||||
WARNING:
|
||||
`gitlab-rake gitlab:backup:restore` doesn't set the correct file system
|
||||
permissions on your Registry directory. This is a [known issue](https://gitlab.com/gitlab-org/gitlab-foss/-/issues/62759).
|
||||
In GitLab 12.2 or later, you can use `gitlab-backup restore` to avoid this
|
||||
issue.
|
||||
|
||||
If there's a GitLab version mismatch between your backup tar file and the
|
||||
installed version of GitLab, the restore command aborts with an error
|
||||
message. Install the [correct GitLab version](https://packages.gitlab.com/gitlab/),
|
||||
and then try again.
|
||||
|
||||
WARNING:
|
||||
The restore command requires [additional parameters](backup_restore.md#back-up-and-restore-for-installations-using-pgbouncer) when
|
||||
your installation is using PgBouncer, for either performance reasons or when using it with a Patroni cluster.
|
||||
|
||||
Next, restore `/etc/gitlab/gitlab-secrets.json` if necessary,
|
||||
[as previously mentioned](#restore-prerequisites).
|
||||
|
||||
Reconfigure, restart and [check](../administration/raketasks/maintenance.md#check-gitlab-configuration) GitLab:
|
||||
|
||||
```shell
|
||||
sudo gitlab-ctl reconfigure
|
||||
sudo gitlab-ctl restart
|
||||
sudo gitlab-rake gitlab:check SANITIZE=true
|
||||
```
|
||||
|
||||
In GitLab 13.1 and later, check [database values can be decrypted](../administration/raketasks/check.md#verify-database-values-can-be-decrypted-using-the-current-secrets)
|
||||
especially if `/etc/gitlab/gitlab-secrets.json` was restored, or if a different server is
|
||||
the target for the restore.
|
||||
|
||||
```shell
|
||||
sudo gitlab-rake gitlab:doctor:secrets
|
||||
```
|
||||
|
||||
For added assurance, you can perform [an integrity check on the uploaded files](../administration/raketasks/check.md#uploaded-files-integrity):
|
||||
|
||||
```shell
|
||||
sudo gitlab-rake gitlab:artifacts:check
|
||||
sudo gitlab-rake gitlab:lfs:check
|
||||
sudo gitlab-rake gitlab:uploads:check
|
||||
```
|
||||
|
||||
## Restore for Docker image and GitLab Helm chart installations
|
||||
|
||||
For GitLab installations using the Docker image or the GitLab Helm chart on a
|
||||
Kubernetes cluster, the restore task expects the restore directories to be
|
||||
empty. However, with Docker and Kubernetes volume mounts, some system level
|
||||
directories may be created at the volume roots, such as the `lost+found`
|
||||
directory found in Linux operating systems. These directories are usually owned
|
||||
by `root`, which can cause access permission errors since the restore Rake task
|
||||
runs as the `git` user. To restore a GitLab installation, users have to confirm
|
||||
the restore target directories are empty.
|
||||
|
||||
For both these installation types, the backup tarball has to be available in
|
||||
the backup location (default location is `/var/opt/gitlab/backups`).
|
||||
|
||||
For Docker installations, the restore task can be run from host:
|
||||
|
||||
```shell
|
||||
# Stop the processes that are connected to the database
|
||||
docker exec -it <name of container> gitlab-ctl stop puma
|
||||
docker exec -it <name of container> gitlab-ctl stop sidekiq
|
||||
|
||||
# Verify that the processes are all down before continuing
|
||||
docker exec -it <name of container> gitlab-ctl status
|
||||
|
||||
# Run the restore. NOTE: "_gitlab_backup.tar" is omitted from the name
|
||||
docker exec -it <name of container> gitlab-backup restore BACKUP=11493107454_2018_04_25_10.6.4-ce
|
||||
|
||||
# Restart the GitLab container
|
||||
docker restart <name of container>
|
||||
|
||||
# Check GitLab
|
||||
docker exec -it <name of container> gitlab-rake gitlab:check SANITIZE=true
|
||||
```
|
||||
|
||||
Users of GitLab 12.1 and earlier should use the command `gitlab-rake gitlab:backup:create` instead.
|
||||
|
||||
WARNING:
|
||||
`gitlab-rake gitlab:backup:restore` doesn't set the correct file system
|
||||
permissions on your Registry directory. This is a [known issue](https://gitlab.com/gitlab-org/gitlab-foss/-/issues/62759).
|
||||
In GitLab 12.2 or later, you can use `gitlab-backup restore` to avoid this
|
||||
issue.
|
||||
|
||||
The GitLab Helm chart uses a different process, documented in
|
||||
[restoring a GitLab Helm chart installation](https://gitlab.com/gitlab-org/charts/gitlab/blob/master/doc/backup-restore/restore.md).
|
||||
|
||||
## Restore for installation from source
|
||||
|
||||
First, ensure your backup tar file is in the backup directory described in the
|
||||
`gitlab.yml` configuration:
|
||||
|
||||
```yaml
|
||||
## Backup settings
|
||||
backup:
|
||||
path: "tmp/backups" # Relative paths are relative to Rails.root (default: tmp/backups/)
|
||||
```
|
||||
|
||||
The default is `/home/git/gitlab/tmp/backups`, and it needs to be owned by the `git` user. Now, you can begin the backup procedure:
|
||||
|
||||
```shell
|
||||
# Stop processes that are connected to the database
|
||||
sudo service gitlab stop
|
||||
|
||||
sudo -u git -H bundle exec rake gitlab:backup:restore RAILS_ENV=production
|
||||
```
|
||||
|
||||
Example output:
|
||||
|
||||
```plaintext
|
||||
Unpacking backup... [DONE]
|
||||
Restoring database tables:
|
||||
-- create_table("events", {:force=>true})
|
||||
-> 0.2231s
|
||||
[...]
|
||||
- Loading fixture events...[DONE]
|
||||
- Loading fixture issues...[DONE]
|
||||
- Loading fixture keys...[SKIPPING]
|
||||
- Loading fixture merge_requests...[DONE]
|
||||
- Loading fixture milestones...[DONE]
|
||||
- Loading fixture namespaces...[DONE]
|
||||
- Loading fixture notes...[DONE]
|
||||
- Loading fixture projects...[DONE]
|
||||
- Loading fixture protected_branches...[SKIPPING]
|
||||
- Loading fixture schema_migrations...[DONE]
|
||||
- Loading fixture services...[SKIPPING]
|
||||
- Loading fixture snippets...[SKIPPING]
|
||||
- Loading fixture taggings...[SKIPPING]
|
||||
- Loading fixture tags...[SKIPPING]
|
||||
- Loading fixture users...[DONE]
|
||||
- Loading fixture users_projects...[DONE]
|
||||
- Loading fixture web_hooks...[SKIPPING]
|
||||
- Loading fixture wikis...[SKIPPING]
|
||||
Restoring repositories:
|
||||
- Restoring repository abcd... [DONE]
|
||||
- Object pool 1 ...
|
||||
Deleting tmp directories...[DONE]
|
||||
```
|
||||
|
||||
Next, restore `/home/git/gitlab/.secret` if necessary, [as previously mentioned](#restore-prerequisites).
|
||||
|
||||
Restart GitLab:
|
||||
|
||||
```shell
|
||||
sudo service gitlab restart
|
||||
```
|
||||
|
||||
## Restoring only one or a few projects or groups from a backup
|
||||
|
||||
Although the Rake task used to restore a GitLab instance doesn't support
|
||||
restoring a single project or group, you can use a workaround by restoring
|
||||
your backup to a separate, temporary GitLab instance, and then export your
|
||||
project or group from there:
|
||||
|
||||
1. [Install a new GitLab](../install/index.md) instance at the same version as
|
||||
the backed-up instance from which you want to restore.
|
||||
1. [Restore the backup](#restore-gitlab) into this new instance, then
|
||||
export your [project](../user/project/settings/import_export.md)
|
||||
or [group](../user/group/settings/import_export.md). Be sure to read the
|
||||
**Important Notes** on either export feature's documentation to understand
|
||||
what is and isn't exported.
|
||||
1. After the export is complete, go to the old instance and then import it.
|
||||
1. After importing the projects or groups that you wanted is complete, you may
|
||||
delete the new, temporary GitLab instance.
|
||||
|
||||
A feature request to provide direct restore of individual projects or groups
|
||||
is being discussed in [issue #17517](https://gitlab.com/gitlab-org/gitlab/-/issues/17517).
|
||||
|
||||
## Restore options
|
||||
|
||||
The command line tool GitLab provides to restore from backup can accept more
|
||||
options.
|
||||
|
||||
### Disabling prompts during restore
|
||||
|
||||
During a restore from backup, the restore script may ask for confirmation before
|
||||
proceeding. If you wish to disable these prompts, you can set the `GITLAB_ASSUME_YES`
|
||||
environment variable to `1`.
|
||||
|
||||
For Omnibus GitLab packages:
|
||||
|
||||
```shell
|
||||
sudo GITLAB_ASSUME_YES=1 gitlab-backup restore
|
||||
```
|
||||
|
||||
For installations from source:
|
||||
|
||||
```shell
|
||||
sudo -u git -H GITLAB_ASSUME_YES=1 bundle exec rake gitlab:backup:restore RAILS_ENV=production
|
||||
```
|
||||
|
||||
### Excluding tasks on restore
|
||||
|
||||
> [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/19347) in GitLab 14.10.
|
||||
|
||||
You can exclude specific tasks on restore by adding the environment variable `SKIP`, whose values are a comma-separated list of the following options:
|
||||
|
||||
- `db` (database)
|
||||
- `uploads` (attachments)
|
||||
- `builds` (CI job output logs)
|
||||
- `artifacts` (CI job artifacts)
|
||||
- `lfs` (LFS objects)
|
||||
- `terraform_state` (Terraform states)
|
||||
- `registry` (Container Registry images)
|
||||
- `pages` (Pages content)
|
||||
- `repositories` (Git repositories data)
|
||||
- `packages` (Packages)
|
||||
|
||||
For Omnibus GitLab packages:
|
||||
|
||||
```shell
|
||||
sudo gitlab-backup restore BACKUP=timestamp_of_backup SKIP=db,uploads
|
||||
```
|
||||
|
||||
For installations from source:
|
||||
|
||||
```shell
|
||||
sudo -u git -H bundle exec rake gitlab:backup:restore BACKUP=timestamp_of_backup SKIP=db,uploads RAILS_ENV=production
|
||||
```
|
||||
|
||||
### Restore specific repository storages
|
||||
|
||||
> [Introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/86896) in GitLab 15.0.
|
||||
|
||||
When using [multiple repository storages](../administration/repository_storage_paths.md),
|
||||
repositories from specific repository storages can be restored separately
|
||||
using the `REPOSITORIES_STORAGES` option. The option accepts a comma-separated list of
|
||||
storage names.
|
||||
|
||||
For example, for Omnibus GitLab installations:
|
||||
|
||||
```shell
|
||||
sudo gitlab-backup restore BACKUP=timestamp_of_backup REPOSITORIES_STORAGES=storage1,storage2
|
||||
```
|
||||
|
||||
For example, for installations from source:
|
||||
|
||||
```shell
|
||||
sudo -u git -H bundle exec rake gitlab:backup:restore BACKUP=timestamp_of_backup REPOSITORIES_STORAGES=storage1,storage2
|
||||
```
|
||||
|
||||
### Restore specific repositories
|
||||
|
||||
> [Introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/88094) in GitLab 15.1.
|
||||
|
||||
You can restore specific repositories using the `REPOSITORIES_PATHS` option.
|
||||
The option accepts a comma-separated list of project and group paths. If you
|
||||
specify a group path, all repositories in all projects in the group and
|
||||
descendent groups are included. The project and group repositories must exist
|
||||
within the specified backup.
|
||||
|
||||
For example, to restore all repositories for all projects in **Group A** (`group-a`), and the repository for **Project C** in **Group B** (`group-b/project-c`):
|
||||
|
||||
- Omnibus GitLab installations:
|
||||
|
||||
```shell
|
||||
sudo gitlab-backup restore BACKUP=timestamp_of_backup REPOSITORIES_PATHS=group-a,group-b/project-c
|
||||
```
|
||||
|
||||
- Installations from source:
|
||||
|
||||
```shell
|
||||
sudo -u git -H bundle exec rake gitlab:backup:restore BACKUP=timestamp_of_backup REPOSITORIES_PATHS=group-a,group-b/project-c
|
||||
```
|
|
@ -79,5 +79,5 @@ Steps:
|
|||
sudo gitlab-ctl reconfigure
|
||||
```
|
||||
|
||||
1. [Restore GitLab](../../raketasks/backup_restore.md#restore-for-omnibus-gitlab-installations)
|
||||
1. [Restore GitLab](../../raketasks/restore_gitlab.md#restore-for-omnibus-gitlab-installations)
|
||||
to complete the downgrade.
|
||||
|
|
|
@ -87,7 +87,7 @@ to roll back GitLab to a working state if there's a problem with the upgrade:
|
|||
|
||||
- Create a [GitLab backup](../raketasks/backup_restore.md).
|
||||
Make sure to follow the instructions based on your installation method.
|
||||
Don't forget to back up the [secrets and configuration files](../raketasks/backup_restore.md#storing-configuration-files).
|
||||
Don't forget to back up the [secrets and configuration files](../raketasks/backup_gitlab.md#storing-configuration-files).
|
||||
- Alternatively, create a snapshot of your instance. If this is a multi-node
|
||||
installation, you must snapshot every node.
|
||||
**This process is out of scope for GitLab Support.**
|
||||
|
@ -103,7 +103,7 @@ To restore your GitLab backup:
|
|||
the versions of the backed up and the new GitLab instance must be the same.
|
||||
- [Restore GitLab](../raketasks/backup_restore.md#restore-gitlab).
|
||||
Make sure to follow the instructions based on your installation method.
|
||||
Confirm that the [secrets and configuration files](../raketasks/backup_restore.md#storing-configuration-files) are also restored.
|
||||
Confirm that the [secrets and configuration files](../raketasks/backup_gitlab.md#storing-configuration-files) are also restored.
|
||||
- If restoring from a snapshot, know the steps to do this.
|
||||
**This process is out of scope for GitLab Support.**
|
||||
|
||||
|
|
|
@ -12,9 +12,9 @@ info: To determine the technical writer assigned to the Stage/Group associated w
|
|||
You can limit the number of inbound alerts for [incidents](../../../operations/incident_management/incidents.md)
|
||||
that can be created in a period of time. The inbound [incident management](../../../operations/incident_management/index.md)
|
||||
alert limit can help prevent overloading your incident responders by reducing the
|
||||
number of alerts or duplicate issues.
|
||||
number of alerts or duplicate issues.
|
||||
|
||||
As an example, if you set a limit of `10` requests every `60` seconds,
|
||||
As an example, if you set a limit of `10` requests every `60` seconds,
|
||||
and `11` requests are sent to an [alert integration endpoint](../../../operations/incident_management/integrations.md) within one minute,
|
||||
the eleventh request is blocked. Access to the endpoint is allowed again after one minute.
|
||||
|
||||
|
|
|
@ -76,6 +76,8 @@ Deployment frequency displays in several charts:
|
|||
- [Project-level value stream analytics](value_stream_analytics.md)
|
||||
- [CI/CD analytics](ci_cd_analytics.md)
|
||||
|
||||
To retrieve metrics for deployment frequency, use the [GraphQL](../../api/graphql/reference/index.md) or the [REST](../../api/dora/metrics.md) APIs.
|
||||
|
||||
### Lead time for changes
|
||||
|
||||
Lead time for changes measures the time to deliver a feature once it has been developed,
|
||||
|
@ -87,6 +89,8 @@ Lead time for changes displays in several charts:
|
|||
- [Project-level value stream analytics](value_stream_analytics.md)
|
||||
- [CI/CD analytics](ci_cd_analytics.md)
|
||||
|
||||
To retrieve metrics for lead time for changes, use the [GraphQL](../../api/graphql/reference/index.md) or the [REST](../../api/dora/metrics.md) APIs.
|
||||
|
||||
### Time to restore service
|
||||
|
||||
Time to restore service measures how long it takes an organization to recover from a failure in production.
|
||||
|
@ -126,7 +130,7 @@ To retrieve metrics for change failure rate, use the [GraphQL](../../api/graphql
|
|||
| `deployment_frequency` | Group | [GitLab 13.10 and later](../../api/dora/metrics.md) | GitLab 13.12 and later | |
|
||||
| `lead_time_for_changes` | Project | [GitLab 13.10 and later](../../api/dora/metrics.md) | GitLab 13.11 and later | Unit in seconds. Aggregation method is median. |
|
||||
| `lead_time_for_changes` | Group | [GitLab 13.10 and later](../../api/dora/metrics.md) | GitLab 14.0 and later | Unit in seconds. Aggregation method is median. |
|
||||
| `time_to_restore_service` | Project and group | [GitLab 14.9 and later](../../api/dora/metrics.md) | Not supported | |
|
||||
| `time_to_restore_service` | Project and group | [GitLab 14.9 and later](../../api/dora/metrics.md) | GitLab 15.1 and later | Unit in days. Aggregation method is median. |
|
||||
| `change_failure_rate` | Project and group | [GitLab 14.10 and later](../../api/dora/metrics.md) | Not supported | |
|
||||
|
||||
## Definitions
|
||||
|
|
|
@ -421,7 +421,7 @@ You can always find supported and deprecated schema versions in the [source code
|
|||
|
||||
This feature was [deprecated](https://gitlab.com/gitlab-org/gitlab/-/issues/354928) in GitLab 14.9
|
||||
and [removed](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/85400) in GitLab 15.0.
|
||||
|
||||
|
||||
<!--- end_remove -->
|
||||
|
||||
## Interact with findings and vulnerabilities
|
||||
|
|
|
@ -66,7 +66,7 @@ The table shows a list of related workflow items for the selected stage. Based o
|
|||
> - [Feature flag removed](https://gitlab.com/gitlab-org/gitlab/-/issues/323982) in GitLab 13.12.
|
||||
|
||||
The **Overview** dashboard in value stream analytics shows key metrics and DORA metrics of group performance. Based on the filter you select,
|
||||
the dashboard automatically aggregates DORA metrics and displays the current status of the value stream.
|
||||
the dashboard automatically aggregates DORA metrics and displays the current status of the value stream. Select a DORA metric to view its chart.
|
||||
|
||||
To view deployment metrics, you must have a
|
||||
[production environment configured](../../../ci/environments/index.md#deployment-tier-of-environments).
|
||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 12 KiB |
Binary file not shown.
Before Width: | Height: | Size: 20 KiB |
|
@ -251,53 +251,6 @@ This feature works only when a merge request is merged. Selecting **Remove sourc
|
|||
after merging does not retarget open merge requests. This improvement is
|
||||
[proposed as a follow-up](https://gitlab.com/gitlab-org/gitlab/-/issues/321559).
|
||||
|
||||
## Request attention to a merge request
|
||||
|
||||
> [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/343528) in GitLab 14.10 [with a flag](../../../administration/feature_flags.md) named `mr_attention_requests`. Disabled by default.
|
||||
|
||||
FLAG:
|
||||
On self-managed GitLab, by default this feature is not available. To make it available, ask an administrator to [enable the feature flag](../../../administration/feature_flags.md) named `mr_attention_requests`.
|
||||
On GitLab.com, this feature is dependent on the enablement status of the feature flag. Refer to the [enablement issue](https://gitlab.com/gitlab-org/gitlab/-/issues/343528) for details.
|
||||
|
||||
To tell a merge request's assignee or reviewer that their attention is
|
||||
needed on a merge request, you can request their attention. If an assignee or a
|
||||
reviewer has their attention requested on a merge request, the **Attention request**
|
||||
icon (**{attention}**) is displayed as a solid icon (**{attention-solid}**) on
|
||||
the merge request list page:
|
||||
|
||||
![Attention request icon](img/attention_request_list_v14_10.png)
|
||||
|
||||
To view a list of merge requests that need your attention:
|
||||
|
||||
1. On the top bar, select **Merge requests** (**{merge-request}**).
|
||||
1. Select **Attention requests**.
|
||||
|
||||
To request attention from another user, use the `/attention @user`
|
||||
[quick action](../quick_actions.md) or:
|
||||
|
||||
1. Go to the merge request.
|
||||
1. On the right sidebar, identify the user you want to request attention from.
|
||||
1. Next to the user's name, select **Request attention** (**{attention}**), and the appearance
|
||||
of the icon changes:
|
||||
|
||||
![Attention request toggle](img/attention_request_sidebar_v14_10.png)
|
||||
|
||||
### Remove an attention request
|
||||
|
||||
If your attention was requested as an assignee or reviewer, it's removed when you:
|
||||
|
||||
- Manually remove the attention request by selecting **Remove attention request** (**{attention-solid}**).
|
||||
- Approve the merge request.
|
||||
- Add a new user as an assignee or reviewer.
|
||||
- Request the attention of a different assignee or reviewer.
|
||||
- Remove yourself (or are removed by someone else) as an assignee or reviewer.
|
||||
- Merge or close the merge request.
|
||||
|
||||
If you are both the assignee and a reviewer on a merge request, you receive
|
||||
only one attention request, which is synced across both duties. If the
|
||||
attention request is removed from you, either as an assignee or a reviewer,
|
||||
it is removed from both your duties.
|
||||
|
||||
## Merge request workflows
|
||||
|
||||
For a software developer working in a team:
|
||||
|
|
|
@ -113,12 +113,6 @@ This example shows reviewers and approval rules in a merge request sidebar:
|
|||
### Request a new review
|
||||
|
||||
> - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/293933) in GitLab 13.9.
|
||||
> - [Deprecated](https://gitlab.com/gitlab-org/gitlab/-/issues/357271) in GitLab 14.10.
|
||||
|
||||
WARNING:
|
||||
This feature is in its end-of-life process. It is [deprecated](https://gitlab.com/gitlab-org/gitlab/-/issues/357271)
|
||||
in GitLab 14.10, and is planned for [removal](https://gitlab.com/gitlab-org/gitlab/-/issues/357271) in GitLab 15.0.
|
||||
Use [attention requests](../index.md#request-attention-to-a-merge-request) instead.
|
||||
|
||||
After a reviewer completes their [merge request reviews](../../../discussions/index.md),
|
||||
the author of the merge request can request a new review from the reviewer:
|
||||
|
|
|
@ -55,7 +55,6 @@ threads. Some quick actions might not be available to all subscription tiers.
|
|||
| `/assign me` | **{check-circle}** Yes | **{check-circle}** Yes | **{dotted-circle}** No | Assign yourself. |
|
||||
| `/assign_reviewer @user1 @user2` or `/reviewer @user1 @user2` or `/request_review @user1 @user2` | **{dotted-circle}** No | **{check-circle}** Yes | **{dotted-circle}** No | Assign one or more users as reviewers. |
|
||||
| `/assign_reviewer me` or `/reviewer me` or `/request_review me` | **{dotted-circle}** No | **{check-circle}** Yes | **{dotted-circle}** No | Assign yourself as a reviewer. |
|
||||
| `/attention @user1` | **{dotted-circle}** No | **{check-circle}** Yes | **{dotted-circle}** No | [Request attention](merge_requests/index.md#request-attention-to-a-merge-request) to a merge request from a user. |
|
||||
| `/award :emoji:` | **{check-circle}** Yes | **{check-circle}** Yes | **{check-circle}** Yes | Toggle emoji award. |
|
||||
| `/child_epic <epic>` | **{dotted-circle}** No | **{dotted-circle}** No | **{check-circle}** Yes | Add child epic to `<epic>`. The `<epic>` value should be in the format of `&epic`, `group&epic`, or a URL to an epic ([introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/7330) in GitLab 12.0). |
|
||||
| `/clear_health_status` | **{check-circle}** Yes | **{dotted-circle}** No | **{dotted-circle}** No | Clear [health status](issues/managing_issues.md#health-status) ([introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/213814) in GitLab 14.7). |
|
||||
|
|
|
@ -59,6 +59,11 @@ pre-push:
|
|||
files: git diff --name-only --diff-filter=d $(git merge-base origin/master HEAD)..HEAD
|
||||
glob: 'doc/*.md'
|
||||
run: scripts/lint-docs-metadata.sh {files}
|
||||
docs-trailing_spaces: # Not enforced in CI/CD pipelines, but reduces the amount of required cleanup: https://gitlab.com/gitlab-org/technical-writing/-/blob/main/.gitlab/issue_templates/tw-monthly-tasks.md#remote-tasks
|
||||
tags: documentation style
|
||||
files: git diff --name-only --diff-filter=d $(git merge-base origin/master HEAD)..HEAD
|
||||
glob: 'doc/*.md'
|
||||
run: yarn markdownlint:no-trailing-spaces {files}
|
||||
docs-deprecations:
|
||||
tags: documentation
|
||||
files: git diff --name-only --diff-filter=d $(git merge-base origin/master HEAD)..HEAD
|
||||
|
@ -67,5 +72,5 @@ pre-push:
|
|||
docs-removals:
|
||||
tags: documentation
|
||||
files: git diff --name-only --diff-filter=d $(git merge-base origin/master HEAD)..HEAD
|
||||
glob: 'data/removals/**/*.yml'
|
||||
glob: 'data/removals/*.yml'
|
||||
run: echo "Changes to removals files detected. Checking removals..\n"; bundle exec rake gitlab:docs:check_removals
|
||||
|
|
|
@ -139,7 +139,7 @@ module API
|
|||
|
||||
if find_user_from_warden
|
||||
Gitlab::UsageDataCounters::WebIdeCounter.increment_commits_count
|
||||
Gitlab::UsageDataCounters::EditorUniqueCounter.track_web_ide_edit_action(author: current_user)
|
||||
Gitlab::UsageDataCounters::EditorUniqueCounter.track_web_ide_edit_action(author: current_user, project: user_project)
|
||||
end
|
||||
|
||||
present commit_detail, with: Entities::CommitDetail, stats: params[:stats]
|
||||
|
|
|
@ -37,6 +37,7 @@ module Gitlab
|
|||
users_get_by_id: { threshold: -> { application_settings.users_get_by_id_limit }, interval: 10.minutes },
|
||||
username_exists: { threshold: 20, interval: 1.minute },
|
||||
user_sign_up: { threshold: 20, interval: 1.minute },
|
||||
user_sign_in: { threshold: 5, interval: 10.minutes },
|
||||
profile_resend_email_confirmation: { threshold: 5, interval: 1.minute },
|
||||
profile_update_username: { threshold: 10, interval: 1.minute },
|
||||
update_environment_canary_ingress: { threshold: 1, interval: 1.minute },
|
||||
|
@ -46,7 +47,9 @@ module Gitlab
|
|||
gitlab_shell_operation: { threshold: 600, interval: 1.minute },
|
||||
pipelines_create: { threshold: -> { application_settings.pipeline_limit_per_project_user_sha }, interval: 1.minute },
|
||||
temporary_email_failure: { threshold: 50, interval: 1.day },
|
||||
project_testing_integration: { threshold: 5, interval: 1.minute }
|
||||
project_testing_integration: { threshold: 5, interval: 1.minute },
|
||||
email_verification: { threshold: 10, interval: 10.minutes },
|
||||
email_verification_code_send: { threshold: 10, interval: 1.hour }
|
||||
}.freeze
|
||||
end
|
||||
|
||||
|
|
|
@ -16,6 +16,14 @@ module Gitlab
|
|||
end
|
||||
|
||||
def execute
|
||||
Gitlab::Ci::YamlProcessor::FeatureFlags.with_actor(project) do
|
||||
parse_config
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def parse_config
|
||||
if @config_content.blank?
|
||||
return Result.new(errors: ['Please provide content of .gitlab-ci.yml'])
|
||||
end
|
||||
|
@ -35,7 +43,9 @@ module Gitlab
|
|||
Result.new(ci_config: @ci_config, errors: [e.message], warnings: @ci_config&.warnings)
|
||||
end
|
||||
|
||||
private
|
||||
def project
|
||||
@opts[:project]
|
||||
end
|
||||
|
||||
def run_logical_validations!
|
||||
@stages = @ci_config.stages
|
||||
|
|
|
@ -0,0 +1,50 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
module Gitlab
|
||||
module Ci
|
||||
class YamlProcessor
|
||||
module FeatureFlags
|
||||
ACTOR_KEY = 'ci_yaml_processor_feature_flag_actor'
|
||||
NO_ACTOR_VALUE = :no_actor
|
||||
|
||||
NoActorError = Class.new(StandardError)
|
||||
NO_ACTOR_MESSAGE = "Actor not set. Ensure to call `enabled?` inside `with_actor` block"
|
||||
|
||||
class << self
|
||||
# Cache a feature flag actor as thread local variable so
|
||||
# we can have it available later with #enabled?
|
||||
def with_actor(actor)
|
||||
previous = Thread.current[ACTOR_KEY]
|
||||
|
||||
# When actor is `nil` the method `Thread.current[]=` does not
|
||||
# create the ACTOR_KEY. Instead, we want to still save an explicit
|
||||
# value to know that we are within the `with_actor` block.
|
||||
Thread.current[ACTOR_KEY] = actor || NO_ACTOR_VALUE
|
||||
|
||||
yield
|
||||
ensure
|
||||
Thread.current[ACTOR_KEY] = previous
|
||||
end
|
||||
|
||||
# Use this to check if a feature flag is enabled
|
||||
def enabled?(feature_flag)
|
||||
::Feature.enabled?(feature_flag, current_actor)
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def current_actor
|
||||
value = Thread.current[ACTOR_KEY] || (raise NoActorError, NO_ACTOR_MESSAGE)
|
||||
return if value == NO_ACTOR_VALUE
|
||||
|
||||
value
|
||||
rescue NoActorError => e
|
||||
Gitlab::ErrorTracking.track_and_raise_for_dev_exception(e)
|
||||
|
||||
nil
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
|
@ -10,24 +10,24 @@ module Gitlab
|
|||
EDIT_BY_LIVE_PREVIEW = 'g_edit_by_live_preview'
|
||||
|
||||
class << self
|
||||
def track_web_ide_edit_action(author:, time: Time.zone.now)
|
||||
track_unique_action(EDIT_BY_WEB_IDE, author, time)
|
||||
def track_web_ide_edit_action(author:, time: Time.zone.now, project:)
|
||||
track_unique_action(EDIT_BY_WEB_IDE, author, time, project)
|
||||
end
|
||||
|
||||
def count_web_ide_edit_actions(date_from:, date_to:)
|
||||
count_unique(EDIT_BY_WEB_IDE, date_from, date_to)
|
||||
end
|
||||
|
||||
def track_sfe_edit_action(author:, time: Time.zone.now)
|
||||
track_unique_action(EDIT_BY_SFE, author, time)
|
||||
def track_sfe_edit_action(author:, time: Time.zone.now, project:)
|
||||
track_unique_action(EDIT_BY_SFE, author, time, project)
|
||||
end
|
||||
|
||||
def count_sfe_edit_actions(date_from:, date_to:)
|
||||
count_unique(EDIT_BY_SFE, date_from, date_to)
|
||||
end
|
||||
|
||||
def track_snippet_editor_edit_action(author:, time: Time.zone.now)
|
||||
track_unique_action(EDIT_BY_SNIPPET_EDITOR, author, time)
|
||||
def track_snippet_editor_edit_action(author:, time: Time.zone.now, project:)
|
||||
track_unique_action(EDIT_BY_SNIPPET_EDITOR, author, time, project)
|
||||
end
|
||||
|
||||
def count_snippet_editor_edit_actions(date_from:, date_to:)
|
||||
|
@ -39,15 +39,25 @@ module Gitlab
|
|||
count_unique(events, date_from, date_to)
|
||||
end
|
||||
|
||||
def track_live_preview_edit_action(author:, time: Time.zone.now)
|
||||
track_unique_action(EDIT_BY_LIVE_PREVIEW, author, time)
|
||||
def track_live_preview_edit_action(author:, time: Time.zone.now, project:)
|
||||
track_unique_action(EDIT_BY_LIVE_PREVIEW, author, time, project)
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def track_unique_action(action, author, time)
|
||||
def track_unique_action(action, author, time, project = nil)
|
||||
return unless author
|
||||
|
||||
if Feature.enabled?(:route_hll_to_snowplow_phase2)
|
||||
Gitlab::Tracking.event(
|
||||
'ide_edit',
|
||||
action.to_s,
|
||||
project: project,
|
||||
namespace: project&.namespace,
|
||||
user: author
|
||||
)
|
||||
end
|
||||
|
||||
Gitlab::UsageDataCounters::HLLRedisCounter.track_event(action, values: author.id, time: time)
|
||||
end
|
||||
|
||||
|
|
|
@ -19347,15 +19347,66 @@ msgstr ""
|
|||
msgid "IdentityVerification|Before you create your group, we need you to verify your identity with a valid payment method. You will not be charged during this step. If we ever need to charge you, we will let you know."
|
||||
msgstr ""
|
||||
|
||||
msgid "IdentityVerification|Before you sign in, we need to verify your identity. Enter the following code on the sign-in page."
|
||||
msgstr ""
|
||||
|
||||
msgid "IdentityVerification|Create a project"
|
||||
msgstr ""
|
||||
|
||||
msgid "IdentityVerification|For added security, you'll need to verify your identity. We've sent a verification code to %{email}"
|
||||
msgstr ""
|
||||
|
||||
msgid "IdentityVerification|Help us protect your account"
|
||||
msgstr ""
|
||||
|
||||
msgid "IdentityVerification|If you have not recently tried to sign into GitLab, we recommend %{password_link_start}changing your password%{link_end} and %{two_fa_link_start}setting up Two-Factor Authentication%{link_end} to keep your account safe. Your verification code expires after %{expires_in_minutes} minutes."
|
||||
msgstr ""
|
||||
|
||||
msgid "IdentityVerification|If you have not recently tried to sign into GitLab, we recommend changing your password (%{password_link}) and setting up Two-Factor Authentication (%{two_fa_link}) to keep your account safe."
|
||||
msgstr ""
|
||||
|
||||
msgid "IdentityVerification|If you've lost access to the email associated to this account or having trouble with the code, %{link_start}here are some other steps you can take.%{link_end}"
|
||||
msgstr ""
|
||||
|
||||
msgid "IdentityVerification|Maximum login attempts exceeded. Wait %{interval} and try again."
|
||||
msgstr ""
|
||||
|
||||
msgid "IdentityVerification|Please enter a valid code"
|
||||
msgstr ""
|
||||
|
||||
msgid "IdentityVerification|Resend code"
|
||||
msgstr ""
|
||||
|
||||
msgid "IdentityVerification|The code has expired. Resend a new code and try again."
|
||||
msgstr ""
|
||||
|
||||
msgid "IdentityVerification|The code is incorrect. Enter it again, or resend a new code."
|
||||
msgstr ""
|
||||
|
||||
msgid "IdentityVerification|Verification code"
|
||||
msgstr ""
|
||||
|
||||
msgid "IdentityVerification|Verification successful"
|
||||
msgstr ""
|
||||
|
||||
msgid "IdentityVerification|Verify code"
|
||||
msgstr ""
|
||||
|
||||
msgid "IdentityVerification|Verify your identity"
|
||||
msgstr ""
|
||||
|
||||
msgid "IdentityVerification|You can always verify your account at a later time to create a group."
|
||||
msgstr ""
|
||||
|
||||
msgid "IdentityVerification|You've reached the maximum amount of tries. Wait %{interval} or resend a new code and try again."
|
||||
msgstr ""
|
||||
|
||||
msgid "IdentityVerification|Your account has been successfully verified. You'll be redirected to your account in just a moment or %{redirect_url_start}click here%{redirect_url_end} to refresh."
|
||||
msgstr ""
|
||||
|
||||
msgid "IdentityVerification|Your verification code expires after %{expires_in_minutes} minutes."
|
||||
msgstr ""
|
||||
|
||||
msgid "If any indexed field exceeds this limit, it is truncated to this number of characters. The rest of the content is neither indexed nor searchable. This does not apply to repository and wiki indexing. For unlimited characters, set this to 0."
|
||||
msgstr ""
|
||||
|
||||
|
@ -23448,9 +23499,6 @@ msgstr ""
|
|||
msgid "Logs"
|
||||
msgstr ""
|
||||
|
||||
msgid "Logs|To see the logs, deploy your code to an environment."
|
||||
msgstr ""
|
||||
|
||||
msgid "Looks like you've reached your %{free_limit} member limit for %{strong_start}%{namespace_name}%{strong_end}"
|
||||
msgstr ""
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
"file-coverage": "scripts/frontend/file_test_coverage.js",
|
||||
"lint-docs": "scripts/lint-doc.sh",
|
||||
"internal:eslint": "eslint --cache --max-warnings 0 --report-unused-disable-directives --ext .js,.vue,.graphql",
|
||||
"internal:stylelint": "stylelint -q '{ee/,}app/assets/stylesheets/**/*.{css,scss}'",
|
||||
"internal:stylelint": "stylelint -q --rd '{ee/,}app/assets/stylesheets/**/*.{css,scss}'",
|
||||
"prejest": "yarn check-dependencies",
|
||||
"jest": "jest --config jest.config.js",
|
||||
"jest-debug": "node --inspect-brk node_modules/.bin/jest --runInBand",
|
||||
|
@ -41,7 +41,6 @@
|
|||
"storybook:install": "yarn --cwd ./storybook install",
|
||||
"storybook:build": "yarn --cwd ./storybook build",
|
||||
"storybook:start": "./scripts/frontend/start_storybook.sh",
|
||||
"stylelint-create-utility-map": "node scripts/frontend/stylelint/stylelint_utility_map.js",
|
||||
"webpack": "NODE_OPTIONS=\"--max-old-space-size=3584\" webpack --config config/webpack.config.js",
|
||||
"webpack-vendor": "NODE_OPTIONS=\"--max-old-space-size=3584\" webpack --config config/webpack.vendor.config.js",
|
||||
"webpack-prod": "NODE_OPTIONS=\"--max-old-space-size=3584\" NODE_ENV=production webpack --config config/webpack.config.js"
|
||||
|
|
|
@ -12,7 +12,7 @@ module QA
|
|||
view 'app/views/projects/mattermosts/new.html.haml'
|
||||
|
||||
def sign_in_using_oauth
|
||||
click_link class: 'btn btn-custom-login gitlab'
|
||||
click_link 'gitlab'
|
||||
|
||||
if page.has_content?('Authorize GitLab Mattermost to use your account?')
|
||||
click_button 'Authorize'
|
||||
|
|
|
@ -1,25 +0,0 @@
|
|||
const stylelint = require('stylelint');
|
||||
const utils = require('./stylelint_utils');
|
||||
|
||||
const ruleName = 'stylelint-gitlab/duplicate-selectors';
|
||||
|
||||
const messages = stylelint.utils.ruleMessages(ruleName, {
|
||||
expected: (selector1, selector2) => {
|
||||
return `"${selector1}" and "${selector2}" have the same properties.`;
|
||||
},
|
||||
});
|
||||
|
||||
module.exports = stylelint.createPlugin(ruleName, (enabled) => {
|
||||
if (!enabled) {
|
||||
return;
|
||||
}
|
||||
|
||||
// eslint-disable-next-line consistent-return
|
||||
return (root, result) => {
|
||||
const selectorGroups = {};
|
||||
utils.createPropertiesHashmap(root, result, ruleName, messages, selectorGroups, true);
|
||||
};
|
||||
});
|
||||
|
||||
module.exports.ruleName = ruleName;
|
||||
module.exports.messages = messages;
|
|
@ -1,25 +0,0 @@
|
|||
const stylelint = require('stylelint');
|
||||
const utils = require('./stylelint_utils');
|
||||
const utilityClasses = require('./utility_classes_map');
|
||||
|
||||
const ruleName = 'stylelint-gitlab/utility-classes';
|
||||
|
||||
const messages = stylelint.utils.ruleMessages(ruleName, {
|
||||
expected: (selector1, selector2) => {
|
||||
return `"${selector1}" has the same properties as our BS4 utility class "${selector2}" so please use that instead.`;
|
||||
},
|
||||
});
|
||||
|
||||
module.exports = stylelint.createPlugin(ruleName, (enabled) => {
|
||||
if (!enabled) {
|
||||
return;
|
||||
}
|
||||
|
||||
// eslint-disable-next-line consistent-return
|
||||
return (root, result) => {
|
||||
utils.createPropertiesHashmap(root, result, ruleName, messages, utilityClasses, false);
|
||||
};
|
||||
});
|
||||
|
||||
module.exports.ruleName = ruleName;
|
||||
module.exports.messages = messages;
|
|
@ -1,64 +0,0 @@
|
|||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
const postcss = require('postcss');
|
||||
const prettier = require('prettier');
|
||||
const sass = require('sass');
|
||||
|
||||
const utils = require('./stylelint_utils');
|
||||
|
||||
const ROOT_PATH = path.resolve(__dirname, '../../..');
|
||||
const hashMapPath = path.resolve(__dirname, './utility_classes_map.js');
|
||||
|
||||
//
|
||||
// This creates a JS based hash map (saved in utility_classes_map.js) of the different values in the utility classes
|
||||
//
|
||||
sass.render(
|
||||
{
|
||||
data: `
|
||||
@import './functions';
|
||||
@import './variables';
|
||||
@import './mixins';
|
||||
@import './utilities';
|
||||
`,
|
||||
includePaths: [path.resolve(ROOT_PATH, 'node_modules/bootstrap/scss')],
|
||||
},
|
||||
(err, result) => {
|
||||
if (err) {
|
||||
return console.error('Error ', err);
|
||||
}
|
||||
|
||||
const cssResult = result.css.toString();
|
||||
|
||||
// We just use postcss to create a CSS tree
|
||||
return postcss([])
|
||||
.process(cssResult, {
|
||||
// This suppresses a postcss warning
|
||||
from: undefined,
|
||||
})
|
||||
.then((processedResult) => {
|
||||
const selectorGroups = {};
|
||||
utils.createPropertiesHashmap(
|
||||
processedResult.root,
|
||||
processedResult,
|
||||
null,
|
||||
null,
|
||||
selectorGroups,
|
||||
true,
|
||||
);
|
||||
|
||||
const prettierOptions = prettier.resolveConfig.sync(hashMapPath);
|
||||
const prettyHashmap = prettier.format(
|
||||
`module.exports = ${JSON.stringify(selectorGroups)};`,
|
||||
prettierOptions,
|
||||
);
|
||||
|
||||
fs.writeFile(hashMapPath, prettyHashmap, (e) => {
|
||||
if (e) {
|
||||
return console.log(e);
|
||||
}
|
||||
|
||||
return console.log('The file was saved!');
|
||||
});
|
||||
});
|
||||
},
|
||||
);
|
|
@ -1,78 +0,0 @@
|
|||
const md5 = require('md5');
|
||||
const stylelint = require('stylelint');
|
||||
|
||||
module.exports.createPropertiesHashmap = (
|
||||
ruleRoot,
|
||||
result,
|
||||
ruleName,
|
||||
messages,
|
||||
selectorGroups,
|
||||
addSelectors,
|
||||
) => {
|
||||
ruleRoot.walkRules((rule) => {
|
||||
const selector = rule.selector.replace(/(?:\r\n|\r|\n)/g, ' ');
|
||||
|
||||
if (
|
||||
rule &&
|
||||
rule.parent &&
|
||||
rule.parent.type !== 'atrule' &&
|
||||
!(
|
||||
selector.includes('-webkit-') ||
|
||||
selector.includes('-moz-') ||
|
||||
selector.includes('-o-') ||
|
||||
selector.includes('-ms-') ||
|
||||
selector.includes(':')
|
||||
)
|
||||
) {
|
||||
let cssArray = [];
|
||||
rule.nodes.forEach((property) => {
|
||||
const { prop, value } = property;
|
||||
if (property && value) {
|
||||
const propval = `${prop}${value}${property.important ? '!important' : ''}`;
|
||||
cssArray.push(propval);
|
||||
}
|
||||
});
|
||||
|
||||
cssArray = cssArray.sort();
|
||||
const cssContent = cssArray.toString();
|
||||
|
||||
if (cssContent) {
|
||||
const hashValue = md5(cssContent);
|
||||
const selObj = selectorGroups[hashValue];
|
||||
|
||||
const selectorLine = `${selector} (${
|
||||
rule.source.input.file ? `${rule.source.input.file} -` : ''
|
||||
}${rule.source.start.line}:${rule.source.start.column})`;
|
||||
|
||||
if (selObj) {
|
||||
if (selectorGroups[hashValue].selectors.indexOf(selector) === -1) {
|
||||
let lastSelector =
|
||||
selectorGroups[hashValue].selectors[selectorGroups[hashValue].selectors.length - 1];
|
||||
|
||||
// So we have nicer formatting if it is the same file, we remove the filename
|
||||
lastSelector = lastSelector.replace(`${rule.source.input.file} - `, '');
|
||||
|
||||
if (messages) {
|
||||
stylelint.utils.report({
|
||||
result,
|
||||
ruleName,
|
||||
message: messages.expected(selector, lastSelector),
|
||||
node: rule,
|
||||
word: rule.node,
|
||||
});
|
||||
}
|
||||
|
||||
if (addSelectors) {
|
||||
selectorGroups[hashValue].selectors.push(selectorLine);
|
||||
}
|
||||
}
|
||||
} else if (addSelectors) {
|
||||
// eslint-disable-next-line no-param-reassign
|
||||
selectorGroups[hashValue] = {
|
||||
selectors: [selectorLine],
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
|
@ -1,259 +0,0 @@
|
|||
module.exports = {
|
||||
'99097f29a9473b56eacdb9ff0681c366': { selectors: ['.align-baseline (1:1)'] },
|
||||
d969b318bb994e104e8c965006d71cb7: { selectors: ['.align-top (5:1)'] },
|
||||
'8cd54ab97b9cc43cb9d13d2ea7c601c7': { selectors: ['.align-middle (9:1)'] },
|
||||
dd06eb6c49e979b7a9fdaa7119aa0a0b: { selectors: ['.align-bottom (13:1)'] },
|
||||
'0af1e90cbc468615e299ec9f49e97c4a': { selectors: ['.align-text-bottom (17:1)'] },
|
||||
'50af706df238cf59bdc634fc684ba0c9': { selectors: ['.align-text-top (21:1)'] },
|
||||
c968922e6e47445362129a684b5913c0: { selectors: ['.bg-primary (25:1)'] },
|
||||
'3c397f9786c24cff4779a11cf5b3d7e7': { selectors: ['.bg-secondary (35:1)'] },
|
||||
'659677469a4477267fabc1788f7cad4e': { selectors: ['.bg-success (45:1)'] },
|
||||
'56d246d5b6a708a4c6f78dbd2444106c': { selectors: ['.bg-info (55:1)'] },
|
||||
'6bec0a33df3a6380c30103db5c273455': { selectors: ['.bg-warning (65:1)'] },
|
||||
'0ce5d074c8667ce6c32360658f428d5d': { selectors: ['.bg-danger (75:1)'] },
|
||||
'0d0269c62a01e97caa9039d227a25d12': { selectors: ['.bg-light (85:1)'] },
|
||||
'3a56309ad8c5b46ebcc3b13fe1987ac1': { selectors: ['.bg-dark (95:1)'] },
|
||||
'0e252f8dd392a33343d3d5efc1e3194a': { selectors: ['.bg-white (105:1)'] },
|
||||
'3af6f52f0ed4f98e797d5f10a35ca6bc': { selectors: ['.bg-transparent (109:1)'] },
|
||||
'16da7fdce74577ceab356509db565612': { selectors: ['.border (113:1)'] },
|
||||
'929622517ca05efde3b51e5f1a57064e': { selectors: ['.border-top (117:1)'] },
|
||||
'7283090353df54f1d515a6ceddfb9693': { selectors: ['.border-right (121:1)'] },
|
||||
bd5670d71332c652b46db82949042e31: { selectors: ['.border-bottom (125:1)'] },
|
||||
fa71e003d04734a898a85cc5285e3cbb: { selectors: ['.border-left (129:1)'] },
|
||||
ed482cea071e316f29d78fd93c3f3644: { selectors: ['.border-0 (133:1)'] },
|
||||
'90cb661baf21e10be6e479cb0544b1a7': { selectors: ['.border-top-0 (137:1)'] },
|
||||
'8a32707eaa09fc998bf8cc915710b60c': { selectors: ['.border-right-0 (141:1)'] },
|
||||
a6f01957e142a000e7742b31ac6c2331: { selectors: ['.border-bottom-0 (145:1)'] },
|
||||
c740fe952cc1985ee14f7d1c7a359a29: { selectors: ['.border-left-0 (149:1)'] },
|
||||
af9dd93e9780306ffa4bb25a6384902f: { selectors: ['.border-primary (153:1)'] },
|
||||
afa290dfe58cca06be5924ceae1b019b: { selectors: ['.border-secondary (157:1)'] },
|
||||
'9b1ac460bdddf1e0164d7bf988cc2da8': { selectors: ['.border-success (161:1)'] },
|
||||
'091cbf41d6be12061382fa571ee1ce82': { selectors: ['.border-info (165:1)'] },
|
||||
'3ada321d4a387901dad6d80e1b6be3fd': { selectors: ['.border-warning (169:1)'] },
|
||||
'13b4713dd52c1e359d1b43dd658cb249': { selectors: ['.border-danger (173:1)'] },
|
||||
'0048e110875ea22b04104d55e764a367': { selectors: ['.border-light (177:1)'] },
|
||||
a900b6b567c9a911326cdd0e19f40f8e: { selectors: ['.border-dark (181:1)'] },
|
||||
'78bcd867ac9677c743c2bc33b872f27b': { selectors: ['.border-white (185:1)'] },
|
||||
'35ef133b860874a5879e9451c491bc1c': { selectors: ['.rounded-sm (189:1)'] },
|
||||
e0fc10c49c7b7f4d1924336d21a4f64e: { selectors: ['.rounded (193:1)'] },
|
||||
'1b74b9d0a7d6a59281b5b5cae43c859a': { selectors: ['.rounded-top (197:1)'] },
|
||||
'20b75f55f39e662e038d51a6442c03df': { selectors: ['.rounded-right (202:1)'] },
|
||||
'83ea6db794873239c21f44af25618677': { selectors: ['.rounded-bottom (207:1)'] },
|
||||
'8464e9e8001e65dfc06397436a5eebd7': { selectors: ['.rounded-left (212:1)'] },
|
||||
a1148f40e8c509b2bcc829e2181c7582: { selectors: ['.rounded-lg (217:1)'] },
|
||||
'59c2f788287fa43caf5891adfc5c796e': { selectors: ['.rounded-circle (221:1)'] },
|
||||
'7f35b0a4b74ee7174b13cb841df0bdb3': { selectors: ['.rounded-pill (225:1)'] },
|
||||
'31a632ba94f8c41558bd6044458f1459': { selectors: ['.rounded-0 (229:1)'] },
|
||||
'16aaf53ab29d6b248b0257f2fa413914': { selectors: ['.d-none (239:1)'] },
|
||||
'4f42736ac9217039ed791b4306e60aeb': { selectors: ['.d-inline (243:1)'] },
|
||||
'067efa04b76649e8afcdceb9f5f7e870': { selectors: ['.d-inline-block (247:1)'] },
|
||||
de54f49149fb9b512aa79ad9ada838f2: { selectors: ['.d-block (251:1)'] },
|
||||
'80fc32acbc0c28ee890a160c23529d26': { selectors: ['.d-table (255:1)'] },
|
||||
'6a87b1db48298ca94cbe5dee79a6eed1': { selectors: ['.d-table-row (259:1)'] },
|
||||
b9896f0d94760bf5920f47904e9f7512: { selectors: ['.d-table-cell (263:1)'] },
|
||||
d25c51f38c4d057209b96c664de68c44: { selectors: ['.d-flex (267:1)'] },
|
||||
e72d46b636d5b8e17e771daa95793f33: { selectors: ['.d-inline-flex (271:1)'] },
|
||||
'2c433b7c14a5ae32cfa8ec7867ee8526': { selectors: ['.embed-responsive (460:1)'] },
|
||||
'56b318b8d8eb845b769d60cefcd131bb': {
|
||||
selectors: [
|
||||
'.embed-responsive .embed-responsive-item, .embed-responsive iframe, .embed-responsive embed, .embed-responsive object, .embed-responsive video (471:1)',
|
||||
],
|
||||
},
|
||||
c5009af89633c4d2f71a0a9fa333630d: { selectors: ['.flex-row (501:1)'] },
|
||||
'7b06a3d956579cd64b6f5b1a57255369': { selectors: ['.flex-column (505:1)'] },
|
||||
'21744a8c4dc6ed1519903b4236b00af4': { selectors: ['.flex-row-reverse (509:1)'] },
|
||||
'18d903735f9c71070b6d8166aa1112f1': { selectors: ['.flex-column-reverse (513:1)'] },
|
||||
e2a57aa8196347d4da84f33a4f551325: { selectors: ['.flex-wrap (517:1)'] },
|
||||
b6b29f75b174b5609f9e7d5eef457b70: { selectors: ['.flex-nowrap (521:1)'] },
|
||||
'839230fc7c0abacb6418b49d8f10b27f': { selectors: ['.flex-wrap-reverse (525:1)'] },
|
||||
'924d9b261944a8e8ff684d5b519062bb': { selectors: ['.flex-fill (529:1)'] },
|
||||
'5ed396aeb08464b7df8fc37d29455319': { selectors: ['.flex-grow-0 (533:1)'] },
|
||||
'94251dc4d012339a3e37df6196fc79bb': { selectors: ['.flex-grow-1 (537:1)'] },
|
||||
'0eeed7dabca0452a46574776a4485e6e': { selectors: ['.flex-shrink-0 (541:1)'] },
|
||||
c69e60d5e51a1b74d22b172ab98ef9d5: { selectors: ['.flex-shrink-1 (545:1)'] },
|
||||
'03401c1a81eb6d4639f020f76dd60176': { selectors: ['.justify-content-start (549:1)'] },
|
||||
'39e3d2c344e78869c98ef099249e717d': { selectors: ['.justify-content-end (553:1)'] },
|
||||
'3b2d00c0bea857ab78a71b0872842980': { selectors: ['.justify-content-center (557:1)'] },
|
||||
b1c3c9edd20ed7c08b43863d38ebee40: { selectors: ['.justify-content-between (561:1)'] },
|
||||
a11b4b1d983c5fa75777f273e998f73e: { selectors: ['.justify-content-around (565:1)'] },
|
||||
'50e33f29f65bfffa6a3591fcb6045ca9': { selectors: ['.align-items-start (569:1)'] },
|
||||
e44b276e47415ec19b74cc16740ada1d: { selectors: ['.align-items-end (573:1)'] },
|
||||
'4a9d2716bca651758564059dceed1271': { selectors: ['.align-items-center (577:1)'] },
|
||||
fd970b017f7f558f30cb273bf71ede7d: { selectors: ['.align-items-baseline (581:1)'] },
|
||||
'7204b6b00b69f8af1e4a24c9b6e7f7f9': { selectors: ['.align-items-stretch (585:1)'] },
|
||||
'350fbb74eb70bd05f9438067c3990e9f': { selectors: ['.align-content-start (589:1)'] },
|
||||
'74d61397b4fcbf608f3dba39ab3b2a1b': { selectors: ['.align-content-end (593:1)'] },
|
||||
eed1ab4ee9e5b327a434512176741548: { selectors: ['.align-content-center (597:1)'] },
|
||||
'19878ab832978ef7e1746ac2fe4084b2': { selectors: ['.align-content-between (601:1)'] },
|
||||
dded333d0522692809517039f5a727c1: { selectors: ['.align-content-around (605:1)'] },
|
||||
'5cbb83ea2af7e9db8ef13f4c7d6db875': { selectors: ['.align-content-stretch (609:1)'] },
|
||||
dc3df46d3c023184d375a63a71916646: { selectors: ['.align-self-auto (613:1)'] },
|
||||
'0c6d2d8c9732c571f9cf61a4b1d2877f': { selectors: ['.align-self-start (617:1)'] },
|
||||
fe7c6071e3e17214df1bdd38850d9ff0: { selectors: ['.align-self-end (621:1)'] },
|
||||
'9611bbad74d72d50cf238088576a5089': { selectors: ['.align-self-center (625:1)'] },
|
||||
'4bc5edddf5981866946175bfedb7247f': { selectors: ['.align-self-baseline (629:1)'] },
|
||||
'4fffdd27ec60120ec9ed16fd7feef801': { selectors: ['.align-self-stretch (633:1)'] },
|
||||
'39e658501f5502b35919f02fa9591360': { selectors: ['.float-left (1185:1)'] },
|
||||
b51436c537ffc4269b1533e44d7c3467: { selectors: ['.float-right (1189:1)'] },
|
||||
c4597a87d2c793a6d696cfe06f6c95ce: { selectors: ['.float-none (1193:1)'] },
|
||||
'16b2e7e5b666b69b9581be6a44947d6f': { selectors: ['.user-select-all (1249:1)'] },
|
||||
f5c4d8f25b8338031e719edc77659558: { selectors: ['.user-select-auto (1253:1)'] },
|
||||
'71ba65d43dcc2b1c3f47ac2578983e83': { selectors: ['.user-select-none (1257:1)'] },
|
||||
'5902adc842d83ad70b89ece99b82a7a9': { selectors: ['.overflow-auto (1261:1)'] },
|
||||
bfb19f18b91fa46f0502e32153287cc4: { selectors: ['.overflow-hidden (1265:1)'] },
|
||||
aaf8dc6e0768e59f3098a98a5c144d66: { selectors: ['.position-static (1269:1)'] },
|
||||
'79592de2383045d15ab57d35aa1dab95': { selectors: ['.position-relative (1273:1)'] },
|
||||
a7c272f53d0368730bde4c2740ffb5c3: { selectors: ['.position-absolute (1277:1)'] },
|
||||
dad0bb92d53f17cf8affc10f77824b7f: { selectors: ['.position-fixed (1281:1)'] },
|
||||
'6da0f6a7354a75fe6c95b08a4cabc06f': { selectors: ['.position-sticky (1285:1)'] },
|
||||
'66602e21eea7b673883155c8f42b9590': { selectors: ['.fixed-top (1289:1)'] },
|
||||
'33ea70eb6db7f6ab3469680f182abb19': { selectors: ['.fixed-bottom (1297:1)'] },
|
||||
'947009e63b4547795ef7cc873f4e4ae9': { selectors: ['.sr-only (1313:1)'] },
|
||||
'9220ad156a70c2586b15fe2b9b6108b2': { selectors: ['.shadow-sm (1334:1)'] },
|
||||
b1b8c0ff70767ca2160811a026766982: { selectors: ['.shadow (1338:1)'] },
|
||||
da0792abe99964acb6692a03c61d6dd8: { selectors: ['.shadow-lg (1342:1)'] },
|
||||
bb2173057af1cf20e687469b2d9cbb3c: { selectors: ['.shadow-none (1346:1)'] },
|
||||
'6d8abb6519a186483b25429ab8b9765e': { selectors: ['.w-25 (1350:1)'] },
|
||||
a087c1ffdf8ead76cdd37445b414d63e: { selectors: ['.w-50 (1354:1)'] },
|
||||
'28180742013a90275be5633e6ec0dd51': { selectors: ['.w-75 (1358:1)'] },
|
||||
'195a03bc95a0af0ba6c8824db97a0b2f': { selectors: ['.w-100 (1362:1)'] },
|
||||
e67c74b650d6236b03be9dfc10c78e32: { selectors: ['.w-auto (1366:1)'] },
|
||||
c1b6262b3ee069addc1fbe46f64aac4e: { selectors: ['.h-25 (1370:1)'] },
|
||||
a520396ae349bef86145e0761aa0699e: { selectors: ['.h-50 (1374:1)'] },
|
||||
'7c53b57d54beb087fd7ab8b669c5fe60': { selectors: ['.h-75 (1378:1)'] },
|
||||
ad74f1972cb745b7a78b03e16a387f21: { selectors: ['.h-100 (1382:1)'] },
|
||||
'2cd49c3d63d260ba4f0b23c559ad05e0': { selectors: ['.h-auto (1386:1)'] },
|
||||
'0b43071a67efc45ee1735fdc2491313c': { selectors: ['.mw-100 (1390:1)'] },
|
||||
eac31a6f08e5c935e24b97df0fdad579: { selectors: ['.mh-100 (1394:1)'] },
|
||||
bd5f5d687d100d127abeb044fc78a3fd: { selectors: ['.min-vw-100 (1398:1)'] },
|
||||
'8dec7662784b943d3ca0615df59d7970': { selectors: ['.min-vh-100 (1402:1)'] },
|
||||
eacc17f16197f6c0291ced3e7cfc067e: { selectors: ['.vw-100 (1406:1)'] },
|
||||
'1a2ec1c9ad7db8d4156ca76a81416c49': { selectors: ['.vh-100 (1410:1)'] },
|
||||
cfdb4f497b16074959bfd3deb7ea9c42: { selectors: ['.m-0 (1414:1)'] },
|
||||
'4d666c270ba50524312d97c4b937d153': { selectors: ['.mt-0, .my-0 (1418:1)'] },
|
||||
eccf47ccd76ceffb4b139cb6c080b5ac: { selectors: ['.mr-0, .mx-0 (1423:1)'] },
|
||||
'9bc513e73c0bdc6efdf170cb31de16d1': { selectors: ['.mb-0, .my-0 (1428:1)'] },
|
||||
e99cfc55b03f0e67f11628b19889ad7b: { selectors: ['.ml-0, .mx-0 (1433:1)'] },
|
||||
e1c39484d90d2acaa00973531f47f738: { selectors: ['.m-1 (1438:1)'] },
|
||||
'63791bc02eccfdfa2c01621a801e565f': { selectors: ['.mt-1, .my-1 (1442:1)'] },
|
||||
bcb27ab9d7dcfdd0d7cacad02709966c: { selectors: ['.mr-1, .mx-1 (1447:1)'] },
|
||||
cb5d1c4328e25b5bc93be9a252973690: { selectors: ['.mb-1, .my-1 (1452:1)'] },
|
||||
b80b1010c7dcfbb30bed9015c4f2e969: { selectors: ['.ml-1, .mx-1 (1457:1)'] },
|
||||
ecab1c9cdf8a562e3c0f70307aeafa89: { selectors: ['.m-2 (1462:1)'] },
|
||||
'6505fe17fbbd88b1884113a754aa82ab': { selectors: ['.mt-2, .my-2 (1466:1)'] },
|
||||
'6f0c7d09d1e729f332c4671ccc2b48c0': { selectors: ['.mr-2, .mx-2 (1471:1)'] },
|
||||
'70ef7b668b382b3c747b2d73e08cdbed': { selectors: ['.mb-2, .my-2 (1476:1)'] },
|
||||
'2d7f277cc78ed324a8fc1f71ab281e1f': { selectors: ['.ml-2, .mx-2 (1481:1)'] },
|
||||
'8ebcfe52fd4024861082ffb1735747a7': { selectors: ['.m-3 (1486:1)'] },
|
||||
'9965fb516bdb72b87023a533123a8035': { selectors: ['.mt-3, .my-3 (1490:1)'] },
|
||||
b1fcbbb1dc6226f6da6000830088e051: { selectors: ['.mr-3, .mx-3 (1495:1)'] },
|
||||
'02204826cfbe3da98535c0d802870940': { selectors: ['.mb-3, .my-3 (1500:1)'] },
|
||||
'0259859060250ae6b730218733e7a437': { selectors: ['.ml-3, .mx-3 (1505:1)'] },
|
||||
'8cf300dab2a4994a105eeddda826f2e6': { selectors: ['.m-4 (1510:1)'] },
|
||||
'1ba62fdddd3349f52a452050688905c7': { selectors: ['.mt-4, .my-4 (1514:1)'] },
|
||||
'66a104129fa13db5a0829567fba6ee41': { selectors: ['.mr-4, .mx-4 (1519:1)'] },
|
||||
eefcc4c10b79e70e8e8a5a66fb2b7aa1: { selectors: ['.mb-4, .my-4 (1524:1)'] },
|
||||
eb1503656dc920d15a31116956fdffa4: { selectors: ['.ml-4, .mx-4 (1529:1)'] },
|
||||
'79cbb6e5c9b73fd0be29d4fc5733a099': { selectors: ['.m-5 (1534:1)'] },
|
||||
'67d8671699df706a428e7da42a7141cb': { selectors: ['.mt-5, .my-5 (1538:1)'] },
|
||||
e9cb4a0a8a60ff018c87a0b7efa9de29: { selectors: ['.mr-5, .mx-5 (1543:1)'] },
|
||||
'93f579214354dbd8cb60209c068f0086': { selectors: ['.mb-5, .my-5 (1548:1)'] },
|
||||
'2a789d4af97d2b87fd0bf2b4626120cd': { selectors: ['.ml-5, .mx-5 (1553:1)'] },
|
||||
'64a89d28e8287c1a0ac153001082644c': { selectors: ['.p-0 (1558:1)'] },
|
||||
b03aa6db5ddf110bbdbefbbec43fda30: { selectors: ['.pt-0, .py-0 (1562:1)'] },
|
||||
e38192ca32a98888d4c4876880f4fece: { selectors: ['.pr-0, .px-0 (1567:1)'] },
|
||||
'70fe8ef50e999ddd29506f672c107069': { selectors: ['.pb-0, .py-0 (1572:1)'] },
|
||||
'9355e8cd9109049726475ba356661bcf': { selectors: ['.pl-0, .px-0 (1577:1)'] },
|
||||
'0d4c53468c2658c5324b9ec7a8ca6de2': { selectors: ['.p-1 (1582:1)'] },
|
||||
d74e430b2a56b3a4e20065c972b7fa3f: { selectors: ['.pt-1, .py-1 (1586:1)'] },
|
||||
'21e4644967aedd19888b6f4a700b629b': { selectors: ['.pr-1, .px-1 (1591:1)'] },
|
||||
e315a7b9b7a1d0df3ea7d95af5203a0b: { selectors: ['.pb-1, .py-1 (1596:1)'] },
|
||||
'14630ca122e1d9830a9ef5591c4097d0': { selectors: ['.pl-1, .px-1 (1601:1)'] },
|
||||
'5b1c65e5139e86e5f4755824f8b77d13': { selectors: ['.p-2 (1606:1)'] },
|
||||
'244af70950a1e200d3849f75ce51d707': { selectors: ['.pt-2, .py-2 (1610:1)'] },
|
||||
b583832738cad724c7c23e5c14ac9bfb: { selectors: ['.pr-2, .px-2 (1615:1)'] },
|
||||
e1e633c4f1375e8276154192d8899e39: { selectors: ['.pb-2, .py-2 (1620:1)'] },
|
||||
'676b01e25f0dbb3f7d2f2529231cda08': { selectors: ['.pl-2, .px-2 (1625:1)'] },
|
||||
'9b5165e3333b22801f2287f7983d7516': { selectors: ['.p-3 (1630:1)'] },
|
||||
'5bcaa9df87a507f6cd14659ea176bdc5': { selectors: ['.pt-3, .py-3 (1634:1)'] },
|
||||
f706637180776c5589385599705a2409: { selectors: ['.pr-3, .px-3 (1639:1)'] },
|
||||
'41157cfbcf47990b383b5b0379386ab2': { selectors: ['.pb-3, .py-3 (1644:1)'] },
|
||||
cac1e7a204bb6a1f42707b684ad46238: { selectors: ['.pl-3, .px-3 (1649:1)'] },
|
||||
'43e0671cd41a4b7590284888b607a134': { selectors: ['.p-4 (1654:1)'] },
|
||||
'116b0f95ebde1ff8907e488413a88854': { selectors: ['.pt-4, .py-4 (1658:1)'] },
|
||||
ecb06765fe691d892df000eebbb23dcc: { selectors: ['.pr-4, .px-4 (1663:1)'] },
|
||||
'1331503a48d36025c861e660bc615048': { selectors: ['.pb-4, .py-4 (1668:1)'] },
|
||||
f8665f7e547e499abd7ac63813b274f5: { selectors: ['.pl-4, .px-4 (1673:1)'] },
|
||||
'4160a315459f1b5a98255863f42136fe': { selectors: ['.p-5 (1678:1)'] },
|
||||
f55a6b2de6a434ec7b4375f06f4fad75: { selectors: ['.pt-5, .py-5 (1682:1)'] },
|
||||
'19391dc45c8d7730a86d521c28f52c3f': { selectors: ['.pr-5, .px-5 (1687:1)'] },
|
||||
'15898bcb7ff74a60006f9931422b4ad3': { selectors: ['.pb-5, .py-5 (1692:1)'] },
|
||||
'6290bdc6355aed1e9b27379003aa4828': { selectors: ['.pl-5, .px-5 (1697:1)'] },
|
||||
'04a144abd49b1402e3588fb4ec237ec0': { selectors: ['.m-n1 (1702:1)'] },
|
||||
b81793fb475f7cc3a0698aa92ae41777: { selectors: ['.mt-n1, .my-n1 (1706:1)'] },
|
||||
'3c39187fca578a65e7aa2d704208cde8': { selectors: ['.mr-n1, .mx-n1 (1711:1)'] },
|
||||
c6c24440dd9edef71c7bc7da951dccd5: { selectors: ['.mb-n1, .my-n1 (1716:1)'] },
|
||||
'8b528f327ea3e562fc61d13c9f3901d8': { selectors: ['.ml-n1, .mx-n1 (1721:1)'] },
|
||||
'4a1926d211f81e5c96d4c9c4f2097774': { selectors: ['.m-n2 (1726:1)'] },
|
||||
f78f1986440a943aeb5553cb11b2f23c: { selectors: ['.mt-n2, .my-n2 (1730:1)'] },
|
||||
'941a9ea73cc97224a3f55ef65ab727c9': { selectors: ['.mr-n2, .mx-n2 (1735:1)'] },
|
||||
'074441007089a0c89cda9bfcb31c763a': { selectors: ['.mb-n2, .my-n2 (1740:1)'] },
|
||||
'7f9e45f6286b38eec32d471b7c1b28b6': { selectors: ['.ml-n2, .mx-n2 (1745:1)'] },
|
||||
c322ab87c4e181d835e6c17a1ca179ad: { selectors: ['.m-n3 (1750:1)'] },
|
||||
dee7caca54972db68f956a7cfd5d372b: { selectors: ['.mt-n3, .my-n3 (1754:1)'] },
|
||||
'60c8b6aa0702bbc3eed911f7483876ce': { selectors: ['.mr-n3, .mx-n3 (1759:1)'] },
|
||||
'595290cc6428614c03bac4631fe3fc12': { selectors: ['.mb-n3, .my-n3 (1764:1)'] },
|
||||
'7b968bc3150d9768117e099261cf23df': { selectors: ['.ml-n3, .mx-n3 (1769:1)'] },
|
||||
'90ca4942944fbc4dd543a821244daa31': { selectors: ['.m-n4 (1774:1)'] },
|
||||
'1716842c880f907fc62889f928273e0c': { selectors: ['.mt-n4, .my-n4 (1778:1)'] },
|
||||
'087ab1596162227935a974af5e856174': { selectors: ['.mr-n4, .mx-n4 (1783:1)'] },
|
||||
f53133714696eaf034f3efe057ac82fe: { selectors: ['.mb-n4, .my-n4 (1788:1)'] },
|
||||
ce56811b70ca493d65e3f63acfa2d9df: { selectors: ['.ml-n4, .mx-n4 (1793:1)'] },
|
||||
'7f52135983abe2eccfbb72e5d16a6a20': { selectors: ['.m-n5 (1798:1)'] },
|
||||
de8fc351c8c23bd867cf10a14642899a: { selectors: ['.mt-n5, .my-n5 (1802:1)'] },
|
||||
b134cecaa2883916d516ae6a2b1a3891: { selectors: ['.mr-n5, .mx-n5 (1807:1)'] },
|
||||
'124ccc6a210fadb889b2742eb0f9b540': { selectors: ['.mb-n5, .my-n5 (1812:1)'] },
|
||||
c3948b63b7b0c864f4f78faf640fd9a0: { selectors: ['.ml-n5, .mx-n5 (1817:1)'] },
|
||||
e57ec4fe9e8ed36e38f1c50041fc9f47: { selectors: ['.m-auto (1822:1)'] },
|
||||
f10380665932186d1effe0674a74ba12: { selectors: ['.mt-auto, .my-auto (1826:1)'] },
|
||||
'2ce71a27023eb50a47c24a99399faa28': { selectors: ['.mr-auto, .mx-auto (1831:1)'] },
|
||||
'196c77d357d314678cd3a99cfacbea96': { selectors: ['.mb-auto, .my-auto (1836:1)'] },
|
||||
ca007ce268b463a6bf42145cf5ce3685: { selectors: ['.ml-auto, .mx-auto (1841:1)'] },
|
||||
'695821b1faf108a559486730b246876a': { selectors: ['.text-monospace (3590:1)'] },
|
||||
a8fc5ca823f51d72673577064387a029: { selectors: ['.text-justify (3594:1)'] },
|
||||
'04e83ef005e9c653fb368008f8ae8a33': { selectors: ['.text-wrap (3598:1)'] },
|
||||
'0bb94dfab7ca2c9892ebbd993b2baf0f': { selectors: ['.text-nowrap (3602:1)'] },
|
||||
aea4958ce85ddc0cbffca1015c3a7eba: { selectors: ['.text-truncate (3606:1)'] },
|
||||
'52b9443947b6b94a5c7e1b837da115e2': { selectors: ['.text-left (3612:1)'] },
|
||||
baaf5136fc6e1c54ba29b6040f166d5f: { selectors: ['.text-right (3616:1)'] },
|
||||
'282aa4319bee75af06cc2632b7124e26': { selectors: ['.text-center (3620:1)'] },
|
||||
'1cb1c8ad9b560eca25ebcefe95c1b7fa': { selectors: ['.text-lowercase (3676:1)'] },
|
||||
'45234533eac658ba2857e9c4d3bc78a5': { selectors: ['.text-uppercase (3680:1)'] },
|
||||
f9e3f64237f2e81b6aed84223a0ceb1d: { selectors: ['.text-capitalize (3684:1)'] },
|
||||
'09caca3d36aa9f3ef815e0da7e1a16b4': { selectors: ['.font-weight-light (3688:1)'] },
|
||||
'23544682bb214a76e383e032d4056be4': { selectors: ['.font-weight-lighter (3692:1)'] },
|
||||
'25189f4fad18eaeef19e349c6680834c': { selectors: ['.font-weight-normal (3696:1)'] },
|
||||
b2a9507678ec557603eb8ec077f0eb1f: { selectors: ['.font-weight-bold (3700:1)'] },
|
||||
'9d05a94a577558235edce4c8fd9ab639': { selectors: ['.font-weight-bolder (3704:1)'] },
|
||||
'7d2da06b621a98a8599e5ec82e39eac8': { selectors: ['.font-italic (3708:1)'] },
|
||||
'0020d10e4fce033b418aace7c3143b82': { selectors: ['.text-white (3712:1)'] },
|
||||
'34ad81e372a038e6f78ae4f22bd4813d': { selectors: ['.text-primary (3716:1)'] },
|
||||
'9fde9a179d24755438ace2a874dda817': {
|
||||
selectors: ['.text-secondary (3724:1)', '.text-muted (3784:1)'],
|
||||
},
|
||||
'9ffcb1532b3fb397c0e818850683da29': { selectors: ['.text-success (3732:1)'] },
|
||||
f28fd089809bcd15d5684b158a0af98d: { selectors: ['.text-info (3740:1)'] },
|
||||
'6cac1cb5ee5149e91e45d15d0bdae310': { selectors: ['.text-warning (3748:1)'] },
|
||||
'2faab1e0abf22b20fdf05b9b01fff29b': { selectors: ['.text-danger (3756:1)'] },
|
||||
'46b52fea531aaaf29b63c40be2356849': { selectors: ['.text-light (3764:1)'] },
|
||||
'78f31d1ab6529decf28e0366a8ee81aa': { selectors: ['.text-dark (3772:1)'] },
|
||||
'45330b41b77e8880ad7680c51e0f61c4': { selectors: ['.text-body (3780:1)'] },
|
||||
'60d93588f62b5e85eb4f11dfd3461897': { selectors: ['.text-black-50 (3788:1)'] },
|
||||
'7dea35658553032ff7b7cc0287613b7c': { selectors: ['.text-white-50 (3792:1)'] },
|
||||
'61bf92980cac3d51d0cf1ba24c948fa1': { selectors: ['.text-hide (3796:1)'] },
|
||||
'187bfde85cb4d8bdaa41735f54f5c4f8': { selectors: ['.text-decoration-none (3804:1)'] },
|
||||
fd57878967b8dce947091cdc114efd83: { selectors: ['.text-break (3808:1)'] },
|
||||
'43b8d67240c3b09505d94522a62a977c': { selectors: ['.text-reset (3813:1)'] },
|
||||
'7dcad258820769677bc60871fafe9b93': { selectors: ['.visible (3817:1)'] },
|
||||
'0f8833af4e2f4a6fc785bd7edc1e75b3': { selectors: ['.invisible (3821:1)'] },
|
||||
};
|
|
@ -80,16 +80,24 @@ RSpec.describe Projects::ServicePingController do
|
|||
it_behaves_like 'counter is not increased'
|
||||
it_behaves_like 'counter is increased', 'WEB_IDE_PREVIEWS_SUCCESS_COUNT'
|
||||
|
||||
context 'when the user has access to the project' do
|
||||
context 'when the user has access to the project', :snowplow do
|
||||
let(:user) { project.owner }
|
||||
|
||||
it 'increases the live preview view counter' do
|
||||
expect(Gitlab::UsageDataCounters::EditorUniqueCounter).to receive(:track_live_preview_edit_action).with(author: user)
|
||||
expect(Gitlab::UsageDataCounters::EditorUniqueCounter).to receive(:track_live_preview_edit_action).with(author: user, project: project)
|
||||
|
||||
subject
|
||||
|
||||
expect(response).to have_gitlab_http_status(:ok)
|
||||
end
|
||||
|
||||
it_behaves_like 'Snowplow event tracking' do
|
||||
let(:project) { create(:project) }
|
||||
let(:category) { 'ide_edit' }
|
||||
let(:action) { 'g_edit_by_live_preview' }
|
||||
let(:namespace) { project.namespace }
|
||||
let(:feature_flag_name) { :route_hll_to_snowplow_phase2 }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -258,12 +258,13 @@ RSpec.describe SearchController do
|
|||
end
|
||||
|
||||
it_behaves_like 'Snowplow event tracking' do
|
||||
subject { get :show, params: { group_id: namespace.id, scope: 'blobs', search: 'term' } }
|
||||
|
||||
let(:project) { nil }
|
||||
let(:category) { described_class.to_s }
|
||||
let(:action) { 'i_search_total' }
|
||||
let(:namespace) { create(:group) }
|
||||
let(:feature_flag_name) { :route_hll_to_snowplow_phase2 }
|
||||
|
||||
subject { get :show, params: { group_id: namespace.id, scope: 'blobs', search: 'term' } }
|
||||
end
|
||||
|
||||
context 'on restricted projects' do
|
||||
|
|
|
@ -0,0 +1,357 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require 'spec_helper'
|
||||
|
||||
RSpec.describe 'Email Verification On Login', :clean_gitlab_redis_rate_limiting do
|
||||
include EmailHelpers
|
||||
|
||||
let_it_be(:user) { create(:user) }
|
||||
|
||||
let(:require_email_verification_enabled) { true }
|
||||
|
||||
before do
|
||||
stub_feature_flags(require_email_verification: require_email_verification_enabled)
|
||||
end
|
||||
|
||||
shared_examples 'email verification required' do
|
||||
before do
|
||||
allow(Gitlab::AppLogger).to receive(:info)
|
||||
end
|
||||
|
||||
it 'requires email verification before being able to access GitLab' do
|
||||
perform_enqueued_jobs do
|
||||
# When logging in
|
||||
gitlab_sign_in(user)
|
||||
expect_log_message(message: "Account Locked: username=#{user.username}")
|
||||
expect_log_message('Instructions Sent')
|
||||
|
||||
# Expect the user to be locked and the unlock_token to be set
|
||||
user.reload
|
||||
expect(user.locked_at).not_to be_nil
|
||||
expect(user.unlock_token).not_to be_nil
|
||||
|
||||
# Expect to see the verification form on the login page
|
||||
expect(page).to have_current_path(new_user_session_path)
|
||||
expect(page).to have_content('Help us protect your account')
|
||||
|
||||
# Expect an instructions email to be sent with a code
|
||||
code = expect_instructions_email_and_extract_code
|
||||
|
||||
# Signing in again prompts for the code and doesn't send a new one
|
||||
gitlab_sign_in(user)
|
||||
expect(page).to have_current_path(new_user_session_path)
|
||||
expect(page).to have_content('Help us protect your account')
|
||||
|
||||
# Verify the code
|
||||
verify_code(code)
|
||||
expect_log_message('Successful')
|
||||
expect_log_message(message: "Successful Login: username=#{user.username} "\
|
||||
"ip=127.0.0.1 method=standard admin=false")
|
||||
|
||||
# Expect the user to be unlocked
|
||||
expect_user_to_be_unlocked
|
||||
|
||||
# Expect a confirmation page with a meta refresh tag for 3 seconds to the root
|
||||
expect(page).to have_current_path(users_successful_verification_path)
|
||||
expect(page).to have_content('Verification successful')
|
||||
expect(page).to have_selector("meta[http-equiv='refresh'][content='3; url=#{root_path}']", visible: false)
|
||||
end
|
||||
end
|
||||
|
||||
describe 'resending a new code' do
|
||||
it 'resends a new code' do
|
||||
perform_enqueued_jobs do
|
||||
# When logging in
|
||||
gitlab_sign_in(user)
|
||||
|
||||
# Expect an instructions email to be sent with a code
|
||||
code = expect_instructions_email_and_extract_code
|
||||
|
||||
# Request a new code
|
||||
click_link 'Resend code'
|
||||
expect_log_message('Instructions Sent', 2)
|
||||
new_code = expect_instructions_email_and_extract_code
|
||||
|
||||
# Verify the old code is different from the new code
|
||||
expect(code).not_to eq(new_code)
|
||||
end
|
||||
end
|
||||
|
||||
it 'rate limits resends' do
|
||||
# When logging in
|
||||
gitlab_sign_in(user)
|
||||
|
||||
# It shows a resend button
|
||||
expect(page).to have_link 'Resend code'
|
||||
|
||||
# Resend more than the rate limited amount of times
|
||||
10.times do
|
||||
click_link 'Resend code'
|
||||
end
|
||||
|
||||
# Expect the link to be gone
|
||||
expect(page).not_to have_link 'Resend code'
|
||||
|
||||
# Wait for 1 hour
|
||||
travel 1.hour
|
||||
|
||||
# Now it's visible again
|
||||
gitlab_sign_in(user)
|
||||
expect(page).to have_link 'Resend code'
|
||||
end
|
||||
end
|
||||
|
||||
describe 'verification errors' do
|
||||
it 'rate limits verifications' do
|
||||
perform_enqueued_jobs do
|
||||
# When logging in
|
||||
gitlab_sign_in(user)
|
||||
|
||||
# Expect an instructions email to be sent with a code
|
||||
code = expect_instructions_email_and_extract_code
|
||||
|
||||
# Verify an invalid token more than the rate limited amount of times
|
||||
11.times do
|
||||
verify_code('123456')
|
||||
end
|
||||
|
||||
# Expect an error message
|
||||
expect_log_message('Failed Attempt', reason: 'rate_limited')
|
||||
expect(page).to have_content("You've reached the maximum amount of tries. "\
|
||||
'Wait 10 minutes or resend a new code and try again.')
|
||||
|
||||
# Wait for 10 minutes
|
||||
travel 10.minutes
|
||||
|
||||
# Now it works again
|
||||
verify_code(code)
|
||||
expect_log_message('Successful')
|
||||
end
|
||||
end
|
||||
|
||||
it 'verifies invalid codes' do
|
||||
# When logging in
|
||||
gitlab_sign_in(user)
|
||||
|
||||
# Verify an invalid code
|
||||
verify_code('123456')
|
||||
|
||||
# Expect an error message
|
||||
expect_log_message('Failed Attempt', reason: 'invalid')
|
||||
expect(page).to have_content('The code is incorrect. Enter it again, or resend a new code.')
|
||||
end
|
||||
|
||||
it 'verifies expired codes' do
|
||||
perform_enqueued_jobs do
|
||||
# When logging in
|
||||
gitlab_sign_in(user)
|
||||
|
||||
# Expect an instructions email to be sent with a code
|
||||
code = expect_instructions_email_and_extract_code
|
||||
|
||||
# Wait for the code to expire before verifying
|
||||
travel VerifiesWithEmail::TOKEN_VALID_FOR_MINUTES.minutes + 1.second
|
||||
verify_code(code)
|
||||
|
||||
# Expect an error message
|
||||
expect_log_message('Failed Attempt', reason: 'expired')
|
||||
expect(page).to have_content('The code has expired. Resend a new code and try again.')
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
shared_examples 'no email verification required' do |**login_args|
|
||||
it 'does not lock the user and redirects to the root page after logging in' do
|
||||
gitlab_sign_in(user, **login_args)
|
||||
|
||||
expect_user_to_be_unlocked
|
||||
|
||||
expect(page).to have_current_path(root_path)
|
||||
end
|
||||
end
|
||||
|
||||
shared_examples 'no email verification required when 2fa enabled or ff disabled' do
|
||||
context 'when 2FA is enabled' do
|
||||
let_it_be(:user) { create(:user, :two_factor) }
|
||||
|
||||
it_behaves_like 'no email verification required', two_factor_auth: true
|
||||
end
|
||||
|
||||
context 'when the feature flag is disabled' do
|
||||
let(:require_email_verification_enabled) { false }
|
||||
|
||||
it_behaves_like 'no email verification required'
|
||||
end
|
||||
end
|
||||
|
||||
describe 'when failing to login the maximum allowed number of times' do
|
||||
before do
|
||||
# See comment in RequireEmailVerification::MAXIMUM_ATTEMPTS on why this is divided by 2
|
||||
(RequireEmailVerification::MAXIMUM_ATTEMPTS / 2).times do
|
||||
gitlab_sign_in(user, password: 'wrong_password')
|
||||
end
|
||||
end
|
||||
|
||||
it 'locks the user, but does not set the unlock token', :aggregate_failures do
|
||||
user.reload
|
||||
expect(user.locked_at).not_to be_nil
|
||||
expect(user.unlock_token).to be_nil # The unlock token is only set after logging in with valid credentials
|
||||
expect(user.failed_attempts).to eq(RequireEmailVerification::MAXIMUM_ATTEMPTS)
|
||||
end
|
||||
|
||||
it_behaves_like 'email verification required'
|
||||
it_behaves_like 'no email verification required when 2fa enabled or ff disabled'
|
||||
|
||||
describe 'when waiting for the auto unlock time' do
|
||||
before do
|
||||
travel User::UNLOCK_IN + 1.second
|
||||
end
|
||||
|
||||
it_behaves_like 'no email verification required'
|
||||
end
|
||||
end
|
||||
|
||||
describe 'when no previous authentication event exists' do
|
||||
it_behaves_like 'no email verification required'
|
||||
end
|
||||
|
||||
describe 'when a previous authentication event exists for another ip address' do
|
||||
before do
|
||||
create(:authentication_event, :successful, user: user, ip_address: '1.2.3.4')
|
||||
end
|
||||
|
||||
it_behaves_like 'email verification required'
|
||||
it_behaves_like 'no email verification required when 2fa enabled or ff disabled'
|
||||
end
|
||||
|
||||
describe 'when a previous authentication event exists for the same ip address' do
|
||||
before do
|
||||
create(:authentication_event, :successful, user: user)
|
||||
end
|
||||
|
||||
it_behaves_like 'no email verification required'
|
||||
end
|
||||
|
||||
describe 'rate limiting password guessing' do
|
||||
before do
|
||||
5.times { gitlab_sign_in(user, password: 'wrong_password') }
|
||||
gitlab_sign_in(user)
|
||||
end
|
||||
|
||||
it 'shows an error message on on the login page' do
|
||||
expect(page).to have_current_path(new_user_session_path)
|
||||
expect(page).to have_content('Maximum login attempts exceeded. Wait 10 minutes and try again.')
|
||||
end
|
||||
end
|
||||
|
||||
describe 'inconsistent states' do
|
||||
context 'when the feature flag is toggled off after being prompted for a verification token' do
|
||||
before do
|
||||
create(:authentication_event, :successful, user: user, ip_address: '1.2.3.4')
|
||||
end
|
||||
|
||||
it 'still accepts the token' do
|
||||
perform_enqueued_jobs do
|
||||
# The user is prompted for a verification code
|
||||
gitlab_sign_in(user)
|
||||
expect(page).to have_content('Help us protect your account')
|
||||
code = expect_instructions_email_and_extract_code
|
||||
|
||||
# We toggle the feature flag off
|
||||
stub_feature_flags(require_email_verification: false)
|
||||
|
||||
# Resending and veryfying the code work as expected
|
||||
click_link 'Resend code'
|
||||
new_code = expect_instructions_email_and_extract_code
|
||||
|
||||
verify_code(code)
|
||||
expect(page).to have_content('The code is incorrect. Enter it again, or resend a new code.')
|
||||
|
||||
travel VerifiesWithEmail::TOKEN_VALID_FOR_MINUTES.minutes + 1.second
|
||||
|
||||
verify_code(new_code)
|
||||
expect(page).to have_content('The code has expired. Resend a new code and try again.')
|
||||
|
||||
click_link 'Resend code'
|
||||
another_code = expect_instructions_email_and_extract_code
|
||||
|
||||
verify_code(another_code)
|
||||
expect_user_to_be_unlocked
|
||||
expect(page).to have_current_path(users_successful_verification_path)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
context 'when the feature flag is toggled on after Devise sent unlock instructions' do
|
||||
let(:require_email_verification_enabled) { false }
|
||||
|
||||
before do
|
||||
perform_enqueued_jobs do
|
||||
(User.maximum_attempts / 2).times do
|
||||
gitlab_sign_in(user, password: 'wrong_password')
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
it 'the unlock link still works' do
|
||||
# The user is locked and unlock instructions are sent
|
||||
expect(page).to have_content('Invalid login or password.')
|
||||
user.reload
|
||||
expect(user.locked_at).not_to be_nil
|
||||
expect(user.unlock_token).not_to be_nil
|
||||
mail = find_email_for(user)
|
||||
|
||||
expect(mail.to).to match_array([user.email])
|
||||
expect(mail.subject).to eq('Unlock instructions')
|
||||
unlock_url = mail.body.parts.first.to_s[/http.*/]
|
||||
|
||||
# We toggle the feature flag on
|
||||
stub_feature_flags(require_email_verification: true)
|
||||
|
||||
# Unlocking works as expected
|
||||
visit unlock_url
|
||||
expect_user_to_be_unlocked
|
||||
expect(page).to have_current_path(new_user_session_path)
|
||||
expect(page).to have_content('Your account has been unlocked successfully')
|
||||
|
||||
gitlab_sign_in(user)
|
||||
expect(page).to have_current_path(root_path)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def expect_user_to_be_unlocked
|
||||
user.reload
|
||||
|
||||
aggregate_failures do
|
||||
expect(user.locked_at).to be_nil
|
||||
expect(user.unlock_token).to be_nil
|
||||
expect(user.failed_attempts).to eq(0)
|
||||
end
|
||||
end
|
||||
|
||||
def expect_instructions_email_and_extract_code
|
||||
mail = find_email_for(user)
|
||||
expect(mail.to).to match_array([user.email])
|
||||
expect(mail.subject).to eq('Verify your identity')
|
||||
code = mail.body.parts.first.to_s[/\d{#{VerifiesWithEmail::TOKEN_LENGTH}}/]
|
||||
reset_delivered_emails!
|
||||
code
|
||||
end
|
||||
|
||||
def verify_code(code)
|
||||
fill_in 'Verification code', with: code
|
||||
click_button 'Verify code'
|
||||
end
|
||||
|
||||
def expect_log_message(event = nil, times = 1, reason: '', message: nil)
|
||||
expect(Gitlab::AppLogger).to have_received(:info)
|
||||
.exactly(times).times
|
||||
.with(message || hash_including(message: 'Email Verification',
|
||||
event: event,
|
||||
username: user.username,
|
||||
ip: '127.0.0.1',
|
||||
reason: reason))
|
||||
end
|
||||
end
|
|
@ -19,9 +19,9 @@ describe('incident utils', () => {
|
|||
|
||||
describe('get event icon', () => {
|
||||
it('should display a matching event icon name', () => {
|
||||
const name = 'comment';
|
||||
|
||||
expect(getEventIcon(name)).toBe(name);
|
||||
['comment', 'issues', 'status'].forEach((name) => {
|
||||
expect(getEventIcon(name)).toBe(name);
|
||||
});
|
||||
});
|
||||
|
||||
it('should return a default icon name', () => {
|
||||
|
|
|
@ -50,4 +50,51 @@ RSpec.describe SessionsHelper do
|
|||
expect(helper.unconfirmed_email?).to be_falsey
|
||||
end
|
||||
end
|
||||
|
||||
describe '#send_rate_limited?' do
|
||||
let_it_be(:user) { build(:user) }
|
||||
|
||||
subject { helper.send_rate_limited?(user) }
|
||||
|
||||
before do
|
||||
allow(::Gitlab::ApplicationRateLimiter)
|
||||
.to receive(:peek)
|
||||
.with(:email_verification_code_send, scope: user)
|
||||
.and_return(rate_limited)
|
||||
end
|
||||
|
||||
context 'when rate limited' do
|
||||
let(:rate_limited) { true }
|
||||
|
||||
it { is_expected.to eq(true) }
|
||||
end
|
||||
|
||||
context 'when not rate limited' do
|
||||
let(:rate_limited) { false }
|
||||
|
||||
it { is_expected.to eq(false) }
|
||||
end
|
||||
end
|
||||
|
||||
describe '#obfuscated_email' do
|
||||
subject { helper.obfuscated_email(email) }
|
||||
|
||||
context 'when an email address is normal length' do
|
||||
let(:email) { 'alex@gitlab.com' }
|
||||
|
||||
it { is_expected.to eq('al**@g*****.com') }
|
||||
end
|
||||
|
||||
context 'when an email address contains multiple top level domains' do
|
||||
let(:email) { 'alex@gl.co.uk' }
|
||||
|
||||
it { is_expected.to eq('al**@g****.uk') }
|
||||
end
|
||||
|
||||
context 'when an email address is very short' do
|
||||
let(:email) { 'a@b' }
|
||||
|
||||
it { is_expected.to eq('a@b') }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -0,0 +1,80 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require 'fast_spec_helper'
|
||||
|
||||
RSpec.describe Gitlab::Ci::YamlProcessor::FeatureFlags do
|
||||
let(:feature_flag) { :my_feature_flag }
|
||||
|
||||
context 'when the actor is set' do
|
||||
let(:actor) { double }
|
||||
let(:another_actor) { double }
|
||||
|
||||
it 'checks the feature flag using the given actor' do
|
||||
described_class.with_actor(actor) do
|
||||
expect(Feature).to receive(:enabled?).with(feature_flag, actor)
|
||||
|
||||
described_class.enabled?(feature_flag)
|
||||
end
|
||||
end
|
||||
|
||||
it 'returns the value of the block' do
|
||||
result = described_class.with_actor(actor) do
|
||||
:test
|
||||
end
|
||||
|
||||
expect(result).to eq(:test)
|
||||
end
|
||||
|
||||
it 'restores the existing actor if any' do
|
||||
described_class.with_actor(actor) do
|
||||
described_class.with_actor(another_actor) do
|
||||
expect(Feature).to receive(:enabled?).with(feature_flag, another_actor)
|
||||
|
||||
described_class.enabled?(feature_flag)
|
||||
end
|
||||
|
||||
expect(Feature).to receive(:enabled?).with(feature_flag, actor)
|
||||
described_class.enabled?(feature_flag)
|
||||
end
|
||||
end
|
||||
|
||||
it 'restores the actor to nil after the block' do
|
||||
described_class.with_actor(actor) do
|
||||
expect(Thread.current[described_class::ACTOR_KEY]).to eq(actor)
|
||||
end
|
||||
|
||||
expect(Thread.current[described_class::ACTOR_KEY]).to be nil
|
||||
end
|
||||
end
|
||||
|
||||
context 'when feature flag is checked outside the "with_actor" block' do
|
||||
it 'raises an error on dev/test environment' do
|
||||
expect { described_class.enabled?(feature_flag) }.to raise_error(described_class::NoActorError)
|
||||
end
|
||||
|
||||
context 'when on production' do
|
||||
before do
|
||||
allow(Gitlab::ErrorTracking).to receive(:should_raise_for_dev?).and_return(false)
|
||||
end
|
||||
|
||||
it 'checks the feature flag without actor' do
|
||||
expect(Feature).to receive(:enabled?).with(feature_flag, nil)
|
||||
expect(Gitlab::ErrorTracking)
|
||||
.to receive(:track_and_raise_for_dev_exception)
|
||||
.and_call_original
|
||||
|
||||
described_class.enabled?(feature_flag)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
context 'when actor is explicitly nil' do
|
||||
it 'checks the feature flag without actor' do
|
||||
described_class.with_actor(nil) do
|
||||
expect(Feature).to receive(:enabled?).with(feature_flag, nil)
|
||||
|
||||
described_class.enabled?(feature_flag)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
|
@ -6,6 +6,7 @@ RSpec.describe Gitlab::UsageDataCounters::EditorUniqueCounter, :clean_gitlab_red
|
|||
let(:user1) { build(:user, id: 1) }
|
||||
let(:user2) { build(:user, id: 2) }
|
||||
let(:user3) { build(:user, id: 3) }
|
||||
let(:project) { build(:project) }
|
||||
let(:time) { Time.zone.now }
|
||||
|
||||
shared_examples 'tracks and counts action' do
|
||||
|
@ -15,10 +16,9 @@ RSpec.describe Gitlab::UsageDataCounters::EditorUniqueCounter, :clean_gitlab_red
|
|||
|
||||
specify do
|
||||
aggregate_failures do
|
||||
expect(track_action(author: user1)).to be_truthy
|
||||
expect(track_action(author: user1)).to be_truthy
|
||||
expect(track_action(author: user2)).to be_truthy
|
||||
expect(track_action(author: user3, time: time - 3.days)).to be_truthy
|
||||
expect(track_action(author: user1, project: project)).to be_truthy
|
||||
expect(track_action(author: user2, project: project)).to be_truthy
|
||||
expect(track_action(author: user3, time: time - 3.days, project: project)).to be_truthy
|
||||
|
||||
expect(count_unique(date_from: time, date_to: Date.today)).to eq(2)
|
||||
expect(count_unique(date_from: time - 5.days, date_to: Date.tomorrow)).to eq(3)
|
||||
|
@ -26,7 +26,7 @@ RSpec.describe Gitlab::UsageDataCounters::EditorUniqueCounter, :clean_gitlab_red
|
|||
end
|
||||
|
||||
it 'does not track edit actions if author is not present' do
|
||||
expect(track_action(author: nil)).to be_nil
|
||||
expect(track_action(author: nil, project: project)).to be_nil
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -67,16 +67,16 @@ RSpec.describe Gitlab::UsageDataCounters::EditorUniqueCounter, :clean_gitlab_red
|
|||
end
|
||||
|
||||
it 'can return the count of actions per user deduplicated' do
|
||||
described_class.track_web_ide_edit_action(author: user1)
|
||||
described_class.track_live_preview_edit_action(author: user1)
|
||||
described_class.track_snippet_editor_edit_action(author: user1)
|
||||
described_class.track_sfe_edit_action(author: user1)
|
||||
described_class.track_web_ide_edit_action(author: user2, time: time - 2.days)
|
||||
described_class.track_web_ide_edit_action(author: user3, time: time - 3.days)
|
||||
described_class.track_live_preview_edit_action(author: user2, time: time - 2.days)
|
||||
described_class.track_live_preview_edit_action(author: user3, time: time - 3.days)
|
||||
described_class.track_snippet_editor_edit_action(author: user3, time: time - 3.days)
|
||||
described_class.track_sfe_edit_action(author: user3, time: time - 3.days)
|
||||
described_class.track_web_ide_edit_action(author: user1, project: project)
|
||||
described_class.track_live_preview_edit_action(author: user1, project: project)
|
||||
described_class.track_snippet_editor_edit_action(author: user1, project: project)
|
||||
described_class.track_sfe_edit_action(author: user1, project: project)
|
||||
described_class.track_web_ide_edit_action(author: user2, time: time - 2.days, project: project)
|
||||
described_class.track_web_ide_edit_action(author: user3, time: time - 3.days, project: project)
|
||||
described_class.track_live_preview_edit_action(author: user2, time: time - 2.days, project: project)
|
||||
described_class.track_live_preview_edit_action(author: user3, time: time - 3.days, project: project)
|
||||
described_class.track_snippet_editor_edit_action(author: user3, time: time - 3.days, project: project)
|
||||
described_class.track_sfe_edit_action(author: user3, time: time - 3.days, project: project)
|
||||
|
||||
expect(described_class.count_edit_using_editor(date_from: time, date_to: Date.today)).to eq(1)
|
||||
expect(described_class.count_edit_using_editor(date_from: time - 5.days, date_to: Date.tomorrow)).to eq(3)
|
||||
|
|
|
@ -249,7 +249,7 @@ RSpec.describe Gitlab::UsageData, :aggregate_failures do
|
|||
)
|
||||
end
|
||||
|
||||
it 'includes imports usage data' do
|
||||
it 'includes imports usage data', :clean_gitlab_redis_cache do
|
||||
for_defined_days_back do
|
||||
user = create(:user)
|
||||
|
||||
|
@ -1152,35 +1152,36 @@ RSpec.describe Gitlab::UsageData, :aggregate_failures do
|
|||
let(:user2) { build(:user, id: 2) }
|
||||
let(:user3) { build(:user, id: 3) }
|
||||
let(:user4) { build(:user, id: 4) }
|
||||
let(:project) { build(:project) }
|
||||
|
||||
before do
|
||||
counter = Gitlab::UsageDataCounters::TrackUniqueEvents
|
||||
project = Event::TARGET_TYPES[:project]
|
||||
project_type = Event::TARGET_TYPES[:project]
|
||||
wiki = Event::TARGET_TYPES[:wiki]
|
||||
design = Event::TARGET_TYPES[:design]
|
||||
|
||||
counter.track_event(event_action: :pushed, event_target: project, author_id: 1)
|
||||
counter.track_event(event_action: :pushed, event_target: project, author_id: 1)
|
||||
counter.track_event(event_action: :pushed, event_target: project, author_id: 2)
|
||||
counter.track_event(event_action: :pushed, event_target: project, author_id: 3)
|
||||
counter.track_event(event_action: :pushed, event_target: project, author_id: 4, time: time - 3.days)
|
||||
counter.track_event(event_action: :pushed, event_target: project_type, author_id: 1)
|
||||
counter.track_event(event_action: :pushed, event_target: project_type, author_id: 1)
|
||||
counter.track_event(event_action: :pushed, event_target: project_type, author_id: 2)
|
||||
counter.track_event(event_action: :pushed, event_target: project_type, author_id: 3)
|
||||
counter.track_event(event_action: :pushed, event_target: project_type, author_id: 4, time: time - 3.days)
|
||||
counter.track_event(event_action: :created, event_target: wiki, author_id: 3)
|
||||
counter.track_event(event_action: :created, event_target: design, author_id: 3)
|
||||
counter.track_event(event_action: :created, event_target: design, author_id: 4)
|
||||
|
||||
counter = Gitlab::UsageDataCounters::EditorUniqueCounter
|
||||
|
||||
counter.track_web_ide_edit_action(author: user1)
|
||||
counter.track_web_ide_edit_action(author: user1)
|
||||
counter.track_sfe_edit_action(author: user1)
|
||||
counter.track_snippet_editor_edit_action(author: user1)
|
||||
counter.track_snippet_editor_edit_action(author: user1, time: time - 3.days)
|
||||
counter.track_web_ide_edit_action(author: user1, project: project)
|
||||
counter.track_web_ide_edit_action(author: user1, project: project)
|
||||
counter.track_sfe_edit_action(author: user1, project: project)
|
||||
counter.track_snippet_editor_edit_action(author: user1, project: project)
|
||||
counter.track_snippet_editor_edit_action(author: user1, time: time - 3.days, project: project)
|
||||
|
||||
counter.track_web_ide_edit_action(author: user2)
|
||||
counter.track_sfe_edit_action(author: user2)
|
||||
counter.track_web_ide_edit_action(author: user2, project: project)
|
||||
counter.track_sfe_edit_action(author: user2, project: project)
|
||||
|
||||
counter.track_web_ide_edit_action(author: user3, time: time - 3.days)
|
||||
counter.track_snippet_editor_edit_action(author: user3)
|
||||
counter.track_web_ide_edit_action(author: user3, time: time - 3.days, project: project)
|
||||
counter.track_snippet_editor_edit_action(author: user3, project: project)
|
||||
end
|
||||
|
||||
it 'returns the distinct count of user actions within the specified time period' do
|
||||
|
|
|
@ -0,0 +1,24 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require 'spec_helper'
|
||||
require_migration!
|
||||
|
||||
RSpec.describe AddUserIdAndIpAddressSuccessIndexToAuthenticationEvents do
|
||||
let(:db) { described_class.new }
|
||||
let(:old_index) { described_class::OLD_INDEX_NAME }
|
||||
let(:new_index) { described_class::NEW_INDEX_NAME }
|
||||
|
||||
it 'correctly migrates up and down' do
|
||||
reversible_migration do |migration|
|
||||
migration.before -> {
|
||||
expect(db.connection.indexes(:authentication_events).map(&:name)).to include(old_index)
|
||||
expect(db.connection.indexes(:authentication_events).map(&:name)).not_to include(new_index)
|
||||
}
|
||||
|
||||
migration.after -> {
|
||||
expect(db.connection.indexes(:authentication_events).map(&:name)).to include(new_index)
|
||||
expect(db.connection.indexes(:authentication_events).map(&:name)).not_to include(old_index)
|
||||
}
|
||||
end
|
||||
end
|
||||
end
|
|
@ -44,4 +44,31 @@ RSpec.describe AuthenticationEvent do
|
|||
expect(described_class.providers).to match_array %w(ldapmain google_oauth2 standard two-factor two-factor-via-u2f-device two-factor-via-webauthn-device)
|
||||
end
|
||||
end
|
||||
|
||||
describe '.initial_login_or_known_ip_address?' do
|
||||
let_it_be(:user) { create(:user) }
|
||||
let_it_be(:ip_address) { '127.0.0.1' }
|
||||
|
||||
subject { described_class.initial_login_or_known_ip_address?(user, ip_address) }
|
||||
|
||||
context 'on first login, when no record exists yet' do
|
||||
it { is_expected.to eq(true) }
|
||||
end
|
||||
|
||||
context 'on second login from the same ip address' do
|
||||
before do
|
||||
create(:authentication_event, :successful, user: user, ip_address: ip_address)
|
||||
end
|
||||
|
||||
it { is_expected.to eq(true) }
|
||||
end
|
||||
|
||||
context 'on second login from another ip address' do
|
||||
before do
|
||||
create(:authentication_event, :successful, user: user, ip_address: '1.2.3.4')
|
||||
end
|
||||
|
||||
it { is_expected.to eq(false) }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -0,0 +1,103 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require 'spec_helper'
|
||||
|
||||
RSpec.describe RequireEmailVerification do
|
||||
let_it_be(:model) do
|
||||
Class.new(ApplicationRecord) do
|
||||
self.table_name = 'users'
|
||||
|
||||
devise :lockable
|
||||
|
||||
include RequireEmailVerification
|
||||
end
|
||||
end
|
||||
|
||||
using RSpec::Parameterized::TableSyntax
|
||||
|
||||
where(:feature_flag_enabled, :two_factor_enabled, :overridden) do
|
||||
false | false | false
|
||||
false | true | false
|
||||
true | false | true
|
||||
true | true | false
|
||||
end
|
||||
|
||||
with_them do
|
||||
let(:instance) { model.new }
|
||||
|
||||
before do
|
||||
stub_feature_flags(require_email_verification: feature_flag_enabled)
|
||||
allow(instance).to receive(:two_factor_enabled?).and_return(two_factor_enabled)
|
||||
end
|
||||
|
||||
describe '#lock_access!' do
|
||||
subject { instance.lock_access! }
|
||||
|
||||
before do
|
||||
allow(instance).to receive(:save)
|
||||
end
|
||||
|
||||
it 'sends Devise unlock instructions unless overridden and always sets locked_at' do
|
||||
expect(instance).to receive(:send_unlock_instructions).exactly(overridden ? 0 : 1).times
|
||||
|
||||
expect { subject }.to change { instance.locked_at }.from(nil)
|
||||
end
|
||||
end
|
||||
|
||||
describe '#attempts_exceeded?' do
|
||||
subject { instance.send(:attempts_exceeded?) }
|
||||
|
||||
context 'when failed_attempts is LT overridden amount' do
|
||||
before do
|
||||
instance.failed_attempts = 5
|
||||
end
|
||||
|
||||
it { is_expected.to eq(false) }
|
||||
end
|
||||
|
||||
context 'when failed_attempts is GTE overridden amount but LT Devise default amount' do
|
||||
before do
|
||||
instance.failed_attempts = 6
|
||||
end
|
||||
|
||||
it { is_expected.to eq(overridden) }
|
||||
end
|
||||
|
||||
context 'when failed_attempts is GTE Devise default amount' do
|
||||
before do
|
||||
instance.failed_attempts = 10
|
||||
end
|
||||
|
||||
it { is_expected.to eq(true) }
|
||||
end
|
||||
end
|
||||
|
||||
describe '#lock_expired?' do
|
||||
subject { instance.send(:lock_expired?) }
|
||||
|
||||
context 'when locked shorter ago than Devise default time' do
|
||||
before do
|
||||
instance.locked_at = 9.minutes.ago
|
||||
end
|
||||
|
||||
it { is_expected.to eq(false) }
|
||||
end
|
||||
|
||||
context 'when locked longer ago than Devise default time but shorter ago than overriden time' do
|
||||
before do
|
||||
instance.locked_at = 11.minutes.ago
|
||||
end
|
||||
|
||||
it { is_expected.to eq(!overridden) }
|
||||
end
|
||||
|
||||
context 'when locked longer ago than overriden time' do
|
||||
before do
|
||||
instance.locked_at = (24.hours + 1.minute).ago
|
||||
end
|
||||
|
||||
it { is_expected.to eq(true) }
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
|
@ -392,14 +392,25 @@ RSpec.describe API::Commits do
|
|||
end
|
||||
end
|
||||
|
||||
context 'when using warden' do
|
||||
it 'increments usage counters', :clean_gitlab_redis_sessions do
|
||||
context 'when using warden', :snowplow, :clean_gitlab_redis_sessions do
|
||||
before do
|
||||
stub_session('warden.user.user.key' => [[user.id], user.encrypted_password[0, 29]])
|
||||
end
|
||||
|
||||
subject { post api(url), params: valid_c_params }
|
||||
|
||||
it 'increments usage counters' do
|
||||
expect(::Gitlab::UsageDataCounters::WebIdeCounter).to receive(:increment_commits_count)
|
||||
expect(::Gitlab::UsageDataCounters::EditorUniqueCounter).to receive(:track_web_ide_edit_action)
|
||||
|
||||
post api(url), params: valid_c_params
|
||||
subject
|
||||
end
|
||||
|
||||
it_behaves_like 'Snowplow event tracking' do
|
||||
let(:namespace) { project.namespace }
|
||||
let(:category) { 'ide_edit' }
|
||||
let(:action) { 'g_edit_by_web_ide' }
|
||||
let(:feature_flag_name) { :route_hll_to_snowplow_phase2 }
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -4,6 +4,7 @@ require 'spec_helper'
|
|||
|
||||
RSpec.describe 'Updating a Snippet' do
|
||||
include GraphqlHelpers
|
||||
include SessionHelpers
|
||||
|
||||
let_it_be(:original_content) { 'Initial content' }
|
||||
let_it_be(:original_description) { 'Initial description' }
|
||||
|
@ -162,7 +163,7 @@ RSpec.describe 'Updating a Snippet' do
|
|||
end
|
||||
end
|
||||
|
||||
context 'when the author is a member of the project' do
|
||||
context 'when the author is a member of the project', :snowplow do
|
||||
before do
|
||||
project.add_developer(current_user)
|
||||
end
|
||||
|
@ -185,6 +186,20 @@ RSpec.describe 'Updating a Snippet' do
|
|||
it_behaves_like 'has spam protection' do
|
||||
let(:mutation_class) { ::Mutations::Snippets::Update }
|
||||
end
|
||||
|
||||
context 'when not sessionless', :clean_gitlab_redis_sessions do
|
||||
before do
|
||||
stub_session('warden.user.user.key' => [[current_user.id], current_user.encrypted_password[0, 29]])
|
||||
end
|
||||
|
||||
it_behaves_like 'Snowplow event tracking' do
|
||||
let(:user) { current_user }
|
||||
let(:namespace) { project.namespace }
|
||||
let(:category) { 'ide_edit' }
|
||||
let(:action) { 'g_edit_by_snippet_ide' }
|
||||
let(:feature_flag_name) { :route_hll_to_snowplow_phase2 }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
it_behaves_like 'when the snippet is not found'
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue