diff options
author | Kamil Trzcinski <ayufan@ayufan.eu> | 2015-12-10 17:44:06 +0100 |
---|---|---|
committer | Kamil Trzcinski <ayufan@ayufan.eu> | 2015-12-11 18:02:09 +0100 |
commit | 64bfd9d71a4017e0b5336a2c1565926f4b8beedd (patch) | |
tree | 8b7770af4cf0e54db3ada26550af9cbda4eabbb0 /app/services/create_commit_builds_service.rb | |
parent | 8cdd54cc0696b76daa2baf463d02d944b50bac6a (diff) | |
download | gitlab-ce-64bfd9d71a4017e0b5336a2c1565926f4b8beedd.tar.gz |
Remove ci_ prefix from all ci related things
Diffstat (limited to 'app/services/create_commit_builds_service.rb')
-rw-r--r-- | app/services/create_commit_builds_service.rb | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/app/services/create_commit_builds_service.rb b/app/services/create_commit_builds_service.rb new file mode 100644 index 00000000000..886bd88d204 --- /dev/null +++ b/app/services/create_commit_builds_service.rb @@ -0,0 +1,29 @@ +class CreateCommitBuildsService + def execute(project, user, params) + return false unless project.builds_enabled? + + sha = params[:checkout_sha] || params[:after] + origin_ref = params[:ref] + + unless origin_ref && sha.present? + return false + end + + ref = origin_ref.gsub(/\Arefs\/(tags|heads)\//, '') + + # Skip branch removal + if sha == Ci::Git::BLANK_SHA + return false + end + + tag = origin_ref.start_with?('refs/tags/') + commit = project.ensure_ci_commit(sha) + unless commit.skip_ci? + commit.update_committed! + commit.create_builds(ref, tag, user) + end + + commit + end +end + |