Commit Graph

299 Commits

Author SHA1 Message Date
Kamil Trzciński e00e62c2c8 Merge branch 'backstage/gb/migrate-stages-statuses' into 'master'
Migrate CI/CD stages statuses

Closes #33453

See merge request !12584
2017-08-21 11:47:44 +00:00
Felipe Artur 91035871d3 Fix project import to group when there are project milestones 2017-08-17 10:40:19 +00:00
Grzegorz Bizon 1066d8ba77 Use usual method to retrieve CI/CD stage statuses 2017-08-16 13:30:49 +02:00
Grzegorz Bizon 32d0983a4e Merge branch 'master' into backstage/gb/migrate-stages-statuses
* master: (1000 commits)
  Fix username autocomplete group name with no avatar alignment
  Fix 'Projected tags' typo in protected_tags_spec.rb
  Many Repo Fixes
  Repo Editor Fixes
  Docs: New index for permissions
  link article from CI index
  link tech articles from the landing page
  new articles come first
  fix relative link
  fix date format
  Fixed changed files dropdown not being shown
  Update publication date
  Remove deprecated field from workhorse API responses
  Fix API responses when dealing with txt files
  Make sure MySQL would not use CURRENT_TIMESTAMP
  Add two more project templates
  Allow usage of any_projects? with an Array
  Copyedit Artifactory and GitLab article
  Rename Artifactory and GitLab article file
  Display GPG status loading spinner only when Ajax request is made
  ...
2017-08-16 13:18:03 +02:00
Sean McGivern e80a893ff0 Merge branch 'split-events-into-push-events' into 'master'
Use a separate table for storing push events

See merge request !12463
2017-08-11 14:40:03 +00:00
James Edwards-Jones 334915d508 Merge branch 'import-symlinks-9-3' into 'security-9-3'
Fix file disclosure via hidden symlinks using the project import (9.3)

See merge request !2164
2017-08-10 20:42:01 +01:00
Yorick Peterse 0395c47193
Migrate events into a new format
This commit migrates events data in such a way that push events are
stored much more efficiently. This is done by creating a shadow table
called "events_for_migration", and a table called "push_event_payloads"
which is used for storing push data of push events. The background
migration in this commit will copy events from the "events" table into
the "events_for_migration" table, push events in will also have a row
created in "push_event_payloads".

This approach allows us to reclaim space in the next release by simply
swapping the "events" and "events_for_migration" tables, then dropping
the old events (now "events_for_migration") table.

The new table structure is also optimised for storage space, and does
not include the unused "title" column nor the "data" column (since this
data is moved to "push_event_payloads").

== Newly Created Events

Newly created events are inserted into both "events" and
"events_for_migration", both using the exact same primary key value. The
table "push_event_payloads" in turn has a foreign key to the _shadow_
table. This removes the need for recreating and validating the foreign
key after swapping the tables. Since the shadow table also has a foreign
key to "projects.id" we also don't have to worry about orphaned rows.

This approach however does require some additional storage as we're
duplicating a portion of the events data for at least 1 release. The
exact amount is hard to estimate, but for GitLab.com this is expected to
be between 10 and 20 GB at most. The background migration in this commit
deliberately does _not_ update the "events" table as doing so would put
a lot of pressure on PostgreSQL's auto vacuuming system.

== Supporting Both Old And New Events

Application code has also been adjusted to support push events using
both the old and new data formats. This is done by creating a PushEvent
class which extends the regular Event class. Using Rails' Single Table
Inheritance system we can ensure the right class is used for the right
data, which in this case is based on the value of `events.action`. To
support displaying old and new data at the same time the PushEvent class
re-defines a few methods of the Event class, falling back to their
original implementations for push events in the old format.

Once all existing events have been migrated the various push event
related methods can be removed from the Event model, and the calls to
`super` can be removed from the methods in the PushEvent model.

The UI and event atom feed have also been slightly changed to better
handle this new setup, fortunately only a few changes were necessary to
make this work.

== API Changes

