提交 099777a3 编写于 作者: K Kamil Trzciński

Merge branch 'feature/gb/ci-pipeline-bridge' into 'master'

Add basic implementation of CI/CD bridge job

See merge request gitlab-org/gitlab-ce!23730
# frozen_string_literal: true
module Ci
class Bridge < CommitStatus
include Importable
include AfterCommitQueue
include Gitlab::Utils::StrongMemoize
belongs_to :project
validates :ref, presence: true
def self.retry(bridge, current_user)
raise NotImplementedError
end
def tags
[:bridge]
end
def detailed_status(current_user)
Gitlab::Ci::Status::Bridge::Factory
.new(self, current_user)
.fabricate!
end
def predefined_variables
raise NotImplementedError
end
def execute_hooks
raise NotImplementedError
end
end
end
# frozen_string_literal: true
module Gitlab
module Ci
module Status
module Bridge
module Common
def label
subject.description
end
def has_details?
false
end
def has_action?
false
end
def details_path
raise NotImplementedError
end
end
end
end
end
end
# frozen_string_literal: true
module Gitlab
module Ci
module Status
module Bridge
class Factory < Status::Factory
def self.common_helpers
Status::Bridge::Common
end
end
end
end
end
end
FactoryBot.define do
factory :ci_bridge, class: Ci::Bridge do
name ' bridge'
stage 'test'
stage_idx 0
ref 'master'
tag false
created_at 'Di 29. Okt 09:50:00 CET 2013'
status :success
pipeline factory: :ci_pipeline
after(:build) do |bridge, evaluator|
bridge.project ||= bridge.pipeline.project
end
end
end
require 'spec_helper'
describe Ci::Bridge do
set(:project) { create(:project) }
set(:pipeline) { create(:ci_pipeline, project: project) }
let(:bridge) do
create(:ci_bridge, pipeline: pipeline)
end
describe '#tags' do
it 'only has a bridge tag' do
expect(bridge.tags).to eq [:bridge]
end
end
describe '#detailed_status' do
let(:user) { create(:user) }
let(:status) { bridge.detailed_status(user) }
it 'returns detailed status object' do
expect(status).to be_a Gitlab::Ci::Status::Success
end
end
end
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册