Commit Graph

741 Commits

Author SHA1 Message Date
Douglas Barbosa Alexandre 06b8fe5607 Merge branch '63667-hashed-storage-migration-count-correctly' into 'master'
Display the amount for Hashed Storage migration/rollback correctly

Closes #63667

See merge request gitlab-org/gitlab-ce!29996
2019-07-11 16:57:04 +00:00
Felipe Artur f0683aab05 Improve Graphql Docs
Adds more friendly docs for GraphQl implementation
2019-07-11 08:06:35 +00:00
Gabriel Mazetto d8cad8837c Display the amount for Hashed Storage migration/rollback correctly
Rake script considers the specified range, if present, to calculate
the affected amount of projects correctly.
2019-07-10 22:14:50 +01:00
Mayra Cabrera 0ab89d8e36 Add a rubocop for Rails.logger
Suggests to use a JSON structured log instead

Related to https://gitlab.com/gitlab-org/gitlab-ce/issues/54102
2019-07-10 19:26:47 +00:00
Toon Claes dabd91b2c8 Add rake task to clean orphan artifact files
This adds the rake task rake
gitlab:cleanup:orphan_job_artifact_files. This rake task cleans all
orphan job artifact files it can find on disk.

 It performs a search on the complete folder of all artifacts on
disk. Then it filters out all the job artifact ID for which it could
not find a record with matching ID in the database. For these, the
file is deleted from disk.
2019-06-28 10:02:18 +02:00
Stan Hu ad3abd1d3a Silence backup warnings when CRON=1 in use
If CRON=1 is in use, we shouldn't generate any output or admins may be
notified via e-mail about unnecessary warnings.

Closes https://gitlab.com/gitlab-org/gitlab-ce/issues/63703
2019-06-25 06:30:51 -07:00
Yorick Peterse 8469f59d78
Backport the EE schema and migrations to CE
This backports all EE schema changes to CE, including EE migrations,
ensuring both use the same schema.

== Updated tests

A spec related to ghost and support bot users had to be modified to make
it pass. The spec in question assumes that the "support_bot" column
exists when defining the spec. In the single codebase setup this is not
the case, as the column is backported in a later migration. Any attempt
to use a different schema version or use of "around" blocks to
conditionally disable specs won't help, as reverting the backport
migration would also drop the "support_bot" column. Removing the
"support_bot" tests entirely appears to be the only solution.

We also need to update some foreign key tests now that we have
backported the EE columns. Fortunately, these changes are very minor.

== Backporting migrations

This commit moves EE specific migrations (except those for the Geo
tracking database) and related files to CE, and also removes any traces
of the ee/db directory.

Some migrations had to be modified or removed, as they no longer work
with the schema being backported. These migrations were all quite old,
so we opted for removing them where modifying them would take too much
time and effort.

Some old migrations were modified in EE, while also existing in CE. In
these cases we took the EE code, and in one case removed them entirely.
It's not worth spending time trying to merge these changes somehow as we
plan to remove old migrations around the release of 12.0, see
https://gitlab.com/gitlab-org/gitlab-ce/issues/59177 for more details.
2019-06-17 17:09:05 +02:00
Bob Van Landuyt 9a8955d3c0 Merge branch 'gitaly-version-v1.43.0' into 'master'
Upgrade Gitaly to v1.43.0

See merge request gitlab-org/gitlab-ce!28867
2019-05-31 14:16:54 +00:00
Zeger-Jan van de Weg 951afba624
Remove hook directory requirement from Shell
It used to be the case that GitLab created symlinks for each repository
to one copy of the Git hooks, so these ran when required. This changed
to set the hooks dynamically on Gitaly when invoking Git.

The side effect is that we didn't need all these symlinks anymore, which
Gitaly doesn't create anymore either. Now that means that the tests in
GitLab-Rails should test for it either.

Related: https://gitlab.com/gitlab-org/gitaly/issues/1392#note_175619926
2019-05-30 20:04:08 +02:00
Sarah Groff Hennigh-Palermo 9377eb1822 Build visual_review_toolbar with webpack
It takes a lot of lines to move a script
2019-05-29 20:24:15 +00:00
Ben Bodenmiller 2497917b65 delete feature flag when disabling Rugged 2019-05-13 08:57:10 +00:00
Cindy Pallares deb5276f8b
Add warning that gitlab-secrets isn't included
Many customers forget to include the gitlab-secrets.json file. This adds
a warning that both gitlab-secrets.json and gitlab.rb are not included
in the backup.
2019-05-08 12:39:04 -05:00
Rémy Coutable 2537b0c1e0
Provide a new gitlab:seed:issues task
Signed-off-by: Rémy Coutable <remy@rymai.me>
2019-04-23 11:43:53 +02:00
Kamil Trzciński 650f40865e Forbid the use of `#reload` and prefer `#reset`
The `#reload` makes to load all objects into memory,
and the main purpose of `#reload` is to drop the association cache.