The API only displays push data of events in the new format. Supporting
both formats in the API is a bit more difficult compared to the UI.
Since the old push data was not really well documented (apart from one
example that used an incorrect "action" nmae) I decided that supporting
both was not worth the effort, especially since events will be migrated
in a few days _and_ new events are created in the correct format.
2017-08-10 17:45:44 +02:00
Rémy Coutable c946ee1282
Enable the Layout/SpaceBeforeBlockBraces cop
Signed-off-by: Rémy Coutable <remy@rymai.me>
2017-08-09 11:52:22 +02:00
Oswaldo Ferreira 0640b3d1d8 Store MergeWorker JID on merge request, and clean up stuck merges 2017-08-07 15:23:37 -03:00
Robert Speicher 72a7b30c9f Change all `:empty_project` to `:project` 2017-08-02 17:47:31 -04:00
Robert Speicher 9513bd18c4 Ensure all project factories use `:repository` trait or `:empty_project` 2017-08-01 14:51:52 -04:00
Gabriel Mazetto abb878326c Rename many path_with_namespace -> full_path 2017-08-01 07:26:58 +02:00
Grzegorz Bizon 8f1274ae03 Merge commit '9a3b283402b8cc1c86802c526f19a459ce09c2e3' into backstage/gb/migrate-stages-statuses
* commit '9a3b283402b8cc1c86802c526f19a459ce09c2e3': (270 commits)
  Add a note about EFS and GitLab log files
  Projects logo are not centered vertically on projects page
  Fix spec/features/projects/branches_spec
  Fixup POST /v3/:id/hooks and PUT /v3/:id/hooks/:hook_id
  Fix a spec that was assuming to be on the wrong page
  Add copy about search terms to ux guide
  Update documentation of user creation by replacing the 'confirm' param with 'skip_confirmation'
  Fix replying to commit comments on MRs from forks
  Fix 500 error when rendering avatar for deleted project creator
  Load and process at most 100 commits when pushing into default branch
  Ensure Gitlab::Application.routes.default_url_options are set correctly in Capybara + :js specs
  Add log messages to clarify log messages about API CSRF token verification failure
  Update gitlab_flow.md, Teatro seems to be completely dead, see also https://forum.gitlab.com/t/gitlab-flow-documentation-teatro/7774
  Fix diff commenting results just after changing view
  Update CHANGELOG.md for 9.4.2
  none is not a CSS Value for sizes ;-)
  Merge issuable "reopened" state into "opened"
  Make access level more compatible with EE
  Add link to JIRA article in docs
  Expand pipeline_trigger_service_spec by godfat request
  ...
2017-07-31 10:50:10 +02:00
Shinya Maeda 56418e85ac init 2017-07-28 18:13:29 +09:00
Rémy Coutable ddccd24c13 Remove superfluous lib: true, type: redis, service: true, models: true, services: true, no_db: true, api: true
Signed-off-by: Rémy Coutable <remy@rymai.me>
2017-07-27 14:31:53 +02:00
Sean McGivern 2e483ca9e3 Merge branch 'rc/fix-tests-factories' into 'master'
Fix the :project factory by not copying the test repo twice

See merge request !13123
2017-07-27 08:55:53 +00:00
Rémy Coutable 05e152fa7f
Fix the :project factory by not copying the test repo twice
Also, fixing some calls to the :project factory with the :test_repo
trait since this trait is already included in the :project factory.

Signed-off-by: Rémy Coutable <remy@rymai.me>
2017-07-27 09:58:06 +02:00
Sean McGivern 396b8f91ec Fix saving diffs that are not valid UTF-8
Previously, we used Psych, which would:

1. Check if a string was encoded as binary, and not ASCII-compatible.
2. Add the !binary tag in that case.
3. Convert to base64.

We need to do the same thing, using a new column in place of the tag.
2017-07-26 15:34:57 +01:00
Grzegorz Bizon c14bd53d74 Fix import/export for CI/CD stage commit statuses 2017-07-24 14:13:29 +02:00
Grzegorz Bizon d3814ad698 Adds some specs for stage optimistic locking 2017-07-24 11:22:01 +02:00
Timothy Andrew 72a85ae9ac Handle errors while a project is being deleted asynchronously.
1. Rescue all errors that `Projects::DestroyService` might throw, to prevent the
   worker from leaving things in an inconsistent state

2. Unmark the project as `pending_delete`

3. Add a `delete_error` text column to `projects`, and save the error message in
   there, to be shown to the project masters/owners.
2017-07-20 09:56:52 +01:00
Grzegorz Bizon 6e9924a224 Add a new stage status column to safe attributes 2017-07-11 11:56:15 +02:00
Kamil Trzciński a77158ff31 Merge branch 'feature/intermediate/32568-adding-variables-to-pipelines-schedules' into 'master'
Add variables to pipelines schedules

Closes #32568

See merge request !12372
2017-07-07 15:17:02 +00:00
Felipe Artur b5f596c3ff Native group milestones 2017-07-07 15:08:49 +00:00
Shinya Maeda 08fba1327f merge from master 2017-07-07 16:12:13 +09:00
Sean McGivern aff5c9f3e5 Add table for merge request commits
This is an ID-less table with just three columns: an association to the merge
request diff the commit belongs to, the relative order of the commit within the
merge request diff, and the commit SHA itself.

