diff options
Diffstat (limited to 'app/models/integrations/google_play.rb')
-rw-r--r-- | app/models/integrations/google_play.rb | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/app/models/integrations/google_play.rb b/app/models/integrations/google_play.rb index 9fa6dc19f11..5389e8dfa81 100644 --- a/app/models/integrations/google_play.rb +++ b/app/models/integrations/google_play.rb @@ -12,6 +12,7 @@ module Integrations } validates :service_account_key_file_name, presence: true validates :package_name, presence: true, format: { with: PACKAGE_NAME_REGEX } + validates :google_play_protected_refs, inclusion: [true, false] end field :package_name, @@ -25,6 +26,12 @@ module Integrations field :service_account_key, api_only: true + field :google_play_protected_refs, + type: :checkbox, + section: SECTION_TYPE_CONFIGURATION, + title: -> { s_('GooglePlayStore|Protected branches and tags only') }, + checkbox_label: -> { s_('GooglePlayStore|Only set variables on protected branches and tags') } + def title s_('GooglePlay|Google Play') end @@ -76,8 +83,9 @@ module Integrations { success: false, message: error } end - def ci_variables + def ci_variables(protected_ref:) return [] unless activated? + return [] if google_play_protected_refs && !protected_ref [ { key: 'SUPPLY_JSON_KEY_DATA', value: service_account_key, masked: true, public: false }, @@ -85,6 +93,11 @@ module Integrations ] end + def initialize_properties + super + self.google_play_protected_refs = true if google_play_protected_refs.nil? + end + private def client |