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: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
This commit is contained in:
parent
3fa8bd0e67
commit
e3bc0e2104
1 changed files with 5 additions and 0 deletions
|
@ -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
|
||||||
|
|
Loading…
Reference in a new issue