Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-03-12 00:09:19 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2020-03-12 00:09:19 +0300
commitfca89bb73ff5b1d14c98c72481f9268fee107ea0 (patch)
treee1c8a2c4fe5df7f054fd09e49f53bcfb51e51c84 /lib
parent76e9fc7b29c1ce716c26932e9fbec0f3c99f53f4 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'lib')
-rw-r--r--lib/api/deploy_tokens.rb25
-rw-r--r--lib/banzai/filter/inline_embeds_filter.rb5
-rw-r--r--lib/gitlab/ci/templates/Security/Dependency-Scanning.gitlab-ci.yml5
-rw-r--r--lib/gitlab/usage_data.rb6
4 files changed, 29 insertions, 12 deletions
diff --git a/lib/api/deploy_tokens.rb b/lib/api/deploy_tokens.rb
index bc58cf0dd32..cb1ee7df496 100644
--- a/lib/api/deploy_tokens.rb
+++ b/lib/api/deploy_tokens.rb
@@ -31,7 +31,7 @@ module API
end
params do
- requires :id, type: Integer, desc: 'The ID of a project'
+ requires :id, type: String, desc: 'The ID of a project'
end
resource :projects, requirements: API::NAMESPACE_OR_PROJECT_REQUIREMENTS do
before do
@@ -74,7 +74,7 @@ module API
end
params do
- requires :id, type: Integer, desc: 'The ID of a group'
+ requires :id, type: String, desc: 'The ID of a group'
end
resource :groups, requirements: API::NAMESPACE_OR_PROJECT_REQUIREMENTS do
before do
@@ -94,6 +94,27 @@ module API
present paginate(user_group.deploy_tokens), with: Entities::DeployToken
end
+ params do
+ requires :name, type: String, desc: 'The name of the deploy token'
+ requires :expires_at, type: DateTime, desc: 'Expiration date for the deploy token. Does not expire if no value is provided.'
+ requires :username, type: String, desc: 'Username for deploy token. Default is `gitlab+deploy-token-{n}`'
+ requires :scopes, type: Array[String], values: ::DeployToken::AVAILABLE_SCOPES.map(&:to_s),
+ desc: 'Indicates the deploy token scopes. Must be at least one of "read_repository" or "read_registry".'
+ end
+ desc 'Create a group deploy token' do
+ detail 'This feature was introduced in GitLab 12.9'
+ success Entities::DeployTokenWithToken
+ end
+ post ':id/deploy_tokens' do
+ authorize!(:create_deploy_token, user_group)
+
+ deploy_token = ::Groups::DeployTokens::CreateService.new(
+ user_group, current_user, scope_params.merge(declared(params, include_missing: false, include_parent_namespaces: false))
+ ).execute
+
+ present deploy_token, with: Entities::DeployTokenWithToken
+ end
+
desc 'Delete a group deploy token' do
detail 'This feature was introduced in GitLab 12.9'
end
diff --git a/lib/banzai/filter/inline_embeds_filter.rb b/lib/banzai/filter/inline_embeds_filter.rb
index 79ac8555636..d7d78cf1866 100644
--- a/lib/banzai/filter/inline_embeds_filter.rb
+++ b/lib/banzai/filter/inline_embeds_filter.rb
@@ -6,7 +6,6 @@ module Banzai
# a given link format. To transform references to DB
# resources in place, prefer to inherit from AbstractReferenceFilter.
class InlineEmbedsFilter < HTML::Pipeline::Filter
- include Gitlab::Utils::StrongMemoize
# Find every relevant link, create a new node based on
# the link, and insert this node after any html content
# surrounding the link.
@@ -74,9 +73,7 @@ module Banzai
# Ex) 'https://<root>/<project>/<environment>/metrics?title=Title&group=Group'
# --> { title: 'Title', group: 'Group' }
def query_params(url)
- strong_memoize(:query_params) do
- Gitlab::Metrics::Dashboard::Url.parse_query(url)
- end
+ Gitlab::Metrics::Dashboard::Url.parse_query(url)
end
# Implement in child class.
diff --git a/lib/gitlab/ci/templates/Security/Dependency-Scanning.gitlab-ci.yml b/lib/gitlab/ci/templates/Security/Dependency-Scanning.gitlab-ci.yml
index 4a9fa3091be..3200220a332 100644
--- a/lib/gitlab/ci/templates/Security/Dependency-Scanning.gitlab-ci.yml
+++ b/lib/gitlab/ci/templates/Security/Dependency-Scanning.gitlab-ci.yml
@@ -5,7 +5,8 @@
# How to set: https://docs.gitlab.com/ee/ci/yaml/#variables
variables:
- DS_ANALYZER_IMAGE_PREFIX: "registry.gitlab.com/gitlab-org/security-products/analyzers"
+ SECURITY_SCANNER_IMAGE_PREFIX: "registry.gitlab.com/gitlab-org/security-products"
+ DS_ANALYZER_IMAGE_PREFIX: "$SECURITY_SCANNER_IMAGE_PREFIX/analyzers"
DS_DEFAULT_ANALYZERS: "bundler-audit, retire.js, gemnasium, gemnasium-maven, gemnasium-python"
DS_MAJOR_VERSION: 2
DS_DISABLE_DIND: "false"
@@ -64,7 +65,7 @@ dependency_scanning:
) \
--volume "$PWD:/code" \
--volume /var/run/docker.sock:/var/run/docker.sock \
- "registry.gitlab.com/gitlab-org/security-products/dependency-scanning:$DS_VERSION" /code
+ "$SECURITY_SCANNER_IMAGE_PREFIX/dependency-scanning:$DS_VERSION" /code
artifacts:
reports:
dependency_scanning: gl-dependency-scanning-report.json
diff --git a/lib/gitlab/usage_data.rb b/lib/gitlab/usage_data.rb
index 09ea1c49c22..35c69099b01 100644
--- a/lib/gitlab/usage_data.rb
+++ b/lib/gitlab/usage_data.rb
@@ -183,10 +183,8 @@ module Gitlab
# rubocop: disable CodeReuse/ActiveRecord
def services_usage
- service_counts = count(Service.active.where(template: false).where.not(type: 'JiraService').group(:type), fallback: Hash.new(-1), batch: false)
-
- results = Service.available_services_names.each_with_object({}) do |service_name, response|
- response["projects_#{service_name}_active".to_sym] = service_counts["#{service_name}_service".camelize] || 0
+ results = Service.available_services_names.without('jira').each_with_object({}) do |service_name, response|
+ response["projects_#{service_name}_active".to_sym] = count(Service.active.where(template: false, type: "#{service_name}_service".camelize))
end
# Keep old Slack keys for backward compatibility, https://gitlab.com/gitlab-data/analytics/issues/3241