Merge branch 'remove_standalone_ci' into 'master'
Remove part of the code for standalone GitLab CI Part of long standing issue #792 I am trying to be cautious here and not remove too much from the package. Idea is to have 2 stages: 1. This MR is first and removes the minimal amount of code. This will remove `gitlab-ci` build that takes time and the parts of the code that depend on it. Additionally it removes recipes that no longer run or are no longer needed. 1. In 9.0 I propose to remove all gitlab-ci mentions in the code which includes the temporary recipes written for the purpose of migration. See merge request !616
This commit is contained in:
commit
de6419c850
|
@ -67,7 +67,6 @@ dependency "remote-syslog" if ee
|
|||
dependency "logrotate"
|
||||
dependency "runit"
|
||||
dependency "nodejs"
|
||||
dependency "gitlab-ci"
|
||||
dependency "gitlab-rails"
|
||||
dependency "gitlab-shell"
|
||||
dependency "gitlab-workhorse"
|
||||
|
|
|
@ -1,83 +0,0 @@
|
|||
#
|
||||
# Copyright:: Copyright (c) 2014 GitLab B.V.
|
||||
# License:: Apache License, Version 2.0
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
name "gitlab-ci"
|
||||
default_version "master" # Nightly build
|
||||
|
||||
EE = system("#{Omnibus::Config.project_root}/support/is_gitlab_ee.sh")
|
||||
|
||||
dependency "ruby"
|
||||
dependency "bundler"
|
||||
dependency "rsync"
|
||||
dependency "postgresql"
|
||||
dependency "mysql-client" if EE
|
||||
|
||||
source :git => "git@dev.gitlab.org:gitlab/gitlab-ci.git"
|
||||
|
||||
build do
|
||||
env = with_standard_compiler_flags(with_embedded_path)
|
||||
|
||||
bundle_without = %w{development test}
|
||||
bundle_without << "mysql" unless EE
|
||||
bundle "install --without #{bundle_without.join(" ")} --path=#{install_dir}/embedded/service/gem --jobs #{workers}", :env => env
|
||||
|
||||
# Record the current Git revision to be displayed in the app
|
||||
command "git log --pretty=format:'%h' -n 1 > REVISION"
|
||||
|
||||
# In order to precompile the assets, we need to get to a state where rake can
|
||||
# load the Rails environment.
|
||||
copy 'config/application.yml.example', 'config/application.yml'
|
||||
copy 'config/database.yml.postgresql', 'config/database.yml'
|
||||
copy 'config/secrets.yml.example', 'config/secrets.yml'
|
||||
|
||||
assets_precompile_env = {
|
||||
"RAILS_ENV" => "production",
|
||||
"PATH" => "#{install_dir}/embedded/bin:#{ENV['PATH']}"
|
||||
}
|
||||
bundle "exec rake assets:precompile", :env => assets_precompile_env
|
||||
|
||||
# Tear down now that the assets:precompile is done.
|
||||
delete 'config/application.yml'
|
||||
delete 'config/database.yml'
|
||||
delete 'config/secrets.yml'
|
||||
delete '.secret'
|
||||
|
||||
# Remove directories that will be created by `gitlab-ctl reconfigure`
|
||||
delete 'log'
|
||||
delete 'tmp'
|
||||
delete 'builds'
|
||||
|
||||
# Because db/schema.rb is modified by `rake db:migrate` after installation,
|
||||
# keep a copy of schema.rb around in case we need it. (I am looking at you,
|
||||
# mysql-postgresql-converter.)
|
||||
copy 'db/schema.rb', 'db/schema.rb.bundled'
|
||||
|
||||
command "mkdir -p #{install_dir}/embedded/service/gitlab-ci"
|
||||
command "#{install_dir}/embedded/bin/rsync -a --delete --exclude=.git/*** --exclude=.gitignore ./ #{install_dir}/embedded/service/gitlab-ci/"
|
||||
|
||||
# Create a wrapper for the rake tasks of the Rails app
|
||||
erb :dest => "#{install_dir}/bin/gitlab-ci-rake",
|
||||
:source => "bundle_exec_wrapper.erb",
|
||||
:mode => 0755,
|
||||
:vars => {:command => 'rake "$@"', :install_dir => install_dir}
|
||||
|
||||
# Create a wrapper for the rails command, useful for e.g. `rails console`
|
||||
erb :dest => "#{install_dir}/bin/gitlab-ci-rails",
|
||||
:source => "bundle_exec_wrapper.erb",
|
||||
:mode => 0755,
|
||||
:vars => {:command => 'rails "$@"', :install_dir => install_dir}
|
||||
end
|
|
@ -1,29 +0,0 @@
|
|||
#!/bin/sh
|
||||
|
||||
error_echo()
|
||||
{
|
||||
echo "$1" 2>& 1
|
||||
}
|
||||
|
||||
gitlab_ci_rc='<%= install_dir %>/etc/gitlab-ci/gitlab-ci-rc'
|
||||
if ! [ -f ${gitlab_ci_rc} ] ; then
|
||||
error_echo "$0 error: could not load ${gitlab_ci_rc}"
|
||||
error_echo "Either you are not allowed to read the file, or it does not exist yet."
|
||||
error_echo "You can generate it with: sudo gitlab-ctl reconfigure"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
. ${gitlab_ci_rc}
|
||||
|
||||
cd <%= install_dir %>/embedded/service/gitlab-ci
|
||||
|
||||
if [ "$(id -n -u)" = "${gitlab_ci_user}" ] ; then
|
||||
# We are already running at the intended privilege; don't try to drop
|
||||
# privileges again because only root can do that (and we are apparently not
|
||||
# root!).
|
||||
privilege_drop=''
|
||||
else
|
||||
privilege_drop="-u ${gitlab_ci_user}"
|
||||
fi
|
||||
|
||||
exec <%= install_dir %>/embedded/bin/chpst -e <%= install_dir %>/etc/gitlab-ci/env ${privilege_drop} -U ${gitlab_ci_user} <%= install_dir %>/embedded/bin/bundle exec <%= command %>
|
|
@ -25,22 +25,6 @@ main() {
|
|||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -d ${DEST_DIR}/service/ci-unicorn ] ; then
|
||||
if ${DEST_DIR}/bin/gitlab-ci-rake -T | grep backup:create ; then
|
||||
# We are upgrading from a version which has CI backup task
|
||||
notify "Backing up GitLab CI SQL database"
|
||||
if ! ${DEST_DIR}/bin/gitlab-ci-rake backup:create ; then
|
||||
notify
|
||||
notify "Backup failed! If you want to skip this backup, run the following command and"
|
||||
notify "try again:"
|
||||
notify
|
||||
notify " sudo touch ${skip_migrations_file}"
|
||||
notify
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
notify() {
|
||||
|
|
|
@ -544,165 +544,10 @@ external_url 'GENERATED_EXTERNAL_URL'
|
|||
## see https://gitlab.com/gitlab-org/omnibus-gitlab/tree/629def0a7a26e7c2326566f0758d4a27857b52a3/doc/gitlab-ci/README.md
|
||||
|
||||
# ci_external_url 'http://ci.example.com'
|
||||
|
||||
|
||||
#################################
|
||||
# application.yml configuration #
|
||||
#################################
|
||||
|
||||
# gitlab_ci['gitlab_server'] = { "url" => 'http://gitlab.example.com', "app_id" => '12345678', "app_secret" => 'QWERTY12345' }
|
||||
|
||||
# gitlab_ci['gitlab_ci_email_from'] = 'gitlab-ci@example.com'
|
||||
# gitlab_ci['gitlab_ci_support_email'] = 'gitlab-ci@example.com'
|
||||
# gitlab_ci['gitlab_ci_all_broken_builds'] = true
|
||||
# gitlab_ci['gitlab_ci_add_pusher'] = true
|
||||
# gitlab_ci['builds_directory'] = '/var/opt/gitlab/gitlab-ci/builds'
|
||||
|
||||
# gitlab_ci['gravatar_enabled'] = true
|
||||
# gitlab_ci['gravatar_plain_url'] = "http://www.gravatar.com/avatar/%{hash}?s=%{size}&d=mm"
|
||||
# gitlab_ci['gravatar_ssl_url'] = "https://secure.gravatar.com/avatar/%{hash}?s=%{size}&d=mm"
|
||||
|
||||
## For setting up backups
|
||||
## see https://gitlab.com/gitlab-org/omnibus-gitlab/blob/629def0a7a26e7c2326566f0758d4a27857b52a3/README.md#backups
|
||||
|
||||
# gitlab_ci['backup_path'] = "/var/opt/gitlab/ci-backups"
|
||||
# gitlab_ci['backup_keep_time'] = 604800
|
||||
# gitlab_ci['backup_upload_connection'] = {
|
||||
# 'provider' => 'AWS',
|
||||
# 'region' => 'eu-west-1',
|
||||
# 'aws_access_key_id' => 'AKIAKIAKI',
|
||||
# 'aws_secret_access_key' => 'secret123'
|
||||
# }
|
||||
# gitlab_ci['backup_upload_remote_directory'] = 'my.s3.bucket'
|
||||
# gitlab_ci['backup_multipart_chunk_size'] = 104857600
|
||||
|
||||
###############################
|
||||
# GitLab CI database settings #
|
||||
###############################
|
||||
## see https://gitlab.com/gitlab-org/omnibus-gitlab/tree/629def0a7a26e7c2326566f0758d4a27857b52a3/doc/settings/database.md#database-settings
|
||||
## Only needed if you use an external database.
|
||||
|
||||
# gitlab_ci['db_adapter'] = "postgresql"
|
||||
# gitlab_ci['db_encoding'] = "unicode"
|
||||
# gitlab_ci['db_database'] = "gitlab_ci_production"
|
||||
# gitlab_ci['db_pool'] = 10
|
||||
# gitlab_ci['db_username'] = "gitlab_ci"
|
||||
# gitlab_ci['db_password'] = nil
|
||||
# gitlab_ci['db_host'] = nil
|
||||
# gitlab_ci['db_port'] = 5432
|
||||
# gitlab_ci['db_socket'] = nil
|
||||
# gitlab_ci['db_sslmode'] = nil
|
||||
# gitlab_ci['db_sslrootcert'] = nil
|
||||
|
||||
############################
|
||||
# GitLab CI redis settings #
|
||||
############################
|
||||
## see https://gitlab.com/gitlab-org/omnibus-gitlab/tree/629def0a7a26e7c2326566f0758d4a27857b52a3/doc/settings/redis.md#redis-settings
|
||||
## Connect to your own redis instance.
|
||||
|
||||
# gitlab_ci['redis_host'] = "127.0.0.1"
|
||||
# gitlab_ci['redis_port'] = nil
|
||||
# gitlab_ci['redis_socket'] = "/var/opt/gitlab/ci-redis/redis.socket"
|
||||
|
||||
###################################
|
||||
# GitLab CI email server settings #
|
||||
###################################
|
||||
## see https://gitlab.com/gitlab-org/omnibus-gitlab/tree/629def0a7a26e7c2326566f0758d4a27857b52a3/doc/settings/smtp.md#smtp-settings
|
||||
|
||||
# gitlab_ci['smtp_enable'] = true
|
||||
# gitlab_ci['smtp_address'] = "smtp.server"
|
||||
# gitlab_ci['smtp_port'] = 456
|
||||
# gitlab_ci['smtp_user_name'] = "smtp user"
|
||||
# gitlab_ci['smtp_password'] = "smtp password"
|
||||
# gitlab_ci['smtp_domain'] = "example.com"
|
||||
# gitlab_ci['smtp_authentication'] = "login"
|
||||
# gitlab_ci['smtp_enable_starttls_auto'] = true
|
||||
# gitlab_ci['smtp_tls'] = false
|
||||
# gitlab_ci['smtp_openssl_verify_mode'] = false
|
||||
|
||||
|
||||
#############
|
||||
# GitLab CI #
|
||||
#############
|
||||
|
||||
# gitlab_ci['schedule_builds_minute'] = "0"
|
||||
# gitlab_ci['env'] = {
|
||||
# 'BUNDLE_GEMFILE' => "/opt/gitlab/embedded/service/gitlab-ci/Gemfile",
|
||||
# 'PATH' => "/opt/gitlab/bin:/opt/gitlab/embedded/bin:/bin:/usr/bin"
|
||||
# }
|
||||
|
||||
# gitlab_ci['username'] = "gitlab-ci"
|
||||
# gitlab_ci['uid'] = nil
|
||||
# gitlab_ci['gid'] = nil
|
||||
|
||||
|
||||
#####################
|
||||
# GitLab CI Unicorn #
|
||||
#####################
|
||||
## Tweak unicorn settings.
|
||||
|
||||
# ci_unicorn['worker_processes'] = 2
|
||||
# ci_unicorn['worker_timeout'] = 60
|
||||
## Advanced settings
|
||||
# ci_unicorn['listen'] = '127.0.0.1'
|
||||
# ci_unicorn['port'] = 8181
|
||||
# ci_unicorn['socket'] = '/var/opt/gitlab/gitlab-ci/sockets/gitlab.socket'
|
||||
# ci_unicorn['pidfile'] = '/opt/gitlab/var/ci-unicorn/unicorn.pid'
|
||||
# ci_unicorn['tcp_nopush'] = true
|
||||
# ci_unicorn['backlog_socket'] = 1024
|
||||
|
||||
|
||||
###################
|
||||
# GitLab CI Redis #
|
||||
###################
|
||||
## see https://gitlab.com/gitlab-org/omnibus-gitlab/tree/629def0a7a26e7c2326566f0758d4a27857b52a3/doc/settings/redis.md
|
||||
## You can turn off bundled redis if you want to use your own redis instanance
|
||||
|
||||
# ci_redis['enable'] = true
|
||||
|
||||
|
||||
###################
|
||||
# GitLab CI NGINX #
|
||||
###################
|
||||
## see https://gitlab.com/gitlab-org/omnibus-gitlab/tree/629def0a7a26e7c2326566f0758d4a27857b52a3/doc/settings/nginx.md
|
||||
## You can tell the bundled NGINX that it should not serve up GitLab CI by setting ci_nginx['enable'] to false.
|
||||
|
||||
# ci_nginx['enable'] = false
|
||||
# ci_nginx['client_max_body_size'] = '250m'
|
||||
# ci_nginx['redirect_http_to_https'] = false
|
||||
# ci_nginx['redirect_http_to_https_port'] = 80
|
||||
# ci_nginx['ssl_certificate'] = "/etc/gitlab/ssl/#{node['fqdn']}.crt"
|
||||
# ci_nginx['ssl_certificate_key'] = "/etc/gitlab/ssl/#{node['fqdn']}.key"
|
||||
# ci_nginx['ssl_ciphers'] = "ECDHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES128-GCM-SHA256"
|
||||
# ci_nginx['ssl_prefer_server_ciphers'] = "on"
|
||||
# ci_nginx['ssl_protocols'] = "TLSv1 TLSv1.1 TLSv1.2" # recommended by https://raymii.org/s/tutorials/Strong_SSL_Security_On_nginx.html & https://cipherli.st/
|
||||
# ci_nginx['ssl_session_cache'] = "builtin:1000 shared:SSL:10m" # recommended in http://nginx.org/en/docs/http/ngx_http_ssl_module.html
|
||||
# ci_nginx['ssl_session_timeout'] = "5m" # default according to http://nginx.org/en/docs/http/ngx_http_ssl_module.html
|
||||
# ci_nginx['ssl_dhparam'] = nil # Path to ci_dhparams.pem, eg. /etc/gitlab/ssl/ci_dhparams.pem
|
||||
# ci_nginx['listen_addresses'] = ['*']
|
||||
# ci_nginx['listen_port'] = nil # override only if you use a reverse proxy: https://gitlab.com/gitlab-org/omnibus-gitlab/blob/master/doc/settings/nginx.md#setting-the-nginx-listen-port
|
||||
# ci_nginx['listen_https'] = nil # override only if your reverse proxy internally communicates over HTTP: https://gitlab.com/gitlab-org/omnibus-gitlab/blob/master/doc/settings/nginx.md#supporting-proxied-ssl
|
||||
# ci_nginx['custom_gitlab_ci_server_config'] = "location ^~ /foo-namespace/bar-project/raw/ {\n deny all;\n}\n"
|
||||
# ci_nginx['custom_nginx_config'] = "include /etc/nginx/conf.d/example.conf;"
|
||||
# ci_nginx['resolver'] = "8.8.8.8 8.8.4.4"
|
||||
|
||||
## Advanced settings
|
||||
# ci_nginx['dir'] = "/var/opt/gitlab/nginx"
|
||||
# ci_nginx['log_directory'] = "/var/log/gitlab/nginx"
|
||||
# ci_nginx['worker_processes'] = 4
|
||||
# ci_nginx['worker_connections'] = 10240
|
||||
# ci_nginx['sendfile'] = 'on'
|
||||
# ci_nginx['tcp_nopush'] = 'on'
|
||||
# ci_nginx['tcp_nodelay'] = 'on'
|
||||
# ci_nginx['gzip'] = "on"
|
||||
# ci_nginx['gzip_http_version'] = "1.0"
|
||||
# ci_nginx['gzip_comp_level'] = "2"
|
||||
# ci_nginx['gzip_proxied'] = "any"
|
||||
# ci_nginx['gzip_types'] = [ "text/plain", "text/css", "application/x-javascript", "text/xml", "application/xml", "application/xml+rss", "text/javascript", "application/json" ]
|
||||
# ci_nginx['keepalive_timeout'] = 65
|
||||
# ci_nginx['cache_max_size'] = '5000m'
|
||||
|
||||
|
||||
#####################
|
||||
# GitLab Mattermost #
|
||||
#####################
|
||||
|
|
|
@ -21,22 +21,12 @@ dependent_services = []
|
|||
dependent_services << "service[unicorn]" if OmnibusHelper.should_notify?("unicorn")
|
||||
dependent_services << "service[sidekiq]" if OmnibusHelper.should_notify?("sidekiq")
|
||||
|
||||
ci_dependent_services = []
|
||||
ci_dependent_services << "service[ci-sidekiq]" if OmnibusHelper.should_notify?("ci-sidekiq")
|
||||
ci_dependent_services << "service[ci-unicorn]" if OmnibusHelper.should_notify?("ci-unicorn")
|
||||
|
||||
|
||||
execute "initialize gitlab-rails database" do
|
||||
command "/opt/gitlab/bin/gitlab-rake db:schema:load db:seed_fu"
|
||||
environment ({'GITLAB_ROOT_PASSWORD' => initial_root_password }) if initial_root_password
|
||||
action :nothing
|
||||
end
|
||||
|
||||
execute "initialize gitlab-ci database" do
|
||||
command "/opt/gitlab/bin/gitlab-ci-rake setup"
|
||||
action :nothing
|
||||
end
|
||||
|
||||
migrate_database 'gitlab-rails' do
|
||||
command '/opt/gitlab/bin/gitlab-rake db:migrate'
|
||||
action :nothing
|
||||
|
|
|
@ -73,7 +73,6 @@ end
|
|||
include_recipe "gitlab::gitlab-ci_disable"
|
||||
|
||||
include_recipe "gitlab::selinux"
|
||||
include_recipe "gitlab::cron"
|
||||
|
||||
# Create dummy unicorn and sidekiq services to receive notifications, in case
|
||||
# the corresponding service recipe is not loaded below.
|
||||
|
|
|
@ -1,214 +0,0 @@
|
|||
#
|
||||
# Copyright:: Copyright (c) 2012 Opscode, Inc.
|
||||
# Copyright:: Copyright (c) 2014 GitLab B.V.
|
||||
# License:: Apache License, Version 2.0
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
package_install_dir = node['package']['install-dir']
|
||||
gitlab_ci_source_dir = "/opt/gitlab/embedded/service/gitlab-ci"
|
||||
gitlab_ci_dir = node['gitlab']['gitlab-ci']['dir']
|
||||
gitlab_ci_home_dir = File.join(gitlab_ci_dir, "home")
|
||||
gitlab_ci_etc_dir = File.join(gitlab_ci_dir, "etc")
|
||||
gitlab_ci_static_etc_dir = "/opt/gitlab/etc/gitlab-ci"
|
||||
gitlab_ci_working_dir = File.join(gitlab_ci_dir, "working")
|
||||
gitlab_ci_tmp_dir = File.join(gitlab_ci_dir, "tmp")
|
||||
gitlab_ci_log_dir = node['gitlab']['gitlab-ci']['log_directory']
|
||||
gitlab_ci_builds_dir = node['gitlab']['gitlab-ci']['builds_directory']
|
||||
|
||||
gitlab_ci_user = AccountHelper.new(node).gitlab_ci_user
|
||||
gitlab_app = "gitlab-ci"
|
||||
|
||||
account "GitLab CI user and group" do
|
||||
username gitlab_ci_user
|
||||
uid node['gitlab']['gitlab-ci']['uid']
|
||||
ugid gitlab_ci_user
|
||||
groupname gitlab_ci_user
|
||||
gid node['gitlab']['gitlab-ci']['gid']
|
||||
shell node['gitlab']['gitlab-ci']['shell']
|
||||
home gitlab_ci_home_dir
|
||||
manage node['gitlab']['manage-accounts']['enable']
|
||||
end
|
||||
|
||||
[
|
||||
gitlab_ci_etc_dir,
|
||||
gitlab_ci_static_etc_dir,
|
||||
gitlab_ci_home_dir,
|
||||
gitlab_ci_working_dir,
|
||||
gitlab_ci_tmp_dir,
|
||||
node['gitlab']['gitlab-ci']['backup_path'],
|
||||
gitlab_ci_log_dir,
|
||||
gitlab_ci_builds_dir
|
||||
].compact.each do |dir_name|
|
||||
directory dir_name do
|
||||
owner gitlab_ci_user
|
||||
mode '0700'
|
||||
recursive true
|
||||
end
|
||||
end
|
||||
|
||||
directory gitlab_ci_dir do
|
||||
owner gitlab_ci_user
|
||||
mode '0755'
|
||||
recursive true
|
||||
end
|
||||
|
||||
template File.join(gitlab_ci_static_etc_dir, "gitlab-ci-rc")
|
||||
|
||||
dependent_services = []
|
||||
dependent_services << "service[ci-unicorn]" if OmnibusHelper.should_notify?("ci-unicorn")
|
||||
dependent_services << "service[ci-sidekiq]" if OmnibusHelper.should_notify?("ci-sidekiq")
|
||||
|
||||
redis_not_listening = OmnibusHelper.not_listening?("redis")
|
||||
postgresql_not_listening = OmnibusHelper.not_listening?("postgresql")
|
||||
|
||||
template_symlink File.join(gitlab_ci_etc_dir, "secret") do
|
||||
link_from File.join(gitlab_ci_source_dir, ".secret")
|
||||
source "secret_token.erb"
|
||||
owner "root"
|
||||
group "root"
|
||||
mode "0644"
|
||||
variables(node['gitlab']['gitlab-ci'].to_hash)
|
||||
restarts dependent_services
|
||||
end
|
||||
|
||||
template_symlink File.join(gitlab_ci_etc_dir, "database.yml") do
|
||||
link_from File.join(gitlab_ci_source_dir, "config/database.yml")
|
||||
source "database.yml.erb"
|
||||
owner "root"
|
||||
group "root"
|
||||
mode "0644"
|
||||
variables node['gitlab']['gitlab-ci'].to_hash
|
||||
helpers SingleQuoteHelper
|
||||
restarts dependent_services
|
||||
end
|
||||
|
||||
template_symlink File.join(gitlab_ci_etc_dir, "secrets.yml") do
|
||||
link_from File.join(gitlab_ci_source_dir, "config/secrets.yml")
|
||||
source "secrets.yml.erb"
|
||||
owner "root"
|
||||
group "root"
|
||||
mode "0644"
|
||||
variables node['gitlab']['gitlab-ci'].to_hash
|
||||
helpers SingleQuoteHelper
|
||||
restarts dependent_services
|
||||
end
|
||||
|
||||
if node['gitlab']['gitlab-ci']['redis_port']
|
||||
redis_url = "redis://#{node['gitlab']['gitlab-ci']['redis_host']}:#{node['gitlab']['gitlab-ci']['redis_port']}"
|
||||
else
|
||||
redis_url = "unix:#{node['gitlab']['gitlab-ci']['redis_socket']}"
|
||||
end
|
||||
|
||||
template_symlink File.join(gitlab_ci_etc_dir, "resque.yml") do
|
||||
link_from File.join(gitlab_ci_source_dir, "config/resque.yml")
|
||||
source "resque.yml.erb"
|
||||
owner "root"
|
||||
group "root"
|
||||
mode "0644"
|
||||
variables(:redis_url => redis_url)
|
||||
restarts dependent_services
|
||||
end
|
||||
|
||||
template_symlink File.join(gitlab_ci_etc_dir, "smtp_settings.rb") do
|
||||
link_from File.join(gitlab_ci_source_dir, "config/initializers/smtp_settings.rb")
|
||||
owner "root"
|
||||
group "root"
|
||||
mode "0644"
|
||||
variables(
|
||||
node['gitlab']['gitlab-ci'].to_hash.merge(
|
||||
:app => gitlab_app
|
||||
)
|
||||
)
|
||||
restarts dependent_services
|
||||
|
||||
unless node['gitlab']['gitlab-ci']['smtp_enable']
|
||||
action :delete
|
||||
end
|
||||
end
|
||||
|
||||
unicorn_url = "http://#{node['gitlab']['unicorn']['listen']}:#{node['gitlab']['unicorn']['port']}"
|
||||
|
||||
pg_helper = PgHelper.new(node)
|
||||
database_ready = pg_helper.is_running? && pg_helper.database_exists?(node['gitlab']['gitlab-rails']['db_database'])
|
||||
|
||||
gitlab_server = if node['gitlab']['gitlab-ci']['gitlab_server']
|
||||
node['gitlab']['gitlab-ci']['gitlab_server']
|
||||
else
|
||||
database_ready ? CiHelper.authorize_with_gitlab(Gitlab['external_url']):{}
|
||||
end
|
||||
|
||||
template_symlink File.join(gitlab_ci_etc_dir, "application.yml") do
|
||||
link_from File.join(gitlab_ci_source_dir, "config/application.yml")
|
||||
source "application.yml.erb"
|
||||
helpers SingleQuoteHelper
|
||||
owner "root"
|
||||
group "root"
|
||||
mode "0644"
|
||||
variables(
|
||||
node['gitlab']['gitlab-ci'].to_hash.merge(
|
||||
:gitlab_server => gitlab_server
|
||||
)
|
||||
)
|
||||
restarts dependent_services
|
||||
unless redis_not_listening
|
||||
notifies :run, 'execute[clear the gitlab-ci cache]'
|
||||
end
|
||||
end
|
||||
|
||||
env_dir File.join(gitlab_ci_static_etc_dir, 'env') do
|
||||
variables(
|
||||
{
|
||||
'HOME' => gitlab_ci_home_dir,
|
||||
'RAILS_ENV' => node['gitlab']['gitlab-ci']['environment'],
|
||||
}.merge(node['gitlab']['gitlab-ci']['env'])
|
||||
)
|
||||
restarts dependent_services
|
||||
end
|
||||
|
||||
# replace empty directories in the Git repo with symlinks to /var/opt/gitlab
|
||||
{
|
||||
"#{package_install_dir}/embedded/service/gitlab-ci/tmp" => gitlab_ci_tmp_dir,
|
||||
"#{package_install_dir}/embedded/service/gitlab-ci/log" => gitlab_ci_log_dir,
|
||||
"#{package_install_dir}/embedded/service/gitlab-ci/builds" => gitlab_ci_builds_dir
|
||||
}.each do |link_dir, target_dir|
|
||||
link link_dir do
|
||||
to target_dir
|
||||
end
|
||||
end
|
||||
|
||||
# Create tmp/cache to make 'rake cache:clear' work
|
||||
directory File.join(gitlab_ci_tmp_dir, 'cache') do
|
||||
user gitlab_ci_user
|
||||
end
|
||||
|
||||
# Make schema.rb writable for when we run `rake db:migrate`
|
||||
file "/opt/gitlab/embedded/service/gitlab-ci/db/schema.rb" do
|
||||
owner gitlab_ci_user
|
||||
end
|
||||
|
||||
# Only run `rake db:migrate` when the gitlab-ci version has changed
|
||||
remote_file File.join(gitlab_ci_dir, 'VERSION') do
|
||||
source "file:///opt/gitlab/embedded/service/gitlab-ci/VERSION"
|
||||
notifies :run, 'bash[migrate gitlab-ci database]' unless postgresql_not_listening
|
||||
notifies :run, 'execute[clear the gitlab-ci cache]' unless redis_not_listening
|
||||
dependent_services.each do |sv|
|
||||
notifies :restart, sv
|
||||
end
|
||||
end
|
||||
|
||||
execute "clear the gitlab-ci cache" do
|
||||
command "/opt/gitlab/bin/gitlab-ci-rake cache:clear"
|
||||
action :nothing
|
||||
end
|
|
@ -1,55 +0,0 @@
|
|||
defaults: &defaults
|
||||
gitlab_server:
|
||||
<%= @gitlab_server.to_json %>
|
||||
|
||||
## Gitlab CI settings
|
||||
gitlab_ci:
|
||||
## Web server settings
|
||||
host: <%= @gitlab_ci_host %>
|
||||
port: <%= @gitlab_ci_port %>
|
||||
https: <%= @gitlab_ci_https %>
|
||||
|
||||
## Email settings
|
||||
# Email address used in the "From" field in mails sent by GitLab-CI
|
||||
email_from: <%= @gitlab_ci_email_from %>
|
||||
|
||||
# Email address of your support contact (default: same as email_from)
|
||||
support_email: <%= @gitlab_ci_support_email %>
|
||||
|
||||
# Default project notifications settings:
|
||||
#
|
||||
# Send emails only on broken builds (default: true)
|
||||
all_broken_builds: <%= @gitlab_ci_all_broken_builds %>
|
||||
#
|
||||
# Add committer to recipients list (default: false)
|
||||
add_pusher: <%= @gitlab_ci_add_pusher || @gitlab_ci_add_committer %>
|
||||
|
||||
builds_path: <%= @builds_directory %>
|
||||
|
||||
gravatar:
|
||||
enabled: <%= @gravatar_enabled %>
|
||||
plain_url: <%= single_quote(@gravatar_plain_url) %>
|
||||
ssl_url: <%= single_quote(@gravatar_ssl_url) %>
|
||||
|
||||
## Backup settings
|
||||
backup:
|
||||
path: "<%= @backup_path %>" # Relative paths are relative to Rails.root (default: tmp/backups/)
|
||||
keep_time: <%= @backup_keep_time %> # default: 0 (forever) (in seconds)
|
||||
upload:
|
||||
# Fog storage connection settings, see http://fog.io/storage/ .
|
||||
connection: <%= @backup_upload_connection.to_json if @backup_upload_connection %>
|
||||
# The remote 'directory' to store your backups. For S3, this would be the bucket name.
|
||||
remote_directory: <%= single_quote(@backup_upload_remote_directory) %>
|
||||
multipart_chunk_size: <%= @backup_multipart_chunk_size %>
|
||||
|
||||
development:
|
||||
<<: *defaults
|
||||
|
||||
test:
|
||||
<<: *defaults
|
||||
gitlab_server:
|
||||
url: 'http://demo.gitlab.com/'
|
||||
app_id: 'id'
|
||||
app_secret: 'secret'
|
||||
production:
|
||||
<<: *defaults
|
|
@ -7,8 +7,6 @@ usr_bin_symlinks="\
|
|||
${DEST_DIR}/bin/gitlab-ctl \
|
||||
${DEST_DIR}/bin/gitlab-rake \
|
||||
${DEST_DIR}/bin/gitlab-rails \
|
||||
${DEST_DIR}/bin/gitlab-ci-rake \
|
||||
${DEST_DIR}/bin/gitlab-ci-rails \
|
||||
"
|
||||
symlink_command="ln -sf ${usr_bin_symlinks} /usr/bin/"
|
||||
|
||||
|
|
Loading…
Reference in New Issue