summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/gitlab/ci/stage/seed.rb13
1 files changed, 13 insertions, 0 deletions
diff --git a/lib/gitlab/ci/stage/seed.rb b/lib/gitlab/ci/stage/seed.rb
index bc97aa63b02..6a3b2f6cc4a 100644
--- a/lib/gitlab/ci/stage/seed.rb
+++ b/lib/gitlab/ci/stage/seed.rb
@@ -39,6 +39,10 @@ module Gitlab
pipeline.stages.create!(stage).tap do |stage|
builds_attributes = builds.map do |attributes|
attributes.merge(stage_id: stage.id)
+
+ if attributes.fetch(:stage_id).nil?
+ invalid_builds_counter.increment(node: hostname)
+ end
end
pipeline.builds.create!(builds_attributes).each do |build|
@@ -52,6 +56,15 @@ module Gitlab
def protected_ref?
@protected_ref ||= project.protected_for?(pipeline.ref)
end
+
+ def invalid_builds_counter
+ @counter ||= Gitlab::Metrics.counter(:invalid_builds_counter,
+ 'Builds without stage assigned counter')
+ end
+
+ def hostname
+ @hostname ||= Socket.gethostname
+ end
end
end
end