From 821ba7ce78f6508fe03e3f7c9bc0b9542fa86485 Mon Sep 17 00:00:00 2001 From: GitLab Bot Date: Fri, 4 Nov 2022 18:07:35 +0000 Subject: [PATCH] Add latest changes from gitlab-org/gitlab@master --- doc/administration/incoming_email.md | 2 +- doc/api/pipelines.md | 61 +++++++++++++++++ doc/development/migration_style_guide.md | 9 +++ .../secret_detection/index.md | 4 +- lib/gitlab/ci/config/external/file/base.rb | 65 +++++++------------ lib/gitlab/ci/config/external/mapper.rb | 5 -- package.json | 4 +- .../web_ide/review_merge_request_spec.rb | 2 +- yarn.lock | 16 ++--- 9 files changed, 108 insertions(+), 60 deletions(-) diff --git a/doc/administration/incoming_email.md b/doc/administration/incoming_email.md index 4959bacaaa4..433956bb066 100644 --- a/doc/administration/incoming_email.md +++ b/doc/administration/incoming_email.md @@ -41,7 +41,7 @@ in the mailbox for `user@example.com` . It is supported by providers such as Gmail, Google Apps, Yahoo! Mail, Outlook.com, and iCloud, as well as the [Postfix mail server](reply_by_email_postfix_setup.md), which you can run on-premises. Microsoft Exchange Server [does not support sub-addressing](#microsoft-exchange-server), -and Microsoft Office 365 [does not support sub-addressing by default](#microsoft-office-365) +and Microsoft Office 365 [does not support sub-addressing by default](#microsoft-office-365). NOTE: If your provider or server supports email sub-addressing, we recommend using it. diff --git a/doc/api/pipelines.md b/doc/api/pipelines.md index a44d02982c0..8242f8cff00 100644 --- a/doc/api/pipelines.md +++ b/doc/api/pipelines.md @@ -269,6 +269,67 @@ Sample response: } ``` +## Get the latest pipeline + +Get the latest pipeline for a specific ref in a project. + +```plaintext +POST /projects/:id/pipeline/latest +``` + +| Attribute | Type | Required | Description | +|-------------|---------|----------|---------------------| +| `ref` | string | no | The branch or tag to check for the latest pipeline. Defaults to the default branch when not specified. | + +```shell +curl --request POST --header "PRIVATE-TOKEN: " "https://gitlab.example.com/api/v4/projects/1/pipelines/latest" +``` + +Example of response + +```json +{ + "id": 287, + "iid": 144, + "project_id": 21, + "sha": "50f0acb76a40e34a4ff304f7347dcc6587da8a14", + "ref": "main", + "status": "success", + "source": "push", + "created_at": "2022-09-21T01:05:07.200Z", + "updated_at": "2022-09-21T01:05:50.185Z", + "web_url": "http://127.0.0.1:3000/test-group/test-project/-/pipelines/287", + "before_sha": "8a24fb3c5877a6d0b611ca41fc86edc174593e2b", + "tag": false, + "yaml_errors": null, + "user": { + "id": 1, + "username": "root", + "name": "Administrator", + "state": "active", + "avatar_url": "https://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon", + "web_url": "http://127.0.0.1:3000/root" + }, + "started_at": "2022-09-21T01:05:14.197Z", + "finished_at": "2022-09-21T01:05:50.175Z", + "committed_at": null, + "duration": 34, + "queued_duration": 6, + "coverage": null, + "detailed_status": { + "icon": "status_success", + "text": "passed", + "label": "passed", + "group": "success", + "tooltip": "passed", + "has_details": false, + "details_path": "/test-group/test-project/-/pipelines/287", + "illustration": null, + "favicon": "/assets/ci_favicons/favicon_status_success-8451333011eee8ce9f2ab25dc487fe24a8758c694827a582f17f42b0a90446a2.png" + } +} +``` + ## Create a new pipeline > `iid` in response [introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/342223) in GitLab 14.6. diff --git a/doc/development/migration_style_guide.md b/doc/development/migration_style_guide.md index f59c1fd8368..529b0802991 100644 --- a/doc/development/migration_style_guide.md +++ b/doc/development/migration_style_guide.md @@ -52,9 +52,18 @@ work it needs to perform and how long it takes to complete: of release manager through the [post-deploy migration pipeline](https://gitlab.com/gitlab-org/release/docs/-/blob/master/general/post_deploy_migration/readme.md#how-to-determine-if-a-post-deploy-migration-has-been-executed-on-gitlabcom). These migrations can be used for schema changes that aren't critical for the application to operate, or data migrations that take at most a few minutes. Common examples for schema changes that should run post-deploy include: + - Clean-ups, like removing unused columns. - Adding non-critical indices on high-traffic tables. - Adding non-critical indices that take a long time to create. + + These migrations should not be used for schema changes that are critical for the application to operate. Making such + schema changes in a post-deployment migration have caused issues in the past, for example [this issue](https://gitlab.com/gitlab-org/gitlab/-/issues/378582). + Changes that should always be a regular schema migration and not be executed in a post-deployment migration include: + + - Creating a new table, example: `create_table`. + - Adding a new column to an existing table, example: `add_column`. + 1. [**Batched background migrations.**](database/batched_background_migrations.md) These aren't regular Rails migrations, but application code that is executed via Sidekiq jobs, although a post-deployment migration is used to schedule them. Use them only for data migrations that exceed the timing guidelines for post-deploy migrations. Batched background migrations should _not_ change the schema. diff --git a/doc/user/application_security/secret_detection/index.md b/doc/user/application_security/secret_detection/index.md index b1cd16a6669..6465b7a2829 100644 --- a/doc/user/application_security/secret_detection/index.md +++ b/doc/user/application_security/secret_detection/index.md @@ -38,7 +38,7 @@ All identified secrets are reported in the: - Merge request widget - Pipelines' **Security** tab -- [Security Dashboard](../security_dashboard/index.md) +- [Vulnerability Report](../vulnerability_report/index.md) ![Secret Detection in merge request widget](img/secret_detection_v13_2.png) @@ -61,7 +61,7 @@ Different features are available in different [GitLab tiers](https://about.gitla | Download [JSON Report](../sast/index.md#reports-json-format) | **{check-circle}** Yes | **{check-circle}** Yes | | See new findings in the merge request widget | **{dotted-circle}** No | **{check-circle}** Yes | | View identified secrets in the pipelines' **Security** tab | **{dotted-circle}** No | **{check-circle}** Yes | -| [Manage vulnerabilities](../vulnerabilities/index.md) | **{dotted-circle}** No | **{check-circle}** Yes | +| [Manage vulnerabilities](../vulnerability_report/index.md) | **{dotted-circle}** No | **{check-circle}** Yes | | [Access the Security Dashboard](../security_dashboard/index.md) | **{dotted-circle}** No | **{check-circle}** Yes | | [Customize Secret Detection rulesets](#custom-rulesets) | **{dotted-circle}** No | **{check-circle}** Yes | diff --git a/lib/gitlab/ci/config/external/file/base.rb b/lib/gitlab/ci/config/external/file/base.rb index 48ba154862a..89da0796906 100644 --- a/lib/gitlab/ci/config/external/file/base.rb +++ b/lib/gitlab/ci/config/external/file/base.rb @@ -47,9 +47,12 @@ module Gitlab end def validate! - validate_location! - fetch_and_validate_content! if valid? - load_and_validate_expanded_hash! if valid? + context.logger.instrument(:config_file_validation) do + validate_execution_time! + validate_location! + validate_content! if errors.none? + validate_hash! if errors.none? + end end def metadata @@ -69,41 +72,11 @@ module Gitlab protected - def validate_location! - if invalid_location_type? - errors.push("Included file `#{masked_location}` needs to be a string") - elsif invalid_extension? - errors.push("Included file `#{masked_location}` does not have YAML extension!") - end - end + def expanded_content_hash + return unless content_hash - def fetch_and_validate_content! - context.logger.instrument(:config_file_fetch_content) do - content # calling the method fetches then memoizes the result - end - - return if errors.any? - - context.logger.instrument(:config_file_validate_content) do - validate_content! - end - end - - def load_and_validate_expanded_hash! - context.logger.instrument(:config_file_fetch_content_hash) do - content_hash # calling the method loads then memoizes the result - end - - context.logger.instrument(:config_file_expand_content_includes) do - expanded_content_hash # calling the method expands then memoizes the result - end - - validate_hash! - end - - def validate_content! - if content.blank? - errors.push("Included file `#{masked_location}` is empty or does not exist!") + strong_memoize(:expanded_content_yaml) do + expand_includes(content_hash) end end @@ -115,11 +88,21 @@ module Gitlab nil end - def expanded_content_hash - return unless content_hash + def validate_execution_time! + context.check_execution_time! + end - strong_memoize(:expanded_content_yaml) do - expand_includes(content_hash) + def validate_location! + if invalid_location_type? + errors.push("Included file `#{masked_location}` needs to be a string") + elsif invalid_extension? + errors.push("Included file `#{masked_location}` does not have YAML extension!") + end + end + + def validate_content! + if content.blank? + errors.push("Included file `#{masked_location}` is empty or does not exist!") end end diff --git a/lib/gitlab/ci/config/external/mapper.rb b/lib/gitlab/ci/config/external/mapper.rb index cd752694e74..2a1060a6059 100644 --- a/lib/gitlab/ci/config/external/mapper.rb +++ b/lib/gitlab/ci/config/external/mapper.rb @@ -127,7 +127,6 @@ module Gitlab def verify!(location_object) verify_max_includes! - verify_execution_time! location_object.validate! expandset.add(location_object) end @@ -138,10 +137,6 @@ module Gitlab end end - def verify_execution_time! - context.check_execution_time! - end - def expand_variables(data) logger.instrument(:config_mapper_variables) do expand_variables_without_instrumentation(data) diff --git a/package.json b/package.json index b793fbbde73..84da16079e6 100644 --- a/package.json +++ b/package.json @@ -53,8 +53,8 @@ "@codesandbox/sandpack-client": "^1.2.2", "@gitlab/at.js": "1.5.7", "@gitlab/favicon-overlay": "2.0.0", - "@gitlab/svgs": "3.6.0", - "@gitlab/ui": "49.2.1", + "@gitlab/svgs": "3.7.0", + "@gitlab/ui": "49.3.0", "@gitlab/visual-review-tools": "1.7.3", "@gitlab/web-ide": "0.0.1-dev-20220815034418", "@rails/actioncable": "6.1.4-7", diff --git a/qa/qa/specs/features/browser_ui/3_create/web_ide/review_merge_request_spec.rb b/qa/qa/specs/features/browser_ui/3_create/web_ide/review_merge_request_spec.rb index 69557fb359a..e4f29952f99 100644 --- a/qa/qa/specs/features/browser_ui/3_create/web_ide/review_merge_request_spec.rb +++ b/qa/qa/specs/features/browser_ui/3_create/web_ide/review_merge_request_spec.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module QA - RSpec.describe 'Create', product_group: :editor do + RSpec.describe 'Create', product_group: :editor, quarantine: { issue: 'https://gitlab.com/gitlab-org/gitlab/-/issues/381530', type: :stale } do describe 'Review a merge request in Web IDE' do let(:new_file) { 'awesome_new_file.txt' } let(:original_text) { 'Text' } diff --git a/yarn.lock b/yarn.lock index 98a5bdb2d19..406fde7c772 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1108,15 +1108,15 @@ stylelint-declaration-strict-value "1.8.0" stylelint-scss "4.2.0" -"@gitlab/svgs@3.6.0": - version "3.6.0" - resolved "https://registry.yarnpkg.com/@gitlab/svgs/-/svgs-3.6.0.tgz#3967cda46087ff2bc163ff339adf7ae6eaaa415f" - integrity sha512-UXTvFmPa1lK7+S+r2iWrN6CIvRpjCNIJFbcJiimEF1UJ8uR+JY3/fGIJXLjd53ZNXkqbffSXurxY35Zd4SeTkg== +"@gitlab/svgs@3.7.0": + version "3.7.0" + resolved "https://registry.yarnpkg.com/@gitlab/svgs/-/svgs-3.7.0.tgz#1257b69fb9898ea5614f992aa6b6dc3619c3c38c" + integrity sha512-6vTqWZzY63ZUTUqk0dmMDcfU27qtkAu0WmlK4e3FMWmISvTxNhAk2j11c/YlLauf6okE4W2T2fnhvXp1mzcPgA== -"@gitlab/ui@49.2.1": - version "49.2.1" - resolved "https://registry.yarnpkg.com/@gitlab/ui/-/ui-49.2.1.tgz#362dda68799d6ecfd32c8e0a4eb1409f20ddec4d" - integrity sha512-dutmZTGQDDn7nPzGFtI6YEnqF7yhnD6tY6ymGQ1U0bkdDcjR8GOMvDn3Gc09505go6ESt0A4dXwleboDgoFP0w== +"@gitlab/ui@49.3.0": + version "49.3.0" + resolved "https://registry.yarnpkg.com/@gitlab/ui/-/ui-49.3.0.tgz#63e6a375d66c6f6ae568f0d1a08fe0e9bd4e355b" + integrity sha512-c8GSajEdW2Q1ME7lYuQgImR493WaELKJOq/T+1zVs3i82cc1YDWbGEJyKZh6srJ6xNSLuIbn6d7oSqfM/jeSAQ== dependencies: "@popperjs/core" "^2.11.2" bootstrap-vue "2.20.1"