diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-09-07 06:11:39 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-09-07 06:11:39 +0300 |
commit | 86db9fdda7bc7d0d709c5fef5f7c75a849d6f702 (patch) | |
tree | 7eb6eac0a8d24889008974e2475a834359d0263c | |
parent | ff97077fc8908cc231d967aa7e7133198172b326 (diff) |
Add latest changes from gitlab-org/gitlab@master
-rw-r--r-- | app/finders/ci/pipelines_finder.rb | 12 | ||||
-rw-r--r-- | app/models/zoom_meeting.rb | 2 | ||||
-rw-r--r-- | app/validators/gitlab/utils/zoom_url_validator.rb | 22 | ||||
-rw-r--r-- | app/validators/gitlab/zoom_url_validator.rb | 22 | ||||
-rw-r--r-- | doc/api/pipelines.md | 1 | ||||
-rw-r--r-- | doc/api/users.md | 12 | ||||
-rw-r--r-- | doc/user/profile/personal_access_tokens.md | 3 | ||||
-rw-r--r-- | lib/api/ci/pipelines.rb | 1 | ||||
-rw-r--r-- | locale/gitlab.pot | 6 | ||||
-rw-r--r-- | spec/finders/ci/pipelines_finder_spec.rb | 21 | ||||
-rw-r--r-- | spec/requests/api/ci/pipelines_spec.rb | 24 | ||||
-rw-r--r-- | spec/validators/gitlab/zoom_url_validator_spec.rb (renamed from spec/validators/gitlab/utils/zoom_url_validator_spec.rb) | 2 |
12 files changed, 36 insertions, 92 deletions
diff --git a/app/finders/ci/pipelines_finder.rb b/app/finders/ci/pipelines_finder.rb index 37168ae9e5b..39355853d88 100644 --- a/app/finders/ci/pipelines_finder.rb +++ b/app/finders/ci/pipelines_finder.rb @@ -25,7 +25,6 @@ module Ci items = by_status(items) items = by_ref(items) items = by_sha(items) - items = by_name(items) items = by_username(items) items = by_yaml_errors(items) items = by_updated_at(items) @@ -115,17 +114,6 @@ module Ci end # rubocop: enable CodeReuse/ActiveRecord - # This method is deprecated and will be removed in 14.3 - # rubocop: disable CodeReuse/ActiveRecord - def by_name(items) - if params[:name].present? - items.joins(:user).where(users: { name: params[:name] }) - else - items - end - end - # rubocop: enable CodeReuse/ActiveRecord - # rubocop: disable CodeReuse/ActiveRecord def by_username(items) return items unless params[:username].present? diff --git a/app/models/zoom_meeting.rb b/app/models/zoom_meeting.rb index f684f9e6fe0..dd230b46d4b 100644 --- a/app/models/zoom_meeting.rb +++ b/app/models/zoom_meeting.rb @@ -10,7 +10,7 @@ class ZoomMeeting < ApplicationRecord validates :project, presence: true, unless: :importing? validates :issue, presence: true, unless: :importing? - validates :url, presence: true, length: { maximum: 255 }, 'gitlab/utils/zoom_url': true + validates :url, presence: true, length: { maximum: 255 }, 'gitlab/zoom_url': true validates :issue, same_project_association: true, unless: :importing? enum issue_status: { diff --git a/app/validators/gitlab/utils/zoom_url_validator.rb b/app/validators/gitlab/utils/zoom_url_validator.rb deleted file mode 100644 index 57e30dcefa6..00000000000 --- a/app/validators/gitlab/utils/zoom_url_validator.rb +++ /dev/null @@ -1,22 +0,0 @@ -# frozen_string_literal: true - -# Gitlab::Utils::ZoomUrlValidator -# -# Custom validator for zoom urls -# -module Gitlab - module Utils - class ZoomUrlValidator < ActiveModel::EachValidator - ALLOWED_SCHEMES = %w(https).freeze - - def validate_each(record, attribute, value) - links_count = Gitlab::ZoomLinkExtractor.new(value).links.size - valid = Gitlab::UrlSanitizer.valid?(value, allowed_schemes: ALLOWED_SCHEMES) - - return if links_count == 1 && valid - - record.errors.add(:url, 'must contain one valid Zoom URL') - end - end - end -end diff --git a/app/validators/gitlab/zoom_url_validator.rb b/app/validators/gitlab/zoom_url_validator.rb new file mode 100644 index 00000000000..c752cec07c2 --- /dev/null +++ b/app/validators/gitlab/zoom_url_validator.rb @@ -0,0 +1,22 @@ +# frozen_string_literal: true + +module Gitlab + # Gitlab::Utils::ZoomUrlValidator + # + # Custom validator for zoom urls + # + # @example usage + # validates :url, 'gitlab/zoom_url': true + class ZoomUrlValidator < ActiveModel::EachValidator + ALLOWED_SCHEMES = %w(https).freeze + + def validate_each(record, attribute, value) + links_count = Gitlab::ZoomLinkExtractor.new(value).links.size + valid = Gitlab::UrlSanitizer.valid?(value, allowed_schemes: ALLOWED_SCHEMES) + + return if links_count == 1 && valid + + record.errors.add(:url, 'must contain one valid Zoom URL') + end + end +end diff --git a/doc/api/pipelines.md b/doc/api/pipelines.md index 8348dd2ae43..55d368336cb 100644 --- a/doc/api/pipelines.md +++ b/doc/api/pipelines.md @@ -36,7 +36,6 @@ GET /projects/:id/pipelines | `ref` | string | no | The ref of pipelines | | `sha` | string | no | The SHA of pipelines | | `yaml_errors`| boolean | no | Returns pipelines with invalid configurations | -| `name`| string | no | _([Deprecated in GitLab 14.2](https://gitlab.com/gitlab-org/gitlab/-/issues/336953))_ The name of the user who triggered pipelines | | `username`| string | no | The username of the user who triggered pipelines | | `updated_after` | datetime | no | Return pipelines updated after the specified date. Expected in ISO 8601 format (`2019-03-15T08:00:00Z`). | | `updated_before` | datetime | no | Return pipelines updated before the specified date. Expected in ISO 8601 format (`2019-03-15T08:00:00Z`). | diff --git a/doc/api/users.md b/doc/api/users.md index b10203e60f7..222594897b6 100644 --- a/doc/api/users.md +++ b/doc/api/users.md @@ -4,7 +4,7 @@ group: Access 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 --- -# Users API +# Users API **(FREE)** ## List users @@ -189,7 +189,7 @@ GET /users ] ``` -Users on GitLab [Premium or higher](https://about.gitlab.com/pricing/) also see the `shared_runners_minutes_limit`, `extra_shared_runners_minutes_limit`, `is_auditor`, and `using_license_seat` parameters. +Users on [GitLab Premium or higher](https://about.gitlab.com/pricing/) also see the `shared_runners_minutes_limit`, `extra_shared_runners_minutes_limit`, `is_auditor`, and `using_license_seat` parameters. ```json [ @@ -205,7 +205,7 @@ Users on GitLab [Premium or higher](https://about.gitlab.com/pricing/) also see ] ``` -Users on GitLab [Premium or higher](https://about.gitlab.com/pricing/) also see +Users on [GitLab Premium or higher](https://about.gitlab.com/pricing/) also see the `group_saml` provider option and `provisioned_by_group_id` parameter: ```json @@ -357,7 +357,7 @@ Example Responses: NOTE: The `plan` and `trial` parameters are only available on GitLab Enterprise Edition. -Users on GitLab [Premium or higher](https://about.gitlab.com/pricing/) also see +Users on [GitLab Premium or higher](https://about.gitlab.com/pricing/) also see the `shared_runners_minutes_limit`, `is_auditor`, and `extra_shared_runners_minutes_limit` parameters. ```json @@ -371,7 +371,7 @@ the `shared_runners_minutes_limit`, `is_auditor`, and `extra_shared_runners_minu } ``` -Users on GitLab.com [Premium or higher](https://about.gitlab.com/pricing/) also +Users on [GitLab.com Premium or higher](https://about.gitlab.com/pricing/) also see the `group_saml` option and `provisioned_by_group_id` parameter: ```json @@ -627,7 +627,7 @@ GET /user } ``` -Users on GitLab [Premium or higher](https://about.gitlab.com/pricing/) also see these +Users on [GitLab Premium or higher](https://about.gitlab.com/pricing/) also see these parameters: - `shared_runners_minutes_limit` diff --git a/doc/user/profile/personal_access_tokens.md b/doc/user/profile/personal_access_tokens.md index 8acb8d34214..ca9460793cf 100644 --- a/doc/user/profile/personal_access_tokens.md +++ b/doc/user/profile/personal_access_tokens.md @@ -29,6 +29,9 @@ For examples of how you can use a personal access token to authenticate with the Alternately, GitLab administrators can use the API to create [impersonation tokens](../../api/index.md#impersonation-tokens). Use impersonation tokens to automate authentication as a specific user. +NOTE: +Use your GitLab username and personal access tokens to authenticate with [GitLab managed Terraform state backend](../infrastructure/iac/terraform_state.md#using-a-gitlab-managed-terraform-state-backend-as-a-remote-data-source), [Docker container registry](../packages/container_registry/index.md#authenticate-with-the-container-registry), or when authenticating to a Git remote repository. Currently, GitLab usernames are ignored when authenticating with a personal access token, however, usernames may become a requirement in the future as per [issue #212953](https://gitlab.com/gitlab-org/gitlab/-/issues/212953). + ## Create a personal access token You can create as many personal access tokens as you like. diff --git a/lib/api/ci/pipelines.rb b/lib/api/ci/pipelines.rb index 4d6d38f2dce..6e786ecd500 100644 --- a/lib/api/ci/pipelines.rb +++ b/lib/api/ci/pipelines.rb @@ -44,7 +44,6 @@ module API optional :ref, type: String, desc: 'The ref of pipelines' optional :sha, type: String, desc: 'The sha of pipelines' optional :yaml_errors, type: Boolean, desc: 'Returns pipelines with invalid configurations' - optional :name, type: String, desc: '(deprecated) The name of the user who triggered pipelines' optional :username, type: String, desc: 'The username of the user who triggered pipelines' optional :updated_before, type: DateTime, desc: 'Return pipelines updated before the specified datetime. Format: ISO 8601 YYYY-MM-DDTHH:MM:SSZ' optional :updated_after, type: DateTime, desc: 'Return pipelines updated after the specified datetime. Format: ISO 8601 YYYY-MM-DDTHH:MM:SSZ' diff --git a/locale/gitlab.pot b/locale/gitlab.pot index f3f8aa49981..b981cf7e2d7 100644 --- a/locale/gitlab.pot +++ b/locale/gitlab.pot @@ -15340,7 +15340,7 @@ msgstr "" msgid "GitLab is open source software to collaborate on code." msgstr "" -msgid "GitLab is undergoing maintenance and is operating in a read-only mode." +msgid "GitLab is undergoing maintenance and is operating in read-only mode." msgstr "" msgid "GitLab member or Email address" @@ -22858,7 +22858,7 @@ msgstr "" msgid "Nodes" msgstr "" -msgid "Non-admin users can sign in with read-only access and make read-only API requests." +msgid "Non-admin users are restricted to read-only access, in both GitLab UI and API." msgstr "" msgid "None" @@ -25370,7 +25370,7 @@ msgstr "" msgid "Prevent users from changing their profile name" msgstr "" -msgid "Prevent users from performing write operations on GitLab while performing maintenance." +msgid "Prevent users from performing write operations while GitLab maintenance is in progress." msgstr "" msgid "Preview" diff --git a/spec/finders/ci/pipelines_finder_spec.rb b/spec/finders/ci/pipelines_finder_spec.rb index 6e2338ac10e..908210e0296 100644 --- a/spec/finders/ci/pipelines_finder_spec.rb +++ b/spec/finders/ci/pipelines_finder_spec.rb @@ -113,27 +113,6 @@ RSpec.describe Ci::PipelinesFinder do end end - context 'when name is specified' do - let(:user) { create(:user) } - let!(:pipeline) { create(:ci_pipeline, project: project, user: user) } - - context 'when name exists' do - let(:params) { { name: user.name } } - - it 'returns matched pipelines' do - is_expected.to eq([pipeline]) - end - end - - context 'when name does not exist' do - let(:params) { { name: 'invalid-name' } } - - it 'returns empty' do - is_expected.to be_empty - end - end - end - context 'when username is specified' do let(:user) { create(:user) } let!(:pipeline) { create(:ci_pipeline, project: project, user: user) } diff --git a/spec/requests/api/ci/pipelines_spec.rb b/spec/requests/api/ci/pipelines_spec.rb index eacc41b2b78..7ae350885f4 100644 --- a/spec/requests/api/ci/pipelines_spec.rb +++ b/spec/requests/api/ci/pipelines_spec.rb @@ -168,30 +168,6 @@ RSpec.describe API::Ci::Pipelines do end end - context 'when name is specified' do - let_it_be(:pipeline) { create(:ci_pipeline, project: project, user: user) } - - context 'when name exists' do - it 'returns matched pipelines' do - get api("/projects/#{project.id}/pipelines", user), params: { name: user.name } - - expect(response).to have_gitlab_http_status(:ok) - expect(response).to include_pagination_headers - expect(json_response.first['id']).to eq(pipeline.id) - end - end - - context 'when name does not exist' do - it 'returns empty' do - get api("/projects/#{project.id}/pipelines", user), params: { name: 'invalid-name' } - - expect(response).to have_gitlab_http_status(:ok) - expect(response).to include_pagination_headers - expect(json_response).to be_empty - end - end - end - context 'when username is specified' do let_it_be(:pipeline) { create(:ci_pipeline, project: project, user: user) } diff --git a/spec/validators/gitlab/utils/zoom_url_validator_spec.rb b/spec/validators/gitlab/zoom_url_validator_spec.rb index 392d8b3a2fe..308a6be78eb 100644 --- a/spec/validators/gitlab/utils/zoom_url_validator_spec.rb +++ b/spec/validators/gitlab/zoom_url_validator_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe Gitlab::Utils::ZoomUrlValidator do +RSpec.describe Gitlab::ZoomUrlValidator do let(:zoom_meeting) { build(:zoom_meeting) } describe 'validations' do |