diff options
author | Kamil Trzcinski <ayufan@ayufan.eu> | 2016-05-19 21:48:57 +0300 |
---|---|---|
committer | Kamil Trzcinski <ayufan@ayufan.eu> | 2016-05-19 23:51:41 +0300 |
commit | b876993677edde4fee3a8ed349c522f1542190f7 (patch) | |
tree | 4d764eec3bcd36e9cd9154b892fd3ba2d5bb7169 /app | |
parent | 86b22b4f153610993008e5f6fa65bca1fb57b659 (diff) |
Fix creation of Ci::Commit object which can lead to pending, failed in some scenarios
Diffstat (limited to 'app')
-rw-r--r-- | app/services/create_commit_builds_service.rb | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/app/services/create_commit_builds_service.rb b/app/services/create_commit_builds_service.rb index 0d2aa1ff03d..5b6fefe669e 100644 --- a/app/services/create_commit_builds_service.rb +++ b/app/services/create_commit_builds_service.rb @@ -18,19 +18,16 @@ class CreateCommitBuildsService return false end - commit = project.ci_commit(sha, ref) - unless commit - commit = project.ci_commits.new(sha: sha, ref: ref, before_sha: before_sha, tag: tag) + commit = Ci::Commit.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 - return false - end - - # Create a new ci_commit - commit.save! + # Skip creating ci_commit when no gitlab-ci.yml is found + unless commit.ci_yaml_file + return false end + # Create a new ci_commit + commit.save! + # Skip creating builds for commits that have [ci skip] unless commit.skip_ci? # Create builds for commit |