The `#reset` seems to solve exactly that case.
2019-04-15 13:05:14 +02:00
Robert Speicher e036cb04a2 Merge branch 'remaining-lib-differences' into 'master'
Resolve remaining CE to EE differences in lib/

See merge request gitlab-org/gitlab-ce!26608
2019-04-03 12:27:55 +00:00
Yorick Peterse 1f4bc814ab
Backport EE changes to gitlab:env:info
This backports EE specific changes for the Rake task `gitlab:env:info`,
wrapping them in a conditional. There is no way to inject code in the
middle of a Rake task in EE, so unfortunately this is the best we can
do.
2019-04-02 14:57:44 +02:00
John Jarvis 69b65a6b74 Merge branch 'master' of dev.gitlab.org:gitlab/gitlabhq into jarv/dev-to-gitlab-2019-04-02 2019-04-02 10:12:32 +02:00
Jan Provaznik a466d97e62 Rake task for removing exif from uploads
Adds a rake task which can be used for removing EXIF
data from existing uploads.
2019-04-02 07:48:35 +00:00
Wei-Meng Lee cfc6d2528c Fix attempting to drop views in PostgreSQL 2019-04-02 00:19:22 +00:00
Douglas Barbosa Alexandre a86f48c79b
Add helper method to return a human-friendly name for database adapter 2019-03-21 19:03:26 -03:00
Patrick Bajao 26dadbc9c4 Integrate Gitlab::Keys with Gitlab::Shell
In this commit, some methods that aren't being used
are removed from `Gitlab::Shell`. They are the ff:
- `#remove_keys_not_found_in_db`
- `#batch_read_key_ids`
- `#list_key_ids`

The corresponding methods in `Gitlab::Keys` have been
removed as well.
2019-03-19 11:16:21 +00:00
Nick Thomas 9f05e97aad
Run rubocop -a 2019-03-13 13:42:43 +00:00
Gabriel Mazetto 337977776a Prevent storage migration and rollback running at the same time
This is a small polishing on the storage migration and storage rollback
rake tasks. By aborting a migration while a rollback is already
scheduled we want to prevent unexpected consequences.
2019-03-12 17:51:05 +01:00
Ray Paik 976fee745e Update cleanup.rake to fix a typo in the error message 2019-03-07 23:37:16 +00:00
Rémy Coutable c1c30f19a1 Merge branch 'resolve-some-rake-differences' into 'master'
Resolve some Rake task differences

See merge request gitlab-org/gitlab-ce!25644
2019-03-04 11:45:21 +00:00
Sean McGivern fd50ba4240 Merge branch 'sh-rugged-find-commit' into 'master'
Bring back Rugged implementation of find_commit

See merge request gitlab-org/gitlab-ce!25477
2019-03-04 09:22:44 +00:00
Stan Hu fb6a4e21d4 Bring back Rugged implementation of find_commit
This brings back some of the changes in
https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/20339.

For users using Gitaly on top of NFS, accessing the Git data directly
via Rugged is more performant than Gitaly. This merge request introduces
the feature flag `rugged_find_commit` to activate Rugged paths.

There are also Rake tasks `gitlab:features:enable_rugged` and
`gitlab:features:disable_rugged` to enable/disable these feature
flags altogether.

Part of four Rugged changes identified in
https://gitlab.com/gitlab-org/gitlab-ce/issues/57317.
2019-03-01 08:45:51 -08:00
Gabriel Mazetto fc0ff92807 Added Rollbacker workers and support on the rake task
Rollback is done similar to Migration for the Hashed Storage.
It also shares the same ExclusiveLease key to prevent both happening
at the same time.

All Hashed Storage related workers now share the same queue namespace
which allows for assigning dedicated workers easily.
2019-03-01 15:49:20 +01:00
Gabriel Mazetto ff2ca3569e Rake task for storage rollback 2019-03-01 15:49:20 +01:00
Yorick Peterse bb873b1e3b
Make the backup Rake task the same as in EE
EE uses single quotes for the changed line, whereas CE was using double
quotes. This commit ensures both repositories use the same kind of
quotes.
2019-02-28 15:03:10 +01:00
Jacob Vosmaer 078f11a6b9 Prepare test suite for switch to Gitaly-embedded Git hooks 2019-02-27 10:58:21 +00:00
Stan Hu 1dadfff3f5 Move terminate_all_connections into setup Rake task 2019-02-11 21:30:57 -08:00
Stan Hu 5488e8a4a3 Kill all PostgreSQL connections for rake dev:setup
If there are any clients connected to the DB, PostgreSQL won't let you
drop the database. It's possible that Sidekiq, Unicorn, or some other
client will be hanging onto a connection, preventing the DROP DATABASE
from working. To workaround this problem, this method cancels all the
connections so that the db:reset command will work.

