Commit e3bc0e21 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Ensure GitLab CI project exists when CI service is activated manually

When I check activeated checkbox in project services for GitLab CI it
cause half-working state when gitlab_ci_project is missing. This patch
fixes it until we have proper behaviour implemented later
Signed-off-by: default avatarDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
parent 3fa8bd0e
...@@ -22,12 +22,17 @@ class GitlabCiService < CiService ...@@ -22,12 +22,17 @@ class GitlabCiService < CiService
include Gitlab::Application.routes.url_helpers include Gitlab::Application.routes.url_helpers
after_save :compose_service_hook, if: :activated? after_save :compose_service_hook, if: :activated?
after_save :ensure_gitlab_ci_project, if: :activated?
def compose_service_hook def compose_service_hook
hook = service_hook || build_service_hook hook = service_hook || build_service_hook
hook.save hook.save
end end
def ensure_gitlab_ci_project
project.ensure_gitlab_ci_project
end
def supported_events def supported_events
%w(push tag_push) %w(push tag_push)
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment