This instance will be upgraded to Heptapod 0.31.0 (final) on 2022-05-24 at 14:00 UTC+2 (a few minutes of down time)

Commit a1b30711 authored by Grzegorz Bizon's avatar Grzegorz Bizon
Browse files

Segregate interface require to make CI/CD entity processable

This commit segregates interface that is require to make CI/CD entity
processable, like `Ci::Build`. With this change it is not clear and
explicit what methods need to be implement to pass an object to pipeline
processing service.
parent 47fe749ed06a
......@@ -3,6 +3,7 @@
module Ci
class Build < CommitStatus
prepend ArtifactMigratable
include Ci::Processable
include TokenAuthenticatable
include AfterCommitQueue
include ObjectStorage::BackgroundMove
......
......@@ -25,6 +25,8 @@ class Pipeline < ActiveRecord::Base
has_many :stages, -> { order(position: :asc) }, inverse_of: :pipeline
has_many :statuses, class_name: 'CommitStatus', foreign_key: :commit_id, inverse_of: :pipeline
has_many :processables, -> { where(type: %w[Ci::Build Ci::Bridge]) },
class_name: 'CommitStatus', foreign_key: :commit_id, inverse_of: :pipeline
has_many :builds, foreign_key: :commit_id, inverse_of: :pipeline
has_many :trigger_requests, dependent: :destroy, foreign_key: :commit_id # rubocop:disable Cop/ActiveRecordDependent
has_many :variables, class_name: 'Ci::PipelineVariable'
......
# frozen_string_literal: true
module Ci
##
# This module implements methods that need to be implemented by CI/CD
# entities that are supposed to go through pipeline processing
# services.
#
#
module Processable
def schedulable?
raise NotImplementedError
end
def action?
raise NotImplementedError
end
def artifacts?
raise NotImplementedError
end
def expanded_environment_name
raise NotImplementedError
end
end
end
......@@ -55,7 +55,7 @@ def created_builds_in_stage(index)
# rubocop: enable CodeReuse/ActiveRecord
def created_builds
pipeline.builds.created
pipeline.processables.created
end
# This method is for compatibility and data consistency and should be removed with 9.3 version of GitLab
......
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