Note that there's still a slight possibility a client connects after its
connection is terminated. If this is an issue, we could solve it by
revoking CONNECT access, but for now it seems this works.

Closes https://gitlab.com/gitlab-org/gitlab-development-kit/issues/450
2019-02-11 21:30:57 -08:00
Jose Torres 56c267e52c Fix MySQL error when truncating a table that doesn't exist
This adds a conditional statement before truncating the
`schema_migrations` table.

This comit also ports this code to Rails 5.
2019-02-05 17:30:22 -08:00
Rémy Coutable 6b39f55d3f
Add cache to the 'compile-assets' and 'gitlab:assets:compile' jobs
Signed-off-by: Rémy Coutable <remy@rymai.me>
2019-02-05 14:04:54 +01:00
Rémy Coutable 5c583c8e87 Merge branch 'master' into '46448-add-timestamps-for-each-stage-of-gitlab-rake-gitlab-backup-restore'
# Conflicts:
#   spec/tasks/gitlab/backup_rake_spec.rb
2019-02-04 14:11:04 +00:00
Gabriel Mazetto 7bc16889df Refactor Storage Migration
Specs were reviewed and improved to better cover the current behavior.
There was some standardization done as well to facilitate the
implementation of the rollback functionality.

StorageMigratorWorker was extracted to HashedStorage namespace were
RollbackerWorker will live one as well.
2019-01-25 20:26:35 +01:00
Gabriel Mazetto c2c34eba62 Prepare rake task for storage rollback
We are keeping compatibility with existing scheduled jobs.
2019-01-25 20:26:35 +01:00
Rémy Coutable 3a2abc1d50
Enable the Layout/ExtraSpacing cop
Signed-off-by: Rémy Coutable <remy@rymai.me>
2019-01-24 13:05:45 +01:00
Michael Kozono 9f80f04059 Prevent admins from attempting hashed storage migration on read only DB 2018-12-19 21:10:00 +00:00
Nick Thomas 7329480412
Fix gitlab:web_hook tasks 2018-12-06 18:37:05 +00:00
Michael Kozono 6855e6b586 Extract system check rake task logic
These changes make the code more reusable, testable, and most
importantly, overrideable.
2018-12-03 13:51:46 -08:00
Nick Thomas c43af89748 Merge branch 'zj-object-pool-path' into 'master'
Rename Repository table to PoolRepository

See merge request gitlab-org/gitlab-ce!23236
2018-11-28 13:07:12 +00:00
Zeger-Jan van de Weg fff7754186
Rename the Repository table to PoolRepository
To separate the different kinds of repositories we have at GitLab this
table will be renamed to pool_repositories. A project can, for now at
least, be member of none, or one of these. The table will get additional
columns in a later merge request where more logic is implemented for the
model.

Further included is a small refactor of logic around hashing ids for the
disk_path, mainly to ensure a previous implementation is reusable.

The disk_path for the pool_repositories table no longer has a NOT NULL
constraint, but given the hashing of the ID requires the DB to assign
the record an ID, an after_create hook is used to update the value.

A related MR is:
https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/23143, adding
tables for 'normal' repositories and wiki_repositories.
2018-11-27 13:41:46 +01:00
Gabriel Mazetto fe2e6c6dc0 Remove Site Statistic
This approach caused many different problems as we tightened
the query execution timeout.
2018-11-26 23:39:05 +01:00
Zeger-Jan van de Weg 358fefc777
Migrate storage checks to Gitaly
Most of these checks are not valuable in the current setup, thus removed
and replaced by Gitaly checking if its read and writeable.

Depends on:
1. https://gitlab.com/gitlab-org/gitaly/merge_requests/675
2018-11-09 09:15:42 +01:00
Rémy Coutable e232ebf7a1 Merge branch 'rake-gitaly-check' into 'master'
Delegate storage health check to Gitaly's health check

Closes gitaly#1336

See merge request gitlab-org/gitlab-ce!22063
2018-11-06 15:08:32 +00:00
Cindy Pallares 75cf72344f
Use gitlab_environment for ldap rake task 2018-10-25 13:56:39 -05:00
Alejandro Rodríguez 098c722542 Add gitlab:gitaly:check task for Gitaly health check
Also, since Gitaly now takes care of checking for storage paths
existence/accessibility, we can remove those check from the
gitlab:gitlab_shell_check task and advance further into 0 direct disk
approach on gitlab-rails
2018-10-23 20:11:10 -03:00
Michael Bisbjerg 51b21050c5 Typo in log message of gitlab-rake gitlab:artifacts:migrate 2018-09-27 13:18:14 +00:00