Welcome to mirror list, hosted at ThFree Co, Russian Federation.

schedule_installation_service.rb « applications « clusters « services « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 15c93f1e79b2a25abf41b04ef22e3be443dc5d41 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# frozen_string_literal: true

module Clusters
  module Applications
    class ScheduleInstallationService
      attr_reader :application

      def initialize(application)
        @application = application
      end

      def execute
        application.updateable? ? schedule_upgrade : schedule_install
      end

      private

      def schedule_upgrade
        application.make_scheduled!

        ClusterUpgradeAppWorker.perform_async(application.name, application.id)
      end

      def schedule_install
        application.make_scheduled!

        ClusterInstallAppWorker.perform_async(application.name, application.id)
      end
    end
  end
end