Commit Graph

118 Commits

Author SHA1 Message Date
Kamil Trzciński 8d1e97fc3b Optimise import performance
- Fix `O(n)` complexity of `append_or_update_attribute`,
  we append objects to an array and re-save project
- Remove the usage of `keys.include?` as it performs `O(n)`
  search, instead use `.has_key?`
- Remove the usage of `.keys.first` as it performs a copy
  of all keys, instead use `.first.first`
2019-07-24 16:24:28 +02:00
Fabio Pitino c2396ce036 Do not import legacy triggers from project JSON 2019-07-15 15:05:22 +02:00
Fabio Pitino 2397f171a3 Ensure ImportExport maintains trigger ownership 2019-07-15 15:05:22 +02:00
Shinya Maeda c5c41ae065 Ignore legacy artifact columns in Project Import/Export
Ignore some columns
2019-06-11 18:39:29 +07:00
Reuben Pereira 4376167a04 Add ProjectMetricsDashboardSetting model and table
This new table will be used to store the external_dashboard_url which
allows users to add a link to their external dashboards (ex Grafana)
to the Metrics dashboard.
2019-04-26 17:23:26 +00:00
Andrew Newdigate 3288e1a874 Adds the Rubocop ReturnNil cop
This style change enforces `return if ...` instead of
`return nil if ...` to save maintainers a few minor review points
2019-03-06 17:51:56 +02:00
Reuben Pereira f40b5860d7 Add table and model for error tracking settings 2019-01-07 17:55:21 +00:00
Kamil Trzciński 0103d5be96 Add config_options|variables to BuildMetadata
These are data columns that store runtime configuration
of build needed to execute it on runner and within pipeline.

The definition of this data is that once used, and when no longer
needed (due to retry capability) they can be freely removed.

They use `jsonb` on PostgreSQL, and `text` on MySQL (due to lacking
support for json datatype on old enough version).
2019-01-04 16:38:17 +01:00
Shinya Maeda 66755c9ed5 Support CURD operation for release asset links
- Add Releases::Links model
- Expose it in release API
- Add integration tests
2019-01-04 22:17:02 +09:00
Francisco Javier López a6778fc647 Rename project's pipelines relation 2018-12-05 14:39:15 +00:00
Grzegorz Bizon 88e2b6ea9f Merge remote-tracking branch 'dev/master' into security-encrypt-runners-tokens
* dev/master: (302 commits)

Conflicts:
	db/schema.rb
	lib/gitlab/import_export/import_export.yml
2018-11-21 11:02:31 +01:00
Grzegorz Bizon e491df5fc6 Encrypt runners communication token in the database 2018-11-20 16:30:39 +01:00
Grzegorz Bizon 478c15fa89 Exclude runners tokens from GitLab project exports 2018-11-20 16:15:09 +01:00
gfyoung 7ec8af5017 Enable even more frozen string for lib/gitlab
Enables frozen string for the following:

* lib/gitlab/hook_data/**/*.rb
* lib/gitlab/i18n/**/*.rb
* lib/gitlab/import/**/*.rb
* lib/gitlab/import_export/**/*.rb
* lib/gitlab/kubernetes/**/*.rb
* lib/gitlab/legacy_github_import/**/*.rb
* lib/gitlab/manifest_import/**/*.rb
* lib/gitlab/metrics/**/*.rb
* lib/gitlab/middleware/**/*.rb

Partially addresses gitlab-org/gitlab-ce#47424.
2018-11-16 17:41:14 -08:00
James Lopez 6e641789fc
Fix null pipeline problem 2018-09-24 11:23:47 +02:00
Mayra Cabrera 33311cb677 CE Port of Protected Environments backend 2018-08-10 13:45:14 +00:00
James Lopez 4eebd231b8
update code based on feedback 2018-06-27 11:53:51 +02:00
James Lopez 3a14ae3ae3
refactor code based on feedback 2018-06-25 09:42:07 +02:00
James Lopez 35d69ccf95
add more specs and refactor more relation factory code 2018-06-22 09:48:44 +02:00
James Lopez 3d3e441c91
refactor code based on feedback 2018-06-22 09:00:10 +02:00
James Lopez b0ddc55dc7
refactor code once again to fix IID issues 2018-06-20 16:18:40 +02:00
James Lopez 8522173e0a
refactor code once again to fix IID issues 2018-06-20 15:45:15 +02:00
James Lopez cc061cd1c6
fix some more edge cases 2018-06-20 11:57:22 +02:00
James Lopez 825c68e2ed
fix some edge cases 2018-06-19 17:08:02 +02:00
James Lopez a19e08feca
refactor relation factory 2018-06-19 15:27:30 +02:00
Oswaldo Ferreira 54ad5fb8a2 Take two for MR metrics population background migration 2018-05-30 11:51:29 -03:00
Mayra Cabrera 0033e57269 Merge branch 'security-fj-import-export-assignment' into 'master'
[master] Arbitrary assignment of Project fields using "Import project" from a Gitlab tar.gz

Closes #2678

See merge request gitlab/gitlabhq!2378
2018-05-29 18:43:04 +00:00
Stan Hu 3126e89eb8
Add a unique and not null constraint on the project_features.project_id column
This commit has two migrations:

