Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'app/models/project.rb')
-rw-r--r--app/models/project.rb43
1 files changed, 34 insertions, 9 deletions
diff --git a/app/models/project.rb b/app/models/project.rb
index 2b9b7dcf733..ef92dda443a 100644
--- a/app/models/project.rb
+++ b/app/models/project.rb
@@ -345,7 +345,7 @@ class Project < ApplicationRecord
has_many :daily_build_group_report_results, class_name: 'Ci::DailyBuildGroupReportResult'
- has_many :repository_storage_moves, class_name: 'ProjectRepositoryStorageMove', inverse_of: :container
+ has_many :repository_storage_moves, class_name: 'Projects::RepositoryStorageMove', inverse_of: :container
has_many :webide_pipelines, -> { webide_source }, class_name: 'Ci::Pipeline', inverse_of: :project
has_many :reviews, inverse_of: :project
@@ -392,7 +392,9 @@ class Project < ApplicationRecord
:merge_requests_access_level, :forking_access_level, :issues_access_level,
:wiki_access_level, :snippets_access_level, :builds_access_level,
:repository_access_level, :pages_access_level, :metrics_dashboard_access_level, :analytics_access_level,
- :operations_enabled?, :operations_access_level, to: :project_feature, allow_nil: true
+ :operations_enabled?, :operations_access_level, :security_and_compliance_access_level,
+ :container_registry_access_level,
+ to: :project_feature, allow_nil: true
delegate :show_default_award_emojis, :show_default_award_emojis=,
:show_default_award_emojis?,
to: :project_setting, allow_nil: true
@@ -491,10 +493,22 @@ class Project < ApplicationRecord
{ column: arel_table["description"], multiplier: 0.2 }
])
- query = reorder(order_expression.desc, arel_table['id'].desc)
+ order = Gitlab::Pagination::Keyset::Order.build([
+ Gitlab::Pagination::Keyset::ColumnOrderDefinition.new(
+ attribute_name: 'similarity',
+ column_expression: order_expression,
+ order_expression: order_expression.desc,
+ order_direction: :desc,
+ distinct: false,
+ add_to_projections: true
+ ),
+ Gitlab::Pagination::Keyset::ColumnOrderDefinition.new(
+ attribute_name: 'id',
+ order_expression: Project.arel_table[:id].desc
+ )
+ ])
- query = query.select(*query.arel.projections, order_expression.as('similarity')) if include_in_select
- query
+ order.apply_cursor_conditions(reorder(order))
end
scope :with_packages, -> { joins(:packages) }
@@ -1696,8 +1710,8 @@ class Project < ApplicationRecord
end
end
- def any_runners?(&block)
- active_runners.any?(&block)
+ def any_active_runners?(&block)
+ active_runners_with_tags.any?(&block)
end
def valid_runners_token?(token)
@@ -1986,6 +2000,7 @@ class Project < ApplicationRecord
.append(key: 'CI_PROJECT_REPOSITORY_LANGUAGES', value: repository_languages.map(&:name).join(',').downcase)
.append(key: 'CI_DEFAULT_BRANCH', value: default_branch)
.append(key: 'CI_PROJECT_CONFIG_PATH', value: ci_config_path_or_default)
+ .append(key: 'CI_CONFIG_PATH', value: ci_config_path_or_default)
end
def predefined_ci_server_variables
@@ -2023,10 +2038,10 @@ class Project < ApplicationRecord
Gitlab::Ci::Variables::Collection.new.tap do |variables|
break variables unless Gitlab.config.dependency_proxy.enabled
- variables.append(key: 'CI_DEPENDENCY_PROXY_SERVER', value: "#{Gitlab.config.gitlab.host}:#{Gitlab.config.gitlab.port}")
+ variables.append(key: 'CI_DEPENDENCY_PROXY_SERVER', value: Gitlab.host_with_port)
variables.append(
key: 'CI_DEPENDENCY_PROXY_GROUP_IMAGE_PREFIX',
- value: "#{Gitlab.config.gitlab.host}:#{Gitlab.config.gitlab.port}/#{namespace.root_ancestor.path}#{DependencyProxy::URL_SUFFIX}"
+ value: "#{Gitlab.host_with_port}/#{namespace.root_ancestor.path}#{DependencyProxy::URL_SUFFIX}"
)
end
end
@@ -2532,6 +2547,10 @@ class Project < ApplicationRecord
Projects::GitGarbageCollectWorker
end
+ def inherited_issuable_templates_enabled?
+ Feature.enabled?(:inherited_issuable_templates, self, default_enabled: :yaml)
+ end
+
private
def find_service(services, name)
@@ -2694,6 +2713,12 @@ class Project < ApplicationRecord
def cache_has_external_issue_tracker
update_column(:has_external_issue_tracker, services.external_issue_trackers.any?) if Gitlab::Database.read_write?
end
+
+ def active_runners_with_tags
+ strong_memoize(:active_runners_with_tags) do
+ active_runners.with_tags
+ end
+ end
end
Project.prepend_if_ee('EE::Project')