Commit d16fab6a authored by Shinya Maeda's avatar Shinya Maeda

Fix all deployment_platform(environment: ???)

parent 9dd4fc2d
......@@ -41,7 +41,7 @@ class Projects::BranchesController < Projects::ApplicationController
branch_name = sanitize(strip_tags(params[:branch_name]))
branch_name = Addressable::URI.unescape(branch_name)
redirect_to_autodeploy = project.empty_repo? && project.deployment_platform(environment: ???).present?
redirect_to_autodeploy = project.empty_repo? && project.deployment_platform.present?
result = CreateBranchService.new(project, current_user)
.execute(branch_name, ref)
......
......@@ -26,7 +26,7 @@ module AutoDevopsHelper
def auto_devops_warning_message(project)
missing_domain = !project.auto_devops&.has_domain?
missing_service = !project.deployment_platform(environment: ???)&.active?
missing_service = !project.deployment_platform&.active?
if missing_service
params = {
......
......@@ -377,7 +377,7 @@ module Ci
end
def has_kubernetes_active?
project.deployment_platform(environment: ???)&.active?
project.deployment_platform&.active?
end
def has_stage_seeds?
......
......@@ -906,7 +906,7 @@ class Project < ActiveRecord::Base
end
def deployment_platform(environment: nil)
@deployment_platform ||= clusters.where(environment_scope: '*').find_by(enabled: true)&.platform_kubernetes
@deployment_platform ||= clusters.find_by(enabled: true)&.platform_kubernetes
@deployment_platform ||= services.where(category: :deployment).reorder(nil).find_by(active: true)
end
......
......@@ -67,7 +67,7 @@
- if koding_enabled? && @repository.koding_yml.blank?
%li.missing
= link_to _('Set up Koding'), add_koding_stack_path(@project)
- if @repository.gitlab_ci_yml.blank? && @project.deployment_platform(environment: ???).present?
- if @repository.gitlab_ci_yml.blank? && @project.deployment_platform.present?
%li.missing
= link_to add_special_file_path(@project, file_name: '.gitlab-ci.yml', commit_message: 'Set up auto deploy', branch_name: 'auto-deploy', context: 'autodeploy') do
#{ _('Set up auto deploy') }
......
......@@ -9,6 +9,14 @@ module Gitlab
end
end
##
# TODO:
# KubernetesService is being replaced by Platform::Kubernetes.
# The new Platform::Kubernetes belongs to multiple environments in a project,
# which means we should do `project.deployment_platform(environment: job.environment)&.active?`
# to check the activeness of the corresponded Kubernetes instance.
# Currently, `kubernetes: active` keyword is defined as it takes an effect on project-wide,
# At some points, it also makes sense, therefore we need to figure out a better shape.
def satisfied_by?(pipeline)
pipeline.has_kubernetes_active?
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