summaryrefslogtreecommitdiff
path: root/app/services/ci/list_config_variables_service.rb
blob: 4a5b3a92a2cf6035b2f8e1ef3c85b272c9527499 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
# frozen_string_literal: true

module Ci
  class ListConfigVariablesService < ::BaseService
    def execute(sha)
      config = project.ci_config_for(sha)
      return {} unless config

      result = Gitlab::Ci::YamlProcessor.new(config, project: project,
                                                     user:    current_user,
                                                     sha:     sha).execute

      result.valid? ? result.variables_with_data : {}
    end
  end
end