Add latest changes from gitlab-org/gitlab@master
This commit is contained in:
parent
b69f406585
commit
a7d1525878
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
title: Separate token entities into own class files
|
||||
merge_request: 24974
|
||||
author: Rajendra Kadam
|
||||
type: added
|
|
@ -373,14 +373,12 @@ Starting from GitLab 12.6, new packages published to the GitLab NPM Registry exp
|
|||
|
||||
## NPM distribution tags
|
||||
|
||||
> [Introduced](https://gitlab.com/gitlab-org/gitlab/issues/9425) in GitLab Premium 12.7.
|
||||
> [Introduced](https://gitlab.com/gitlab-org/gitlab/issues/9425) in GitLab Premium 12.8.
|
||||
|
||||
Dist Tags for newly published packages are supported, and they follow NPM's convention where they are optional, and each tag can only be assigned to 1 package at
|
||||
You can add [distribution tags](https://docs.npmjs.com/cli/dist-tag) for newly
|
||||
published packages. They follow NPM's convention where they are optional, and
|
||||
each tag can only be assigned to one package at a time. The latest tag is added
|
||||
by default when a package is published without a tag. The same goes to installing
|
||||
a package without specifying the tag or version.
|
||||
You can add [distribution tags](https://docs.npmjs.com/cli/dist-tag) for newly published packages.
|
||||
They follow NPM's convention where they are optional, and each tag can only be assigned to one
|
||||
package at a time. The `latest` tag is added by default when a package is published without a tag.
|
||||
The same applies to installing a package without specifying the tag or version.
|
||||
|
||||
Examples of the supported `dist-tag` commands and using tags in general:
|
||||
|
||||
|
|
|
@ -169,36 +169,6 @@ module API
|
|||
expose :last_pipeline, using: Entities::PipelineBasic
|
||||
expose :variables, using: Entities::Variable
|
||||
end
|
||||
|
||||
class ImpersonationToken < PersonalAccessToken
|
||||
expose :impersonation
|
||||
end
|
||||
|
||||
class ImpersonationTokenWithToken < PersonalAccessTokenWithToken
|
||||
expose :impersonation
|
||||
end
|
||||
|
||||
class FeatureGate < Grape::Entity
|
||||
expose :key
|
||||
expose :value
|
||||
end
|
||||
|
||||
class Feature < Grape::Entity
|
||||
expose :name
|
||||
expose :state
|
||||
expose :gates, using: FeatureGate do |model|
|
||||
model.gates.map do |gate|
|
||||
value = model.gate_values[gate.key]
|
||||
|
||||
# By default all gate values are populated. Only show relevant ones.
|
||||
if (value.is_a?(Integer) && value.zero?) || (value.is_a?(Set) && value.empty?)
|
||||
next
|
||||
end
|
||||
|
||||
{ key: gate.key, value: value }
|
||||
end.compact
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -0,0 +1,22 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
module API
|
||||
module Entities
|
||||
class Feature < Grape::Entity
|
||||
expose :name
|
||||
expose :state
|
||||
expose :gates, using: Entities::FeatureGate do |model|
|
||||
model.gates.map do |gate|
|
||||
value = model.gate_values[gate.key]
|
||||
|
||||
# By default all gate values are populated. Only show relevant ones.
|
||||
if (value.is_a?(Integer) && value.zero?) || (value.is_a?(Set) && value.empty?)
|
||||
next
|
||||
end
|
||||
|
||||
{ key: gate.key, value: value }
|
||||
end.compact
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
|
@ -0,0 +1,10 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
module API
|
||||
module Entities
|
||||
class FeatureGate < Grape::Entity
|
||||
expose :key
|
||||
expose :value
|
||||
end
|
||||
end
|
||||
end
|
|
@ -0,0 +1,9 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
module API
|
||||
module Entities
|
||||
class ImpersonationToken < Entities::PersonalAccessToken
|
||||
expose :impersonation
|
||||
end
|
||||
end
|
||||
end
|
|
@ -0,0 +1,9 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
module API
|
||||
module Entities
|
||||
class ImpersonationTokenWithToken < Entities::PersonalAccessTokenWithToken
|
||||
expose :impersonation
|
||||
end
|
||||
end
|
||||
end
|
|
@ -12,6 +12,7 @@ module Gitlab
|
|||
:console,
|
||||
:geo_log_cursor,
|
||||
:puma,
|
||||
:rails_runner,
|
||||
:rake,
|
||||
:sidekiq,
|
||||
:test_suite,
|
||||
|
@ -64,6 +65,10 @@ module Gitlab
|
|||
!!defined?(::GeoLogCursorOptionParser)
|
||||
end
|
||||
|
||||
def rails_runner?
|
||||
!!defined?(::Rails::Command::RunnerCommand)
|
||||
end
|
||||
|
||||
def web_server?
|
||||
puma? || unicorn?
|
||||
end
|
||||
|
|
|
@ -97,4 +97,12 @@ describe Gitlab::Runtime do
|
|||
|
||||
it_behaves_like "valid runtime", :geo_log_cursor, 1
|
||||
end
|
||||
|
||||
context "rails runner" do
|
||||
before do
|
||||
stub_const('::Rails::Command::RunnerCommand', double('::Rails::Command::RunnerCommand'))
|
||||
end
|
||||
|
||||
it_behaves_like "valid runtime", :rails_runner, 1
|
||||
end
|
||||
end
|
||||
|
|
|
@ -217,18 +217,20 @@ describe Ci::StopEnvironmentsService do
|
|||
|
||||
context 'when user does not have a permission to play the stop action' do
|
||||
before do
|
||||
Ci::Build.find_by_ref('review/feature-2').update_column(:user_id, nil)
|
||||
project.team.truncate
|
||||
end
|
||||
|
||||
it 'tracks the exception' do
|
||||
deployable = Ci::Build.find_by_ref('review/feature-2')
|
||||
|
||||
expect(Gitlab::ErrorTracking)
|
||||
.to receive(:track_error)
|
||||
.with(Gitlab::Access::AccessDeniedError, deployable_id: deployable.id).once
|
||||
.with(Gitlab::Access::AccessDeniedError, anything).twice
|
||||
|
||||
subject
|
||||
end
|
||||
|
||||
after do
|
||||
project.add_developer(user)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in New Issue