Commit 381180bc authored by Valery Sizov's avatar Valery Sizov
Browse files

remove gitlab_ci config

parent 507a6f13e0d3
......@@ -5,9 +5,9 @@ class Base
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
......
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
......@@ -5,10 +5,10 @@ class Notify < ActionMailer::Base
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
......
......@@ -19,8 +19,8 @@ def self.current
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
......
......@@ -244,7 +244,7 @@ def trace=(trace)
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
)
......
......@@ -211,7 +211,7 @@ def execute_services(data)
end
def gitlab_url
File.join(GitlabCi.config.gitlab_server.url, path)
File.join(Gitlab.config.gitlab.url, path)
end
def setup_finished?
......
- 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
......
......@@ -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
......
# 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
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
......@@ -18,7 +18,19 @@ def get_host_without_www(url)
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 @@ def base_gitlab_url
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
#
......
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
......@@ -5,6 +5,6 @@ module GitlabCi
REGISTRATION_TOKEN = SecureRandom.hex(10)
def self.config
Ci::Settings
Settings
end
end
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment