summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2019-11-21 00:06:02 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2019-11-21 00:06:02 +0000
commit96f3246b9ca41d27d1e268ac3fc90326ad0714ba (patch)
tree2b0e7426d4aae6dd7461ccdb4c5be315313254ab
parent2477ab5553eabc6c4579cb23aba620ffc8cba228 (diff)
downloadgitlab-ce-96f3246b9ca41d27d1e268ac3fc90326ad0714ba.tar.gz
Add latest changes from gitlab-org/gitlab@master
-rw-r--r--app/graphql/types/issue_sort_enum.rb2
-rw-r--r--app/helpers/issues_helper.rb2
-rw-r--r--changelogs/unreleased/29713-graphql-add-issue-weight-sorting.yml5
-rw-r--r--changelogs/unreleased/35094-mr-approver-tooltip-color.yml5
-rw-r--r--changelogs/unreleased/sh-disable-google-backup-acl.yml5
-rw-r--r--db/migrate/20191026120008_add_promoted_to_epic_to_issues.rb16
-rw-r--r--db/migrate/20191026120112_add_promoted_to_epic_to_issues_index.rb22
-rw-r--r--db/schema.rb3
-rw-r--r--doc/api/graphql/reference/gitlab_schema.graphql10
-rw-r--r--doc/api/graphql/reference/gitlab_schema.json12
-rw-r--r--lib/backup/manager.rb28
-rw-r--r--locale/gitlab.pot3
-rw-r--r--spec/lib/backup/manager_spec.rb36
-rw-r--r--spec/lib/gitlab/import_export/all_models.yml1
-rw-r--r--spec/lib/gitlab/import_export/safe_model_attributes.yml1
15 files changed, 143 insertions, 8 deletions
diff --git a/app/graphql/types/issue_sort_enum.rb b/app/graphql/types/issue_sort_enum.rb
index 48ff5819286..4be7260e0b1 100644
--- a/app/graphql/types/issue_sort_enum.rb
+++ b/app/graphql/types/issue_sort_enum.rb
@@ -12,3 +12,5 @@ module Types
end
# rubocop: enable Graphql/AuthorizeTypes
end
+
+Types::IssueSortEnum.prepend_if_ee('::EE::Types::IssueSortEnum')
diff --git a/app/helpers/issues_helper.rb b/app/helpers/issues_helper.rb
index 6375513f514..34b6ba05a62 100644
--- a/app/helpers/issues_helper.rb
+++ b/app/helpers/issues_helper.rb
@@ -183,4 +183,4 @@ module IssuesHelper
module_function :url_for_tracker_issue
end
-IssuesHelper.include_if_ee('EE::IssuesHelper')
+IssuesHelper.prepend_if_ee('EE::IssuesHelper')
diff --git a/changelogs/unreleased/29713-graphql-add-issue-weight-sorting.yml b/changelogs/unreleased/29713-graphql-add-issue-weight-sorting.yml
new file mode 100644
index 00000000000..ce2ada38a82
--- /dev/null
+++ b/changelogs/unreleased/29713-graphql-add-issue-weight-sorting.yml
@@ -0,0 +1,5 @@
+---
+title: Graphql query for issues can now be sorted by weight
+merge_request: 19721
+author:
+type: added
diff --git a/changelogs/unreleased/35094-mr-approver-tooltip-color.yml b/changelogs/unreleased/35094-mr-approver-tooltip-color.yml
new file mode 100644
index 00000000000..962f62aa035
--- /dev/null
+++ b/changelogs/unreleased/35094-mr-approver-tooltip-color.yml
@@ -0,0 +1,5 @@
+---
+title: Fixes MR approvers tooltip wrong color
+merge_request: 20287
+author: Dheeraj Joshi
+type: fixed
diff --git a/changelogs/unreleased/sh-disable-google-backup-acl.yml b/changelogs/unreleased/sh-disable-google-backup-acl.yml
new file mode 100644
index 00000000000..0fa300879e4
--- /dev/null
+++ b/changelogs/unreleased/sh-disable-google-backup-acl.yml
@@ -0,0 +1,5 @@
+---
+title: 'Backup: Disable setting of ACL for Google uploads'
+merge_request: 20407
+author:
+type: fixed
diff --git a/db/migrate/20191026120008_add_promoted_to_epic_to_issues.rb b/db/migrate/20191026120008_add_promoted_to_epic_to_issues.rb
new file mode 100644
index 00000000000..158dbf69bcc
--- /dev/null
+++ b/db/migrate/20191026120008_add_promoted_to_epic_to_issues.rb
@@ -0,0 +1,16 @@
+# frozen_string_literal: true
+
+# See http://doc.gitlab.com/ce/development/migration_style_guide.html
+# for more information on how to write migrations for GitLab.
+
+class AddPromotedToEpicToIssues < ActiveRecord::Migration[5.2]
+ DOWNTIME = false
+
+ def up
+ add_column :issues, :promoted_to_epic_id, :integer
+ end
+
+ def down
+ remove_column :issues, :promoted_to_epic_id
+ end
+end
diff --git a/db/migrate/20191026120112_add_promoted_to_epic_to_issues_index.rb b/db/migrate/20191026120112_add_promoted_to_epic_to_issues_index.rb
new file mode 100644
index 00000000000..649c2f7abe5
--- /dev/null
+++ b/db/migrate/20191026120112_add_promoted_to_epic_to_issues_index.rb
@@ -0,0 +1,22 @@
+# frozen_string_literal: true
+
+# See http://doc.gitlab.com/ce/development/migration_style_guide.html
+# for more information on how to write migrations for GitLab.
+
+class AddPromotedToEpicToIssuesIndex < ActiveRecord::Migration[5.2]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ disable_ddl_transaction!
+
+ def up
+ add_concurrent_foreign_key :issues, :epics, column: :promoted_to_epic_id, on_delete: :nullify
+ add_concurrent_index :issues, :promoted_to_epic_id, where: 'promoted_to_epic_id IS NOT NULL'
+ end
+
+ def down
+ remove_concurrent_index(:issues, :promoted_to_epic_id)
+ remove_foreign_key :issues, column: :promoted_to_epic_id
+ end
+end
diff --git a/db/schema.rb b/db/schema.rb
index 41757457a52..21d045be380 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -2049,6 +2049,7 @@ ActiveRecord::Schema.define(version: 2019_11_18_182722) do
t.integer "closed_by_id"
t.integer "state_id", limit: 2, default: 1, null: false
t.integer "duplicated_to_id"
+ t.integer "promoted_to_epic_id"
t.index ["author_id"], name: "index_issues_on_author_id"
t.index ["closed_by_id"], name: "index_issues_on_closed_by_id"
t.index ["confidential"], name: "index_issues_on_confidential"
@@ -2065,6 +2066,7 @@ ActiveRecord::Schema.define(version: 2019_11_18_182722) do
t.index ["project_id", "relative_position", "state_id", "id"], name: "idx_issues_on_project_id_and_rel_position_and_state_id_and_id", order: { id: :desc }
t.index ["project_id", "updated_at", "id", "state"], name: "index_issues_on_project_id_and_updated_at_and_id_and_state"
t.index ["project_id", "updated_at", "id", "state_id"], name: "idx_issues_on_project_id_and_updated_at_and_id_and_state_id"
+ t.index ["promoted_to_epic_id"], name: "index_issues_on_promoted_to_epic_id", where: "(promoted_to_epic_id IS NOT NULL)"
t.index ["relative_position"], name: "index_issues_on_relative_position"
t.index ["state"], name: "index_issues_on_state"
t.index ["state_id"], name: "idx_issues_on_state_id"
@@ -4428,6 +4430,7 @@ ActiveRecord::Schema.define(version: 2019_11_18_182722) do
add_foreign_key "issue_tracker_data", "services", on_delete: :cascade
add_foreign_key "issue_user_mentions", "issues", on_delete: :cascade
add_foreign_key "issue_user_mentions", "notes", on_delete: :cascade
+ add_foreign_key "issues", "epics", column: "promoted_to_epic_id", name: "fk_df75a7c8b8", on_delete: :nullify
add_foreign_key "issues", "issues", column: "duplicated_to_id", name: "fk_9c4516d665", on_delete: :nullify
add_foreign_key "issues", "issues", column: "moved_to_id", name: "fk_a194299be1", on_delete: :nullify
add_foreign_key "issues", "milestones", name: "fk_96b1dd429c", on_delete: :nullify
diff --git a/doc/api/graphql/reference/gitlab_schema.graphql b/doc/api/graphql/reference/gitlab_schema.graphql
index a357c93b020..12ae1fc3029 100644
--- a/doc/api/graphql/reference/gitlab_schema.graphql
+++ b/doc/api/graphql/reference/gitlab_schema.graphql
@@ -2538,6 +2538,16 @@ enum IssueSort {
RELATIVE_POSITION_ASC
"""
+ Weight by ascending order
+ """
+ WEIGHT_ASC
+
+ """
+ Weight by descending order
+ """
+ WEIGHT_DESC
+
+ """
Created at ascending order
"""
created_asc
diff --git a/doc/api/graphql/reference/gitlab_schema.json b/doc/api/graphql/reference/gitlab_schema.json
index fea67f28d69..7bbbe823697 100644
--- a/doc/api/graphql/reference/gitlab_schema.json
+++ b/doc/api/graphql/reference/gitlab_schema.json
@@ -13772,6 +13772,18 @@
"description": "Relative position by ascending order",
"isDeprecated": false,
"deprecationReason": null
+ },
+ {
+ "name": "WEIGHT_ASC",
+ "description": "Weight by ascending order",
+ "isDeprecated": false,
+ "deprecationReason": null
+ },
+ {
+ "name": "WEIGHT_DESC",
+ "description": "Weight by descending order",
+ "isDeprecated": false,
+ "deprecationReason": null
}
],
"possibleTypes": null
diff --git a/lib/backup/manager.rb b/lib/backup/manager.rb
index ce0c4c5d974..cb1f2fdcd17 100644
--- a/lib/backup/manager.rb
+++ b/lib/backup/manager.rb
@@ -47,11 +47,7 @@ module Backup
directory = connect_to_remote_directory(connection_settings)
- if directory.files.create(key: remote_target, body: File.open(tar_file), public: false,
- multipart_chunk_size: Gitlab.config.backup.upload.multipart_chunk_size,
- encryption: Gitlab.config.backup.upload.encryption,
- encryption_key: Gitlab.config.backup.upload.encryption_key,
- storage_class: Gitlab.config.backup.upload.storage_class)
+ if directory.files.create(create_attributes)
progress.puts "done".color(:green)
else
puts "uploading backup to #{remote_directory} failed".color(:red)
@@ -252,5 +248,27 @@ module Backup
skipped: ENV["SKIP"]
}
end
+
+ def create_attributes
+ attrs = {
+ key: remote_target,
+ body: File.open(tar_file),
+ multipart_chunk_size: Gitlab.config.backup.upload.multipart_chunk_size,
+ encryption: Gitlab.config.backup.upload.encryption,
+ encryption_key: Gitlab.config.backup.upload.encryption_key,
+ storage_class: Gitlab.config.backup.upload.storage_class
+ }
+
+ # Google bucket-only policies prevent setting an ACL. In any case, by default,
+ # all objects are set to the default ACL, which is project-private:
+ # https://cloud.google.com/storage/docs/json_api/v1/defaultObjectAccessControls
+ attrs[:public] = false unless google_provider?
+
+ attrs
+ end
+
+ def google_provider?
+ Gitlab.config.backup.upload.connection&.provider&.downcase == 'google'
+ end
end
end
diff --git a/locale/gitlab.pot b/locale/gitlab.pot
index 0bac018f70f..b39a2c7db09 100644
--- a/locale/gitlab.pot
+++ b/locale/gitlab.pot
@@ -9565,6 +9565,9 @@ msgstr ""
msgid "IssuableStatus|moved"
msgstr ""
+msgid "IssuableStatus|promoted"
+msgstr ""
+
msgid "Issue"
msgstr ""
diff --git a/spec/lib/backup/manager_spec.rb b/spec/lib/backup/manager_spec.rb
index 35594cd2fb8..06ad0557e37 100644
--- a/spec/lib/backup/manager_spec.rb
+++ b/spec/lib/backup/manager_spec.rb
@@ -326,7 +326,7 @@ describe Backup::Manager do
context 'target path' do
it 'uses the tar filename by default' do
expect_any_instance_of(Fog::Collection).to receive(:create)
- .with(hash_including(key: backup_filename))
+ .with(hash_including(key: backup_filename, public: false))
.and_return(true)
Dir.chdir(Gitlab.config.backup.path) do
@@ -338,7 +338,39 @@ describe Backup::Manager do
stub_env('DIRECTORY', 'daily')
expect_any_instance_of(Fog::Collection).to receive(:create)
- .with(hash_including(key: "daily/#{backup_filename}"))
+ .with(hash_including(key: "daily/#{backup_filename}", public: false))
+ .and_return(true)
+
+ Dir.chdir(Gitlab.config.backup.path) do
+ subject.upload
+ end
+ end
+ end
+
+ context 'with Google provider' do
+ before do
+ stub_backup_setting(
+ upload: {
+ connection: {
+ provider: 'Google',
+ google_storage_access_key_id: 'test-access-id',
+ google_storage_secret_access_key: 'secret'
+ },
+ remote_directory: 'directory',
+ multipart_chunk_size: Gitlab.config.backup.upload.multipart_chunk_size,
+ encryption: nil,
+ encryption_key: nil,
+ storage_class: nil
+ }
+ )
+
+ connection = ::Fog::Storage.new(Gitlab.config.backup.upload.connection.symbolize_keys)
+ connection.directories.create(key: Gitlab.config.backup.upload.remote_directory)
+ end
+
+ it 'does not attempt to set ACL' do
+ expect_any_instance_of(Fog::Collection).to receive(:create)
+ .with(hash_excluding(public: false))
.and_return(true)
Dir.chdir(Gitlab.config.backup.path) do
diff --git a/spec/lib/gitlab/import_export/all_models.yml b/spec/lib/gitlab/import_export/all_models.yml
index 27256ee311d..5612b0dc270 100644
--- a/spec/lib/gitlab/import_export/all_models.yml
+++ b/spec/lib/gitlab/import_export/all_models.yml
@@ -15,6 +15,7 @@ issues:
- user_agent_detail
- moved_to
- duplicated_to
+- promoted_to_epic
- events
- merge_requests_closing_issues
- metrics
diff --git a/spec/lib/gitlab/import_export/safe_model_attributes.yml b/spec/lib/gitlab/import_export/safe_model_attributes.yml
index c3d4bd01e51..a16c23832e2 100644
--- a/spec/lib/gitlab/import_export/safe_model_attributes.yml
+++ b/spec/lib/gitlab/import_export/safe_model_attributes.yml
@@ -20,6 +20,7 @@ Issue:
- due_date
- moved_to_id
- duplicated_to_id
+- promoted_to_epic_id
- lock_version
- milestone_id
- weight