summaryrefslogtreecommitdiff
path: root/qa/qa/support/helpers/mask_token.rb
blob: 0c0af524c978d00f20886c2fa751ee0ca76fbe61 (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
# frozen_string_literal: true

module QA
  module Support
    module Helpers
      module MaskToken
        def use_ci_variable(name:, value:, project:)
          Resource::CiVariable.fabricate_via_api! do |ci_variable|
            ci_variable.project = project
            ci_variable.key = name
            ci_variable.value = value
            ci_variable.protected = true
          end
          "$#{name}"
        end

        def use_group_ci_variable(name:, value:, group:)
          Resource::GroupCiVariable.fabricate_via_api! do |ci_variable|
            ci_variable.group = group
            ci_variable.key = name
            ci_variable.value = value
            ci_variable.protected = true
          end
          "$#{name}"
        end
      end
    end
  end
end