Add latest changes from gitlab-org/gitlab@master

This commit is contained in:
GitLab Bot 2021-11-16 03:13:10 +00:00
parent d089b5729e
commit 766a6a66d3
15 changed files with 134 additions and 133 deletions

View File

@ -1776,7 +1776,7 @@
changes: *code-backstage-patterns
when: on_success
.setup:rules:no_ee_check:
.setup:rules:no-ee-check:
rules:
- <<: *if-not-foss
when: never
@ -1784,6 +1784,14 @@
changes: *code-backstage-patterns
when: on_success
.setup:rules:no-jh-check:
rules:
- <<: *if-jh
when: never
- <<: *if-default-refs
changes: *code-backstage-patterns
when: on_success
.setup:rules:verify-tests-yml:
rules:
- <<: *if-not-ee

View File

@ -41,13 +41,21 @@ gitlab_git_test:
script:
- spec/support/prepare-gitlab-git-test-for-commit --check-for-changes
no_ee_check:
no-ee-check:
extends:
- .minimal-job
- .setup:rules:no_ee_check
- .setup:rules:no-ee-check
stage: test
script:
- scripts/no-ee-check
- scripts/no-dir-check ee
no-jh-check:
extends:
- .minimal-job
- .setup:rules:no-jh-check
stage: test
script:
- scripts/no-dir-check jh
verify-tests-yml:
extends:

View File

@ -4,6 +4,37 @@
* https://gitlab.com/gitlab-org/gitlab-chronic-duration/-/blob/master/lib/gitlab_chronic_duration.rb.
*/
/*
* This code is based on code from
* https://gitlab.com/gitlab-org/gitlab-chronic-duration and is
* distributed under the following license:
*
* MIT License
*
* Copyright (c) Henry Poydar
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
* files (the "Software"), to deal in the Software without
* restriction, including without limitation the rights to use,
* copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following
* conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*/
export class DurationParseError extends Error {}
// On average, there's a little over 4 weeks in month.

View File

