Commit 3577b57f authored by Kamil Trzcinski's avatar Kamil Trzcinski

Try to use `pipeline` where applicable

parent 717fdd6d
...@@ -118,12 +118,12 @@ module Ci ...@@ -118,12 +118,12 @@ module Ci
.reorder(iid: :asc) .reorder(iid: :asc)
merge_requests.find do |merge_request| merge_requests.find do |merge_request|
merge_request.commits.any? { |ci| ci.id == commit.sha } merge_request.commits.any? { |ci| ci.id == pipeline.sha }
end end
end end
def project_id def project_id
commit.project.id pipeline.project_id
end end
def project_name def project_name
...@@ -359,8 +359,8 @@ module Ci ...@@ -359,8 +359,8 @@ module Ci
end end
def global_yaml_variables def global_yaml_variables
if commit.config_processor if pipeline.config_processor
commit.config_processor.global_variables.map do |key, value| pipeline.config_processor.global_variables.map do |key, value|
{ key: key, value: value, public: true } { key: key, value: value, public: true }
end end
else else
...@@ -369,8 +369,8 @@ module Ci ...@@ -369,8 +369,8 @@ module Ci
end end
def job_yaml_variables def job_yaml_variables
if commit.config_processor if pipeline.config_processor
commit.config_processor.job_variables(name).map do |key, value| pipeline.config_processor.job_variables(name).map do |key, value|
{ key: key, value: value, public: true } { key: key, value: value, public: true }
end end
else else
......
...@@ -55,7 +55,7 @@ class CommitStatus < ActiveRecord::Base ...@@ -55,7 +55,7 @@ class CommitStatus < ActiveRecord::Base
delegate :sha, :short_sha, to: :commit delegate :sha, :short_sha, to: :commit
def before_sha def before_sha
commit.before_sha || Gitlab::Git::BLANK_SHA pipeline.before_sha || Gitlab::Git::BLANK_SHA
end end
def self.stages def self.stages
......
...@@ -3,7 +3,7 @@ module Gitlab ...@@ -3,7 +3,7 @@ module Gitlab
class << self class << self
def build(build) def build(build)
project = build.project project = build.project
commit = build.commit commit = build.pipeline
user = build.user user = build.user
data = { data = {
......
...@@ -43,7 +43,7 @@ FactoryGirl.define do ...@@ -43,7 +43,7 @@ FactoryGirl.define do
end end
after(:build) do |build, evaluator| after(:build) do |build, evaluator|
build.project = build.commit.project build.project = build.pipeline.project
end end
factory :ci_not_started_build do factory :ci_not_started_build do
......
...@@ -8,7 +8,7 @@ FactoryGirl.define do ...@@ -8,7 +8,7 @@ FactoryGirl.define do
finished_at 'Tue, 26 Jan 2016 08:23:42 +0100' finished_at 'Tue, 26 Jan 2016 08:23:42 +0100'
after(:build) do |build, evaluator| after(:build) do |build, evaluator|
build.project = build.commit.project build.project = build.pipeline.project
end end
factory :generic_commit_status, class: GenericCommitStatus do factory :generic_commit_status, class: GenericCommitStatus do
......
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