Commit 59f9f070 authored by kakakikikeke's avatar kakakikikeke Committed by Michael Kozono

Allow SKIP=remote option to be specified during backup

Even if you have set backup_upload_connection,
you can skip the process of uploading the backup file
to the cloud storage by giving the SKIP=remote option.

Changelog: added
parent c88f43cc
......@@ -724,6 +724,23 @@ sudo gitlab-backup create DIRECTORY=weekly
Users of GitLab 12.1 and earlier should use the command `gitlab-rake gitlab:backup:create` instead.
#### Skip uploading backups to remote storage
If you have configured GitLab to [upload backups in a remote storage](#uploading-backups-to-a-remote-cloud-storage),
you can use the `SKIP=remote` option to skip uploading your backups to the remote storage.
For Omnibus GitLab packages:
```shell
sudo gitlab-backup create SKIP=remote
```
For installations from source:
```shell
sudo -u git -H bundle exec rake gitlab:backup:create SKIP=remote RAILS_ENV=production
```
#### Uploading to locally mounted shares
You may also send backups to a mounted share (for example, `NFS`,`CIFS`, or
......
......@@ -229,7 +229,7 @@ module Backup
def upload
connection_settings = Gitlab.config.backup.upload.connection
if connection_settings.blank?
if connection_settings.blank? || skipped?('remote')
puts_time "Uploading backup archive to remote storage #{remote_directory} ... ".color(:blue) + "[SKIPPED]".color(:cyan)
return
end
......
......@@ -442,6 +442,23 @@ RSpec.describe Backup::Manager do
connection.directories.create(key: Gitlab.config.backup.upload.remote_directory) # rubocop:disable Rails/SaveBang
end
context 'skipped upload' do
let(:backup_information) do
{
backup_created_at: Time.zone.parse('2019-01-01'),
gitlab_version: '12.3',
skipped: ['remote']
}
end
it 'informs the user' do
stub_env('SKIP', 'remote')
subject.create # rubocop:disable Rails/SaveBang
expect(Gitlab::BackupLogger).to have_received(:info).with(message: 'Uploading backup archive to remote storage directory ... [SKIPPED]')
end
end
context 'target path' do
it 'uses the tar filename by default' do
expect_any_instance_of(Fog::Collection).to receive(:create)
......
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