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:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-02-12 09:09:05 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2020-02-12 09:09:05 +0300
commit8c9dc985b90c353b33cb829caf51f8320171bc15 (patch)
tree9a68886dbea1aefabddb46bbd3faf961eab22ae6 /app/models
parent500626a5c953ad81cfc3ed74bf0148c075617e58 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/models')
-rw-r--r--app/models/ci/bridge.rb1
-rw-r--r--app/models/ci/build.rb1
-rw-r--r--app/models/ci/processable.rb19
-rw-r--r--app/models/clusters/applications/elastic_stack.rb15
4 files changed, 32 insertions, 4 deletions
diff --git a/app/models/ci/bridge.rb b/app/models/ci/bridge.rb
index 3726c05acd8..bb22cc3e039 100644
--- a/app/models/ci/bridge.rb
+++ b/app/models/ci/bridge.rb
@@ -8,7 +8,6 @@ module Ci
include Importable
include AfterCommitQueue
include HasRef
- include Gitlab::Utils::StrongMemoize
InvalidBridgeTypeError = Class.new(StandardError)
diff --git a/app/models/ci/build.rb b/app/models/ci/build.rb
index c23b2d81ce3..b0502f7a26e 100644
--- a/app/models/ci/build.rb
+++ b/app/models/ci/build.rb
@@ -10,7 +10,6 @@ module Ci
include ObjectStorage::BackgroundMove
include Presentable
include Importable
- include Gitlab::Utils::StrongMemoize
include HasRef
include IgnorableColumns
diff --git a/app/models/ci/processable.rb b/app/models/ci/processable.rb
index 6c4b271cd2c..95fb75688a9 100644
--- a/app/models/ci/processable.rb
+++ b/app/models/ci/processable.rb
@@ -2,10 +2,14 @@
module Ci
class Processable < ::CommitStatus
+ include Gitlab::Utils::StrongMemoize
+
has_many :needs, class_name: 'Ci::BuildNeed', foreign_key: :build_id, inverse_of: :build
accepts_nested_attributes_for :needs
+ enum scheduling_type: { stage: 0, dag: 1 }, _prefix: true
+
scope :preload_needs, -> { preload(:needs) }
def self.select_with_aggregated_needs(project)
@@ -23,6 +27,7 @@ module Ci
end
validates :type, presence: true
+ validates :scheduling_type, presence: true, on: :create, if: :validate_scheduling_type?
def aggregated_needs_names
read_attribute(:aggregated_needs_names)
@@ -47,5 +52,19 @@ module Ci
def scoped_variables_hash
raise NotImplementedError
end
+
+ # scheduling_type column of previous builds/bridges have not been populated,
+ # so we calculate this value on runtime when we need it.
+ def find_legacy_scheduling_type
+ strong_memoize(:find_legacy_scheduling_type) do
+ needs.exists? ? :dag : :stage
+ end
+ end
+
+ private
+
+ def validate_scheduling_type?
+ !importing? && Feature.enabled?(:validate_scheduling_type_of_processables, project)
+ end
end
end
diff --git a/app/models/clusters/applications/elastic_stack.rb b/app/models/clusters/applications/elastic_stack.rb
index de7d3ab3fdb..ce42bc65579 100644
--- a/app/models/clusters/applications/elastic_stack.rb
+++ b/app/models/clusters/applications/elastic_stack.rb
@@ -30,7 +30,8 @@ module Clusters
version: VERSION,
rbac: cluster.platform_kubernetes_rbac?,
chart: chart,
- files: files
+ files: files,
+ postinstall: post_install_script
)
end
@@ -43,6 +44,10 @@ module Clusters
)
end
+ def files
+ super.merge('wait-for-elasticsearch.sh': File.read("#{Rails.root}/vendor/elastic_stack/wait-for-elasticsearch.sh"))
+ end
+
def elasticsearch_client
strong_memoize(:elasticsearch_client) do
next unless kube_client
@@ -69,10 +74,16 @@ module Clusters
private
+ def post_install_script
+ [
+ "timeout -t60 sh /data/helm/elastic-stack/config/wait-for-elasticsearch.sh http://elastic-stack-elasticsearch-client:9200"
+ ]
+ end
+
def post_delete_script
[
Gitlab::Kubernetes::KubectlCmd.delete("pvc", "--selector", "release=elastic-stack")
- ].compact
+ ]
end
def kube_client