Skip to content
Snippets Groups Projects
Commit c8b98d56 authored by Marin Jankovski's avatar Marin Jankovski
Browse files

Merge branch 'feature-disable-backup' into 'master'

Feature disable backup

This MR permits the user to disable backup cron task even if environment is `production`.

See merge request !111
parents 02b4634c 15747c8a
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -269,6 +269,7 @@ default['gitlab']['monitrc']['emergency_email'] = nil
default['gitlab']['monitrc']['emergency_events'] = ['timeout']
 
# backups
default['gitlab']['backup']['enable'] = true
default['gitlab']['backup']['cron']['action'] = :create
default['gitlab']['backup']['cron']['minute'] = 0
default['gitlab']['backup']['cron']['hour'] = 2
Loading
Loading
Loading
Loading
@@ -15,5 +15,5 @@ cron 'gitlab_backups' do
path node['gitlab']['backup']['cron']['path']
command "cd #{gitlab['home']}/gitlab && bundle exec rake gitlab:backup:create RAILS_ENV=#{gitlab['env']}"
 
only_if { gitlab['env'] == 'production' }
only_if { gitlab['backup']['enable'] and gitlab['env'] == 'production' }
end
Loading
Loading
@@ -22,6 +22,18 @@ describe "gitlab::backup" do
path: '/usr/local/bin:/usr/bin:/bin')
end
 
describe "when backup disabled" do
let(:chef_run) do
runner = ChefSpec::Runner.new(platform: "ubuntu", version: version)
runner.node.set['gitlab']['backup']['enable'] = false
runner.converge("gitlab::backup")
end
it "does not create a cron job" do
expect(chef_run).to_not create_cron('gitlab_backups')
end
end
describe "when in development environment" do
let(:chef_run) do
runner = ChefSpec::Runner.new(platform: "ubuntu", version: version)
Loading
Loading
@@ -53,6 +65,18 @@ describe "gitlab::backup" do
path: '/usr/local/bin:/usr/bin:/bin')
end
 
describe "when backup disabled" do
let(:chef_run) do
runner = ChefSpec::Runner.new(platform: "centos", version: version)
runner.node.set['gitlab']['backup']['enable'] = false
runner.converge("gitlab::backup")
end
it "does not create a cron job" do
expect(chef_run).to_not create_cron('gitlab_backups')
end
end
describe "when in development environment" do
let(:chef_run) do
runner = ChefSpec::Runner.new(platform: "centos", version: version)
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment