Add latest changes from gitlab-org/gitlab@master

This commit is contained in:
GitLab Bot 2022-12-13 21:07:31 +00:00
parent 5248c5e221
commit 3f0848998e
24 changed files with 191 additions and 58 deletions

View File

@ -701,6 +701,7 @@ Gitlab/NamespacedClass:
- 'app/validators/gitlab/zoom_url_validator.rb'
- 'app/validators/html_safety_validator.rb'
- 'app/validators/ip_address_validator.rb'
- 'app/validators/iso8601_date_validator.rb'
- 'app/validators/js_regex_validator.rb'
- 'app/validators/json_schema_validator.rb'
- 'app/validators/key_restriction_validator.rb'

View File

@ -87,6 +87,7 @@ export default {
frameborder="0"
height="100%"
:src="iframeSrcWithParams"
sandbox="allow-same-origin allow-forms allow-scripts"
></iframe>
</observability-skeleton>
</template>

View File

@ -16,5 +16,9 @@ module Types
value 'OBJECTIVE', value: 'objective',
description: 'Objective issue type. Available only when feature flag `okrs_mvc` is enabled.',
alpha: { milestone: '15.6' }
value 'KEY_RESULT', value: 'key_result',
description: 'Key Result issue type. Available only when feature flag `okrs_mvc` is enabled.',
alpha: { milestone: '15.7' }
end
end

View File

@ -37,6 +37,7 @@ class DeployToken < ApplicationRecord
message: "can contain only letters, digits, '_', '-', '+', and '.'"
}
validates :expires_at, iso8601_date: true, on: :create
validates :deploy_token_type, presence: true
enum deploy_token_type: {
group_type: 1,

View File

@ -0,0 +1,9 @@
# frozen_string_literal: true
class Iso8601DateValidator < ActiveModel::EachValidator
def validate_each(record, attribute, value)
Date.iso8601(record.read_attribute_before_type_cast(attribute).to_s)
rescue ArgumentError, TypeError
record.errors.add(attribute, _('must be in ISO 8601 format'))
end
end

View File

@ -21922,6 +21922,7 @@ Issue type.
| ----- | ----------- |
| <a id="issuetypeincident"></a>`INCIDENT` | Incident issue type. |
| <a id="issuetypeissue"></a>`ISSUE` | Issue issue type. |
| <a id="issuetypekey_result"></a>`KEY_RESULT` **{warning-solid}** | **Introduced** in 15.7. This feature is in Alpha. It can be changed or removed at any time. Key Result issue type. Available only when feature flag `okrs_mvc` is enabled. |
| <a id="issuetypeobjective"></a>`OBJECTIVE` **{warning-solid}** | **Introduced** in 15.6. This feature is in Alpha. It can be changed or removed at any time. Objective issue type. Available only when feature flag `okrs_mvc` is enabled. |
| <a id="issuetyperequirement"></a>`REQUIREMENT` | Requirement issue type. |
| <a id="issuetypetask"></a>`TASK` **{warning-solid}** | **Introduced** in 15.2. This feature is in Alpha. It can be changed or removed at any time. Task issue type. |

View File

@ -9,7 +9,7 @@ info: To determine the technical writer assigned to the Stage/Group associated w
> [Moved](https://gitlab.com/gitlab-org/gitlab/-/issues/221259) from GitLab Premium to GitLab Free in 13.3.
With the GitLab Package Registry, you can use GitLab as a private or public registry for a variety
of [supported package managers](#supported-package-managers).
of [supported package managers](reference.md#supported-package-managers).
You can publish and share packages, which can be consumed as a dependency in downstream projects.
## Package workflows
@ -122,50 +122,20 @@ your project's settings. For example, if you have a public project and set the r
to **Only Project Members**, the Package Registry is then public. Disabling the Package
Registry disables all Package Registry operations.
| Project visibility | Action | [Role](../../permissions.md#roles) required |
| ---- | ---- | ---- |
| Public | View Package Registry | `n/a`, everyone on the internet can perform this action |
| Public | Publish a package | Developer or higher |
| Public | Pull a package | `n/a`, everyone on the internet can perform this action |
| Internal | View Package Registry | Guest or higher |
| Internal | Publish a package | Developer or higher |
| Internal | Pull a package | Guest or higher(1) |
| Private | View Package Registry | Reporter or higher |
| Private | Publish a package | Developer or higher |
| Private | Pull a package | Reporter or higher(1) |
| Project visibility | Action | [Role](../../permissions.md#roles) required |
|--------------------|-----------------------|---------------------------------------------------------|
| Public | View Package Registry | `n/a`, everyone on the internet can perform this action |
| Public | Publish a package | Developer or higher |
| Public | Pull a package | `n/a`, everyone on the internet can perform this action |
| Internal | View Package Registry | Guest or higher |
| Internal | Publish a package | Developer or higher |
| Internal | Pull a package | Guest or higher(1) |
| Private | View Package Registry | Reporter or higher |
| Private | Publish a package | Developer or higher |
| Private | Pull a package | Reporter or higher(1) |
1. [GitLab-#329253](https://gitlab.com/gitlab-org/gitlab/-/issues/329253) proposes adding a setting to allow anyone (everyone on the internet) to pull from the Package Registry, no matter what the project visibility is.
## Supported package managers
WARNING:
Not all package manager formats are ready for production use. To view each format's status, see the
table's **Status** column.
The Package Registry supports the following formats:
| Package type | GitLab version | Status |
| ------------------------------------------------ | -------------- | ---------------------------------------------------------- |
| [Maven](../maven_repository/index.md) | 11.3+ | GA |
| [npm](../npm_registry/index.md) | 11.7+ | GA |
| [NuGet](../nuget_repository/index.md) | 12.8+ | GA |
| [PyPI](../pypi_repository/index.md) | 12.10+ | GA |
| [Generic packages](../generic_packages/index.md) | 13.5+ | GA |
| [Composer](../composer_repository/index.md) | 13.2+ | [Beta](https://gitlab.com/groups/gitlab-org/-/epics/6817) |
| [Conan](../conan_repository/index.md) | 12.6+ | [Beta](https://gitlab.com/groups/gitlab-org/-/epics/6816) |
| [Helm](../helm_repository/index.md) | 14.1+ | [Beta](https://gitlab.com/groups/gitlab-org/-/epics/6366) |
| [Debian](../debian_repository/index.md) | 14.2+ | [Alpha](https://gitlab.com/groups/gitlab-org/-/epics/6057) |
| [Go](../go_proxy/index.md) | 13.1+ | [Alpha](https://gitlab.com/groups/gitlab-org/-/epics/3043) |
| [Ruby gems](../rubygems_registry/index.md) | 13.10+ | [Alpha](https://gitlab.com/groups/gitlab-org/-/epics/3200) |
[Status](../../../policy/alpha-beta-support.md):
- Alpha: behind a feature flag and not officially supported.
- Beta: several known issues that may prevent expected use.
- GA (Generally Available): ready for production use at any scale.
You can also use the [API](../../../api/packages.md) to administer the Package Registry.
## Accepting contributions
This table lists unsupported package manager formats that we are accepting contributions for.

View File

@ -0,0 +1,58 @@
---
stage: Package
group: Package Registry
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/product/ux/technical-writing/#assignments
---
# Package Registry reference **(FREE)**
The following sections provide a quick reference to the tools, formats, and data structures supported in the Package Registry.
## Supported package managers
WARNING:
Not all package manager formats are ready for production use.
The Package Registry supports the following package manager types:
| Package type | GitLab version | Status |
| ------------------------------------------------ | -------------- | ---------------------------------------------------------- |
| [Maven](../maven_repository/index.md) | 11.3+ | GA |
| [npm](../npm_registry/index.md) | 11.7+ | GA |
| [NuGet](../nuget_repository/index.md) | 12.8+ | GA |
| [PyPI](../pypi_repository/index.md) | 12.10+ | GA |
| [Generic packages](../generic_packages/index.md) | 13.5+ | GA |
| [Composer](../composer_repository/index.md) | 13.2+ | [Beta](https://gitlab.com/groups/gitlab-org/-/epics/6817) |
| [Conan](../conan_repository/index.md) | 12.6+ | [Beta](https://gitlab.com/groups/gitlab-org/-/epics/6816) |
| [Helm](../helm_repository/index.md) | 14.1+ | [Beta](https://gitlab.com/groups/gitlab-org/-/epics/6366) |
| [Debian](../debian_repository/index.md) | 14.2+ | [Alpha](https://gitlab.com/groups/gitlab-org/-/epics/6057) |
| [Go](../go_proxy/index.md) | 13.1+ | [Alpha](https://gitlab.com/groups/gitlab-org/-/epics/3043) |
| [Ruby gems](../rubygems_registry/index.md) | 13.10+ | [Alpha](https://gitlab.com/groups/gitlab-org/-/epics/3200) |
[Status](../../../policy/alpha-beta-support.md):
- Alpha: behind a feature flag and not officially supported.
- Beta: several known issues that may prevent expected use.
- GA (Generally Available): ready for production use at any scale.
You can also use the [API](../../../api/packages.md) to administer the Package Registry.
## Supported hash types
Hash values are used to ensure you are using the correct package. You can view these values in the user interface or with the [API](../../../api/packages.md).
The Package Registry supports the following hash types:
| Package type | Supported hashes |
|--------------------------------------------------|----------------------------------|
| [Maven](../maven_repository/index.md) | MD5, SHA1 |
| [npm](../npm_registry/index.md) | SHA1 |
| [NuGet](../nuget_repository/index.md) | not applicable |
| [PyPI](../pypi_repository/index.md) | MD5, SHA256 |
| [Generic packages](../generic_packages/index.md) | SHA256 |
| [Composer](../composer_repository/index.md) | not applicable |
| [Conan](../conan_repository/index.md) | MD5, SHA1 |
| [Helm](../helm_repository/index.md) | not applicable |
| [Debian](../debian_repository/index.md) | MD5, SHA1, SHA256 |
| [Go](../go_proxy/index.md) | MD5, SHA1, SHA256 |
| [Ruby gems](../rubygems_registry/index.md) | MD5, SHA1, SHA256 (gemspec only) |

View File

@ -49787,6 +49787,9 @@ msgstr ""
msgid "must be greater than start date"
msgstr ""
msgid "must be in ISO 8601 format"
msgstr ""
msgid "must be in same hierarchy as custom role's namespace"
msgstr ""

View File

@ -93,6 +93,10 @@ module QA
has_css?('ul.gl-dropdown-contents', wait: 1)
end
def find_input_by_prefix_and_set(element_prefix, item_text)
find("input[id^=\"#{element_prefix}\"]").set(item_text)
end
private
# rubocop:disable Gitlab/PredicateMemoization

View File

@ -16,7 +16,7 @@ RSpec.describe Groups::Settings::RepositoryController do
let(:good_deploy_token_params) do
{
name: 'name',
expires_at: 1.day.from_now.to_s,
expires_at: 1.day.from_now.to_datetime.to_s,
username: 'deployer',
read_repository: '1',
deploy_token_type: DeployToken.deploy_token_types[:group_type]

View File

@ -54,7 +54,7 @@ RSpec.describe Projects::Settings::RepositoryController do
let(:good_deploy_token_params) do
{
name: 'name',
expires_at: 1.day.from_now.to_s,
expires_at: 1.day.from_now.to_datetime.to_s,
username: 'deployer',
read_repository: '1',
deploy_token_type: DeployToken.deploy_token_types[:project_type]

View File

@ -10,7 +10,7 @@ FactoryBot.define do
read_package_registry { false }
write_package_registry { false }
revoked { false }
expires_at { 5.days.from_now }
expires_at { 5.days.from_now.to_datetime }
deploy_token_type { DeployToken.deploy_token_types[:project_type] }
trait :revoked do

View File

@ -76,6 +76,11 @@ FactoryBot.define do
association :work_item_type, :default, :objective
end
trait :key_result do
issue_type { :key_result }
association :work_item_type, :default, :key_result
end
factory :incident do
issue_type { :incident }
association :work_item_type, :default, :incident

View File

@ -27,5 +27,15 @@ FactoryBot.define do
trait :last_edited_by_user do
association :last_edited_by, factory: :user
end
trait :objective do
issue_type { :objective }
association :work_item_type, :default, :objective
end
trait :key_result do
issue_type { :key_result }
association :work_item_type, :default, :key_result
end
end
end

View File

@ -2,7 +2,7 @@
require 'spec_helper'
RSpec.describe IssuesFinder do
RSpec.describe IssuesFinder, feature_category: :team_planning do
include_context 'IssuesFinder context'
it_behaves_like 'issues or work items finder', :issue, 'IssuesFinder#execute context'

View File

@ -2,7 +2,7 @@
require 'spec_helper'
RSpec.describe WorkItems::WorkItemsFinder do
RSpec.describe WorkItems::WorkItemsFinder, feature_category: :team_planning do
using RSpec::Parameterized::TableSyntax
include_context 'WorkItemsFinder context'

View File

@ -1,4 +1,4 @@
import { GlCollapsibleListbox, GlSearchBoxByType } from '@gitlab/ui';
import { GlCollapsibleListbox } from '@gitlab/ui';
import { mount, shallowMount } from '@vue/test-utils';
import Vue from 'vue';
import VueApollo from 'vue-apollo';
@ -30,7 +30,6 @@ describe('SourceBranchDropdown', () => {
let wrapper;
const findListbox = () => wrapper.findComponent(GlCollapsibleListbox);
const findSearchBox = () => wrapper.findComponent(GlSearchBoxByType);
const assertListboxItems = () => {
const listboxItems = findListbox().props('items');
@ -112,7 +111,7 @@ describe('SourceBranchDropdown', () => {
jest.clearAllMocks();
const mockSearchTerm = 'mai';
await findSearchBox().vm.$emit('input', mockSearchTerm);
await findListbox().vm.$emit('search', mockSearchTerm);
expect(mockGetProjectQuery).toHaveBeenCalledWith({
branchNamesLimit: BRANCHES_PER_PAGE,

View File

@ -81,6 +81,16 @@ describe('Observability root app', () => {
});
});
describe('iframe sandbox', () => {
it('should render an iframe with sandbox attributes', () => {
mountComponent();
const iframe = findIframe();
expect(iframe.exists()).toBe(true);
expect(iframe.attributes('sandbox')).toBe('allow-same-origin allow-forms allow-scripts');
});
});
describe('on GOUI_ROUTE_UPDATE', () => {
it('should not call replace method from vue router if message event does not have url', () => {
mountComponent();

View File

@ -2,12 +2,12 @@
require 'spec_helper'
RSpec.describe Types::IssueTypeEnum do
RSpec.describe Types::IssueTypeEnum, feature_category: :team_planning do
specify { expect(described_class.graphql_name).to eq('IssueType') }
it 'exposes all the existing issue type values except key_result' do
expect(described_class.values.keys).to match_array(
%w[ISSUE INCIDENT TEST_CASE REQUIREMENT TASK OBJECTIVE]
%w[ISSUE INCIDENT TEST_CASE REQUIREMENT TASK OBJECTIVE KEY_RESULT]
)
end
end

View File

@ -2,7 +2,7 @@
require 'spec_helper'
RSpec.describe DeployToken do
RSpec.describe DeployToken, feature_category: :continuous_delivery do
subject(:deploy_token) { create(:deploy_token) }
it { is_expected.to have_many :project_deploy_tokens }
@ -82,9 +82,7 @@ RSpec.describe DeployToken do
describe '#ensure_at_least_one_scope' do
context 'with at least one scope' do
it 'is valid' do
is_expected.to be_valid
end
it { is_expected.to be_valid }
end
context 'with no scopes' do

View File

@ -346,7 +346,7 @@ RSpec.describe API::DeployTokens, feature_category: :continuous_delivery do
context 'deploy token creation' do
shared_examples 'creating a deploy token' do |entity, unauthenticated_response, authorized_role|
let(:expires_time) { 1.year.from_now }
let(:expires_time) { 1.year.from_now.to_datetime }
let(:params) do
{
name: 'Foo',
@ -414,6 +414,14 @@ RSpec.describe API::DeployTokens, feature_category: :continuous_delivery do
it { is_expected.to have_gitlab_http_status(:bad_request) }
end
context 'with an invalid expires_at date' do
before do
params[:expires_at] = 'foo'
end
it { is_expected.to have_gitlab_http_status(:bad_request) }
end
end
end

View File

@ -921,12 +921,15 @@ RSpec.shared_examples 'issues or work items finder' do |factory, execute_context
context 'filtering by item type' do
let_it_be(:incident_item) { create(factory, issue_type: :incident, project: project1) }
let_it_be(:objective) { create(factory, issue_type: :objective, project: project1) }
let_it_be(:key_result) { create(factory, issue_type: :key_result, project: project1) }
context 'no type given' do
let(:params) { { issue_types: [] } }
it 'returns all items' do
expect(items).to contain_exactly(incident_item, item1, item2, item3, item4, item5)
expect(items)
.to contain_exactly(incident_item, item1, item2, item3, item4, item5, objective, key_result)
end
end
@ -938,6 +941,22 @@ RSpec.shared_examples 'issues or work items finder' do |factory, execute_context
end
end
context 'objective type' do
let(:params) { { issue_types: ['objective'] } }
it 'returns incident items' do
expect(items).to contain_exactly(objective)
end
end
context 'key_result type' do
let(:params) { { issue_types: ['key_result'] } }
it 'returns incident items' do
expect(items).to contain_exactly(key_result)
end
end
context 'item type' do
let(:params) { { issue_types: ['issue'] } }

View File

@ -0,0 +1,32 @@
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe Iso8601DateValidator do
subject do
Class.new(ActiveRecord::Base) do
self.table_name = 'deploy_tokens'
attribute :expires_at
validates :expires_at, iso8601_date: true
def self.name
"DeployToken"
end
end.new
end
it 'passes a valid date' do
subject.expires_at = DateTime.now
expect(subject.valid?).to be_truthy
end
it 'errors on an invalid date' do
subject.expires_at = '2-12-2022'
expect(subject.valid?).to be_falsy
expect(subject.errors.full_messages).to include('Expires at must be in ISO 8601 format')
end
end