diff options
| author | Grzegorz Bizon <grzegorz@gitlab.com> | 2015-12-18 18:48:06 +0000 |
|---|---|---|
| committer | Grzegorz Bizon <grzegorz@gitlab.com> | 2015-12-18 18:48:06 +0000 |
| commit | 27859f7ed9e1efe98b8386844d0a7e69fd58277a (patch) | |
| tree | 08add401475c571e9f5ab63b558136aed051f92d /app/services | |
| parent | 3ca78f015afd02503d96bd8837ae55d2ad62db13 (diff) | |
| parent | 742089ae04f60012a15564a3efc4d3152ff4bcdb (diff) | |
| download | gitlab-ce-27859f7ed9e1efe98b8386844d0a7e69fd58277a.tar.gz | |
Merge branch 'ci-commit-status-skipped' into 'master'
Don't create CI status for refs that doesn't have .gitlab-ci.yml, even if the builds are enabled
Fixes #3827
Fixes #4157
/cc @grzesiek @dblessing
See merge request !2139
Diffstat (limited to 'app/services')
| -rw-r--r-- | app/services/create_commit_builds_service.rb | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/app/services/create_commit_builds_service.rb b/app/services/create_commit_builds_service.rb index 759c334ebe9..31b407efeb1 100644 --- a/app/services/create_commit_builds_service.rb +++ b/app/services/create_commit_builds_service.rb @@ -16,9 +16,23 @@ class CreateCommitBuildsService return false end - tag = Gitlab::Git.tag_ref?(origin_ref) - commit = project.ensure_ci_commit(sha) + commit = project.ci_commit(sha) + unless commit + commit = project.ci_commits.new(sha: sha) + + # 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! + end + + # Skip creating builds for commits that have [ci skip] unless commit.skip_ci? + # Create builds for commit + tag = Gitlab::Git.tag_ref?(origin_ref) commit.update_committed! commit.create_builds(ref, tag, user) end |
