BigW Consortium Gitlab

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: 's avatarDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
parent 3fa8bd0e
......@@ -22,12 +22,17 @@ class GitlabCiService < CiService
include Gitlab::Application.routes.url_helpers
after_save :compose_service_hook, if: :activated?
after_save :ensure_gitlab_ci_project, if: :activated?
def compose_service_hook
hook = service_hook || build_service_hook
hook.save
end
def ensure_gitlab_ci_project
project.ensure_gitlab_ci_project
end
def supported_events
%w(push tag_push)
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