@ -1,6 +1,6 @@
<script>
import { GlAvatar, GlFilteredSearchSuggestion } from '@gitlab/ui';
import { compact } from 'lodash';
import createFlash from '~/flash';
import { __ } from '~/locale';
@ -59,8 +59,10 @@ export default {
.then((res) => {
// We'd want to avoid doing this check but
// users.json and /groups/:id/members & /projects/:id/users
// return response differently.
this.authors = Array.isArray(res) ? res : res.data;
// return response differently
// TODO: rm when completed https://gitlab.com/gitlab-org/gitlab/-/issues/345756
this.authors = Array.isArray(res) ? compact(res) : compact(res.data);
})
.catch(() =>
createFlash({

View File

@ -15,7 +15,7 @@
.form-group
- can_be_configured = @application_setting.usage_ping_can_be_configured?
.form-check
= f.check_box :usage_ping_enabled, disabled: !can_be_configured, class: 'form-check-input'
= f.check_box :usage_ping_enabled, disabled: !can_be_configured, class: 'form-check-input', data: { qa_selector: 'enable_usage_data_checkbox' }
= f.label :usage_ping_enabled, class: 'form-check-label' do
= _('Enable Service Ping')
.form-text.text-muted

View File

@ -42,7 +42,7 @@
.js-self-monitoring-settings{ data: self_monitoring_project_data }
%section.settings.as-usage.no-animate#js-usage-settings{ class: ('expanded' if expanded_by_default?) }
%section.settings.as-usage.no-animate#js-usage-settings{ class: ('expanded' if expanded_by_default?), data: { qa_selector: 'usage_statistics_settings_content' } }
.settings-header#usage-statistics
%h4
= _('Usage statistics')

View File

@ -1,4 +1,4 @@
= cache_if(Feature.enabled?(:cached_loading_hints, current_user), [ActionController::Base.asset_host, user_application_theme, user_color_scheme], expires_in: 1.minute) do
= cache([ActionController::Base.asset_host, user_application_theme, user_color_scheme], expires_in: 1.minute) do
- css_crossorigin = ActionController::Base.asset_host ? 'anonymous' : nil
- if ActionController::Base.asset_host

View File

@ -1,8 +0,0 @@
---
name: cached_loading_hints
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/61609
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/330802
milestone: '13.12'
type: development
group: group::source code
default_enabled: false

View File

@ -26,11 +26,8 @@ indexed lookup in the GitLab database. This page describes how to enable the fas
lookup of authorized SSH keys.
WARNING:
OpenSSH version 6.9+ is required because
`AuthorizedKeysCommand` must be able to accept a fingerprint. These
instructions break installations that use older versions of OpenSSH, such as
those included with CentOS 6 as of September 2017. If you want to use this
feature for CentOS 6, follow [the instructions on how to build and install a custom OpenSSH package](#compiling-a-custom-version-of-openssh-for-centos-6) before continuing.
OpenSSH version 6.9+ is required because `AuthorizedKeysCommand` must be
able to accept a fingerprint. Check the version of OpenSSH on your server.
## Fast lookup is required for Geo **(PREMIUM)**
@ -170,101 +167,6 @@ To switch from OpenSSH to `gitlab-sshd`:
1. Perform a Helm upgrade.
## Compiling a custom version of OpenSSH for CentOS 6
Building a custom version of OpenSSH is not necessary for Ubuntu 16.04 users,
since Ubuntu 16.04 ships with OpenSSH 7.2.
It is also unnecessary for CentOS 7.4 users, as that version ships with
OpenSSH 7.4. If you are using CentOS 7.0 - 7.3, we strongly recommend that you
upgrade to CentOS 7.4 instead of following this procedure. This should be as
simple as running `yum update`.
CentOS 6 users must build their own OpenSSH package to enable SSH lookups via
the database. The following instructions can be used to build OpenSSH 7.5:
1. First, download the package and install the required packages:
```shell
sudo su -
cd /tmp
curl --remote-name "https://cdn.openbsd.org/pub/OpenBSD/OpenSSH/portable/openssh-7.5p1.tar.gz"
tar xzvf openssh-7.5p1.tar.gz
yum install rpm-build gcc make wget openssl-devel krb5-devel pam-devel libX11-devel xmkmf libXt-devel
```
1. Prepare the build by copying files to the right place:
```shell
mkdir -p /root/rpmbuild/{SOURCES,SPECS}
cp ./openssh-7.5p1/contrib/redhat/openssh.spec /root/rpmbuild/SPECS/
cp openssh-7.5p1.tar.gz /root/rpmbuild/SOURCES/
cd /root/rpmbuild/SPECS
```
1. Next, set the spec settings properly:
```shell
sed -i -e "s/%define no_gnome_askpass 0/%define no_gnome_askpass 1/g" openssh.spec
sed -i -e "s/%define no_x11_askpass 0/%define no_x11_askpass 1/g" openssh.spec
sed -i -e "s/BuildPreReq/BuildRequires/g" openssh.spec
```
1. Build the RPMs:
```shell
rpmbuild -bb openssh.spec
```
1. Ensure the RPMs were built:
```shell
ls -al /root/rpmbuild/RPMS/x86_64/
```
You should see something as the following:
```plaintext
total 1324
drwxr-xr-x. 2 root root 4096 Jun 20 19:37 .
drwxr-xr-x. 3 root root 19 Jun 20 19:37 ..
-rw-r--r--. 1 root root 470828 Jun 20 19:37 openssh-7.5p1-1.x86_64.rpm
-rw-r--r--. 1 root root 490716 Jun 20 19:37 openssh-clients-7.5p1-1.x86_64.rpm
-rw-r--r--. 1 root root 17020 Jun 20 19:37 openssh-debuginfo-7.5p1-1.x86_64.rpm
-rw-r--r--. 1 root root 367516 Jun 20 19:37 openssh-server-7.5p1-1.x86_64.rpm
```
1. Install the packages. OpenSSH packages replace `/etc/pam.d/sshd`
with their own versions, which may prevent users from logging in, so be sure
that the file is backed up and restored after installation:
```shell
timestamp=$(date +%s)
cp /etc/pam.d/sshd pam-ssh-conf-$timestamp
rpm -Uvh /root/rpmbuild/RPMS/x86_64/*.rpm
yes | cp pam-ssh-conf-$timestamp /etc/pam.d/sshd
```
1. Verify the installed version. In another window, attempt to sign in to the
server:
```shell
ssh -v <your-centos-machine>
```
You should see a line that reads: "debug1: Remote protocol version 2.0, remote software version OpenSSH_7.5"
If not, you may need to restart `sshd` (for example, `systemctl restart sshd.service`).
1. *IMPORTANT!* Open a new SSH session to your server before exiting to make
sure everything is working! If you need to downgrade, simple install the
older package:
```shell
# Only run this if you run into a problem logging in
yum downgrade openssh-server openssh openssh-clients
```
## SELinux support and limitations
GitLab supports `authorized_keys` database lookups with [SELinux](https://en.wikipedia.org/wiki/Security-Enhanced_Linux).

View File

@ -19,10 +19,8 @@ In such setups some external automated process is needed to constantly
upload the new keys to GitLab.
WARNING:
OpenSSH version 6.9+ is required because that version
introduced the `AuthorizedPrincipalsCommand` configuration option. If
using CentOS 6, you can [follow these instructions](fast_ssh_key_lookup.md#compiling-a-custom-version-of-openssh-for-centos-6)
to compile an up-to-date version.
OpenSSH version 6.9+ is required because `AuthorizedKeysCommand` must be
able to accept a fingerprint. Check the version of OpenSSH on your server.
## Why use OpenSSH certificates?

View File

@ -120,8 +120,8 @@ To remove a member from a project:
1. Optional. In the confirmation box, select the
**Also unassign this user from related issues and merge requests** checkbox.
1. To prevent leaks of sensitive information from private projects, verify the
user has not forked the private repository. Existing forks continue to receive
changes from the upstream project. You may also want to configure your project
user has not forked the private repository or created webhooks. Existing forks continue to receive
changes from the upstream project, and webhooks continue to receive updates. You may also want to configure your project
to prevent projects in a group
[from being forked outside their group](../../group/index.md#prevent-project-forking-outside-group).
1. Select **Remove member**.

9
scripts/no-dir-check Executable file
View File

@ -0,0 +1,9 @@
#!/usr/bin/env ruby
# frozen_string_literal: true
dir_name = ARGV.first || abort('ERROR: Please specify a directory.')
dir_path = File.expand_path(dir_name, "#{__dir__}/..")
if Dir.exist?(dir_path)
abort("ERROR: This repository contains #{dir_name}/ directory. #{dir_name.upcase} changes should go to the corresponding repository.")
end

View File

@ -1,9 +0,0 @@
#!/usr/bin/env ruby
# frozen_string_literal: true
ee_path = File.join(File.expand_path(__dir__), '../ee')
if Dir.exist?(ee_path)
puts 'The repository contains /ee directory. There should be no /ee directory in CE repo.'
exit 1
end

View File

@ -4,6 +4,37 @@
* https://gitlab.com/gitlab-org/gitlab-chronic-duration/-/blob/master/spec/lib/chronic_duration_spec.rb.
*/
/*
* This code is based on code from
* https://gitlab.com/gitlab-org/gitlab-chronic-duration and is
* distributed under the following license:
*
* MIT License
*
* Copyright (c) Henry Poydar
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
* files (the "Software"), to deal in the Software without
* restriction, including without limitation the rights to use,
* copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following
* conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*/
import {
parseChronicDuration,
outputChronicDuration,

View File

@ -112,6 +112,35 @@ describe('AuthorToken', () => {
});
});
// TODO: rm when completed https://gitlab.com/gitlab-org/gitlab/-/issues/345756
describe('when there are null users presents', () => {
const mockAuthorsWithNullUser = mockAuthors.concat([null]);
beforeEach(() => {
jest
.spyOn(wrapper.vm.config, 'fetchAuthors')
.mockResolvedValue({ data: mockAuthorsWithNullUser });
getBaseToken().vm.$emit('fetch-suggestions', 'root');
});
describe('when res.data is present', () => {
it('filters the successful response when null values are present', () => {
return waitForPromises().then(() => {
expect(getBaseToken().props('suggestions')).toEqual(mockAuthors);
});
});
});
describe('when response is an array', () => {
it('filters the successful response when null values are present', () => {
return waitForPromises().then(() => {
expect(getBaseToken().props('suggestions')).toEqual(mockAuthors);
});
});
});
});
it('calls `createFlash` with flash error message when request fails', () => {
jest.spyOn(wrapper.vm.config, 'fetchAuthors').mockRejectedValue({});