Commit 077bb1b2 authored by Grzegorz Bizon's avatar Grzegorz Bizon

Merge branch 'mc/feature/required-template-inclusion-single-commit-ce' into 'master'

Enforce template inclusion in pipelines - CE

See merge request gitlab-org/gitlab-ce!29296
parents 289ca35d 7ac3723b
# frozen_string_literal: true
# See http://doc.gitlab.com/ce/development/migration_style_guide.html
# for more information on how to write migrations for GitLab.
class AddRequiredTemplateNameToApplicationSettings < ActiveRecord::Migration[5.1]
include Gitlab::Database::MigrationHelpers
# Set this constant to true if this migration requires downtime.
DOWNTIME = false
def change
add_column :application_settings, :required_instance_ci_template, :string, null: true
end
end
...@@ -194,6 +194,7 @@ ActiveRecord::Schema.define(version: 20190613030606) do ...@@ -194,6 +194,7 @@ ActiveRecord::Schema.define(version: 20190613030606) do
t.integer "elasticsearch_replicas", default: 1, null: false t.integer "elasticsearch_replicas", default: 1, null: false
t.text "encrypted_lets_encrypt_private_key" t.text "encrypted_lets_encrypt_private_key"
t.text "encrypted_lets_encrypt_private_key_iv" t.text "encrypted_lets_encrypt_private_key_iv"
t.string "required_instance_ci_template"
t.boolean "dns_rebinding_protection_enabled", default: true, null: false t.boolean "dns_rebinding_protection_enabled", default: true, null: false
t.boolean "default_project_deletion_protection", default: false, null: false t.boolean "default_project_deletion_protection", default: false, null: false
t.boolean "lock_memberships_to_ldap", default: false, null: false t.boolean "lock_memberships_to_ldap", default: false, null: false
......
...@@ -8,6 +8,12 @@ module Gitlab ...@@ -8,6 +8,12 @@ module Gitlab
class Config class Config
ConfigError = Class.new(StandardError) ConfigError = Class.new(StandardError)
RESCUE_ERRORS = [
Gitlab::Config::Loader::FormatError,
Extendable::ExtensionError,
External::Processor::IncludeError
].freeze
def initialize(config, project: nil, sha: nil, user: nil) def initialize(config, project: nil, sha: nil, user: nil)
@config = Config::Extendable @config = Config::Extendable
.new(build_config(config, project: project, sha: sha, user: user)) .new(build_config(config, project: project, sha: sha, user: user))
...@@ -15,9 +21,7 @@ module Gitlab ...@@ -15,9 +21,7 @@ module Gitlab
@global = Entry::Global.new(@config) @global = Entry::Global.new(@config)
@global.compose! @global.compose!
rescue Gitlab::Config::Loader::FormatError, rescue *rescue_errors => e
Extendable::ExtensionError,
External::Processor::IncludeError => e
raise Config::ConfigError, e.message raise Config::ConfigError, e.message
end end
...@@ -83,6 +87,11 @@ module Gitlab ...@@ -83,6 +87,11 @@ module Gitlab
user: user, user: user,
expandset: Set.new).perform expandset: Set.new).perform
end end
# Overriden in EE
def rescue_errors
RESCUE_ERRORS
end
end end
end end
end end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment