Commit a7d15258 authored by GitLab Bot's avatar GitLab Bot

Add latest changes from gitlab-org/gitlab@master

parent b69f4065
---
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 ...@@ -373,14 +373,12 @@ Starting from GitLab 12.6, new packages published to the GitLab NPM Registry exp
## NPM distribution tags ## 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.
You can add [distribution tags](https://docs.npmjs.com/cli/dist-tag) for newly They follow NPM's convention where they are optional, and each tag can only be assigned to one
published packages. They follow NPM's convention where they are optional, and package at a time. The `latest` tag is added by default when a package is published without a tag.
each tag can only be assigned to one package at a time. The latest tag is added The same applies to installing a package without specifying the tag or version.
by default when a package is published without a tag. The same goes to installing
a package without specifying the tag or version.
Examples of the supported `dist-tag` commands and using tags in general: Examples of the supported `dist-tag` commands and using tags in general:
......
...@@ -169,36 +169,6 @@ module API ...@@ -169,36 +169,6 @@ module API
expose :last_pipeline, using: Entities::PipelineBasic expose :last_pipeline, using: Entities::PipelineBasic
expose :variables, using: Entities::Variable expose :variables, using: Entities::Variable
end 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
end end
......
# 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
# frozen_string_literal: true
module API
module Entities
class FeatureGate < Grape::Entity
expose :key
expose :value
end
end
end
# frozen_string_literal: true
module API
module Entities
class ImpersonationToken < Entities::PersonalAccessToken
expose :impersonation
end
end
end
# frozen_string_literal: true
module API
module Entities
class ImpersonationTokenWithToken < Entities::PersonalAccessTokenWithToken
expose :impersonation
end
end
end
...@@ -12,6 +12,7 @@ module Gitlab ...@@ -12,6 +12,7 @@ module Gitlab
:console, :console,
:geo_log_cursor, :geo_log_cursor,
:puma, :puma,
:rails_runner,
:rake, :rake,
:sidekiq, :sidekiq,
:test_suite, :test_suite,
...@@ -64,6 +65,10 @@ module Gitlab ...@@ -64,6 +65,10 @@ module Gitlab
!!defined?(::GeoLogCursorOptionParser) !!defined?(::GeoLogCursorOptionParser)
end end
def rails_runner?
!!defined?(::Rails::Command::RunnerCommand)
end
def web_server? def web_server?
puma? || unicorn? puma? || unicorn?
end end
......
...@@ -97,4 +97,12 @@ describe Gitlab::Runtime do ...@@ -97,4 +97,12 @@ describe Gitlab::Runtime do
it_behaves_like "valid runtime", :geo_log_cursor, 1 it_behaves_like "valid runtime", :geo_log_cursor, 1
end 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 end
...@@ -217,18 +217,20 @@ describe Ci::StopEnvironmentsService do ...@@ -217,18 +217,20 @@ describe Ci::StopEnvironmentsService do
context 'when user does not have a permission to play the stop action' do context 'when user does not have a permission to play the stop action' do
before do before do
Ci::Build.find_by_ref('review/feature-2').update_column(:user_id, nil) project.team.truncate
end end
it 'tracks the exception' do it 'tracks the exception' do
deployable = Ci::Build.find_by_ref('review/feature-2')
expect(Gitlab::ErrorTracking) expect(Gitlab::ErrorTracking)
.to receive(:track_error) .to receive(:track_error)
.with(Gitlab::Access::AccessDeniedError, deployable_id: deployable.id).once .with(Gitlab::Access::AccessDeniedError, anything).twice
subject subject
end end
after do
project.add_developer(user)
end
end end
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment