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

Add latest changes from gitlab-org/gitlab@master

上级 1e5ef4fb
<script> <script>
import { GlDeprecatedButton, GlTooltipDirective, GlIcon } from '@gitlab/ui'; import { GlButton, GlTooltipDirective } from '@gitlab/ui';
import { __ } from '~/locale'; import { __ } from '~/locale';
/** /**
* Renders the Monitoring (Metrics) link in environments table. * Renders the Monitoring (Metrics) link in environments table.
*/ */
export default { export default {
components: { components: {
GlIcon, GlButton,
GlDeprecatedButton,
}, },
directives: { directives: {
GlTooltip: GlTooltipDirective, GlTooltip: GlTooltipDirective,
...@@ -26,15 +25,14 @@ export default { ...@@ -26,15 +25,14 @@ export default {
}; };
</script> </script>
<template> <template>
<gl-deprecated-button <gl-button
v-gl-tooltip v-gl-tooltip
:href="monitoringUrl" :href="monitoringUrl"
:title="title" :title="title"
:aria-label="title" :aria-label="title"
class="monitoring-url d-none d-sm-none d-md-block" class="monitoring-url gl-display-none gl-display-sm-none gl-display-md-block"
icon="chart"
rel="noopener noreferrer nofollow" rel="noopener noreferrer nofollow"
variant="default" variant="default"
> />
<gl-icon name="chart" />
</gl-deprecated-button>
</template> </template>
---
title: Migrating to gl-button in Environments table
merge_request: 40444
author:
type: changed
---
title: Add first OpenAPI specification file
merge_request: 35868
author: winniehell
type: other
...@@ -603,9 +603,9 @@ or `gitlab-ctl promote-to-primary-node`, either: ...@@ -603,9 +603,9 @@ or `gitlab-ctl promote-to-primary-node`, either:
bug](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/22021) was bug](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/22021) was
fixed. fixed.
If the above does not work, another possible reason is that you have paused replication ### Message: ActiveRecord::RecordInvalid: Validation failed: Enabled Geo primary node cannot be disabled
from the original primary node before attempting to promote this node.
This error may occur if you have paused replication from the original primary node before attempting to promote this node.
To double check this, you can do the following: To double check this, you can do the following:
- Get the current secondary node's ID using: - Get the current secondary node's ID using:
......
...@@ -4,6 +4,8 @@ Automate GitLab via a simple and powerful API. ...@@ -4,6 +4,8 @@ Automate GitLab via a simple and powerful API.
The main GitLab API is a [REST](https://en.wikipedia.org/wiki/Representational_state_transfer) API. Therefore, documentation in this section assumes knowledge of REST concepts. The main GitLab API is a [REST](https://en.wikipedia.org/wiki/Representational_state_transfer) API. Therefore, documentation in this section assumes knowledge of REST concepts.
There is also a partial [OpenAPI definition](https://gitlab.com/gitlab-org/gitlab/blob/master/doc/api/openapi/openapi.yaml), which allows you to test the API directly from the GitLab user interface. Contributions are welcome.
## Available API resources ## Available API resources
For a list of the available resources and their endpoints, see For a list of the available resources and their endpoints, see
......
openapi: "3.0.0"
info:
description: |
An OpenAPI definition for the GitLab REST API.
Only one API resource/endpoint is currently included.
The intent is to expand this to match the entire Markdown documentation of the API:
<https://docs.gitlab.com/ee/api/>. Contributions are welcome.
When viewing this on gitlab.com, you can test API calls directly from the browser
against the `gitlab.com` instance, if you are logged in.
The feature uses the current [GitLab session cookie](https://docs.gitlab.com/ee/api/README.html#session-cookie),
so each request is made using your account.
Read more at <https://docs.gitlab.com/ee/development/documentation/styleguide.html#restful-api>.
version: "v4"
title: "GitLab API"
termsOfService: "https://about.gitlab.com/terms/"
license:
name: "CC BY-SA 4.0"
url: "https://gitlab.com/gitlab-org/gitlab/-/blob/master/LICENSE"
servers:
- url: "https://gitlab.com/api/"
paths:
/v4/version:
$ref: "v4/version.yaml"
# Markdown documentation: https://gitlab.com/gitlab-org/gitlab/-/blob/master/doc/api/version.md
get:
tags:
- version
summary: "Retrieve version information for this GitLab instance."
operationId: "getVersion"
responses:
"401":
description: "unauthorized operation"
"200":
description: "successful operation"
content:
"application/json":
schema:
title: "VersionResponse"
type: "object"
properties:
version:
type: "string"
revision:
type: "string"
examples:
Example:
value:
version: "13.3.0-pre"
revision: "f2b05afebb0"
...@@ -13,10 +13,12 @@ Always use an [Entity](https://gitlab.com/gitlab-org/gitlab/blob/master/lib/api/ ...@@ -13,10 +13,12 @@ Always use an [Entity](https://gitlab.com/gitlab-org/gitlab/blob/master/lib/api/
## Documentation ## Documentation
API endpoints must come with [documentation](documentation/styleguide.md#restful-api), unless it is internal or behind a feature flag. Each new or updated API endpoint must come with documentation, unless it is internal or behind a feature flag.
The docs should be in the same merge request, or, if strictly necessary, The docs should be in the same merge request, or, if strictly necessary,
in a follow-up with the same milestone as the original merge request. in a follow-up with the same milestone as the original merge request.
See the [Documentation Style Guide RESTful API section](documentation/styleguide.md#restful-api) for details on documenting API resources in Markdown as well as in OpenAPI definition files.
## Methods and parameters description ## Methods and parameters description
Every method must be described using the [Grape DSL](https://github.com/ruby-grape/grape#describing-methods) Every method must be described using the [Grape DSL](https://github.com/ruby-grape/grape#describing-methods)
......
...@@ -1738,8 +1738,13 @@ For guidance on developing GitLab with feature flags, see ...@@ -1738,8 +1738,13 @@ For guidance on developing GitLab with feature flags, see
## RESTful API ## RESTful API
Here is a list of must-have items for RESTful API documentation. Use them in the REST API resources are documented in Markdown under [`/doc/api`](https://gitlab.com/gitlab-org/gitlab/-/tree/master/doc/api). Each resource has its own Markdown file, which is linked from `api_resources.md`.
exact order that appears on this document. Further explanation is given below.
When modifying the Markdown, also update the corresponding [OpenAPI definition](https://gitlab.com/gitlab-org/gitlab/-/tree/master/doc/api/openapi) if one exists for the resource.
If not, consider creating one. Match the latest [OpenAPI 3.0.x specification](https://swagger.io/specification/).
(For more information, see the discussion in [this issue](https://gitlab.com/gitlab-org/gitlab/-/issues/16023#note_370901810).)
In the Markdown doc for a resource (AKA endpoint):
- Every method must have the REST API request. For example: - Every method must have the REST API request. For example:
......
...@@ -241,14 +241,16 @@ module API ...@@ -241,14 +241,16 @@ module API
break { success: false, message: "Invalid token expiry date: '#{params[:expires_at]}'" } break { success: false, message: "Invalid token expiry date: '#{params[:expires_at]}'" }
end end
access_token = nil result = ::PersonalAccessTokens::CreateService.new(
user, name: params[:name], scopes: params[:scopes], expires_at: expires_at
).execute
::Users::UpdateService.new(current_user, user: user).execute! do |user| unless result.status == :success
access_token = user.personal_access_tokens.create!( break { success: false, message: "Failed to create token: #{result.message}" }
name: params[:name], scopes: params[:scopes], expires_at: expires_at
)
end end
access_token = result.payload[:personal_access_token]
{ success: true, token: access_token.token, scopes: access_token.scopes, expires_at: access_token.expires_at } { success: true, token: access_token.token, scopes: access_token.scopes, expires_at: access_token.expires_at }
end end
......
import { shallowMount } from '@vue/test-utils'; import { shallowMount } from '@vue/test-utils';
import { GlIcon } from '@gitlab/ui'; import { GlButton } from '@gitlab/ui';
import MonitoringComponent from '~/environments/components/environment_monitoring.vue'; import MonitoringComponent from '~/environments/components/environment_monitoring.vue';
describe('Monitoring Component', () => { describe('Monitoring Component', () => {
...@@ -15,8 +15,8 @@ describe('Monitoring Component', () => { ...@@ -15,8 +15,8 @@ describe('Monitoring Component', () => {
}); });
}; };
const findIcons = () => wrapper.findAll(GlIcon); const findButtons = () => wrapper.findAll(GlButton);
const findIconsByName = name => findIcons().filter(icon => icon.props('name') === name); const findButtonsByIcon = icon => findButtons().filter(button => button.props('icon') === icon);
beforeEach(() => { beforeEach(() => {
createWrapper(); createWrapper();
...@@ -30,7 +30,7 @@ describe('Monitoring Component', () => { ...@@ -30,7 +30,7 @@ describe('Monitoring Component', () => {
it('should render a link to environment monitoring page', () => { it('should render a link to environment monitoring page', () => {
expect(wrapper.attributes('href')).toEqual(monitoringUrl); expect(wrapper.attributes('href')).toEqual(monitoringUrl);
expect(findIconsByName('chart').length).toBe(1); expect(findButtonsByIcon('chart').length).toBe(1);
expect(wrapper.attributes('title')).toBe('Monitoring'); expect(wrapper.attributes('title')).toBe('Monitoring');
expect(wrapper.attributes('aria-label')).toBe('Monitoring'); expect(wrapper.attributes('aria-label')).toBe('Monitoring');
}); });
......
...@@ -55,7 +55,7 @@ RSpec.describe Backup::Repository do ...@@ -55,7 +55,7 @@ RSpec.describe Backup::Repository do
end end
[4, 10].each do |max_storage_concurrency| [4, 10].each do |max_storage_concurrency|
context "max_storage_concurrency #{max_storage_concurrency}" do context "max_storage_concurrency #{max_storage_concurrency}", quarantine: 'https://gitlab.com/gitlab-org/gitlab/-/issues/241701' do
it 'creates the expected number of threads' do it 'creates the expected number of threads' do
expect(Thread).to receive(:new) expect(Thread).to receive(:new)
.exactly(storage_keys.length * (max_storage_concurrency + 1)).times .exactly(storage_keys.length * (max_storage_concurrency + 1)).times
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册