diff options
author | Valery Sizov <vsv2711@gmail.com> | 2015-09-10 13:42:41 +0300 |
---|---|---|
committer | Valery Sizov <vsv2711@gmail.com> | 2015-09-10 13:42:41 +0300 |
commit | 381180bc27b7c4f0d54ca4a1599ad5d857a2086e (patch) | |
tree | 7fd9a727f7dccdc02648973d070c4eb1fa8fae6f | |
parent | 44261a5d9fd5b78f8a44fe330e2386525f4c3437 (diff) |
remove gitlab_ci config
-rw-r--r-- | app/helpers/ci/routes_helper.rb | 6 | ||||
-rw-r--r-- | app/helpers/ci/triggers_helper.rb | 2 | ||||
-rw-r--r-- | app/mailers/ci/notify.rb | 8 | ||||
-rw-r--r-- | app/models/ci/application_setting.rb | 4 | ||||
-rw-r--r-- | app/models/ci/build.rb | 2 | ||||
-rw-r--r-- | app/models/ci/project.rb | 2 | ||||
-rw-r--r-- | app/views/ci/projects/gitlab.html.haml | 1 | ||||
-rw-r--r-- | app/views/ci/projects/index.html.haml | 5 | ||||
-rw-r--r-- | config/gitlab_ci.yml.example | 68 | ||||
-rw-r--r-- | config/gitlab_ci.yml.example.development | 19 | ||||
-rw-r--r-- | config/initializers/1_settings.rb | 24 | ||||
-rw-r--r-- | config/initializers/3_ci_settings.rb | 61 | ||||
-rw-r--r-- | config/initializers/4_ci_app.rb | 2 |
13 files changed, 36 insertions, 168 deletions
diff --git a/app/helpers/ci/routes_helper.rb b/app/helpers/ci/routes_helper.rb index f22d5023db5..299a96edee4 100644 --- a/app/helpers/ci/routes_helper.rb +++ b/app/helpers/ci/routes_helper.rb @@ -5,9 +5,9 @@ module Ci def default_url_options { - host: Ci::Settings.gitlab_ci['host'], - protocol: Ci::Settings.gitlab_ci['https'] ? "https" : "http", - port: Ci::Settings.gitlab_ci['port'] + host: Settings.gitlab['host'], + protocol: Settings.gitlab['https'] ? "https" : "http", + port: Settings.gitlab['port'] } end end diff --git a/app/helpers/ci/triggers_helper.rb b/app/helpers/ci/triggers_helper.rb index caff54c3520..0d62bbf36b8 100644 --- a/app/helpers/ci/triggers_helper.rb +++ b/app/helpers/ci/triggers_helper.rb @@ -1,7 +1,7 @@ module Ci module TriggersHelper def build_trigger_url(project_id, ref_name) - "#{Ci::Settings.gitlab_ci.url}/api/v1/projects/#{project_id}/refs/#{ref_name}/trigger" + "#{Settings.gitlab_ci.url}/ci/api/v1/projects/#{project_id}/refs/#{ref_name}/trigger" end end end diff --git a/app/mailers/ci/notify.rb b/app/mailers/ci/notify.rb index 44e490e9b36..6dcc118ac05 100644 --- a/app/mailers/ci/notify.rb +++ b/app/mailers/ci/notify.rb @@ -5,10 +5,10 @@ module Ci add_template_helper Ci::ApplicationHelper add_template_helper Ci::GitlabHelper - default_url_options[:host] = GitlabCi.config.gitlab_ci.host - default_url_options[:protocol] = GitlabCi.config.gitlab_ci.protocol - default_url_options[:port] = GitlabCi.config.gitlab_ci.port if GitlabCi.config.gitlab_ci_on_non_standard_port? - default_url_options[:script_name] = GitlabCi.config.gitlab_ci.relative_url_root + default_url_options[:host] = Gitlab.config.gitlab.host + default_url_options[:protocol] = Gitlab.config.gitlab.protocol + default_url_options[:port] = Gitlab.config.gitlab.port unless Gitlab.config.gitlab_on_standard_port? + default_url_options[:script_name] = Gitlab.config.gitlab.relative_url_root default from: GitlabCi.config.gitlab_ci.email_from diff --git a/app/models/ci/application_setting.rb b/app/models/ci/application_setting.rb index 0ea2452e392..0cf496f7d81 100644 --- a/app/models/ci/application_setting.rb +++ b/app/models/ci/application_setting.rb @@ -19,8 +19,8 @@ module Ci def self.create_from_defaults create( - all_broken_builds: Ci::Settings.gitlab_ci['all_broken_builds'], - add_pusher: Ci::Settings.gitlab_ci['add_pusher'], + all_broken_builds: Settings.gitlab_ci['all_broken_builds'], + add_pusher: Settings.gitlab_ci['add_pusher'], ) end end diff --git a/app/models/ci/build.rb b/app/models/ci/build.rb index 64e7a600672..8096d4fa5ae 100644 --- a/app/models/ci/build.rb +++ b/app/models/ci/build.rb @@ -244,7 +244,7 @@ module Ci def dir_to_trace File.join( - Ci::Settings.gitlab_ci.builds_path, + Settings.gitlab_ci.builds_path, created_at.utc.strftime("%Y_%m"), project.id.to_s ) diff --git a/app/models/ci/project.rb b/app/models/ci/project.rb index dceca7a275a..9c9198302f6 100644 --- a/app/models/ci/project.rb +++ b/app/models/ci/project.rb @@ -211,7 +211,7 @@ module Ci end def gitlab_url - File.join(GitlabCi.config.gitlab_server.url, path) + File.join(Gitlab.config.gitlab.url, path) end def setup_finished? diff --git a/app/views/ci/projects/gitlab.html.haml b/app/views/ci/projects/gitlab.html.haml index 0344676680e..690b6cf3cdb 100644 --- a/app/views/ci/projects/gitlab.html.haml +++ b/app/views/ci/projects/gitlab.html.haml @@ -1,7 +1,6 @@ - if @offset == 0 .clearfix.light .pull-left.fetch-status - Fetched from GitLab (#{link_to GitlabCi.config.gitlab_server.url, GitlabCi.config.gitlab_server.url, no_turbolink}) - if params[:search].present? by keyword: "#{params[:search]}", %br diff --git a/app/views/ci/projects/index.html.haml b/app/views/ci/projects/index.html.haml index 69b6c8b4d6d..99d07329af0 100644 --- a/app/views/ci/projects/index.html.haml +++ b/app/views/ci/projects/index.html.haml @@ -8,14 +8,9 @@ .projects %p.fetch-status.light %i.fa.fa-refresh.fa-spin - Please wait while we fetch from GitLab (#{GitlabCi.config.gitlab_server.url}) :coffeescript $.get '#{gitlab_ci_projects_path}', (data) -> $(".projects").html data.html - $('.projects').on 'click', '.reset-cache', -> - $.get '#{gitlab_ci_projects_path}', { reset_cache: true }, (data) -> - $(".projects").html data.html - false CiPager.init "#{gitlab_ci_projects_path}", #{Ci::ProjectsController::PROJECTS_BATCH}, false - else diff --git a/config/gitlab_ci.yml.example b/config/gitlab_ci.yml.example deleted file mode 100644 index dd33daa5578..00000000000 --- a/config/gitlab_ci.yml.example +++ /dev/null @@ -1,68 +0,0 @@ -# If you change this file in a Merge Request, please also create -# a MR on https://gitlab.com/gitlab-org/omnibus-gitlab/merge_requests - -defaults: &defaults - gitlab_server: - url: 'https://gitlab.example.com/' # Replace with your gitlab server url - app_id: '' - app_secret: '' - - ## Gitlab CI settings - gitlab_ci: - ## Web server settings - host: localhost - port: 80 - https: false - - ## Email settings - # Email address used in the "From" field in mails sent by GitLab-CI - email_from: gitlab-ci@localhost - - # Email address of your support contact (default: same as email_from) - support_email: support@localhost - - # Default project notifications settings: - # - # Send emails only on broken builds (default: true) - # all_broken_builds: true - # - # Add pusher to recipients list (default: false) - # add_pusher: true - - # The location where build traces are stored (default: builds/). Relative paths are relative to Rails.root - # builds_path: builds/ - - ## Backup settings - backup: - path: "tmp/backups" # Relative paths are relative to Rails.root (default: tmp/backups/) - # keep_time: 604800 # default: 0 (forever) (in seconds) - # upload: - # # Fog storage connection settings, see http://fog.io/storage/ . - # connection: - # provider: AWS - # region: eu-west-1 - # aws_access_key_id: AKIAKIAKI - # aws_secret_access_key: 'secret123' - # # The remote 'directory' to store your backups. For S3, this would be the bucket name. - # remote_directory: 'my.s3.bucket' - # # Use multipart uploads when file size reaches 100MB, see - # # http://docs.aws.amazon.com/AmazonS3/latest/dev/uploadobjusingmpu.html - # multipart_chunk_size: 104857600 - - -development: - <<: *defaults - -test: - <<: *defaults - gitlab_server: - url: 'http://demo.gitlab.com/' - app_id: 'id' - app_secret: 'secret' - gitlab_ci: - host: localhost - port: 80 - https: false - -production: - <<: *defaults diff --git a/config/gitlab_ci.yml.example.development b/config/gitlab_ci.yml.example.development deleted file mode 100644 index d23c4daf464..00000000000 --- a/config/gitlab_ci.yml.example.development +++ /dev/null @@ -1,19 +0,0 @@ -development: - gitlab_server: - url: 'http://localhost:3000' - app_id: '' - app_secret: '' - - gitlab_ci: - host: localhost - port: 9000 - https: false -test: - gitlab_server: - url: 'http://demo.gitlab.com/' - app_id: '' - app_secret: '' - gitlab_ci: - host: localhost - port: 80 - https: false diff --git a/config/initializers/1_settings.rb b/config/initializers/1_settings.rb index 689c3f3049d..3893bd45cf5 100644 --- a/config/initializers/1_settings.rb +++ b/config/initializers/1_settings.rb @@ -18,7 +18,19 @@ class Settings < Settingslogic host.start_with?('www.') ? host[4..-1] : host end - private + def build_gitlab_ci_url + if gitlab_on_standard_port? + custom_port = nil + else + custom_port = ":#{gitlab.port}" + end + [ gitlab.protocol, + "://", + gitlab.host, + custom_port, + gitlab.relative_url_root + ].join('') + end def build_gitlab_shell_ssh_path_prefix if gitlab_shell.ssh_port != 22 @@ -160,6 +172,16 @@ Settings.gitlab['repository_downloads_path'] = File.absolute_path(Settings.gitla Settings.gitlab['restricted_signup_domains'] ||= [] Settings.gitlab['import_sources'] ||= ['github','bitbucket','gitlab','gitorious','google_code','fogbugz','git'] + +# +# CI +# +Settings['gitlab_ci'] ||= Settingslogic.new({}) +Settings.gitlab_ci['all_broken_builds'] = true if Settings.gitlab_ci['all_broken_builds'].nil? +Settings.gitlab_ci['add_pusher'] = false if Settings.gitlab_ci['add_pusher'].nil? +Settings.gitlab_ci['url'] ||= Settings.send(:build_gitlab_ci_url) +Settings.gitlab_ci['builds_path'] = File.expand_path(Settings.gitlab_ci['builds_path'] || "builds/", Rails.root + '/ci') + # # Reply by email # diff --git a/config/initializers/3_ci_settings.rb b/config/initializers/3_ci_settings.rb deleted file mode 100644 index 5cdff48d316..00000000000 --- a/config/initializers/3_ci_settings.rb +++ /dev/null @@ -1,61 +0,0 @@ -module Ci - class Settings < Settingslogic - source "#{Rails.root}/config/gitlab_ci.yml" - namespace Rails.env - - class << self - def gitlab_ci_on_non_standard_port? - ![443, 80].include?(gitlab_ci.port.to_i) - end - - private - - def build_gitlab_ci_url - if gitlab_ci_on_non_standard_port? - custom_port = ":#{gitlab_ci.port}" - else - custom_port = nil - end - [ gitlab_ci.protocol, - "://", - gitlab_ci.host, - custom_port, - gitlab_ci.relative_url_root - ].join('') - end - end - end -end - - -# -# GitlabCi -# -Ci::Settings['gitlab_ci'] ||= Settingslogic.new({}) -Ci::Settings.gitlab_ci['https'] = false if Ci::Settings.gitlab_ci['https'].nil? -Ci::Settings.gitlab_ci['host'] ||= 'localhost' -Ci::Settings.gitlab_ci['port'] ||= Ci::Settings.gitlab_ci.https ? 443 : 80 -Ci::Settings.gitlab_ci['relative_url_root'] ||= (ENV['RAILS_RELATIVE_URL_ROOT'] || '') + '/ci' -Ci::Settings.gitlab_ci['protocol'] ||= Ci::Settings.gitlab_ci.https ? "https" : "http" -Ci::Settings.gitlab_ci['email_from'] ||= "gitlab-ci@#{Ci::Settings.gitlab_ci.host}" -Ci::Settings.gitlab_ci['support_email'] ||= Ci::Settings.gitlab_ci.email_from -Ci::Settings.gitlab_ci['all_broken_builds'] = true if Ci::Settings.gitlab_ci['all_broken_builds'].nil? -Ci::Settings.gitlab_ci['add_pusher'] = false if Ci::Settings.gitlab_ci['add_pusher'].nil? -Ci::Settings.gitlab_ci['url'] ||= Ci::Settings.send(:build_gitlab_ci_url) -Ci::Settings.gitlab_ci['builds_path'] = File.expand_path(Ci::Settings.gitlab_ci['builds_path'] || "builds/", Rails.root + '/ci') - -# Compatibility with old config -Ci::Settings['gitlab_server_urls'] ||= Ci::Settings['allowed_gitlab_urls'] - -# -# Backup -# -Ci::Settings['backup'] ||= Settingslogic.new({}) -Ci::Settings.backup['keep_time'] ||= 0 -Ci::Settings.backup['path'] = File.expand_path(Ci::Settings.backup['path'] || "tmp/backups/", Rails.root) -Ci::Settings.backup['upload'] ||= Settingslogic.new({ 'remote_directory' => nil, 'connection' => nil }) -# Convert upload connection settings to use symbol keys, to make Fog happy -if Ci::Settings.backup['upload']['connection'] - Ci::Settings.backup['upload']['connection'] = Hash[Ci::Settings.backup['upload']['connection'].map { |k, v| [k.to_sym, v] }] -end -Ci::Settings.backup['upload']['multipart_chunk_size'] ||= 104857600 diff --git a/config/initializers/4_ci_app.rb b/config/initializers/4_ci_app.rb index 60a30bf3bb7..cac8edb32bf 100644 --- a/config/initializers/4_ci_app.rb +++ b/config/initializers/4_ci_app.rb @@ -5,6 +5,6 @@ module GitlabCi REGISTRATION_TOKEN = SecureRandom.hex(10) def self.config - Ci::Settings + Settings end end |