diff options
-rw-r--r-- | .gitlab/ci/rules.gitlab-ci.yml | 10 | ||||
-rw-r--r-- | .gitlab/ci/setup.gitlab-ci.yml | 14 | ||||
-rw-r--r-- | app/assets/javascripts/chronic_duration.js | 31 | ||||
-rw-r--r-- | app/assets/javascripts/vue_shared/components/filtered_search_bar/tokens/author_token.vue | 8 | ||||
-rw-r--r-- | app/views/admin/application_settings/_usage.html.haml | 2 | ||||
-rw-r--r-- | app/views/admin/application_settings/metrics_and_profiling.html.haml | 2 | ||||
-rw-r--r-- | app/views/layouts/_loading_hints.html.haml | 2 | ||||
-rw-r--r-- | config/feature_flags/development/cached_loading_hints.yml | 8 | ||||
-rw-r--r-- | doc/administration/operations/fast_ssh_key_lookup.md | 102 | ||||
-rw-r--r-- | doc/administration/operations/ssh_certificates.md | 6 | ||||
-rw-r--r-- | doc/user/project/members/index.md | 4 | ||||
-rwxr-xr-x | scripts/no-dir-check | 9 | ||||
-rwxr-xr-x | scripts/no-ee-check | 9 | ||||
-rw-r--r-- | spec/frontend/chronic_duration_spec.js | 31 | ||||
-rw-r--r-- | spec/frontend/vue_shared/components/filtered_search_bar/tokens/author_token_spec.js | 29 |
15 files changed, 134 insertions, 133 deletions
diff --git a/.gitlab/ci/rules.gitlab-ci.yml b/.gitlab/ci/rules.gitlab-ci.yml index 666a4fbe3a9..ca1cdc5a61e 100644 --- a/.gitlab/ci/rules.gitlab-ci.yml +++ b/.gitlab/ci/rules.gitlab-ci.yml @@ -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 diff --git a/.gitlab/ci/setup.gitlab-ci.yml b/.gitlab/ci/setup.gitlab-ci.yml index 7c4ffafce1c..4c674f38939 100644 --- a/.gitlab/ci/setup.gitlab-ci.yml +++ b/.gitlab/ci/setup.gitlab-ci.yml @@ -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: diff --git a/app/assets/javascripts/chronic_duration.js b/app/assets/javascripts/chronic_duration.js index b595324f6e9..1073d736b06 100644 --- a/app/assets/javascripts/chronic_duration.js +++ b/app/assets/javascripts/chronic_duration.js @@ -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. diff --git a/app/assets/javascripts/vue_shared/components/filtered_search_bar/tokens/author_token.vue b/app/assets/javascripts/vue_shared/components/filtered_search_bar/tokens/author_token.vue index ae5d3965de1..b3b3d5c88c6 100644 --- a/app/assets/javascripts/vue_shared/components/filtered_search_bar/tokens/author_token.vue +++ b/app/assets/javascripts/vue_shared/components/filtered_search_bar/tokens/author_token.vue @@ -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({ diff --git a/app/views/admin/application_settings/_usage.html.haml b/app/views/admin/application_settings/_usage.html.haml index 5bdad50c161..4fba1aee12d 100644 --- a/app/views/admin/application_settings/_usage.html.haml +++ b/app/views/admin/application_settings/_usage.html.haml @@ -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 diff --git a/app/views/admin/application_settings/metrics_and_profiling.html.haml b/app/views/admin/application_settings/metrics_and_profiling.html.haml index eba50b93bfe..7cb5760f62a 100644 --- a/app/views/admin/application_settings/metrics_and_profiling.html.haml +++ b/app/views/admin/application_settings/metrics_and_profiling.html.haml @@ -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') diff --git a/app/views/layouts/_loading_hints.html.haml b/app/views/layouts/_loading_hints.html.haml index fc130490d8b..9b2815ea9bc 100644 --- a/app/views/layouts/_loading_hints.html.haml +++ b/app/views/layouts/_loading_hints.html.haml @@ -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 diff --git a/config/feature_flags/development/cached_loading_hints.yml b/config/feature_flags/development/cached_loading_hints.yml deleted file mode 100644 index ba4eaece55a..00000000000 --- a/config/feature_flags/development/cached_loading_hints.yml +++ /dev/null @@ -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 diff --git a/doc/administration/operations/fast_ssh_key_lookup.md b/doc/administration/operations/fast_ssh_key_lookup.md index dec008b335e..c99f94589d7 100644 --- a/doc/administration/operations/fast_ssh_key_lookup.md +++ b/doc/administration/operations/fast_ssh_key_lookup.md @@ -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). diff --git a/doc/administration/operations/ssh_certificates.md b/doc/administration/operations/ssh_certificates.md index 77dc4eb180b..4fcc5d7c916 100644 --- a/doc/administration/operations/ssh_certificates.md +++ b/doc/administration/operations/ssh_certificates.md @@ -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? diff --git a/doc/user/project/members/index.md b/doc/user/project/members/index.md index f9788ef18ec..adf0a115c6e 100644 --- a/doc/user/project/members/index.md +++ b/doc/user/project/members/index.md @@ -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**. diff --git a/scripts/no-dir-check b/scripts/no-dir-check new file mode 100755 index 00000000000..bbb303da9b2 --- /dev/null +++ b/scripts/no-dir-check @@ -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 diff --git a/scripts/no-ee-check b/scripts/no-ee-check deleted file mode 100755 index a878a4424e9..00000000000 --- a/scripts/no-ee-check +++ /dev/null @@ -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 diff --git a/spec/frontend/chronic_duration_spec.js b/spec/frontend/chronic_duration_spec.js index 90248e4788d..32652e13dfc 100644 --- a/spec/frontend/chronic_duration_spec.js +++ b/spec/frontend/chronic_duration_spec.js @@ -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, diff --git a/spec/frontend/vue_shared/components/filtered_search_bar/tokens/author_token_spec.js b/spec/frontend/vue_shared/components/filtered_search_bar/tokens/author_token_spec.js index 14fcffd3c50..b29c394e7ae 100644 --- a/spec/frontend/vue_shared/components/filtered_search_bar/tokens/author_token_spec.js +++ b/spec/frontend/vue_shared/components/filtered_search_bar/tokens/author_token_spec.js @@ -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({}); |