Add latest changes from gitlab-org/gitlab@master

This commit is contained in:
GitLab Bot 2022-02-10 00:15:43 +00:00
parent 2744f5f9d7
commit dd28adcbf0
16 changed files with 130 additions and 30 deletions

View File

@ -80,6 +80,15 @@ export default {
userPath() {
return this.user?.path;
},
deployable() {
return this.deployment?.deployable;
},
jobName() {
return truncate(this.deployable?.name ?? '', 25);
},
jobPath() {
return this.deployable?.buildPath;
},
},
methods: {
toggleCollapse() {
@ -94,6 +103,8 @@ export default {
showDetails: __('Show details'),
hideDetails: __('Hide details'),
triggerer: s__('Deployment|Triggerer'),
job: __('Job'),
api: __('API'),
},
headerClasses: [
'gl-display-flex',
@ -174,6 +185,20 @@ export default {
<span class="gl-text-gray-500 gl-font-weight-bold">{{ $options.i18n.triggerer }}</span>
<gl-link :href="userPath" class="gl-font-monospace gl-mt-3"> @{{ username }} </gl-link>
</div>
<div class="gl-display-flex gl-flex-direction-column gl-ml-5">
<span class="gl-text-gray-500 gl-font-weight-bold" :class="{ 'gl-ml-3': !deployable }">
{{ $options.i18n.job }}
</span>
<gl-link v-if="jobPath" :href="jobPath" class="gl-font-monospace gl-mt-3">
{{ jobName }}
</gl-link>
<span v-else-if="jobName" class="gl-font-monospace gl-mt-3">
{{ jobName }}
</span>
<gl-badge v-else class="gl-font-monospace gl-mt-3" variant="info">
{{ $options.i18n.api }}
</gl-badge>
</div>
</div>
</gl-collapse>
</div>

View File

@ -148,12 +148,7 @@
}
.gl-label .gl-label-link:hover {
text-decoration: none;
color: inherit;
.gl-label-text:last-of-type {
text-decoration: underline;
}
}
.btn-link {

View File

@ -18,6 +18,9 @@ module Mutations
argument :state_event, Types::WorkItems::StateEventEnum,
description: 'Close or reopen a work item.',
required: false
argument :title, GraphQL::Types::String,
required: false,
description: copy_field_description(Types::WorkItemType, :title)
field :work_item, Types::WorkItemType,
null: true,

View File

@ -4,10 +4,14 @@ group: Respond
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#assignments
---
# Self monitoring project **(FREE SELF)**
# Self-monitoring project (DEPRECATED) **(FREE SELF)**
> - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/32351) in GitLab 12.7, behind a disabled feature flag (`self_monitoring_project`).
> - The feature flag was removed and the self monitoring project was [made generally available](https://gitlab.com/gitlab-org/gitlab/-/issues/198511) in GitLab 12.8.
> - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/32351) in GitLab 12.7 [with a flag](../../feature_flags.md) named `self_monitoring_project`. Disabled by default.
> - Generally available in GitLab 12.8. [Feature flag `self_monitoring_project`](https://gitlab.com/gitlab-org/gitlab/-/issues/198511) removed.
> - [Deprecated](https://gitlab.com/gitlab-org/gitlab/-/issues/348909) in GitLab 14.8.
WARNING:
This feature was [deprecated](https://gitlab.com/gitlab-org/gitlab/-/issues/348909) in GitLab 14.8.
GitLab provides administrators insights into the health of their GitLab instance.

View File

@ -5202,6 +5202,7 @@ Input type: `WorkItemUpdateInput`
| <a id="mutationworkitemupdateclientmutationid"></a>`clientMutationId` | [`String`](#string) | A unique identifier for the client performing the mutation. |
| <a id="mutationworkitemupdateid"></a>`id` | [`WorkItemID!`](#workitemid) | Global ID of the work item. |
| <a id="mutationworkitemupdatestateevent"></a>`stateEvent` | [`WorkItemStateEvent`](#workitemstateevent) | Close or reopen a work item. |
| <a id="mutationworkitemupdatetitle"></a>`title` | [`String`](#string) | Title of the work item. |
#### Fields

View File

@ -338,12 +338,12 @@ To support the following package managers, the GitLab analyzers proceed in two s
| Package Manager | Preinstalled Versions | Tested Versions |
| ------ | ------ | ------ |
| Bundler | [2.1.4](https://gitlab.com/gitlab-org/security-products/analyzers/bundler-audit/-/blob/v2.11.3/Dockerfile#L15)<sup><b><a href="#exported-dependency-information-notes-1">1</a></b></sup> | [1.17.3](https://gitlab.com/gitlab-org/security-products/tests/ruby-bundler/-/blob/master/Gemfile.lock#L118), [2.1.4](https://gitlab.com/gitlab-org/security-products/tests/ruby-bundler/-/blob/bundler2-FREEZE/Gemfile.lock#L118) |
| sbt | [1.3.8](https://gitlab.com/gitlab-org/security-products/analyzers/gemnasium-maven/-/blob/v2.23.0/config/.tool-versions#L4) | [1.0.4](https://gitlab.com/gitlab-org/security-products/analyzers/gemnasium-maven/-/blob/master/.gitlab-ci.yml#L263), [1.1.4](https://gitlab.com/gitlab-org/security-products/tests/scala-sbt-multiproject/-/blob/main/project/build.properties#L1), [1.1.6](https://gitlab.com/gitlab-org/security-products/analyzers/gemnasium-maven/-/blob/master/.gitlab-ci.yml#L272), [1.2.8](https://gitlab.com/gitlab-org/security-products/analyzers/gemnasium-maven/-/blob/master/.gitlab-ci.yml#L281), [1.3.12](https://gitlab.com/gitlab-org/security-products/analyzers/gemnasium-maven/-/blob/master/.gitlab-ci.yml#L290), [1.4.6](https://gitlab.com/gitlab-org/security-products/analyzers/gemnasium-maven/-/blob/master/.gitlab-ci.yml#L299) |
| sbt | [1.6.1](https://gitlab.com/gitlab-org/security-products/analyzers/gemnasium-maven/-/blob/v2.24.6/config/.tool-versions#L4) | [1.0.4](https://gitlab.com/gitlab-org/security-products/analyzers/gemnasium-maven/-/blob/v2.24.6/.gitlab-ci.yml#L330), [1.1.4](https://gitlab.com/gitlab-org/security-products/tests/scala-sbt-multiproject/-/blob/main/project/build.properties#L1), [1.1.6](https://gitlab.com/gitlab-org/security-products/analyzers/gemnasium-maven/-/blob/v2.24.6/.gitlab-ci.yml#L339), [1.2.8](https://gitlab.com/gitlab-org/security-products/analyzers/gemnasium-maven/-/blob/v2.24.6/.gitlab-ci.yml#L348), [1.3.12](https://gitlab.com/gitlab-org/security-products/analyzers/gemnasium-maven/-/blob/v2.24.6/.gitlab-ci.yml#L357), [1.4.6](https://gitlab.com/gitlab-org/security-products/analyzers/gemnasium-maven/-/blob/v2.24.6/.gitlab-ci.yml#L366), [1.6.1](https://gitlab.com/gitlab-org/security-products/analyzers/gemnasium-maven/-/blob/v2.24.6/.gitlab-ci.yml#L384) |
| Maven | [3.6.3](https://gitlab.com/gitlab-org/security-products/analyzers/gemnasium-maven/-/blob/v2.23.0/config/.tool-versions#L3) | [3.6.3](https://gitlab.com/gitlab-org/security-products/tests/java-maven/-/blob/master/pom.xml#L3) |
| Gradle | [6.7.1](https://gitlab.com/gitlab-org/security-products/analyzers/gemnasium-maven/-/blob/v2.23.0/config/.tool-versions#L5) | [5.6.4](https://gitlab.com/gitlab-org/security-products/tests/java-gradle/-/blob/master/gradle/wrapper/gradle-wrapper.properties#L3), [6.5](https://gitlab.com/gitlab-org/security-products/tests/java-gradle/-/blob/java-14/gradle/wrapper/gradle-wrapper.properties#L3), [6.7-rc-1](https://gitlab.com/gitlab-org/security-products/tests/java-gradle/-/blob/java-15/gradle/wrapper/gradle-wrapper.properties#L3), [6.9](https://gitlab.com/gitlab-org/security-products/tests/java-gradle/-/blob/java-14-gradle-6-9/gradle/wrapper/gradle-wrapper.properties#L3), [7.0-rc-2](https://gitlab.com/gitlab-org/security-products/tests/java-gradle/-/blob/java-16/gradle/wrapper/gradle-wrapper.properties#L3) |
| setuptools | [50.3.2](https://gitlab.com/gitlab-org/security-products/analyzers/gemnasium/-/blob/v2.29.9/Dockerfile#L27) | [57.5.0](https://gitlab.com/gitlab-org/security-products/tests/python-setuptools/-/blob/main/setup.py) |
| Gradle | [6.7.1](https://gitlab.com/gitlab-org/security-products/analyzers/gemnasium-maven/-/blob/v2.23.0/config/.tool-versions#L5) | [5.6.4](https://gitlab.com/gitlab-org/security-products/tests/java-gradle/-/blob/master/gradle/wrapper/gradle-wrapper.properties#L3), [6.5](https://gitlab.com/gitlab-org/security-products/tests/java-gradle/-/blob/java-14/gradle/wrapper/gradle-wrapper.properties#L3), [6.7-rc-1](https://gitlab.com/gitlab-org/security-products/tests/java-gradle/-/blob/java-15/gradle/wrapper/gradle-wrapper.properties#L3), [6.9](https://gitlab.com/gitlab-org/security-products/tests/java-gradle/-/blob/java-14-gradle-6-9/gradle/wrapper/gradle-wrapper.properties#L3), [7.0-rc-2](https://gitlab.com/gitlab-org/security-products/tests/java-gradle/-/blob/java-16/gradle/wrapper/gradle-wrapper.properties#L3) |
| setuptools | [50.3.2](https://gitlab.com/gitlab-org/security-products/analyzers/gemnasium/-/blob/v2.29.9/Dockerfile#L27) | [57.5.0](https://gitlab.com/gitlab-org/security-products/tests/python-setuptools/-/blob/main/setup.py) |
| pip | [20.2.4](https://gitlab.com/gitlab-org/security-products/analyzers/gemnasium/-/blob/v2.29.9/Dockerfile#L26) | [20.x](https://gitlab.com/gitlab-org/security-products/tests/python-pip/-/blob/master/requirements.txt) |
| Pipenv | [2018.11.26](https://gitlab.com/gitlab-org/security-products/analyzers/gemnasium-python/-/blob/v2.18.4/requirements.txt#L13) | [2018.11.26](https://gitlab.com/gitlab-org/security-products/tests/python-pipenv/-/blob/pipfile-lock-FREEZE/Pipfile.lock#L6)<sup><b><a href="#exported-dependency-information-notes-2">2</a></b></sup>, [2018.11.26](https://gitlab.com/gitlab-org/security-products/tests/python-pipenv/-/blob/master/Pipfile) |
| Pipenv | [2018.11.26](https://gitlab.com/gitlab-org/security-products/analyzers/gemnasium-python/-/blob/v2.18.4/requirements.txt#L13) | [2018.11.26](https://gitlab.com/gitlab-org/security-products/tests/python-pipenv/-/blob/pipfile-lock-FREEZE/Pipfile.lock#L6)<sup><b><a href="#exported-dependency-information-notes-2">2</a></b></sup>, [2018.11.26](https://gitlab.com/gitlab-org/security-products/tests/python-pipenv/-/blob/master/Pipfile) |
<!-- markdownlint-disable MD044 -->
<ol>

View File

@ -32,7 +32,7 @@ module API
success Entities::Commit
end
params do
optional :ref_name, type: String, desc: 'The name of a repository branch or tag, if not given the default branch is used'
optional :ref_name, type: String, desc: 'The name of a repository branch or tag, if not given the default branch is used', regexp: /\A#{Gitlab::PathRegex.git_reference_regex}\z|\A\z/
optional :since, type: DateTime, desc: 'Only commits after or on this date will be returned'
optional :until, type: DateTime, desc: 'Only commits before or on this date will be returned'
optional :path, type: String, desc: 'The file path'

View File

@ -126,8 +126,10 @@ module ExtractsRef
# overridden in subclasses, do not remove
def get_id
id = [params[:id] || params[:ref]]
id << "/" + params[:path] unless params[:path].blank?
allowed_params = params.permit(:id, :ref, :path)
id = [allowed_params[:id] || allowed_params[:ref]]
id << "/" + allowed_params[:path] unless allowed_params[:path].blank?
id.join
end

View File

@ -234,7 +234,7 @@ module Gitlab
@git_reference_regex ||= single_line_regexp %r{
(?!
(?# doesn't begins with)
\/| (?# rule #6)
\/|-| (?# rule #6)
(?# doesn't contain)
.*(?:
[\/.]\.| (?# rule #1,3)

View File

@ -209,6 +209,36 @@ describe('~/environments/components/deployment.vue', () => {
const username = wrapper.findByRole('link', { name: `@${deployment.user.username}` });
expect(username.attributes('href')).toBe(deployment.user.path);
const job = wrapper.findByRole('link', { name: deployment.deployable.name });
expect(job.attributes('href')).toBe(deployment.deployable.buildPath);
const apiBadge = wrapper.findByText(__('API'));
expect(apiBadge.exists()).toBe(false);
});
});
describe('with API deployment', () => {
beforeEach(async () => {
wrapper = createWrapper({ propsData: { deployment: { ...deployment, deployable: null } } });
await wrapper.findComponent({ ref: 'details-toggle' }).trigger('click');
});
it('shows API instead of a job name', () => {
const apiBadge = wrapper.findByText(__('API'));
expect(apiBadge.exists()).toBe(true);
});
});
describe('without a job path', () => {
beforeEach(async () => {
wrapper = createWrapper({
propsData: {
deployment: { ...deployment, deployable: { name: deployment.deployable.name } },
},
});
await wrapper.findComponent({ ref: 'details-toggle' }).trigger('click');
});
it('shows a span instead of a link', () => {
const job = wrapper.findByText(deployment.deployable.name);
expect(job.attributes('href')).toBeUndefined();
});
});
});

View File

@ -32,7 +32,7 @@ RSpec.describe ExtractsPath do
describe '#assign_ref_vars' do
let(:ref) { sample_commit[:id] }
let(:path) { sample_commit[:line_code_path] }
let(:params) { { path: path, ref: ref } }
let(:params) { ActionController::Parameters.new(path: path, ref: ref) }
it_behaves_like 'assigns ref vars'
@ -54,7 +54,8 @@ RSpec.describe ExtractsPath do
context 'ref only exists without .atom suffix' do
context 'with a path' do
let(:params) { { ref: 'v1.0.0.atom', path: 'README.md' } }
let(:ref) { 'v1.0.0.atom' }
let(:path) { 'README.md' }
it 'renders a 404' do
expect(self).to receive(:render_404)
@ -64,7 +65,8 @@ RSpec.describe ExtractsPath do
end
context 'without a path' do
let(:params) { { ref: 'v1.0.0.atom' } }
let(:ref) { 'v1.0.0.atom' }
let(:path) { nil }
before do
assign_ref_vars
@ -82,7 +84,8 @@ RSpec.describe ExtractsPath do
context 'ref exists with .atom suffix' do
context 'with a path' do
let(:params) { { ref: 'master.atom', path: 'README.md' } }
let(:ref) { 'master.atom' }
let(:path) { 'README.md' }
before do
repository = @project.repository
@ -102,7 +105,8 @@ RSpec.describe ExtractsPath do
end
context 'without a path' do
let(:params) { { ref: 'master.atom' } }
let(:ref) { 'master.atom' }
let(:path) { nil }
before do
repository = @project.repository
@ -125,7 +129,8 @@ RSpec.describe ExtractsPath do
end
context 'ref and path are nil' do
let(:params) { { path: nil, ref: nil } }
let(:path) { nil }
let(:ref) { nil }
it 'does not set commit' do
expect(container.repository).not_to receive(:commit).with('')

View File

@ -10,7 +10,8 @@ RSpec.describe ExtractsRef do
let_it_be(:container) { create(:snippet, :repository, author: owner) }
let(:ref) { sample_commit[:id] }
let(:params) { { path: sample_commit[:line_code_path], ref: ref } }
let(:path) { sample_commit[:line_code_path] }
let(:params) { ActionController::Parameters.new(path: path, ref: ref) }
before do
ref_names = ['master', 'foo/bar/baz', 'v1.0.0', 'v2.0.0', 'release/app', 'release/app/v1.0.0']
@ -23,7 +24,8 @@ RSpec.describe ExtractsRef do
it_behaves_like 'assigns ref vars'
context 'ref and path are nil' do
let(:params) { { path: nil, ref: nil } }
let(:ref) { nil }
let(:path) { nil }
it 'does not set commit' do
expect(container.repository).not_to receive(:commit).with('')
@ -33,6 +35,15 @@ RSpec.describe ExtractsRef do
expect(@commit).to be_nil
end
end
context 'when ref and path have incorrect format' do
let(:ref) { { wrong: :format } }
let(:path) { { also: :wrong } }
it 'does not raise an exception' do
expect { assign_ref_vars }.not_to raise_error
end
end
end
it_behaves_like 'extracts refs'

View File

@ -530,6 +530,18 @@ RSpec.describe Gitlab::PathRegex do
it { is_expected.not_to match('snippets/1.wiki.git') }
end
describe '.git_reference_regex' do
subject { %r{\A#{described_class.git_reference_regex}\z} }
it { is_expected.to match('main') }
it { is_expected.to match('v1.2.3') }
it { is_expected.to match('refs/heads/main') }
it { is_expected.to match('1-2-3') }
it { is_expected.to match('1-----') }
it { is_expected.not_to match('-main') }
it { is_expected.not_to match('') }
end
describe '.full_snippets_repository_path_regex' do
subject { described_class.full_snippets_repository_path_regex }

View File

@ -127,6 +127,14 @@ RSpec.describe API::Commits do
it_behaves_like 'project commits'
end
context 'with incorrect ref_name parameter' do
let(:route) { "/projects/#{project_id}/repository/commits?ref_name=-main" }
it_behaves_like '400 response' do
let(:request) { get api(route, user) }
end
end
context "path optional parameter" do
it "returns project commits matching provided path parameter" do
path = 'files/ruby/popen.rb'

View File

@ -10,7 +10,7 @@ RSpec.describe 'Update a work item' do
let_it_be(:work_item, refind: true) { create(:work_item, project: project) }
let(:work_item_event) { 'CLOSE' }
let(:input) { { 'stateEvent' => work_item_event } }
let(:input) { { 'stateEvent' => work_item_event, 'title' => 'updated title' } }
let(:mutation) { graphql_mutation(:workItemUpdate, input.merge('id' => work_item.to_global_id.to_s)) }
@ -26,15 +26,18 @@ RSpec.describe 'Update a work item' do
let(:current_user) { developer }
context 'when the work item is open' do
it 'closes the work item' do
it 'closes and updates the work item' do
expect do
post_graphql_mutation(mutation, current_user: current_user)
work_item.reload
end.to change(work_item, :state).from('opened').to('closed')
end.to change(work_item, :state).from('opened').to('closed').and(
change(work_item, :title).from(work_item.title).to('updated title')
)
expect(response).to have_gitlab_http_status(:success)
expect(mutation_response['workItem']).to include(
'state' => 'CLOSED'
'state' => 'CLOSED',
'title' => 'updated title'
)
end
end

View File

@ -40,12 +40,13 @@ RSpec.shared_examples 'assigns ref vars' do
end
context 'path contains space' do
let(:params) { { path: 'with space', ref: '38008cb17ce1466d8fec2dfa6f6ab8dcfe5cf49e' } }
let(:ref) { '38008cb17ce1466d8fec2dfa6f6ab8dcfe5cf49e' }
let(:path) { 'with space' }
it 'is not converted to %20 in @path' do
assign_ref_vars
expect(@path).to eq(params[:path])
expect(@path).to eq(path)
end
end