1. The first prunes duplicate rows in the project_features table and leaves
   the row with the highest ID.  Since the behavior was indeterministic before
   and depended on which row the database decided to use, this change at least
   makes the permissions consistent. For example, in some cases, the Wiki may
   have been disabled but enabled in another entry.

2. The second adds a non-null constraint on the project_features.project_id
   column.

Closes #37882

Fixes a significant part of gitlab-com/migration#408.

We found that we were overcounting Wikis because of these duplicates.
On GitLab.com, there are 56 rows with duplicate entries by project_id, and 16,661 rows with NULL project_id values.
2018-05-15 14:20:14 +02:00
Francisco Javier López 761d890a68
Blacklisting attributes in the project import process 2018-05-14 09:28:33 +02:00
Yorick Peterse 392c411bdc
Introduce new ProjectCiCdSetting
This model and the corresponding table will be used for storing settings
specific to CI/CD, starting with the "group_runners_enabled" boolean.

The model is called ProjectCiCdSetting and not ProjectCiCdSettings. The
project exporter doesn't like plural model names as it uses "classify"
which turns those into singular (so "ProjectCiCdSettings" becomes
"ProjectCiCdSetting", producing an error if said class is undefined).

The initial work in this commit was done by Dylan Griffith, with most of
the migration work being done by Yorick Peterse.
2018-04-16 14:05:35 +02:00
Sean McGivern 7c36e8561c Merge branch '41967_issue_api_closed_by_info' into 'master'
Add closed by information to issue API

See merge request gitlab-org/gitlab-ce!17042
2018-03-30 15:43:45 +00:00
Bob Van Landuyt ca8f1ed9bb Import multiple issue assignees from GitLab export
When importing from a GitLab archive, an admin can carry over the
assignations. Other users can not.

When a regular user is importing an issue with multiple assignees, the
assignee is replaced with the current user, meaning we would try to
insert current user as an assignee multiple times.

By filtering the array before storing it, the import becomes more
robust.
2018-03-14 13:39:08 +01:00
Francisco Javier López 8fe880dc06 Projects and groups badges API 2018-03-05 17:51:40 +00:00
haseeb 93e7c353eb closedby_id added to safe attributes 2018-03-01 18:40:33 +05:30
James Lopez f677aa7d57 fix label issue 2018-02-02 06:35:40 -08:00
🙈 jacopo beschi 🙉 729f05f0e3 Adds Rubocop rule for line break around conditionals 2018-01-11 16:34:01 +00:00
Grzegorz Bizon 05ddb25995 Assign stage and pipeline to a status when importing 2018-01-05 14:48:50 +01:00
Sean McGivern 4ebbfe5d3e Remove serialised diff and commit columns
The st_commits and st_diffs columns on merge_request_diffs historically held the
YAML-serialised data for a merge request diff, in a variety of formats.

Since 9.5, these have been migrated in the background to two new tables:
merge_request_diff_commits and merge_request_diff_files. That has the advantage
that we can actually query the data (for instance, to find out how many commits
we've stored), and that it can't be in a variety of formats, but must match the
new schema.

This is the final step of that journey, where we drop those columns and remove
all references to them. This is a breaking change to the importer, because we
can no longer import diffs created in the old format, and we cannot guarantee
the export will be in the new format unless it was generated after this commit.
2017-11-28 16:13:40 +00:00
Shinya Maeda b982a44abb Merge branch '38464-k8s-apps' of https://gitlab.com/gitlab-org/gitlab-ce into 38464-k8s-apps 2017-11-07 21:24:28 +09:00
Shinya Maeda bbdb0cf051 Merge branch 'master' into 38464-k8s-apps 2017-11-07 21:23:54 +09:00
Rémy Coutable 31e3ef93e5 Merge branch 'feature/custom-attributes-on-projects-and-groups' into 'master'
Support custom attributes on groups and projects

See merge request gitlab-org/gitlab-ce!14593
2017-11-07 10:59:38 +00:00
Alessio Caiazza d6134709cb
Remove Project#clusters export 2017-11-07 11:20:02 +01:00
Alessio Caiazza 2b4fccb720
Add Helm import/export 2017-11-06 18:06:02 +01:00
Markus Koller 6902848a9c
Support custom attributes on projects 2017-11-06 10:51:46 +01:00
Shinya Maeda 6571efb6c3 Fix spec. Fix usage ping. Fix warnings by adding new models and attributes. 2017-11-01 16:12:44 +09:00
Sean McGivern 565a2d7303 Merge branch '35580-cannot-import-project-with-milestones' into 'master'
fix the import :milestone from adding the group_id

Closes #35580

See merge request gitlab-org/gitlab-ce!14657
2017-10-11 10:46:05 +00:00
micael.bergeron de025ad2db fixing group label import 2017-10-06 09:11:29 -04:00
micael.bergeron a8d9dbc1a6 fix the project import when an issue has a group milestone 2017-10-05 12:05:55 -04:00
Shinya Maeda 982c2b83ed Fix static anlysys. Added safe_model_attributes. 2017-10-04 18:21:01 +09:00
Shinya Maeda 20abcbffae Add google_api to TOP_LEVEL_ROUTES. Import/Export model failure fix. Fix static analysys. 2017-10-04 16:04:45 +09:00