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

Try to use `pipeline` where applicable

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