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

manual.rb « build « status « ci « gitlab « lib - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 5e77db3d3361a6788256430cb5d4824020f7400f (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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# frozen_string_literal: true

module Gitlab
  module Ci
    module Status
      module Build
        class Manual < Status::Extended
          def self.matches?(build, user)
            build.playable?
          end

          def illustration
            {
              image: 'illustrations/manual_action.svg',
              size: 'svg-394',
              title: _('This job requires a manual action'),
              content: illustration_content
            }
          end

          private

          def illustration_content
            if can?(user, :update_build, subject)
              manual_job_action_message
            else
              generic_permission_failure_message
            end
          end

          def manual_job_action_message
            if subject.retryable?
              _("You can modify this job's CI/CD variables before running it again.")
            else
              _('This job does not start automatically and must be started manually. You can add CI/CD variables below for last-minute configuration changes before starting the job.')
            end
          end

          def generic_permission_failure_message
            if subject.outdated_deployment?
              _("This deployment job does not run automatically and must be started manually, but it's older than the latest deployment, and therefore can't run.")
            else
              _("This job does not run automatically and must be started manually, but you do not have access to it.")
            end
          end
        end
      end
    end
  end
end

Gitlab::Ci::Status::Build::Manual.prepend_mod_with('Gitlab::Ci::Status::Build::Manual')