debian-mirror-gitlab/app/models/project_ci_cd_setting.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

41 lines
1.1 KiB
Ruby
Raw Normal View History

2018-11-18 11:00:15 +05:30
# frozen_string_literal: true
2019-07-07 11:18:12 +05:30
class ProjectCiCdSetting < ApplicationRecord
2022-03-02 08:16:31 +05:30
include ChronicDurationAttribute
2023-07-09 08:55:56 +05:30
include IgnorableColumns
2022-03-02 08:16:31 +05:30
2018-10-15 14:42:47 +05:30
belongs_to :project, inverse_of: :ci_cd_settings
2022-03-02 08:16:31 +05:30
DEFAULT_GIT_DEPTH = 20
2019-09-04 21:01:54 +05:30
before_create :set_default_git_depth
validates :default_git_depth,
numericality: {
only_integer: true,
greater_than_or_equal_to: 0,
less_than_or_equal_to: 1000
},
allow_nil: true
2023-01-13 00:05:48 +05:30
attribute :forward_deployment_enabled, default: true
attribute :separated_caches, default: true
2020-03-13 15:44:24 +05:30
2022-03-02 08:16:31 +05:30
chronic_duration_attr :runner_token_expiration_interval_human_readable, :runner_token_expiration_interval
2023-07-09 08:55:56 +05:30
ignore_column :opt_in_jwt, remove_with: '16.2', remove_after: '2023-07-01'
2021-03-11 19:13:27 +05:30
def keep_latest_artifacts_available?
# The project level feature can only be enabled when the feature is enabled instance wide
Gitlab::CurrentSettings.current_application_settings.keep_latest_artifact? && keep_latest_artifact?
end
2019-09-04 21:01:54 +05:30
private
def set_default_git_depth
self.default_git_depth ||= DEFAULT_GIT_DEPTH
end
2018-10-15 14:42:47 +05:30
end
2019-12-04 20:38:33 +05:30
2021-06-08 01:23:25 +05:30
ProjectCiCdSetting.prepend_mod_with('ProjectCiCdSetting')