Commit graph

29 commits

Author SHA1 Message Date
Dirk Hörner
2e44284054 lib/backup: fix broken permissions when creating repo dir
This commit fixes a typo where the mode argument to FileUtils.mkdir()
would be passed in decimal rather than octal format, yielding bad
permissions.
2016-08-30 13:35:50 +02:00
bogdanvlviv
96ebc8c4f7 Use File::exist? instead of File::exists?
Since version ruby-2.2.0, method `File::exists?` is deprecated.
2016-08-11 13:54:45 +03:00
Stan Hu
c6ff77d4b8 Fix backup restore
Set permissions of backup dir to g+s

Closes #20188
2016-07-25 06:23:07 -07:00
Alejandro Rodríguez
86359ec854 Refactor repository paths handling to allow multiple git mount points 2016-06-29 22:30:31 -04:00
Connor Shea
903946c78a
Replace colorize gem with rainbow.
Colorize is a gem licensed under the GPLv2, so we can’t use it in GitLab without relicensing GitLab under the terms of the GPL. Rainbow is licensed under the MIT license and does the exact same thing as Colorize, so Rainbow was added in place of Colorize.

The syntax is slightly different for Rainbow vs. Colorize, and was updated in accordance.

The gem is still a dependency of Spinach, so it’s included in the development/test environments, but won’t be packaged with the actual product, and therefore doesn’t require we relicense the product.

An attempt at relicensing Colorize was made, but didn’t succeed as the library owner never responded.

Rainbow library: https://github.com/sickill/rainbow
Relevant issue regarding licensing in GitLab's gems: https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/3775
2016-06-03 10:37:09 -06:00
Robert Speicher
d09d62b6b8 Replace all usages of git command with configurable binary path
Closes #3311
2015-11-03 17:11:09 -05:00
Jacob Vosmaer
baa157926d Stricter mkdir's in 'rake gitlab:backup:create' 2015-07-30 10:17:34 +02:00
Jacob Vosmaer
c5aae30773 Set internal backup directory modes on create
This sidesteps problems with running 'chmod' on some CIFS mounts.
2015-07-29 11:18:55 +02:00
Valery Sizov
d411a9e4d8 backup repo with tar instead of git bundle 2015-03-19 14:36:02 +02:00
Achilleas Pipinellis
191aa9712e Properly fix wiki restore.
ProjectWiki.new() creates a new wiki git repository, so any tries
to bare clone a bundle fail. With this patch we remove the newly
created wiki.git before restoring from the backup bundle.
2014-11-30 18:24:05 +02:00
Achilleas Pipinellis
880478b21e Proper wiki restore. Fixes #845 2014-11-29 22:01:52 +02:00
Jacob Vosmaer
7c54c63ac1 Add CRON=1 backup setting for quiet backups 2014-11-20 15:46:04 +01:00
Dimitry Andric
4a5044e302 Correctly restore empty repositories.
If a project is being restored, but there is no bundle file, the project was
empty when it was backed up.  In this case, just use git init --base to create a
new bare repository.
2014-11-13 13:09:47 +01:00
Ciro Santilli
e4a38e4471 Factor using Repository#path_to_repo 2014-11-05 17:51:49 +01:00
Jacob Vosmaer
8ad1330b6a Ask the wiki repo, not Gollum, if it's empty
We need to skip empty repositories when creating a backup. Before this
change, we were asking gollum-lib if the wiki contains any _pages_. Now
we ask gitlab_git if the repository contains _files_. This should
resolve gollum_lib Grit timeouts in the backup script.
2014-10-20 10:52:29 +02:00
Jacob Vosmaer
02bf992f37 Fail harder in the backup script
This change also shows the output of failed Git commands during the
backup.
2014-10-01 15:43:27 +02:00
Jacob Vosmaer
042465c448 Use create-hooks instead of rewrite-hooks.sh
The rewrite-hooks.sh script is a deprecated wrapper for gitlab-shell's
create-hooks script.
2014-09-08 10:16:15 +02:00
Jacob Vosmaer
0f29ccffd2 Backup wiki repo even if the main repo is empty
This fixes a bug where wiki repositories for projects with an empty main
repository would not get backed up.
2014-05-08 22:50:48 +02:00
Dmitriy Zaporozhets
1bd28994cc
Use ProjectWiki instead of GollumWiki in code
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
2014-04-09 14:35:58 +03:00
Jacob Vosmaer
91c70c5b1c Use gitlab_shell.path to invoke rewrite-hooks.sh
The backup restore code for repositories was assuming that gitlab-shell
is installed in /home/git/gitlab-shell. This commit changes that to use
the configuration setting from gitlab.yml that specifies the path where
gitlab-shell is installed.
2014-02-26 17:32:52 +01:00
Jacob Vosmaer
a540ab4290 Remove Bourne shell from backup code 2013-11-06 14:02:28 +01:00
Dmitriy Zaporozhets
f9b66aecdd Revert "More escaping"
This reverts commit c46eaca912.
2013-11-05 15:35:49 +02:00
Nigel Kukard
c46eaca912 More escaping
- Database name may contain characters which are not shell friendly
- Database password could contain the same
- While we at it there is no harm in escaping generated paths too
- Refactored 2-line system(command)

Signed-off-by: Nigel Kukard <nkukard@lbsd.net>
2013-11-04 22:09:03 +00:00
Jacob Vosmaer
cb6a86ed62 Skip rather than fail empty wikis during backup 2013-10-10 16:07:39 +02:00
Angus MacArthur
9c82bca5ee fixes for gitlab restore with non-standard backup and repo dirs
These fixes will allow a restore of gitlab when the backups and
repositories directories are in non-standard locations (ie sub-dirs
of gitlabhq).  Also allows the restore to be run from script
overriding the need of a user to confirm the rebuild of the
authorized_keys file.
2013-05-30 09:58:36 -04:00
Dmitriy Zaporozhets
1d03fa2e7f Run rewrite-hooks after repos restore 2013-04-10 15:11:45 +03:00
Dmitriy Zaporozhets
6c206805ae Backup/restore wiki repos too 2013-04-05 21:20:11 +03:00
Dmitriy Zaporozhets
10902c844f move old repositories dir to one with timestamp 2013-04-05 19:48:56 +03:00
Dmitriy Zaporozhets
c33d5e16fe refactor backup/restore 2013-04-05 19:01:19 +03:00