Previously we stored much more information about the commits, so that we could
display them even when they were deleted from the repo. Since 8.0, we ensure
that those commits are kept around for as long as the target repo itself is, so
we don't need to duplicate that data in the database.
2017-07-06 17:36:10 +01:00
Lin Jen-Shin 9f5ac179d1 Rename ci_config_file to ci_config_path 2017-07-05 20:11:01 +08:00
Shinya Maeda 3acc91866b Fix spec 2017-07-05 18:38:35 +09:00
Shinya Maeda ff7529b39d Fix spec/lib/gitlab/import_export/all_models.yml 2017-07-05 18:38:35 +09:00
Shinya Maeda 324cfe0f9b Fix spec. Add PipelineScheduleVariable for import_export 2017-07-05 18:38:35 +09:00
Shinya Maeda 17f34e5a74 Fix spec 2017-07-05 18:36:19 +09:00
Shinya Maeda cd6aa92207 Fix spec/lib/gitlab/import_export/all_models.yml 2017-07-05 18:36:19 +09:00
Shinya Maeda b6f41544d8 Fix spec. Add PipelineScheduleVariable for import_export 2017-07-05 18:36:19 +09:00
Lin Jen-Shin fb897f53bb Merge remote-tracking branch 'upstream/master' into 32815--Add-Custom-CI-Config-Path
* upstream/master: (39 commits)
  Fix rubocop offenses
  Make entrypoint and command keys to be array of strings
  Add issuable-list class to shared mr/issue lists to fix new responsive layout
  New navigation breadcrumbs
  Restore timeago translations in renderTimeago.
  Automatically hide sidebar on smaller screens
  Fix typo in IssuesFinder comment
  Remove placeholder note when award emoji slash command is applied
  Make setSidebarHeight more efficient with SidebarHeightManager.
  Update CHANGELOG.md for 9.3.3
  Resolve "More actions dropdown hidden by end of diff"
  Use Gitaly 0.14.0
  Improve support for external issue references
  Make issuables_count_for_state public
  Only verifies top position after the request has finished to account for errors
  Clarify counter caching for users without project access
  Make finders responsible for counter cache keys
  Add changelog entry for issue / MR tab counting optimisations
  Don't count any confidential issues for non-project-members
  Cache total issue / MR counts for project by user type
  ...
2017-07-03 14:03:10 +08:00
Alejandro Rodríguez f4e6aba1bb Set the GL_REPOSITORY env variable on Gitlab::Git::Hook 2017-06-29 15:22:40 -04:00
Lin Jen-Shin 468e8b5558 Fix doc, test, and form 2017-06-28 18:17:53 +08:00
Adam Niedzielski 0eb3d18c56 Store merge request ref_fetched status in the database
Closes #34052
2017-06-26 17:36:09 +02:00
Sean McGivern 9a73b634ab Add table for files in merge request diffs
This adds an ID-less table containing one row per file, per merge request
diff. It has a column for each attribute on Gitlab::Git::Diff that is serialised
currently, with the advantage that we can easily query the attributes of this
new table.

It does not migrate existing data, so we have fallback code when the legacy
st_diffs column is present instead. For a merge request diff to be valid, it
should have at most one of:

* Rows in this new table, with the correct merge_request_diff_id.
* A non-NULL st_diffs column.

It may have neither, if the diff is empty.
2017-06-16 18:30:01 +01:00
Kamil Trzciński 5c26f4718b Merge branch 'feature/gb/persist-pipeline-stages' into 'master'
Persist stages in the database

Closes #26481

See merge request !11790
2017-06-07 11:32:29 +00:00
Kamil Trzciński acd0b691a4 Merge branch 'feature/gb/migrate-pipeline-stages' into 'master'
Migrate pipeline stages in the database

See merge request !11714
2017-06-07 11:30:18 +00:00
Phil Hughes 563ea34692 Merge branch '12910-snippets-description' into 'master'
Support descriptions for snippets

Closes #31894

See merge request !11071
2017-06-07 09:26:48 +00:00
Grzegorz Bizon 96a7236bfd Merge branch 'feature/gb/migrate-pipeline-stages' into feature/gb/persist-pipeline-stages
* feature/gb/migrate-pipeline-stages: (76 commits)
  redesign caching of application settings
  Fix binary encoding error on MR diffs
  Fix missing tooltip and ARIA labels for accessibility
  Add info on using self-signed certs with Registry
  Actually clean gitlab-test path when TestEnv.set_repo_refs fails
  Introduce optimistic locking support via optional parameter last_commit_id on File Update API
  Move issuable bulk edit form into a new sidebar.
  Add PowerShell to CI variable docs
  Responsive environment tables
  Accept a username for User-level Events API
  Introduce an Events API
  Update GitLab Pages to v0.4.3
  Allow numeric pages domain
  Remove references to old settings location
  Resolve "API: Environment info missed"
  Fix Projects API spec
  Resolve "When changing project visibility setting, change other dropdowns automatically"
  Update explanation of job-level variable override to fit example
  change headings to improve SEO
  backports changed import logic from pull mirroring feature into CE
  ...
