Rename commit
to pipeline
in application code
This commit is contained in:
parent
20c7144ed2
commit
393ec8e74a
2 changed files with 16 additions and 16 deletions
|
@ -1,7 +1,7 @@
|
|||
module Ci
|
||||
class CreateBuildsService
|
||||
def initialize(commit)
|
||||
@commit = commit
|
||||
def initialize(pipeline)
|
||||
@pipeline = pipeline
|
||||
end
|
||||
|
||||
def execute(stage, user, status, trigger_request = nil)
|
||||
|
@ -21,8 +21,8 @@ module Ci
|
|||
|
||||
builds_attrs.map do |build_attrs|
|
||||
# don't create the same build twice
|
||||
unless @commit.builds.find_by(ref: @commit.ref, tag: @commit.tag,
|
||||
trigger_request: trigger_request, name: build_attrs[:name])
|
||||
unless @pipeline.builds.find_by(ref: @pipeline.ref, tag: @pipeline.tag,
|
||||
trigger_request: trigger_request, name: build_attrs[:name])
|
||||
build_attrs.slice!(:name,
|
||||
:commands,
|
||||
:tag_list,
|
||||
|
@ -31,13 +31,13 @@ module Ci
|
|||
:stage,
|
||||
:stage_idx)
|
||||
|
||||
build_attrs.merge!(ref: @commit.ref,
|
||||
tag: @commit.tag,
|
||||
build_attrs.merge!(ref: @pipeline.ref,
|
||||
tag: @pipeline.tag,
|
||||
trigger_request: trigger_request,
|
||||
user: user,
|
||||
project: @commit.project)
|
||||
project: @pipeline.project)
|
||||
|
||||
@commit.builds.create!(build_attrs)
|
||||
@pipeline.builds.create!(build_attrs)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -45,7 +45,7 @@ module Ci
|
|||
private
|
||||
|
||||
def config_processor
|
||||
@config_processor ||= @commit.config_processor
|
||||
@config_processor ||= @pipeline.config_processor
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -18,23 +18,23 @@ class CreateCommitBuildsService
|
|||
return false
|
||||
end
|
||||
|
||||
commit = Ci::Pipeline.new(project: project, sha: sha, ref: ref, before_sha: before_sha, tag: tag)
|
||||
pipeline = Ci::Pipeline.new(project: project, sha: sha, ref: ref, before_sha: before_sha, tag: tag)
|
||||
|
||||
# Skip creating ci_commit when no gitlab-ci.yml is found
|
||||
unless commit.ci_yaml_file
|
||||
unless pipeline.ci_yaml_file
|
||||
return false
|
||||
end
|
||||
|
||||
# Create a new ci_commit
|
||||
commit.save!
|
||||
pipeline.save!
|
||||
|
||||
# Skip creating builds for commits that have [ci skip]
|
||||
unless commit.skip_ci?
|
||||
unless pipeline.skip_ci?
|
||||
# Create builds for commit
|
||||
commit.create_builds(user)
|
||||
pipeline.create_builds(user)
|
||||
end
|
||||
|
||||
commit.touch
|
||||
commit
|
||||
pipeline.touch
|
||||
pipeline
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue