diff options
Diffstat (limited to 'app')
-rw-r--r-- | app/finders/clusters/knative_serving_namespace_finder.rb | 25 | ||||
-rw-r--r-- | app/finders/clusters/knative_version_role_binding_finder.rb | 17 | ||||
-rw-r--r-- | app/models/project.rb | 2 | ||||
-rw-r--r-- | app/presenters/release_presenter.rb | 2 | ||||
-rw-r--r-- | app/services/ci/find_exposed_artifacts_service.rb | 2 | ||||
-rw-r--r-- | app/services/clusters/aws/provision_service.rb | 3 | ||||
-rw-r--r-- | app/services/clusters/kubernetes.rb | 3 | ||||
-rw-r--r-- | app/services/clusters/kubernetes/create_or_update_service_account_service.rb | 41 |
8 files changed, 5 insertions, 90 deletions
diff --git a/app/finders/clusters/knative_serving_namespace_finder.rb b/app/finders/clusters/knative_serving_namespace_finder.rb deleted file mode 100644 index b6cf84beb79..00000000000 --- a/app/finders/clusters/knative_serving_namespace_finder.rb +++ /dev/null @@ -1,25 +0,0 @@ -# frozen_string_literal: true - -module Clusters - class KnativeServingNamespaceFinder - attr_reader :cluster - - def initialize(cluster) - @cluster = cluster - end - - def execute - cluster.kubeclient&.get_namespace(Clusters::Kubernetes::KNATIVE_SERVING_NAMESPACE) - rescue Kubeclient::ResourceNotFoundError - nil - rescue Kubeclient::HttpError => e - # If the kubernetes auth engine is enabled, it will return 403 - if e.error_code == 403 - Gitlab::ErrorTracking.track_exception(e) - nil - else - raise - end - end - end -end diff --git a/app/finders/clusters/knative_version_role_binding_finder.rb b/app/finders/clusters/knative_version_role_binding_finder.rb deleted file mode 100644 index 26f5492840a..00000000000 --- a/app/finders/clusters/knative_version_role_binding_finder.rb +++ /dev/null @@ -1,17 +0,0 @@ -# frozen_string_literal: true - -module Clusters - class KnativeVersionRoleBindingFinder - attr_reader :cluster - - def initialize(cluster) - @cluster = cluster - end - - def execute - cluster.kubeclient&.get_cluster_role_binding(Clusters::Kubernetes::GITLAB_KNATIVE_VERSION_ROLE_BINDING_NAME) - rescue Kubeclient::ResourceNotFoundError - nil - end - end -end diff --git a/app/models/project.rb b/app/models/project.rb index cfdcdbed502..3f6c2d6a448 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -1320,7 +1320,7 @@ class Project < ApplicationRecord end def has_active_hooks?(hooks_scope = :push_hooks) - hooks.hooks_for(hooks_scope).any? || SystemHook.hooks_for(hooks_scope).any? + hooks.hooks_for(hooks_scope).any? || SystemHook.hooks_for(hooks_scope).any? || Gitlab::Plugin.any? end def has_active_services?(hooks_scope = :push_hooks) diff --git a/app/presenters/release_presenter.rb b/app/presenters/release_presenter.rb index b38bbc8d96c..099ac9b09cd 100644 --- a/app/presenters/release_presenter.rb +++ b/app/presenters/release_presenter.rb @@ -40,7 +40,7 @@ class ReleasePresenter < Gitlab::View::Presenter::Delegated def evidence_file_path return unless release.evidence.present? - evidence_project_release_url(project, tag, format: :json) + evidence_project_release_url(project, release.to_param, format: :json) end private diff --git a/app/services/ci/find_exposed_artifacts_service.rb b/app/services/ci/find_exposed_artifacts_service.rb index 5c75af294bf..d268252577f 100644 --- a/app/services/ci/find_exposed_artifacts_service.rb +++ b/app/services/ci/find_exposed_artifacts_service.rb @@ -46,6 +46,8 @@ module Ci # it could contain many. We only need to know whether it has 1 or more # artifacts, so fetching the first 2 would be sufficient. def first_2_metadata_entries_for_artifacts_paths(job) + return [] unless job.artifacts_metadata + job.artifacts_paths .lazy .map { |path| job.artifacts_metadata_entry(path, recursive: true) } diff --git a/app/services/clusters/aws/provision_service.rb b/app/services/clusters/aws/provision_service.rb index 35fe8433b4d..109e4c04a9c 100644 --- a/app/services/clusters/aws/provision_service.rb +++ b/app/services/clusters/aws/provision_service.rb @@ -38,8 +38,7 @@ module Clusters def credentials @credentials ||= Clusters::Aws::FetchCredentialsService.new( provision_role, - provider: provider, - region: provider.region + provider: provider ).execute end diff --git a/app/services/clusters/kubernetes.rb b/app/services/clusters/kubernetes.rb index 59cb1c4b3a9..d29519999b2 100644 --- a/app/services/clusters/kubernetes.rb +++ b/app/services/clusters/kubernetes.rb @@ -12,8 +12,5 @@ module Clusters GITLAB_KNATIVE_SERVING_ROLE_BINDING_NAME = 'gitlab-knative-serving-rolebinding' GITLAB_CROSSPLANE_DATABASE_ROLE_NAME = 'gitlab-crossplane-database-role' GITLAB_CROSSPLANE_DATABASE_ROLE_BINDING_NAME = 'gitlab-crossplane-database-rolebinding' - GITLAB_KNATIVE_VERSION_ROLE_NAME = 'gitlab-knative-version-role' - GITLAB_KNATIVE_VERSION_ROLE_BINDING_NAME = 'gitlab-knative-version-rolebinding' - KNATIVE_SERVING_NAMESPACE = 'knative-serving' end end diff --git a/app/services/clusters/kubernetes/create_or_update_service_account_service.rb b/app/services/clusters/kubernetes/create_or_update_service_account_service.rb index 046046bf5a3..d798dcdcfd3 100644 --- a/app/services/clusters/kubernetes/create_or_update_service_account_service.rb +++ b/app/services/clusters/kubernetes/create_or_update_service_account_service.rb @@ -49,14 +49,8 @@ module Clusters create_or_update_knative_serving_role create_or_update_knative_serving_role_binding - create_or_update_crossplane_database_role create_or_update_crossplane_database_role_binding - - return unless knative_serving_namespace - - create_or_update_knative_version_role - create_or_update_knative_version_role_binding end private @@ -70,12 +64,6 @@ module Clusters ).ensure_exists! end - def knative_serving_namespace - kubeclient.get_namespace(Clusters::Kubernetes::KNATIVE_SERVING_NAMESPACE) - rescue Kubeclient::ResourceNotFoundError - nil - end - def create_role_or_cluster_role_binding if namespace_creator kubeclient.create_or_update_role_binding(role_binding_resource) @@ -100,14 +88,6 @@ module Clusters kubeclient.update_role_binding(crossplane_database_role_binding_resource) end - def create_or_update_knative_version_role - kubeclient.update_cluster_role(knative_version_role_resource) - end - - def create_or_update_knative_version_role_binding - kubeclient.update_cluster_role_binding(knative_version_role_binding_resource) - end - def service_account_resource Gitlab::Kubernetes::ServiceAccount.new( service_account_name, @@ -186,27 +166,6 @@ module Clusters service_account_name: service_account_name ).generate end - - def knative_version_role_resource - Gitlab::Kubernetes::ClusterRole.new( - name: Clusters::Kubernetes::GITLAB_KNATIVE_VERSION_ROLE_NAME, - rules: [{ - apiGroups: %w(apps), - resources: %w(deployments), - verbs: %w(list get) - }] - ).generate - end - - def knative_version_role_binding_resource - subjects = [{ kind: 'ServiceAccount', name: service_account_name, namespace: service_account_namespace }] - - Gitlab::Kubernetes::ClusterRoleBinding.new( - Clusters::Kubernetes::GITLAB_KNATIVE_VERSION_ROLE_BINDING_NAME, - Clusters::Kubernetes::GITLAB_KNATIVE_VERSION_ROLE_NAME, - subjects - ).generate - end end end end |