2017-06-06 21:22:19 +02:00
Grzegorz Bizon 36ed05faf4 Merge commit '6ac1caa01a4c059f5bcb7c9da2e83001e5469f73' into feature/gb/migrate-pipeline-stages
* commit '6ac1caa01a4c059f5bcb7c9da2e83001e5469f73': (76 commits)
  redesign caching of application settings
  Fix binary encoding error on MR diffs
  Fix missing tooltip and ARIA labels for accessibility
  Add info on using self-signed certs with Registry
  Actually clean gitlab-test path when TestEnv.set_repo_refs fails
  Introduce optimistic locking support via optional parameter last_commit_id on File Update API
  Move issuable bulk edit form into a new sidebar.
  Add PowerShell to CI variable docs
  Responsive environment tables
  Accept a username for User-level Events API
  Introduce an Events API
  Update GitLab Pages to v0.4.3
  Allow numeric pages domain
  Remove references to old settings location
  Resolve "API: Environment info missed"
  Fix Projects API spec
  Resolve "When changing project visibility setting, change other dropdowns automatically"
  Update explanation of job-level variable override to fit example
  change headings to improve SEO
  backports changed import logic from pull mirroring feature into CE
  ...
2017-06-06 21:21:11 +02:00
Tim Zallmann 43dcb0afdb Merge branch 'jej-backport-protected-tag-ee-role-refactorings' into 'master'
Backport EE refactorings for Protected Tag EE-only functionality

See merge request !11125
2017-06-05 18:32:37 +00:00
Grzegorz Bizon 25b26c2f28 Fix typo in import/export safe model attributes 2017-06-05 15:01:15 +02:00
Grzegorz Bizon 5b718d4825 Merge branch 'master' into feature/gb/migrate-pipeline-stages
* master: (524 commits)
  Improve user experience around slash commands in instant comments
  Fix LFS timeouts when trying to save large files
  retryable? is now available for CommitStatus
  Resolve "Documentation of `.gitlab-ci.yml` states incorrect example for variables"
  Fix test failures
  Add slugify project path to CI enviroment variables
  Fixed typo: craeted -> created
  32118 Make New environment empty state btn lowercase
  Expose import_status in Projects API
  32832 Remove overflow from comment form for confidential issues and vertically aligns confidential issue icon
  Fix test failures
  Allow manual bypass of auto_sign_in_with_provider
  Fix keys seed
  Allow users to be hard-deleted from the API
  fixup some classnames and media queries
  Enable the Style/PreferredHashMethods cop
  Lint our factories creation in addition to their build
  Don’t schedule workers from inside transactions
  Allow scheduling from after_commit hooks
  Forbid Sidekiq scheduling in transactions
  ...

Conflicts:
	db/schema.rb
	spec/spec_helper.rb
2017-06-05 13:13:38 +02:00
Grzegorz Bizon 79380fe5fb Merge branch 'master' into feature/gb/persist-pipeline-stages
* master: (524 commits)
  Improve user experience around slash commands in instant comments
  Fix LFS timeouts when trying to save large files
  retryable? is now available for CommitStatus
  Resolve "Documentation of `.gitlab-ci.yml` states incorrect example for variables"
  Fix test failures
  Add slugify project path to CI enviroment variables
  Fixed typo: craeted -> created
  32118 Make New environment empty state btn lowercase
  Expose import_status in Projects API
  32832 Remove overflow from comment form for confidential issues and vertically aligns confidential issue icon
  Fix test failures
  Allow manual bypass of auto_sign_in_with_provider
  Fix keys seed
  Allow users to be hard-deleted from the API
  fixup some classnames and media queries
  Enable the Style/PreferredHashMethods cop
  Lint our factories creation in addition to their build
  Don’t schedule workers from inside transactions
  Allow scheduling from after_commit hooks
  Forbid Sidekiq scheduling in transactions
  ...

Conflicts:
	app/serializers/pipeline_entity.rb
	db/schema.rb
	spec/factories/ci/stages.rb
	spec/lib/gitlab/import_export/safe_model_attributes.yml
	spec/services/ci/create_pipeline_service_spec.rb
	spec/spec_helper.rb
2017-06-05 12:51:59 +02:00
Grzegorz Bizon 3801a0df80 Export pipeline stages in import/export feature 2017-06-05 12:46:57 +02:00
Grzegorz Bizon 1a438e9f71 Use stage_id column in code that needs to know about it 2017-06-01 12:21:34 +02:00
Kamil Trzcinski 161af17c1b Introduce source to pipeline entity 2017-05-31 14:17:49 +02:00