Skip to content
Snippets Groups Projects
Commit d5264e88 authored by Lin Jen-Shin's avatar Lin Jen-Shin
Browse files
parent 0a20897b
No related branches found
No related tags found
No related merge requests found
Showing
with 62 additions and 33 deletions
Loading
Loading
@@ -343,7 +343,7 @@ module Ci
 
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)
Loading
Loading
Loading
Loading
@@ -222,7 +222,7 @@ module Ci
end
 
def pipeline_data
Gitlab::DataBuilder::PipelineDataBuilder.build(self)
Gitlab::DataBuilder::Pipeline.build(self)
end
 
def keep_around_commits
Loading
Loading
Loading
Loading
@@ -51,8 +51,7 @@ class BuildsEmailService < Service
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
Loading
Loading
Loading
Loading
@@ -80,7 +80,7 @@ class Service < ActiveRecord::Base
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
Loading
Loading
Loading
Loading
@@ -39,7 +39,12 @@ class DeleteBranchService < BaseService
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
Loading
Loading
@@ -33,7 +33,12 @@ class DeleteTagService < BaseService
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
Loading
Loading
@@ -138,13 +138,23 @@ class GitPushService < BaseService
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?
Loading
Loading
Loading
Loading
@@ -34,12 +34,24 @@ class GitTagPushService < BaseService
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
Loading
Loading
@@ -16,7 +16,7 @@ module Notes
end
 
def hook_data
Gitlab::DataBuilder::NoteDataBuilder.build(@note, @note.author)
Gitlab::DataBuilder::Note.build(@note, @note.author)
end
 
def execute_note_hooks
Loading
Loading
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)
Loading
Loading
module Gitlab
module DataBuilder
module NoteDataBuilder
module Note
extend self
 
# Produce a hash of post-receive data
Loading
Loading
module Gitlab
module DataBuilder
module PipelineDataBuilder
module Pipeline
extend self
 
def build(pipeline)
Loading
Loading
module Gitlab
module DataBuilder
module PushDataBuilder
module Push
extend self
 
# Produce a hash of post-receive data
Loading
Loading
require 'spec_helper'
 
describe Gitlab::DataBuilder::BuildDataBuilder do
describe Gitlab::DataBuilder::Build do
let(:build) { create(:ci_build) }
 
describe '.build' do
Loading
Loading
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) }
Loading
Loading
require 'spec_helper'
 
describe Gitlab::DataBuilder::PipelineDataBuilder do
describe Gitlab::DataBuilder::Pipeline do
let(:user) { create(:user) }
let(:project) { create(:project) }
 
Loading
Loading
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) }
 
Loading
Loading
Loading
Loading
@@ -39,8 +39,7 @@ describe AssemblaService, models: true do
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
Loading
Loading
Loading
Loading
@@ -2,7 +2,7 @@ require 'spec_helper'
 
describe BuildsEmailService do
let(:data) do
Gitlab::DataBuilder::BuildDataBuilder.build(create(:ci_build))
Gitlab::DataBuilder::Build.build(create(:ci_build))
end
 
describe 'Validations' do
Loading
Loading
@@ -41,7 +41,7 @@ describe BuildsEmailService do
 
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)
Loading
Loading
@@ -51,7 +51,7 @@ describe BuildsEmailService do
 
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'
 
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment