'NoMethodError (undefined method `ensure_gitlab_ci_project' for nil:NilClass)' when trying to enable GitLab CI

steps to reproduce

  • "Admin area"
  • "Service Templates"
  • "GitLab CI"
  • Tick the "Active" checkbox
  • "Save"

backtrace

Processing by Admin::ServicesController#update as HTML
  Parameters: {"utf8"=>"✓", "authenticity_token"=>"[FILTERED]", "service"=>{"active"=>"1", "push_events"=>"1", "tag_push_events"=>"1"}, "id"=>"2"}
Completed 500 Internal Server Error in 73ms (ActiveRecord: 6.2ms)

NoMethodError (undefined method `ensure_gitlab_ci_project' for nil:NilClass):
  app/models/project_services/gitlab_ci_service.rb:33:in `ensure_gitlab_ci_project'
  app/controllers/admin/services_controller.rb:16:in `update'
Assignee Loading
Time tracking Loading