summaryrefslogtreecommitdiff
path: root/lib/gitlab/ci/config.rb
blob: bbfa6cf7d05ab66d2061315f1667ef7e978007bf (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
module Gitlab
  module Ci
    ##
    # Base GitLab CI Configuration facade
    #
    class Config
      ##
      # Temporary delegations that should be removed after refactoring
      #
      delegate :before_script, :image, :services, :after_script, :variables,
               :stages, :cache, :jobs, to: :@global

      def initialize(config)
        @config = Loader.new(config).load!

        @global = Node::Global.new(@config)
        @global.compose!
      end

      def valid?
        @global.valid?
      end

      def errors
        @global.errors
      end

      def to_hash
        @config
      end
    end
  end
end