Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'app/services/ci/create_commit_service.rb')
-rw-r--r--app/services/ci/create_commit_service.rb34
1 files changed, 6 insertions, 28 deletions
diff --git a/app/services/ci/create_commit_service.rb b/app/services/ci/create_commit_service.rb
index 0a1abf89a95..479a2d6defc 100644
--- a/app/services/ci/create_commit_service.rb
+++ b/app/services/ci/create_commit_service.rb
@@ -1,7 +1,6 @@
module Ci
class CreateCommitService
- def execute(project, params)
- before_sha = params[:before]
+ def execute(project, user, params)
sha = params[:checkout_sha] || params[:after]
origin_ref = params[:ref]
@@ -16,34 +15,13 @@ module Ci
return false
end
- commit = project.commits.find_by_sha_and_ref(sha, ref)
-
- # Create commit if not exists yet
- unless commit
- data = {
- ref: ref,
- sha: sha,
- tag: origin_ref.start_with?('refs/tags/'),
- before_sha: before_sha,
- push_data: {
- before: before_sha,
- after: sha,
- ref: ref,
- user_name: params[:user_name],
- user_email: params[:user_email],
- repository: params[:repository],
- commits: params[:commits],
- total_commits_count: params[:total_commits_count],
- ci_yaml_file: params[:ci_yaml_file]
- }
- }
-
- commit = project.commits.create(data)
+ tag = origin_ref.start_with?('refs/tags/')
+ commit = project.gl_project.ensure_ci_commit(sha)
+ unless commit.skip_ci?
+ commit.update_committed!
+ commit.create_builds(ref, tag, user)
end
- commit.update_committed!
- commit.create_builds unless commit.builds.any?
-
commit
end
end