diff options
author | Toon Claes <toon@gitlab.com> | 2019-05-28 22:16:22 +0300 |
---|---|---|
committer | Toon Claes <toon@gitlab.com> | 2019-07-01 14:40:21 +0300 |
commit | 9d5526073782744a8553fc6b689174a46c29e851 (patch) | |
tree | 4173c2cc96ddd4f59d5256a0c8ebe05552ca6dd9 | |
parent | 66f97f06332dc8e960eb1b8210a8d1b57c7e5d8e (diff) |
Remove unused files and gdk-defaults.yml.erb
We no longer need these.
-rw-r--r-- | Makefile | 2 | ||||
-rw-r--r-- | gdk-defaults.yml.erb | 91 | ||||
-rw-r--r-- | lib/gdk/config_file.rb | 71 | ||||
-rw-r--r-- | lib/gdk/defaults.rb | 23 |
4 files changed, 1 insertions, 186 deletions
@@ -325,7 +325,7 @@ support-setup: .ruby-version foreman Procfile redis gitaly-setup jaeger-setup po gdk.yml: touch $@ -Procfile: Procfile.erb gdk.yml gdk-defaults.yml.erb auto_devops_enabled auto_devops_gitlab_port auto_devops_registry_port +Procfile: Procfile.erb gdk.yml auto_devops_enabled auto_devops_gitlab_port auto_devops_registry_port rake $@ redis: redis/redis.conf diff --git a/gdk-defaults.yml.erb b/gdk-defaults.yml.erb deleted file mode 100644 index 9e4dcb8ea39..00000000000 --- a/gdk-defaults.yml.erb +++ /dev/null @@ -1,91 +0,0 @@ -# This file contains the defaults for GDK -# It is a YAML file, but it will be processed as ERB first - -repositories: - gitlab: https://gitlab.com/gitlab-org/gitlab-ce.git - gitlab_shell: https://gitlab.com/gitlab-org/gitlab-shell.git - gitlab_workhorse: https://gitlab.com/gitlab-org/gitlab-workhorse.git - gitaly: https://gitlab.com/gitlab-org/gitaly.git - gitaly_proto: https://gitlab.com/gitlab-org/gitaly-proto.git - gitlab_pages: https://gitlab.com/gitlab-org/gitlab-pages.git - gitlab_docs: https://gitlab.com/gitlab-com/gitlab-docs.git - -gdk_root: <%= cmd!('pwd') %> -#<% if config.auto_devops.enabled %> -hostname: <%= "#{config.auto_devops.gitlab.port}.qa-tunnel.gitlab.info" %> -port: 443 -https: true -#<% else %> -hostname: <%= read!('hostname') || 'localhost' %> -port: <%= read!('port') || 3000 %> -https: <%= read!('https_enabled') || false %> -#<% end %> - -relative_url_root: <%= read!('relative_url_root') || nil %> -username: <%= cmd!('whoami') %> - -webpack: - port: <%= read!('webpack_port') || 3808 %> - -registry: -#<% if config.auto_devops.enabled %> - enabled: true - host: <%= "#{config.auto_devops.registry.port}.qa-tunnel.gitlab.info" %> - port: <%= config.auto_devops.registry.port %> - external_port: 443 -#<% else %> - enabled: <%= read!('registry_enabled') || false %> - host: 127.0.0.1 - port: <%= read!('registry_port') || 5000 %> - external_port: 5000 -#<% end %> - -object_store: - enabled: <%= read!('object_store_enabled') || false %> - port: <%= read!('object_store_port') || 9000 %> - -gitlab_pages: - enabled: true - port: <%= read!('gitlab_pages_port') || 3010 %> - -auto_devops: - enabled: <%= read!('auto_devops_enabled') || false %> - gitlab: - port: <%= read_or_write!('auto_devops_gitlab_port', rand(20000..24999)) %> - registry: - port: <%= read!('auto_devops_registry_port') || (config.auto_devops.gitlab.port.to_i + 5000) %> - -geo: - enabled: false - -elasticsearch: - version: 6.5.1 - checksum: 5903e1913a7c96aad96a8227517c40490825f672 - -tracer: - build_tags: tracer_static tracer_static_jaeger - jaeger: - enabled: true - version: 1.10.1 - -nginx: - enabled: false - bin: <%= cmd!('which nginx') %> - workhorse_port: 3333 - -postgresql: - bin_dir: <%= cmd!('support/pg_bindir') %> - replication_user: gitlab_replication - dir: <%= config.gdk_root %>/postgresql - data_dir: <%= config.postgresql.dir %>/data - replica_dir: <%= config.gdk_root %>/postgresql-replica - geo_dir: <%= config.gdk_root %>/postgresql-geo - -gitaly: - assembly_dir: <%= config.gdk_root %>/gitaly/assembly - -sshd: - bin: <%= cmd!('which sshd') %> - -git: - bin: <%= cmd!('which git') %> diff --git a/lib/gdk/config_file.rb b/lib/gdk/config_file.rb deleted file mode 100644 index d29cb28cbd8..00000000000 --- a/lib/gdk/config_file.rb +++ /dev/null @@ -1,71 +0,0 @@ -# frozen_string_literal: true - -require 'yaml' -require 'erb' -require 'ostruct' - -module GDK - class ConfigFile - attr_reader :config - - def initialize(file) - load! File.read(file) - - # Run in a loop for variables that refer other variables - # See https://stackoverflow.com/a/7235513/89376 - while /<%=.*%>/.match(data) - load! ERB.new(data).result(config_binding) - end - end - - # Inspired by https://stackoverflow.com/a/34501230/89376 - def config_binding - binding.tap do |b| - b.local_variable_set(:config, config) - end - end - - def cmd!(cmd) - `#{cmd}`.chomp - end - - def read!(filename) - File.read(filename).chomp - rescue Errno::ENOENT - nil - end - - def read_or_write!(filename, value) - File.read(filename).chomp - rescue Errno::ENOENT - File.write(filename, value) - value - end - - private - - attr_reader :data - - def load!(data) - @data = data - @config = hashes2ostruct(YAML.safe_load(@data)) - end - - # From: https://www.dribin.org/dave/blog/archives/2006/11/17/hashes_to_ostruct/ - def hashes2ostruct(object) - case object - when Hash - object = object.clone - object.each do |key, value| - object[key] = hashes2ostruct(value) - end - OpenStruct.new(object) - when Array - object = object.clone - object.map! { |i| hashes2ostruct(i) } - else - object - end - end - end -end diff --git a/lib/gdk/defaults.rb b/lib/gdk/defaults.rb deleted file mode 100644 index a476a177128..00000000000 --- a/lib/gdk/defaults.rb +++ /dev/null @@ -1,23 +0,0 @@ -# frozen_string_literal: true - -require_relative 'config_file' - -module GDK - class Defaults < ConfigFile - FILE = 'gdk-defaults.yml.erb' - - def initialize - super(FILE) - end - - def respond_to_missing?(method_name, *_args) - config.respond_to?(method_name) || super - end - - def method_missing(method_name, *_args, &_block) - return config[method_name] if data.respond_to?(method_name) - - super - end - end -end |