提交 a9104a50 编写于 作者: G GitLab Bot

Add latest changes from gitlab-org/gitlab@master

上级 696b3629
...@@ -1130,6 +1130,12 @@ class Repository ...@@ -1130,6 +1130,12 @@ class Repository
true true
end end
def create_from_bundle(bundle_path)
raw.create_from_bundle(bundle_path).tap do |result|
after_create if result
end
end
def blobs_metadata(paths, ref = 'HEAD') def blobs_metadata(paths, ref = 'HEAD')
references = Array.wrap(paths).map { |path| [ref, path] } references = Array.wrap(paths).map { |path| [ref, path] }
......
---
title: Separate 5 classes into own entities files
merge_request: 24745
author: Rajendra Kadam
type: added
---
title: Squelch Snowplow tracker log messages
merge_request: 24809
author:
type: fixed
...@@ -3,21 +3,12 @@ ...@@ -3,21 +3,12 @@
# Gitlab.com uses Snowplow for identifying users and events. # Gitlab.com uses Snowplow for identifying users and events.
# https://gitlab.com/gitlab-org/gitlab/issues/6329 # https://gitlab.com/gitlab-org/gitlab/issues/6329
# #
# SnowplowTracker write log into STDERR # SnowplowTracker writes logs to STDERR:
# https://github.com/snowplow/snowplow-ruby-tracker/blob/39fcfa2be793f2e25e73087a9700abc93f43b5e8/lib/snowplow-tracker/emitters.rb#L23 # https://github.com/snowplow/snowplow-ruby-tracker/blob/39fcfa2be793f2e25e73087a9700abc93f43b5e8/lib/snowplow-tracker/emitters.rb#L23
# `LOGGER = Logger.new(STDERR)` if defined?(::SnowplowTracker::LOGGER)
# # This squelches the output of the logger since it doesn't really
# In puma.rb, if `stdout_redirect` specify stderr, Puma will overwrite STDERR in: # provide useful information.
# https://github.com/puma/puma/blob/b41205f5cacbc2ad0060472bdce68ba636f42175/lib/puma/runner.rb#L134 # https://github.com/snowplow/snowplow-ruby-tracker/pull/109
# `STDERR.reopen stderr, (append ? "a" : "w")` # would make it possible to configure this logger directly.
# As a result, SnowplowTracker will log into Puma stderr, when Puma enabled. ::SnowplowTracker::LOGGER.level = Logger::FATAL
#
# By default, SnowplowTracker uses default log formatter.
# When enable Puma, SnowplowTracker log is expected to be JSON format, as part of puma_stderr.log.
# Hence overwrite ::SnowplowTracker::LOGGER.formatter to JSON formatter
if defined?(::Puma) && defined?(::SnowplowTracker::LOGGER)
::SnowplowTracker::LOGGER.formatter = proc do |severity, datetime, progname, msg|
{ severity: severity, timestamp: datetime.utc.iso8601(3), pid: $$, progname: progname, message: msg }.to_json << "\n"
end
end end
...@@ -55,3 +55,23 @@ Adding a user: ...@@ -55,3 +55,23 @@ Adding a user:
SSO settings: SSO settings:
![OneLogin SSO settings](img/OneLogin-SSOsettings.png) ![OneLogin SSO settings](img/OneLogin-SSOsettings.png)
## ADFS
Setup SAML SSO URL:
![ADFS Setup SAML SSO URL](img/ADFS-saml-setup-sso-url.png)
Configure Assertions:
![ADFS Configure Assertions](img/ADFS-configure-assertions.png)
Configure NameID:
![ADFS ADFS-configure-NameID](img/ADFS-configure-NameID.png)
Determine Certificate Fingerprint:
| Via UI | Via Shell |
|--------|-----------|
| ![ADFS Determine Token Signing Certificate Fingerprint](img/ADFS-determine-token-signing-certificate-fingerprint.png) | ![ADFS Determine Token Signing Fingerprint From Shell](img/ADFS-determine-token-signing-fingerprint-from-shell.png) |
...@@ -131,7 +131,7 @@ The following API resources are available outside of project and group contexts ...@@ -131,7 +131,7 @@ The following API resources are available outside of project and group contexts
| [Projects](projects.md) | `/users/:id/projects` (also available for projects) | | [Projects](projects.md) | `/users/:id/projects` (also available for projects) |
| [Runners](runners.md) | `/runners` (also available for projects) | | [Runners](runners.md) | `/runners` (also available for projects) |
| [Search](search.md) | `/search` (also available for groups and projects) | | [Search](search.md) | `/search` (also available for groups and projects) |
| [Settings](settings.md) | `/application/settings` | | [Settings](settings.md) **(CORE ONLY)** | `/application/settings` |
| [Statistics](statistics.md) | `/application/statistics` | | [Statistics](statistics.md) | `/application/statistics` |
| [Sidekiq metrics](sidekiq_metrics.md) | `/sidekiq` | | [Sidekiq metrics](sidekiq_metrics.md) | `/sidekiq` |
| [Suggestions](suggestions.md) | `/suggestions` | | [Suggestions](suggestions.md) | `/suggestions` |
......
# Application settings API # Application settings API **(CORE ONLY)**
These API calls allow you to read and modify GitLab instance These API calls allow you to read and modify GitLab instance
[application settings](#list-of-settings-that-can-be-accessed-via-api-calls) [application settings](#list-of-settings-that-can-be-accessed-via-api-calls)
......
...@@ -129,86 +129,6 @@ module API ...@@ -129,86 +129,6 @@ module API
end end
end end
class PushEventPayload < Grape::Entity
expose :commit_count, :action, :ref_type, :commit_from, :commit_to, :ref,
:commit_title, :ref_count
end
class Event < Grape::Entity
expose :project_id, :action_name
expose :target_id, :target_iid, :target_type, :author_id
expose :target_title
expose :created_at
expose :note, using: Entities::Note, if: ->(event, options) { event.note? }
expose :author, using: Entities::UserBasic, if: ->(event, options) { event.author }
expose :push_event_payload,
as: :push_data,
using: PushEventPayload,
if: -> (event, _) { event.push_action? }
expose :author_username do |event, options|
event.author&.username
end
end
class ProjectGroupLink < Grape::Entity
expose :id, :project_id, :group_id, :group_access, :expires_at
end
class Todo < Grape::Entity
expose :id
expose :project, using: Entities::ProjectIdentity, if: -> (todo, _) { todo.project_id }
expose :group, using: 'API::Entities::NamespaceBasic', if: -> (todo, _) { todo.group_id }
expose :author, using: Entities::UserBasic
expose :action_name
expose :target_type
expose :target do |todo, options|
todo_options = options.fetch(todo.target_type, {})
todo_target_class(todo.target_type).represent(todo.target, todo_options)
end
expose :target_url do |todo, options|
todo_target_url(todo)
end
expose :body
expose :state
expose :created_at
def todo_target_class(target_type)
# false as second argument prevents looking up in module hierarchy
# see also https://gitlab.com/gitlab-org/gitlab-foss/issues/59719
::API::Entities.const_get(target_type, false)
end
def todo_target_url(todo)
target_type = todo.target_type.underscore
target_url = "#{todo.resource_parent.class.to_s.underscore}_#{target_type}_url"
Gitlab::Routing
.url_helpers
.public_send(target_url, todo.resource_parent, todo.target, anchor: todo_target_anchor(todo)) # rubocop:disable GitlabSecurity/PublicSend
end
def todo_target_anchor(todo)
"note_#{todo.note_id}" if todo.note_id?
end
end
class NamespaceBasic < Grape::Entity
expose :id, :name, :path, :kind, :full_path, :parent_id, :avatar_url
expose :web_url do |namespace|
if namespace.user?
Gitlab::Routing.url_helpers.user_url(namespace.owner)
else
namespace.web_url
end
end
end
class Namespace < NamespaceBasic class Namespace < NamespaceBasic
expose :members_count_with_descendants, if: -> (namespace, opts) { expose_members_count_with_descendants?(namespace, opts) } do |namespace, _| expose :members_count_with_descendants, if: -> (namespace, opts) { expose_members_count_with_descendants?(namespace, opts) } do |namespace, _|
namespace.users_with_descendants.count namespace.users_with_descendants.count
......
# frozen_string_literal: true
module API
module Entities
class Event < Grape::Entity
expose :project_id, :action_name
expose :target_id, :target_iid, :target_type, :author_id
expose :target_title
expose :created_at
expose :note, using: Entities::Note, if: ->(event, options) { event.note? }
expose :author, using: Entities::UserBasic, if: ->(event, options) { event.author }
expose :push_event_payload,
as: :push_data,
using: Entities::PushEventPayload,
if: -> (event, _) { event.push_action? }
expose :author_username do |event, options|
event.author&.username
end
end
end
end
# frozen_string_literal: true
module API
module Entities
class NamespaceBasic < Grape::Entity
expose :id, :name, :path, :kind, :full_path, :parent_id, :avatar_url
expose :web_url do |namespace|
if namespace.user?
Gitlab::Routing.url_helpers.user_url(namespace.owner)
else
namespace.web_url
end
end
end
end
end
# frozen_string_literal: true
module API
module Entities
class ProjectGroupLink < Grape::Entity
expose :id, :project_id, :group_id, :group_access, :expires_at
end
end
end
# frozen_string_literal: true
module API
module Entities
class PushEventPayload < Grape::Entity
expose :commit_count, :action, :ref_type, :commit_from, :commit_to, :ref,
:commit_title, :ref_count
end
end
end
# frozen_string_literal: true
module API
module Entities
class Todo < Grape::Entity
expose :id
expose :project, using: Entities::ProjectIdentity, if: -> (todo, _) { todo.project_id }
expose :group, using: 'API::Entities::NamespaceBasic', if: -> (todo, _) { todo.group_id }
expose :author, using: Entities::UserBasic
expose :action_name
expose :target_type
expose :target do |todo, options|
todo_options = options.fetch(todo.target_type, {})
todo_target_class(todo.target_type).represent(todo.target, todo_options)
end
expose :target_url do |todo, options|
todo_target_url(todo)
end
expose :body
expose :state
expose :created_at
def todo_target_class(target_type)
# false as second argument prevents looking up in module hierarchy
# see also https://gitlab.com/gitlab-org/gitlab-foss/issues/59719
::API::Entities.const_get(target_type, false)
end
def todo_target_url(todo)
target_type = todo.target_type.underscore
target_url = "#{todo.resource_parent.class.to_s.underscore}_#{target_type}_url"
Gitlab::Routing
.url_helpers
.public_send(target_url, todo.resource_parent, todo.target, anchor: todo_target_anchor(todo)) # rubocop:disable GitlabSecurity/PublicSend
end
def todo_target_anchor(todo)
"note_#{todo.note_id}" if todo.note_id?
end
end
end
end
...@@ -2781,6 +2781,45 @@ describe Repository do ...@@ -2781,6 +2781,45 @@ describe Repository do
end end
end end
describe '#create_from_bundle' do
let(:project) { create(:project) }
let(:repository) { project.repository }
let(:valid_bundle_path) { File.join(Dir.tmpdir, "repo-#{SecureRandom.hex}.bundle") }
let(:raw_repository) { repository.raw }
before do
allow(raw_repository).to receive(:create_from_bundle).and_return({})
end
after do
FileUtils.rm_rf(valid_bundle_path)
end
it 'calls out to the raw_repository to create a repo from bundle' do
expect(raw_repository).to receive(:create_from_bundle)
repository.create_from_bundle(valid_bundle_path)
end
it 'calls after_create' do
expect(repository).to receive(:after_create)
repository.create_from_bundle(valid_bundle_path)
end
context 'when exception is raised' do
before do
allow(raw_repository).to receive(:create_from_bundle).and_raise(::Gitlab::Git::BundleFile::InvalidBundleError)
end
it 'after_create is not executed' do
expect(repository).not_to receive(:after_create)
expect {repository.create_from_bundle(valid_bundle_path)}.to raise_error(::Gitlab::Git::BundleFile::InvalidBundleError)
end
end
end
describe "#blobs_metadata" do describe "#blobs_metadata" do
let_it_be(:project) { create(:project, :repository) } let_it_be(:project) { create(:project, :repository) }
let(:repository) { project.repository } let(:repository) { project.repository }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册