Commit d5264e88 authored by Lin Jen-Shin's avatar Lin Jen-Shin
Browse files
parent 543f707f7a06
......@@ -343,7 +343,7 @@ def stuck?
def execute_hooks
return unless project
build_data = Gitlab::DataBuilder::BuildDataBuilder.build(self)
build_data = Gitlab::DataBuilder::Build.build(self)
project.execute_hooks(build_data.dup, :build_hooks)
project.execute_services(build_data.dup, :build_hooks)
project.running_or_pending_build_count(force: true)
......
......@@ -222,7 +222,7 @@ def execute_hooks
end
def pipeline_data
Gitlab::DataBuilder::PipelineDataBuilder.build(self)
Gitlab::DataBuilder::Pipeline.build(self)
end
def keep_around_commits
......
......@@ -51,8 +51,7 @@ def disabled_title
end
def test_data(project = nil, user = nil)
build = project.builds.last
Gitlab::DataBuilder::BuildDataBuilder.build(build)
Gitlab::DataBuilder::Build.build(project.builds.last)
end
def fields
......
......@@ -80,7 +80,7 @@ def fields
end
def test_data(project, user)
Gitlab::DataBuilder::PushDataBuilder.build_sample(project, user)
Gitlab::DataBuilder::Push.build_sample(project, user)
end
def event_channel_names
......
......@@ -39,7 +39,12 @@ def success(message)
end
def build_push_data(branch)
Gitlab::DataBuilder::PushDataBuilder
.build(project, current_user, branch.target.sha, Gitlab::Git::BLANK_SHA, "#{Gitlab::Git::BRANCH_REF_PREFIX}#{branch.name}", [])
Gitlab::DataBuilder::Push.build(
project,
current_user,
branch.target.sha,
Gitlab::Git::BLANK_SHA,
"#{Gitlab::Git::BRANCH_REF_PREFIX}#{branch.name}",
[])
end
end
......@@ -33,7 +33,12 @@ def success(message)
end
def build_push_data(tag)
Gitlab::DataBuilder::PushDataBuilder
.build(project, current_user, tag.target.sha, Gitlab::Git::BLANK_SHA, "#{Gitlab::Git::TAG_REF_PREFIX}#{tag.name}", [])
Gitlab::DataBuilder::Push.build(
project,
current_user,
tag.target.sha,
Gitlab::Git::BLANK_SHA,
"#{Gitlab::Git::TAG_REF_PREFIX}#{tag.name}",
[])
end
end
......@@ -138,13 +138,23 @@ def process_commit_messages
end
def build_push_data
@push_data ||= Gitlab::DataBuilder::PushDataBuilder.
build(@project, current_user, params[:oldrev], params[:newrev], params[:ref], push_commits)
@push_data ||= Gitlab::DataBuilder::Push.build(
@project,
current_user,
params[:oldrev],
params[:newrev],
params[:ref],
push_commits)
end
def build_push_data_system_hook
@push_data_system ||= Gitlab::DataBuilder::PushDataBuilder.
build(@project, current_user, params[:oldrev], params[:newrev], params[:ref], [])
@push_data_system ||= Gitlab::DataBuilder::Push.build(
@project,
current_user,
params[:oldrev],
params[:newrev],
params[:ref],
[])
end
def push_to_existing_branch?
......
......@@ -34,12 +34,24 @@ def build_push_data
end
end
Gitlab::DataBuilder::PushDataBuilder.
build(project, current_user, params[:oldrev], params[:newrev], params[:ref], commits, message)
Gitlab::DataBuilder::Push.build(
project,
current_user,
params[:oldrev],
params[:newrev],
params[:ref],
commits,
message)
end
def build_system_push_data
Gitlab::DataBuilder::PushDataBuilder.
build(project, current_user, params[:oldrev], params[:newrev], params[:ref], [], '')
Gitlab::DataBuilder::Push.build(
project,
current_user,
params[:oldrev],
params[:newrev],
params[:ref],
[],
'')
end
end
......@@ -16,7 +16,7 @@ def execute
end
def hook_data
Gitlab::DataBuilder::NoteDataBuilder.build(@note, @note.author)
Gitlab::DataBuilder::Note.build(@note, @note.author)
end
def execute_note_hooks
......
class TestHookService
def execute(hook, current_user)
data = Gitlab::DataBuilder::PushDataBuilder.
build_sample(hook.project, current_user)
data = Gitlab::DataBuilder::Push.build_sample(hook.project, current_user)
hook.execute(data, 'push_hooks')
end
end
module Gitlab
module DataBuilder
module BuildDataBuilder
module Build
extend self
def build(build)
......
module Gitlab
module DataBuilder
module NoteDataBuilder
module Note
extend self
# Produce a hash of post-receive data
......
module Gitlab
module DataBuilder
module PipelineDataBuilder
module Pipeline
extend self
def build(pipeline)
......
module Gitlab
module DataBuilder
module PushDataBuilder
module Push
extend self
# Produce a hash of post-receive data
......
require 'spec_helper'
describe Gitlab::DataBuilder::BuildDataBuilder do
describe Gitlab::DataBuilder::Build do
let(:build) { create(:ci_build) }
describe '.build' do
......
require 'spec_helper'
describe Gitlab::DataBuilder::NoteDataBuilder, lib: true do
describe Gitlab::DataBuilder::Note, lib: true do
let(:project) { create(:project) }
let(:user) { create(:user) }
let(:data) { described_class.build(note, user) }
......
require 'spec_helper'
describe Gitlab::DataBuilder::PipelineDataBuilder do
describe Gitlab::DataBuilder::Pipeline do
let(:user) { create(:user) }
let(:project) { create(:project) }
......
require 'spec_helper'
describe Gitlab::DataBuilder::PushDataBuilder, lib: true do
describe Gitlab::DataBuilder::Push, lib: true do
let(:project) { create(:project) }
let(:user) { create(:user) }
......
......@@ -39,8 +39,7 @@
token: 'verySecret',
subdomain: 'project_name'
)
@sample_data = Gitlab::DataBuilder::PushDataBuilder.
build_sample(project, user)
@sample_data = Gitlab::DataBuilder::Push.build_sample(project, user)
@api_url = 'https://atlas.assembla.com/spaces/project_name/github_tool?secret_key=verySecret'
WebMock.stub_request(:post, @api_url)
end
......
......@@ -2,7 +2,7 @@
describe BuildsEmailService do
let(:data) do
Gitlab::DataBuilder::BuildDataBuilder.build(create(:ci_build))
Gitlab::DataBuilder::Build.build(create(:ci_build))
end
describe 'Validations' do
......@@ -41,7 +41,7 @@
describe '#test' do
it 'sends email' do
data = Gitlab::DataBuilder::BuildDataBuilder.build(create(:ci_build))
data = Gitlab::DataBuilder::Build.build(create(:ci_build))
subject.recipients = 'test@gitlab.com'
expect(BuildEmailWorker).to receive(:perform_async)
......@@ -51,7 +51,7 @@
context 'notify only failed builds is true' do
it 'sends email' do
data = Gitlab::DataBuilder::BuildDataBuilder.build(create(:ci_build))
data = Gitlab::DataBuilder::Build.build(create(:ci_build))
data[:build_status] = "success"
subject.recipients = 'test@gitlab.com'
......
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