diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2015-10-01 19:10:09 +0300 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2015-10-01 19:10:09 +0300 |
commit | e3bc0e210451494ad5290755a79a510ea5c9a18b (patch) | |
tree | 965aab881713448969874f4a7a251d446c3981b5 | |
parent | 3fa8bd0e67233cb3636490fb35993e2db3424772 (diff) |
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>
-rw-r--r-- | app/models/project_services/gitlab_ci_service.rb | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/app/models/project_services/gitlab_ci_service.rb b/app/models/project_services/gitlab_ci_service.rb index 436d4cfed81..a095eaaada1 100644 --- a/app/models/project_services/gitlab_ci_service.rb +++ b/app/models/project_services/gitlab_ci_service.rb @@ -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 |