Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2023-04-11 12:12:15 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2023-04-11 12:12:15 +0300
commita48957b317edf23b1bcfc6df0c098a824eae86f4 (patch)
tree9a8ce03341e088db5cdba549f4a2fee6afef6e3c
parenta3e10bf32044486be8923176581670cf9ccacc8b (diff)
Add latest changes from gitlab-org/gitlab@master
-rw-r--r--.gitlab/ci/rules.gitlab-ci.yml7
-rw-r--r--app/controllers/projects/usage_quotas_controller.rb4
-rw-r--r--app/models/ci/build_trace.rb6
-rw-r--r--app/models/resource_milestone_event.rb3
-rw-r--r--app/models/resource_state_event.rb4
-rw-r--r--app/views/protected_branches/shared/_branches_list.html.haml2
-rw-r--r--app/views/users/show.html.haml2
-rw-r--r--config/feature_flags/development/product_analytics_snowplow_support.yml (renamed from config/feature_flags/development/github_import_gists.yml)12
-rw-r--r--config/feature_flags/development/sign_and_verify_ansi2json_state.yml (renamed from config/feature_flags/development/move_year_dropdown_usage_charts.yml)6
-rw-r--r--db/fixtures/development/33_triage_ops.rb1
-rw-r--r--doc/api/import.md6
-rw-r--r--doc/api/index.md1
-rw-r--r--doc/development/pipelines/index.md31
-rw-r--r--doc/integration/jira/connect-app.md40
-rw-r--r--doc/user/group/manage.md2
-rw-r--r--doc/user/project/repository/code_suggestions.md60
-rw-r--r--doc/user/project/repository/forking_workflow.md8
-rw-r--r--doc/user/project/repository/vscode.md1
-rw-r--r--lib/api/import_github.rb2
-rw-r--r--lib/gitlab/ci/ansi2json.rb4
-rw-r--r--lib/gitlab/ci/ansi2json/converter.rb8
-rw-r--r--lib/gitlab/ci/ansi2json/signed_state.rb71
-rw-r--r--lib/gitlab/ci/ansi2json/state.rb19
-rwxr-xr-xscripts/verify-tff-mapping6
-rw-r--r--spec/lib/gitlab/ci/ansi2json/signed_state_spec.rb53
-rw-r--r--spec/lib/gitlab/ci/ansi2json/state_spec.rb59
-rw-r--r--spec/lib/gitlab/ci/ansi2json_spec.rb18
-rw-r--r--spec/models/ci/build_trace_spec.rb24
-rw-r--r--spec/models/resource_milestone_event_spec.rb18
-rw-r--r--spec/models/resource_state_event_spec.rb17
-rw-r--r--spec/requests/api/import_github_spec.rb74
-rw-r--r--spec/tooling/lib/tooling/mappings/js_to_system_specs_mappings_spec.rb24
-rw-r--r--tests.yml4
-rw-r--r--tooling/lib/tooling/mappings/js_to_system_specs_mappings.rb2
34 files changed, 450 insertions, 149 deletions
diff --git a/.gitlab/ci/rules.gitlab-ci.yml b/.gitlab/ci/rules.gitlab-ci.yml
index 45f14dc0033..c61819d0a4c 100644
--- a/.gitlab/ci/rules.gitlab-ci.yml
+++ b/.gitlab/ci/rules.gitlab-ci.yml
@@ -1787,7 +1787,12 @@
when: never
- <<: *if-merge-request-labels-pipeline-expedite
when: never
- - if: '$SKIP_FLAKY_TESTS_AUTOMATICALLY == "true" || $RETRY_FAILED_TESTS_IN_NEW_PROCESS == "true"'
+ - if: '$SKIP_FLAKY_TESTS_AUTOMATICALLY != "true" && $RETRY_FAILED_TESTS_IN_NEW_PROCESS != "true"'
+ when: never
+ - <<: *if-merge-request
+ changes: *code-backstage-patterns
+ when: always
+ - <<: *if-default-branch-refs
changes: *code-backstage-patterns
when: always
diff --git a/app/controllers/projects/usage_quotas_controller.rb b/app/controllers/projects/usage_quotas_controller.rb
index dfca289ef71..7037cf8811a 100644
--- a/app/controllers/projects/usage_quotas_controller.rb
+++ b/app/controllers/projects/usage_quotas_controller.rb
@@ -6,10 +6,6 @@ module Projects
layout "project_settings"
- before_action do
- push_frontend_feature_flag(:move_year_dropdown_usage_charts, current_user)
- end
-
feature_category :consumables_cost_management
urgency :low
diff --git a/app/models/ci/build_trace.rb b/app/models/ci/build_trace.rb
index f70e1ed69ea..b9a74102641 100644
--- a/app/models/ci/build_trace.rb
+++ b/app/models/ci/build_trace.rb
@@ -12,7 +12,11 @@ module Ci
if stream.valid?
stream.limit
- @trace = Gitlab::Ci::Ansi2json.convert(stream.stream, state)
+ @trace = Gitlab::Ci::Ansi2json.convert(
+ stream.stream,
+ state,
+ verify_state: Feature.enabled?(:sign_and_verify_ansi2json_state, build.project)
+ )
end
end
diff --git a/app/models/resource_milestone_event.rb b/app/models/resource_milestone_event.rb
index f3301ee2051..61129bbc9d8 100644
--- a/app/models/resource_milestone_event.rb
+++ b/app/models/resource_milestone_event.rb
@@ -4,6 +4,9 @@ class ResourceMilestoneEvent < ResourceTimeboxEvent
belongs_to :milestone
scope :include_relations, -> { includes(:user, milestone: [:project, :group]) }
+ scope :aliased_for_timebox_report, -> do
+ select("'timebox' AS event_type", "id", "created_at", "milestone_id AS value", "action", "issue_id")
+ end
# state is used for issue and merge request states.
enum state: Issue.available_states.merge(MergeRequest.available_states)
diff --git a/app/models/resource_state_event.rb b/app/models/resource_state_event.rb
index 134f71e35ad..e2ac762b1cd 100644
--- a/app/models/resource_state_event.rb
+++ b/app/models/resource_state_event.rb
@@ -13,6 +13,10 @@ class ResourceStateEvent < ResourceEvent
after_create :issue_usage_metrics
+ scope :aliased_for_timebox_report, -> do
+ select("'state' AS event_type", "id", "created_at", "state AS value", "NULL AS action", "issue_id")
+ end
+
def self.issuable_attrs
%i(issue merge_request).freeze
end
diff --git a/app/views/protected_branches/shared/_branches_list.html.haml b/app/views/protected_branches/shared/_branches_list.html.haml
index 8235411d240..ed2d420ffcd 100644
--- a/app/views/protected_branches/shared/_branches_list.html.haml
+++ b/app/views/protected_branches/shared/_branches_list.html.haml
@@ -26,7 +26,7 @@
%th
= s_("ProtectedBranch|Allowed to force push")
%span.has-tooltip{ data: { container: 'body' }, title: s_('ProtectedBranch|Allow all users with push access to force push.'), 'aria-hidden': 'true' }
- = sprite_icon('question', size: 16, css_class: 'gl-text-gray-500')
+ = sprite_icon('question-o', size: 16, css_class: 'gl-text-blue-500')
= render_if_exists 'protected_branches/ee/code_owner_approval_table_head', protected_branch_entity: protected_branch_entity
diff --git a/app/views/users/show.html.haml b/app/views/users/show.html.haml
index 16d79a4ff72..28f9a6a6336 100644
--- a/app/views/users/show.html.haml
+++ b/app/views/users/show.html.haml
@@ -116,7 +116,7 @@
- if @user.website_url.present?
= render 'middle_dot_divider', stacking: true do
- if Feature.enabled?(:security_auto_fix) && @user.bot?
- = sprite_icon('question', css_class: 'gl-text-blue-600')
+ = sprite_icon('question-o', css_class: 'gl-text-blue-500')
= link_to @user.short_website_url, @user.full_website_url, target: '_blank', rel: 'me noopener noreferrer nofollow', itemprop: 'url'
- if display_public_email?(@user)
= render 'middle_dot_divider', stacking: true do
diff --git a/config/feature_flags/development/github_import_gists.yml b/config/feature_flags/development/product_analytics_snowplow_support.yml
index a8d1483f26f..f3684a3f26b 100644
--- a/config/feature_flags/development/github_import_gists.yml
+++ b/config/feature_flags/development/product_analytics_snowplow_support.yml
@@ -1,8 +1,8 @@
---
-name: github_import_gists
-introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/107651
-rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/386579
-milestone: '15.8'
+name: product_analytics_snowplow_support
+introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/116317
+rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/403418
+milestone: '15.11'
type: development
-group: group::import
-default_enabled: true
+group: group::product analytics
+default_enabled: false
diff --git a/config/feature_flags/development/move_year_dropdown_usage_charts.yml b/config/feature_flags/development/sign_and_verify_ansi2json_state.yml
index dfeaa3d7144..7d9ac48dba6 100644
--- a/config/feature_flags/development/move_year_dropdown_usage_charts.yml
+++ b/config/feature_flags/development/sign_and_verify_ansi2json_state.yml
@@ -1,7 +1,7 @@
---
-name: move_year_dropdown_usage_charts
-introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/115609
-rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/402311
+name: sign_and_verify_ansi2json_state
+introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/116625
+rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/404718
milestone: '15.11'
type: development
group: group::pipeline execution
diff --git a/db/fixtures/development/33_triage_ops.rb b/db/fixtures/development/33_triage_ops.rb
index 5d8b4a0a48f..5cdb1496c3d 100644
--- a/db/fixtures/development/33_triage_ops.rb
+++ b/db/fixtures/development/33_triage_ops.rb
@@ -85,6 +85,7 @@ class Gitlab::Seeder::TriageOps
Sidekiq::Testing.inline! do
puts "Ensuring required groups"
ensure_group('gitlab-com')
+ ensure_group('gitlab-com/support')
ensure_group('gitlab-com/gl-security/appsec')
ensure_group('gitlab-jh/jh-team')
ensure_group('gitlab-org')
diff --git a/doc/api/import.md b/doc/api/import.md
index 133abb6b2f6..4aeb5277b4a 100644
--- a/doc/api/import.md
+++ b/doc/api/import.md
@@ -141,11 +141,7 @@ Returns the following status codes:
> - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/371099) in GitLab 15.8 [with a flag](../administration/feature_flags.md) named `github_import_gists`. Disabled by default. Enabled on GitLab.com.
> - [Enabled on self-managed](https://gitlab.com/gitlab-org/gitlab/-/issues/386579) in GitLab 15.10.
-
-FLAG:
-On self-managed GitLab, this feature is available by default. To hide the feature,
-ask an administrator to [disable the feature flag](../administration/feature_flags.md) named `github_import_gists`.
-On GitLab.com, this feature is available.
+> - [Generally available](https://gitlab.com/gitlab-org/gitlab/-/issues/386579) in GitLab 15.11. Feature flag `github_import_gists` removed.
You can use the GitLab API to import personal GitHub gists (with up to 10 files) into personal GitLab snippets.
GitHub gists with more than 10 files are skipped. You should manually migrate these GitHub gists.
diff --git a/doc/api/index.md b/doc/api/index.md
index 46d7629327e..92301a1c3e0 100644
--- a/doc/api/index.md
+++ b/doc/api/index.md
@@ -15,3 +15,4 @@ Automate and interact with GitLab, and integrate with external applications.
- [OAuth 2.0 identity provider API](oauth2.md)
- [GitLab CLI (glab)](../integration/glab/index.md)
- [Visual Studio Code extension](../user/project/repository/vscode.md)
+- [Code Suggestions](../user/project/repository/code_suggestions.md)
diff --git a/doc/development/pipelines/index.md b/doc/development/pipelines/index.md
index 9fcbe8c55e4..c19580203e6 100644
--- a/doc/development/pipelines/index.md
+++ b/doc/development/pipelines/index.md
@@ -465,10 +465,9 @@ Exceptions to this general guideline should be motivated and documented.
### Ruby versions testing
-We're running Ruby 3.0 for the merge requests and the default branch. However,
-we're still running Ruby 2.7 for GitLab.com and there are older versions that
-we need to maintain, so we also run our test suite against Ruby 2.7 on a
-dedicated 2-hourly scheduled pipelines.
+We're running Ruby 3.0 on GitLab.com, as well as for merge requests and the default branch.
+However, there are older versions for which we need to support Ruby 2.7, so we also run our
+test suite against Ruby 2.7 on a dedicated 2-hourly scheduled pipelines.
For merge requests, you can add the `pipeline:run-in-ruby2` label to switch
the Ruby version used for running the whole test suite to 2.7. When you do
@@ -561,7 +560,7 @@ In general, pipelines for an MR fall into one of the following types (from short
- [Documentation pipeline](#documentation-pipeline): For MRs that touch documentation.
- [Backend pipeline](#backend-pipeline): For MRs that touch backend code.
-- [Frontend pipeline](#frontend-pipeline): For MRs that touch frontend code.
+- [Review app pipeline](#review-app-pipeline): For MRs that touch frontend code.
- [End-to-end pipeline](#end-to-end-pipeline): For MRs that touch code in the `qa/` folder.
A "pipeline type" is an abstract term that mostly describes the "critical path" (for example, the chain of jobs for which the sum
@@ -598,10 +597,10 @@ graph LR
graph RL;
classDef criticalPath fill:#f66;
- 1-3["compile-test-assets (6 minutes)"];
+ 1-3["compile-test-assets (5.5 minutes)"];
class 1-3 criticalPath;
click 1-3 "https://app.periscopedata.com/app/gitlab/652085/Engineering-Productivity---Pipeline-Build-Durations?widget=6914317&udv=0"
- 1-6["setup-test-env (4 minutes)"];
+ 1-6["setup-test-env (3.6 minutes)"];
click 1-6 "https://app.periscopedata.com/app/gitlab/652085/Engineering-Productivity---Pipeline-Build-Durations?widget=6914315&udv=0"
1-14["retrieve-tests-metadata"];
click 1-14 "https://app.periscopedata.com/app/gitlab/652085/Engineering-Productivity---Pipeline-Build-Durations?widget=8356697&udv=0"
@@ -613,19 +612,19 @@ graph RL;
click 2_5-1 "https://app.periscopedata.com/app/gitlab/652085/Engineering-Productivity---Pipeline-Build-Durations"
2_5-1 --> 1-3 & 1-6 & 1-14 & 1-15;
- 3_2-1["rspec:coverage (5.35 minutes)"];
+ 3_2-1["rspec:coverage (5 minutes)"];
class 3_2-1 criticalPath;
click 3_2-1 "https://app.periscopedata.com/app/gitlab/652085/Engineering-Productivity---Pipeline-Build-Durations?widget=7248745&udv=0"
3_2-1 -.->|"(don't use needs<br/>because of limitations)"| 2_5-1;
- 4_3-1["rspec:undercoverage (3.5 minutes)"];
+ 4_3-1["rspec:undercoverage (1.3 minutes)"];
class 4_3-1 criticalPath;
click 4_3-1 "https://app.periscopedata.com/app/gitlab/652085/EP---Jobs-Durations?widget=13446492&udv=1005715"
4_3-1 --> 3_2-1;
```
-### Frontend pipeline
+### Review app pipeline
[Reference pipeline](https://gitlab.com/gitlab-org/gitlab/-/pipelines/431913287).
@@ -635,15 +634,15 @@ graph RL;
1-2["build-qa-image (2 minutes)"];
click 1-2 "https://app.periscopedata.com/app/gitlab/652085/Engineering-Productivity---Pipeline-Build-Durations?widget=6914325&udv=0"
- 1-5["compile-production-assets (16 minutes)"];
+ 1-5["compile-production-assets (12 minutes)"];
class 1-5 criticalPath;
click 1-5 "https://app.periscopedata.com/app/gitlab/652085/Engineering-Productivity---Pipeline-Build-Durations?widget=6914312&udv=0"
- 2_3-1["build-assets-image (1.3 minutes)"];
+ 2_3-1["build-assets-image (1.1 minutes)"];
class 2_3-1 criticalPath;
2_3-1 --> 1-5
- 2_6-1["start-review-app-pipeline (49 minutes)"];
+ 2_6-1["start-review-app-pipeline (52 minutes)"];
class 2_6-1 criticalPath;
click 2_6-1 "https://app.periscopedata.com/app/gitlab/652085/Engineering-Productivity---Pipeline-Build-Durations"
2_6-1 --> 2_3-1 & 1-2;
@@ -659,17 +658,17 @@ graph RL;
1-2["build-qa-image (2 minutes)"];
click 1-2 "https://app.periscopedata.com/app/gitlab/652085/Engineering-Productivity---Pipeline-Build-Durations?widget=6914325&udv=0"
- 1-5["compile-production-assets (16 minutes)"];
+ 1-5["compile-production-assets (12 minutes)"];
class 1-5 criticalPath;
click 1-5 "https://app.periscopedata.com/app/gitlab/652085/Engineering-Productivity---Pipeline-Build-Durations?widget=6914312&udv=0"
1-15["detect-tests"];
click 1-15 "https://app.periscopedata.com/app/gitlab/652085/EP---Jobs-Durations?widget=10113603&udv=1005715"
- 2_3-1["build-assets-image (1.3 minutes)"];
+ 2_3-1["build-assets-image (1.1 minutes)"];
class 2_3-1 criticalPath;
2_3-1 --> 1-5
- 2_4-1["e2e:package-and-test (102 minutes)"];
+ 2_4-1["e2e:package-and-test-ee (103 minutes)"];
class 2_4-1 criticalPath;
click 2_4-1 "https://app.periscopedata.com/app/gitlab/652085/Engineering-Productivity---Pipeline-Build-Durations?widget=6914305&udv=0"
2_4-1 --> 1-2 & 2_3-1 & 1-15;
diff --git a/doc/integration/jira/connect-app.md b/doc/integration/jira/connect-app.md
index c39f8275786..d78c356305b 100644
--- a/doc/integration/jira/connect-app.md
+++ b/doc/integration/jira/connect-app.md
@@ -104,26 +104,29 @@ To create an OAuth application:
> Introduced in GitLab 15.7.
-Prerequisites:
-
-- GitLab.com must serve as a proxy for the instance.
-- The instance must be publicly available.
-- The instance must be on version 15.7 or later.
-- You must set up [OAuth authentication](#set-up-oauth-authentication-for-self-managed-instances).
-
You can link self-managed instances after installing the GitLab for Jira Cloud app from the marketplace.
Jira apps can only link to one URL per marketplace listing. The official listing links to GitLab.com.
-If your instance doesn't meet the prerequisites or you don't want to use the official marketplace listing, you can
+NOTE:
+With this method, GitLab.com serves as a proxy for Jira traffic from your instance.
+
+If your instance doesn't meet the [prerequisites](#prerequisites) or you don't want to use the official marketplace listing, you can
[install the app manually](#install-the-gitlab-for-jira-cloud-app-manually).
It's not possible to create branches from Jira for self-managed instances. For more information, see [issue 391432](https://gitlab.com/gitlab-org/gitlab/-/issues/391432).
+### Prerequisites
+
+- The instance must be publicly available.
+- The instance must be on GitLab version 15.7 or later.
+- You must set up [OAuth authentication](#set-up-oauth-authentication-for-self-managed-instances).
+
### Set up your instance
+See [prerequisites](#prerequisites).
+
To set up your self-managed instance for the GitLab for Jira Cloud app in GitLab 15.7 and later:
-1. [Set up OAuth authentication](#set-up-oauth-authentication-for-self-managed-instances).
1. On the top bar, select **Main menu > Admin**.
1. On the left sidebar, select **Settings > General** (`/admin/application_settings/general`).
1. Expand the **GitLab for Jira App** section.
@@ -144,7 +147,7 @@ To link your self-managed instance to the GitLab for Jira Cloud app:
If your GitLab instance is self-managed and you don't want to use the official marketplace listing,
you can install the app manually.
-Prerequisites:
+### Prerequisites
- The instance must be publicly available.
- You must set up [OAuth authentication](#set-up-oauth-authentication-for-self-managed-instances).
@@ -161,8 +164,10 @@ self-managed GitLab instances with Jira Cloud, you can do one of the following:
#### Install the application in development mode
-You can configure your Atlassian Cloud instance to allow you to install applications
-from outside the Marketplace, which allows you to install the application:
+See [prerequisites](#prerequisites-1).
+
+To configure your Atlassian Cloud instance so you can install applications
+from outside the Marketplace:
1. Sign in to your Jira instance as an administrator.
1. Place your Jira instance into
@@ -194,11 +199,12 @@ then reinstall the application.
#### Create a Marketplace listing
-If you prefer to not use development mode on your Jira instance, you can create
-your own Marketplace listing for your instance. This enables your application
-to be installed from the Atlassian Marketplace.
+If you don't want to use development mode on your Jira instance, you can create
+your own Marketplace listing. This way, your application
+can be installed from the Atlassian Marketplace.
+
+See [prerequisites](#prerequisites-1).
-For full instructions, review the Atlassian [guide to creating a marketplace listing](https://developer.atlassian.com/platform/marketplace/installing-cloud-apps/#creating-the-marketplace-listing).
To create a Marketplace listing:
1. Register as a Marketplace vendor.
@@ -212,6 +218,8 @@ NOTE:
This method uses [automated updates](#update-the-gitlab-for-jira-cloud-app)
the same way as our GitLab.com Marketplace listing.
+For more information about creating a Marketplace listing, see the [Atlassian documentation](https://developer.atlassian.com/platform/marketplace/installing-cloud-apps/#creating-the-marketplace-listing).
+
## Configure your GitLab instance to serve as a proxy for the GitLab for Jira Cloud app **(FREE SELF)**
A GitLab instance can serve as a proxy for other GitLab instances through the GitLab for Jira Cloud app.
diff --git a/doc/user/group/manage.md b/doc/user/group/manage.md
index 6bdd58d8314..6989f746e92 100644
--- a/doc/user/group/manage.md
+++ b/doc/user/group/manage.md
@@ -658,7 +658,7 @@ Support for group-level settings for merge request approval rules is tracked in
> [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/405126) in GitLab 15.11.
WARNING:
-This feature is in [Open Beta](/ee/policy/alpha-beta-support.md#open-beta-features). Code Suggestions is a generative AI feature that suggests code for developers. Due to high demand, we expect this feature will have unscheduled downtime and delays in code suggestions appearing in VS Code. We strongly encourage beta users to read about the [known limitations](../project/repository/code_suggestions.md#known-limitations). We look forward to hearing your feedback.
+This feature is in [Open Beta](/ee/policy/alpha-beta-support.md#open-beta-features). Code Suggestions use generative AI to suggest code while you're developing. Due to high demand, this feature will have unscheduled downtime and code suggestions in VS Code may be delayed. Code Suggestions may produce [low-quality or incomplete suggestions](../project/repository/code_suggestions.md#model-accuracy-and-quality). Beta users should read about the [known limitations](../project/repository/code_suggestions.md#known-limitations). We look forward to hearing your feedback.
This setting enables users in the group to access [Code Suggestions](../project/repository/code_suggestions.md).
This setting [cascades to all projects](../project/merge_requests/approvals/settings.md#settings-cascading)
diff --git a/doc/user/project/repository/code_suggestions.md b/doc/user/project/repository/code_suggestions.md
index 42465f5cd63..f9f6b2f75fd 100644
--- a/doc/user/project/repository/code_suggestions.md
+++ b/doc/user/project/repository/code_suggestions.md
@@ -5,21 +5,21 @@ info: To determine the technical writer assigned to the Stage/Group associated w
type: index, reference
---
-# Code Suggestions (Open Beta) **(ULTIMATE)**
+# Code Suggestions (Open Beta) **(ULTIMATE SAAS)**
> - Enabled as opt-in with GitLab 15.11 as [Open Beta](/ee/policy/alpha-beta-support.md#open-beta-features).
> - [Introduced](https://about.gitlab.com/releases/2023/02/22/gitlab-15-9-released/#code-suggestions-available-in-closed-beta) in GitLab 15.9 as [Closed Beta](/ee/policy/alpha-beta-support.md#closed-beta-features).
WARNING:
-This feature is in [Open Beta](/ee/policy/alpha-beta-support.md#open-beta-features). Code Suggestions is a generative AI feature that suggests code for developers. Due to high demand, we expect this feature will have unscheduled downtime and delays in code suggestions appearing in VS Code. We strongly encourage beta users to read about the [known limitations](#known-limitations). We look forward to hearing your feedback.
+This feature is in [Open Beta](/ee/policy/alpha-beta-support.md#open-beta-features). Code Suggestions use generative AI to suggest code while you're developing. Due to high demand, this feature will have unscheduled downtime and code suggestions in VS Code may be delayed. Code Suggestions may produce [low-quality or incomplete suggestions](#model-accuracy-and-quality). Beta users should read about the [known limitations](#known-limitations). We look forward to hearing your feedback.
-Use Code Suggestions to code more efficiently by viewing code suggestions
+Use Code Suggestions to write code more efficiently by viewing code suggestions
as you type. Depending on the cursor position, the extension either:
- Provides entire code snippets, like generating functions.
- Completes the current line.
-You can press <kbd>Tab</kbd> to accept suggestions.
+To accept a suggestion, press <kbd>Tab</kbd>.
Code Suggestions are supported in Visual Studio Code with the GitLab Workflow extension. GitLab plans to support the [new GitLab WebIDE in an upcoming release](../web_ide_beta/index.md) in the future.
@@ -34,20 +34,20 @@ The best results from Code Suggestions are expected for these six languages:
Suggestions may be mixed for other languages. Using natural language code comments to request completions may also not function as expected.
-GitLab is continuously improving the model and expect to support an additional seven languages soon, as well as natural language code comments.
+GitLab is continuously improving the model and expects to support an additional seven languages soon, as well as natural language code comments.
Usage of Code Suggestions is governed by the [GitLab Testing Agreement](https://about.gitlab.com/handbook/legal/testing-agreement/). Learn about [data usage when using Code Suggestions](#code-suggestions-data-usage).
-## Group level setting **(ULTIMATE)**
+## Group level setting
[Group owners](../../permissions.md#group-members-permissions) can enable Code Suggestions for all projects in a group by using the [group level Code Suggestions setting](../../group/manage.md#group-code-suggestions).
-## Enable Code Suggestions in VS Code **(ULTIMATE)**
+## Enable Code Suggestions in VS Code
Prerequisites:
-- Your group owner has enabled the [group level Code Suggestions setting](#group-level-setting).
-- You have [created a personal access token](../../profile/personal_access_tokens.md#create-a-personal-access-token) with the `read_api` and `read_user` scopes.
+- Your group owner must enable the [group level code suggestions setting](../../group/manage.md#group-code-suggestions).
+- You must have [a personal access token](../../profile/personal_access_tokens.md#create-a-personal-access-token) with the `read_api` and `read_user` scopes.
To enable Code Suggestions in VS Code:
@@ -61,12 +61,12 @@ To enable Code Suggestions in VS Code:
1. Provide your personal access token.
1. After your GitLab account connects successfully, in the left sidebar, select **Extensions**.
1. Find the **GitLab workflow** extension, select **Settings** (**{settings}**), and select **Extension Settings**.
-1. Enable **GitLab › AI Assisted Code Suggestions**.
+1. Enable **GitLab > AI Assisted Code Suggestions**.
Start typing and receive suggestions for your GitLab projects.
<div class="video-fallback">
- See an end-to-end demo: <a href="https://www.youtube.com/watch?v=WnxBYxN2-p4">How to get started with GitLab Code Suggestions in VS Code</a>.
+ See an end-to-end demo: <a href="https://www.youtube.com/watch?v=WnxBYxN2-p4">Get started with GitLab Code Suggestions in VS Code</a>.
</div>
<figure class="video-container">
<iframe src="https://www.youtube-nocookie.com/embed/WnxBYxN2-p4" frameborder="0" allowfullscreen> </iframe>
@@ -78,11 +78,15 @@ Start typing and receive suggestions for your GitLab projects.
Code Suggestions is a generative artificial intelligence (AI) model hosted on GitLab.com that can empower your developers to code more efficiently by suggesting code as they type.
-This feature uses a VS Code plugin to securely connect to a GitLab API hosted in GitLab.com's enterprise infrastructure that inferences a GitLab managed generative AI model.
+The personal access token enables a secure API connection to GitLab.com. This API connection securely transmits a context window from VS Code to the Code Suggestions ML model for inference, and the generated suggestion is transmitted back to VS Code.
-#### Enabling the feature
+#### Progressive enhancement
-Code Suggestions are managed by a group-level setting that is disabled by default. This group-level setting can only be enabled by group owners.
+This feature is designed as a progressive enhancement to the existing VS Code GitLab Workflow plugin. Code Suggestions offer a completion if the machine learning engine can generate a recommendation. In the event of a connection issue or model inference failure, the feature gracefully degrades. Code Suggestions do not prevent you from writing code in VS Code.
+
+#### Off by default
+
+Code Suggestions are off by default and require a group owner to enable the feature with a [group-level setting](#group-level-setting).
After the group level setting is enabled, Developers using Visual Studio Code with the [GitLab Workflow extension](https://marketplace.visualstudio.com/items?itemName=GitLab.gitlab-workflow) can connect to GitLab.com via a GitLab [personal access token](../../profile/personal_access_tokens.md#create-a-personal-access-token) with the `read_api` and `read_user` scopes.
@@ -90,37 +94,29 @@ After the group level setting is enabled, Developers using Visual Studio Code wi
Once configured by a developer in VS Code. The personal access token enables a secure API connection to GitLab.com. This API connection securely transmits a context window from VS Code to the Code Suggestions ML model for inference, and the generated suggestion is transmitted back to VS Code.
-Code Suggestions only works when developers have internet connectivity and can access GitLab.com. Code Suggestions is not available for self-managed customers, nor customers operating within an air-gapped environment.
-
-### Progressive enhancement
-
-This feature is designed as a progressive enhancement to the existing VS Code GitLab Workflow plugin. Code Suggestions only offers a completion if the ML engine is able to generate a recommendation. In the event of a connection issue or model inference failure, the feature gracefully degrades. At no point with the usage of Code Suggestions prevent a user from being able to write code in VS Code.
-
-### Off by default
-
-Code Suggestions is off by default and requires a Group Owner to enable the feature.
+Code Suggestions only work when you have internet connectivity and can access GitLab.com. Code Suggestions are not available for self-managed customers, nor customers operating within an air-gapped environment.
### Stability and performance
-This feature is currently marked as [open beta](/ee/policy/alpha-beta-support.md#open-beta-features). While the Code Suggestions inference API operates completely within GitLab.com's enterprise infrastructure, we expect a high demand for this beta feature, which may cause degraded performance or unexpected downtime of the feature. We have built this feature to gracefully degrade and have controls in place to allow us to mitigate abuse or misuse. GitLab may disable this feature for any or all customers at anytime at our discretion.
+This feature is currently in [Open Beta](/ee/policy/alpha-beta-support.md#open-beta-features). While the Code Suggestions inference API operates completely within GitLab.com's enterprise infrastructure, we expect a high demand for this Beta feature, which may cause degraded performance or unexpected downtime of the feature. We have built this feature to gracefully degrade and have controls in place to allow us to mitigate abuse or misuse. GitLab may disable this feature for any or all customers at any time at our discretion.
## Data privacy
-Code Suggestions operates completely in the GitLab.com infrastructure, providing the same level of [security](https://about.gitlab.com/security/) as any other feature of GitLab.com, and processing any Personal Data in accordance with our [Privacy Statement](https://about.gitlab.com/privacy/).
+Code Suggestions operate completely in the GitLab.com infrastructure, providing the same level of [security](https://about.gitlab.com/security/) as any other feature of GitLab.com, and processing any personal data in accordance with our [Privacy Statement](https://about.gitlab.com/privacy/).
No new additional data is collected to enable this feature. The content of your GitLab hosted source code is not used as training data. Source code inference against the Code Suggestions model is not used to re-train the model. Your data also never leaves GitLab.com. All training and inference is done in GitLab.com infrastructure.
[Read more about the security of GitLab.com](https://about.gitlab.com/security/faq/).
-### Model Accuracy and quality
+### Model accuracy and quality
-We use a customized open source dataset to fine-tune the model to support multiple languages. Based on the languages the developer codes in, we route the request to a targeted inference and prompt engine to get relevant context.
+While in Beta, Code Suggestions can generate low-quality, incomplete, and possibly insecure code. We strongly encourage all beta users to leverage GitLab native [Code Quality Scanning](../../../ci/testing/code_quality.md) and [Security Scanning](../../application_security/index.md) capabilities.
-We are actively refining these models to improve the quality of recommendations, add support for more languages, and add protections to limit Personal Data, insecure code, and other unwanted behavior that the model may have learned from training data.
+GitLab uses a customized open source dataset to fine-tune the model to support multiple languages. Based on the languages you code in, GitLab routes the request to a targeted inference and prompt engine to get relevant suggestions.
-While in beta, it is possible for Code Suggestions to generate low-quality and possibly insecure code. We strongly encourage all beta users to leverage GitLab native [Code Quality Scanning](../../../ci/testing/code_quality.md) and [Security Scanning](../../application_security/index.md) capabilities.
+GitLab is actively refining these models to improve the quality of recommendations, add support for more languages, and add protections to limit personal data, insecure code, and other unwanted behavior that the model may have learned from training data.
-### Training Data
+### Training data
Code Suggestions uses open source pre-trained base models from the [CodeGen family](https://openreview.net/forum?id=iaYcJKpY2B_) including CodeGen-MULTI and CodeGen-NL. We then re-train and fine-tune these base models with a customized open source dataset to enable multi-language support and additional use cases. This customized dataset contains non-preprocessed open source code in 13 programming languages from [The Pile](https://pile.eleuther.ai/) and [Google's BigQuery source code dataset](https://cloud.google.com/blog/topics/public-datasets/github-on-bigquery-analyze-all-the-open-source-code). We then process this raw dataset against heuristics that aim to increase the quality of the dataset.
@@ -128,7 +124,7 @@ The Code Suggestions model is not trained on GitLab customer data.
## Known limitations
-While in beta, we are working on improving the accuracy of overall generated content. However, Code Suggestions may generate suggestions that are:
+While in Beta, we are working on improving the accuracy of overall generated content. However, Code Suggestions may generate suggestions that are:
- Low-quality
- Incomplete
@@ -143,4 +139,4 @@ We are also aware of specific situations that can produce unexpected or incohere
## Feedback
-You may report issues in our [feedback issue](https://gitlab.com/gitlab-org/gitlab/-/issues/405152).
+Report issues in the [feedback issue](https://gitlab.com/gitlab-org/gitlab/-/issues/405152).
diff --git a/doc/user/project/repository/forking_workflow.md b/doc/user/project/repository/forking_workflow.md
index 690cf4a04a5..85414a55e81 100644
--- a/doc/user/project/repository/forking_workflow.md
+++ b/doc/user/project/repository/forking_workflow.md
@@ -101,7 +101,7 @@ an `upstream` remote repository for your fork:
A fork can be configured as a mirror of the upstream if all these conditions are met:
-1. Your subscription is **(PREMIUM)** or a higher tier.
+1. Your subscription is **Premium** or higher.
1. You create all changes in branches (not `main`).
1. You do not work on [merge requests for confidential issues](../merge_requests/confidential.md),
which requires changes to `main`.
@@ -132,6 +132,12 @@ changes are added to the repository and branch you're merging into.
You can unlink your fork from its upstream project in the [advanced settings](../settings/index.md#remove-a-fork-relationship).
+If you unlink a fork in this way and if [pool repositories](../../../development/git_object_deduplication.md#pool-repositories) are used, all objects are
+copied from the pool into the fork.
+
+After this copy is complete, the relationship is broken and the fork becomes an independent project. From this point, any updates to objects in the pool are
+not propagated to the project that was previously a fork.
+
## Related topics
- GitLab blog post: [Keep your fork up to date with its origin](https://about.gitlab.com/blog/2016/12/01/how-to-keep-your-fork-up-to-date-with-its-origin/)
diff --git a/doc/user/project/repository/vscode.md b/doc/user/project/repository/vscode.md
index 8e1d76a94f9..94824f3c492 100644
--- a/doc/user/project/repository/vscode.md
+++ b/doc/user/project/repository/vscode.md
@@ -22,6 +22,7 @@ do more day-to-day tasks in Visual Studio Code, such as:
and paste snippets to, and from, your editor.
- [Browse repositories](https://marketplace.visualstudio.com/items?itemName=GitLab.gitlab-workflow#browse-a-repository-without-cloning)
without cloning them.
+- [Receive Code Suggestions](code_suggestions.md)
## Download the extension
diff --git a/lib/api/import_github.rb b/lib/api/import_github.rb
index 6330a4458f3..6550808a563 100644
--- a/lib/api/import_github.rb
+++ b/lib/api/import_github.rb
@@ -111,8 +111,6 @@ module API
requires :personal_access_token, type: String, desc: 'GitHub personal access token'
end
post 'import/github/gists' do
- not_found! if Feature.disabled?(:github_import_gists)
-
authorize! :create_snippet
result = Import::Github::GistsImportService.new(current_user, client, access_params).execute
diff --git a/lib/gitlab/ci/ansi2json.rb b/lib/gitlab/ci/ansi2json.rb
index 79114d35916..70b68c7b821 100644
--- a/lib/gitlab/ci/ansi2json.rb
+++ b/lib/gitlab/ci/ansi2json.rb
@@ -4,8 +4,8 @@
module Gitlab
module Ci
module Ansi2json
- def self.convert(ansi, state = nil)
- Converter.new.convert(ansi, state)
+ def self.convert(ansi, state = nil, verify_state: false)
+ Converter.new.convert(ansi, state, verify_state: verify_state)
end
end
end
diff --git a/lib/gitlab/ci/ansi2json/converter.rb b/lib/gitlab/ci/ansi2json/converter.rb
index 78f6c5bf0aa..84541208a2f 100644
--- a/lib/gitlab/ci/ansi2json/converter.rb
+++ b/lib/gitlab/ci/ansi2json/converter.rb
@@ -4,9 +4,13 @@ module Gitlab
module Ci
module Ansi2json
class Converter
- def convert(stream, new_state)
+ def convert(stream, new_state, verify_state: false)
@lines = []
- @state = State.new(new_state, stream.size)
+ @state = if verify_state
+ SignedState.new(new_state, stream.size)
+ else
+ State.new(new_state, stream.size)
+ end
append = false
truncated = false
diff --git a/lib/gitlab/ci/ansi2json/signed_state.rb b/lib/gitlab/ci/ansi2json/signed_state.rb
new file mode 100644
index 00000000000..207c134d753
--- /dev/null
+++ b/lib/gitlab/ci/ansi2json/signed_state.rb
@@ -0,0 +1,71 @@
+# frozen_string_literal: true
+
+require 'openssl'
+
+module Gitlab
+ module Ci
+ module Ansi2json
+ class SignedState < ::Gitlab::Ci::Ansi2json::State
+ include Gitlab::Utils::StrongMemoize
+
+ SIGNATURE_KEY_SALT = 'gitlab-ci-ansi2json-state'
+ SEPARATOR = '--'
+
+ def encode
+ encoded = super
+
+ encoded + SEPARATOR + sign(encoded)
+ end
+
+ private
+
+ def sign(message)
+ ::OpenSSL::HMAC.hexdigest(
+ signature_digest,
+ signature_key,
+ message
+ )
+ end
+
+ def verify(signed_message)
+ return unless signed_message.present?
+
+ signature_length = signature_digest.digest_length * 2 # a byte is exactly two hexadecimals
+ message_length = signed_message.length - SEPARATOR.length - signature_length
+ return if message_length <= 0
+
+ signature = signed_message.last(signature_length)
+ message = signed_message.first(message_length)
+ return unless valid_signature?(message, signature)
+
+ message
+ end
+
+ def valid_signature?(message, signature)
+ expected_signature = sign(message)
+ expected_signature.bytesize == signature.bytesize &&
+ ::OpenSSL.fixed_length_secure_compare(signature, expected_signature)
+ end
+
+ def decode_state(data)
+ encoded_state = verify(data)
+ return unless encoded_state.present?
+
+ decoded_state = Base64.urlsafe_decode64(encoded_state)
+ return unless decoded_state.present?
+
+ ::Gitlab::Json.parse(decoded_state)
+ end
+
+ def signature_digest
+ ::OpenSSL::Digest.new('SHA256')
+ end
+
+ def signature_key
+ ::Gitlab::Application.key_generator.generate_key(SIGNATURE_KEY_SALT, signature_digest.block_length)
+ end
+ strong_memoize_attr :signature_key
+ end
+ end
+ end
+end
diff --git a/lib/gitlab/ci/ansi2json/state.rb b/lib/gitlab/ci/ansi2json/state.rb
index b2b6ce649ed..20279a3bed8 100644
--- a/lib/gitlab/ci/ansi2json/state.rb
+++ b/lib/gitlab/ci/ansi2json/state.rb
@@ -18,12 +18,13 @@ module Gitlab
end
def encode
- state = {
+ json = {
offset: @last_line_offset,
style: @current_line.style.to_h,
open_sections: @open_sections
- }
- Base64.urlsafe_encode64(state.to_json)
+ }.to_json
+
+ Base64.urlsafe_encode64(json, padding: false)
end
def open_section(section, timestamp, options)
@@ -91,7 +92,17 @@ module Gitlab
decoded_state = Base64.urlsafe_decode64(state)
return unless decoded_state.present?
- Gitlab::Json.parse(decoded_state)
+ ::Gitlab::Json.parse(decoded_state)
+ rescue ArgumentError, JSON::ParserError
+ # This rescue is so that we don't break during the rollout or rollback
+ # of `sign_and_verify_ansi2json_state`, because we may receive a
+ # signed state even when the flag is disabled, and this would result
+ # in invalid Base64 (ArgumentError) or invalid JSON in case the signed
+ # state happens to decode as valid Base64 (JSON::ParserError).
+ #
+ # Once the flag has been fully rolled out this should not
+ # be possible (it would imply a backend bug) and we not rescue from
+ # this.
end
end
end
diff --git a/scripts/verify-tff-mapping b/scripts/verify-tff-mapping
index 2f803bcda28..39834ec38bc 100755
--- a/scripts/verify-tff-mapping
+++ b/scripts/verify-tff-mapping
@@ -201,6 +201,12 @@ tests = [
explanation: 'https://gitlab.com/gitlab-org/quality/engineering-productivity/team/-/issues/146',
source: 'config/feature_categories.yml',
expected: ['spec/db/docs_spec.rb', 'ee/spec/lib/ee/gitlab/database/docs/docs_spec.rb']
+ },
+
+ {
+ explanation: 'https://gitlab.com/gitlab-org/quality/engineering-productivity/master-broken-incidents/-/issues/1360',
+ source: 'vendor/project_templates/gitbook.tar.gz',
+ expected: ['spec/lib/gitlab/project_template_spec.rb']
}
]
diff --git a/spec/lib/gitlab/ci/ansi2json/signed_state_spec.rb b/spec/lib/gitlab/ci/ansi2json/signed_state_spec.rb
new file mode 100644
index 00000000000..8ab4900e902
--- /dev/null
+++ b/spec/lib/gitlab/ci/ansi2json/signed_state_spec.rb
@@ -0,0 +1,53 @@
+# frozen_string_literal: true
+
+require 'spec_helper'
+
+RSpec.describe Gitlab::Ci::Ansi2json::SignedState, feature_category: :continuous_integration do
+ def build_state(state_class)
+ state_class.new('', 1000).tap do |state|
+ state.offset = 1
+ state.new_line!(style: { fg: 'some-fg', bg: 'some-bg', mask: 1234 })
+ state.set_last_line_offset
+ state.open_section('hello', 111, {})
+ end
+ end
+
+ let(:state) { build_state(described_class) }
+
+ describe '#initialize' do
+ it 'restores valid prior state', :aggregate_failures do
+ new_state = described_class.new(state.encode, 1000)
+
+ expect(new_state.offset).to eq(1)
+ expect(new_state.inherited_style).to eq({
+ bg: 'some-bg',
+ fg: 'some-fg',
+ mask: 1234
+ })
+ expect(new_state.open_sections).to eq({ 'hello' => 111 })
+ end
+
+ it 'ignores unsigned prior state', :aggregate_failures do
+ unsigned = build_state(Gitlab::Ci::Ansi2json::State)
+ new_state = described_class.new(unsigned.encode, 0)
+
+ expect(new_state.offset).to eq(0)
+ expect(new_state.inherited_style).to eq({})
+ expect(new_state.open_sections).to eq({})
+ end
+
+ it 'ignores bad input', :aggregate_failures do
+ new_state = described_class.new('abcd', 0)
+
+ expect(new_state.offset).to eq(0)
+ expect(new_state.inherited_style).to eq({})
+ expect(new_state.open_sections).to eq({})
+ end
+ end
+
+ describe '#encode' do
+ it 'deterministically signs the state' do
+ expect(state.encode).to eq state.encode
+ end
+ end
+end
diff --git a/spec/lib/gitlab/ci/ansi2json/state_spec.rb b/spec/lib/gitlab/ci/ansi2json/state_spec.rb
new file mode 100644
index 00000000000..3340eb05033
--- /dev/null
+++ b/spec/lib/gitlab/ci/ansi2json/state_spec.rb
@@ -0,0 +1,59 @@
+# frozen_string_literal: true
+
+require 'spec_helper'
+
+RSpec.describe Gitlab::Ci::Ansi2json::State, feature_category: :continuous_integration do
+ def build_state(state_class)
+ state_class.new('', 1000).tap do |state|
+ state.offset = 1
+ state.new_line!(style: { fg: 'some-fg', bg: 'some-bg', mask: 1234 })
+ state.set_last_line_offset
+ state.open_section('hello', 111, {})
+ end
+ end
+
+ let(:state) { build_state(described_class) }
+
+ describe '#initialize' do
+ it 'restores valid prior state', :aggregate_failures do
+ new_state = described_class.new(state.encode, 1000)
+
+ expect(new_state.offset).to eq(1)
+ expect(new_state.inherited_style).to eq({
+ bg: 'some-bg',
+ fg: 'some-fg',
+ mask: 1234
+ })
+ expect(new_state.open_sections).to eq({ 'hello' => 111 })
+ end
+
+ it 'ignores signed state' do
+ signed_state = Gitlab::Ci::Ansi2json::SignedState.new('', 1000)
+ signed_state.offset = 1
+ signed_state.new_line!(style: { fg: 'some-fg', bg: 'some-bg', mask: 1234 })
+ signed_state.set_last_line_offset
+ signed_state.open_section('hello', 111, {})
+
+ new_state = described_class.new(signed_state.encode, 1000)
+ expect(new_state.offset).to eq(0)
+ expect(new_state.inherited_style).to eq({})
+ expect(new_state.open_sections).to eq({})
+ end
+
+ it 'ignores invalid Base64', :aggregate_failures do
+ new_state = described_class.new('.', 0)
+
+ expect(new_state.offset).to eq(0)
+ expect(new_state.inherited_style).to eq({})
+ expect(new_state.open_sections).to eq({})
+ end
+
+ it 'ignores invalid JSON', :aggregate_failures do
+ new_state = described_class.new(Base64.urlsafe_encode64('.'), 0)
+
+ expect(new_state.offset).to eq(0)
+ expect(new_state.inherited_style).to eq({})
+ expect(new_state.open_sections).to eq({})
+ end
+ end
+end
diff --git a/spec/lib/gitlab/ci/ansi2json_spec.rb b/spec/lib/gitlab/ci/ansi2json_spec.rb
index 0f8f3759834..12eeb8f6cac 100644
--- a/spec/lib/gitlab/ci/ansi2json_spec.rb
+++ b/spec/lib/gitlab/ci/ansi2json_spec.rb
@@ -2,10 +2,26 @@
require 'spec_helper'
-RSpec.describe Gitlab::Ci::Ansi2json do
+RSpec.describe Gitlab::Ci::Ansi2json, feature_category: :continuous_integration do
subject { described_class }
describe 'lines' do
+ describe 'verify_state' do
+ it 'uses SignedState when true' do
+ expect(Gitlab::Ci::Ansi2json::State).not_to receive(:new)
+ expect(Gitlab::Ci::Ansi2json::SignedState).to receive(:new).and_call_original
+
+ described_class.convert(StringIO.new('data'), verify_state: true)
+ end
+
+ it 'uses State when false' do
+ expect(Gitlab::Ci::Ansi2json::State).to receive(:new).and_call_original
+ expect(Gitlab::Ci::Ansi2json::SignedState).not_to receive(:new)
+
+ described_class.convert(StringIO.new('data'), verify_state: false)
+ end
+ end
+
it 'prints non-ansi as-is' do
expect(convert_json('Hello')).to eq([{ offset: 0, content: [{ text: 'Hello' }] }])
end
diff --git a/spec/models/ci/build_trace_spec.rb b/spec/models/ci/build_trace_spec.rb
index 907b49dc180..54b4f02fb91 100644
--- a/spec/models/ci/build_trace_spec.rb
+++ b/spec/models/ci/build_trace_spec.rb
@@ -2,7 +2,7 @@
require 'spec_helper'
-RSpec.describe Ci::BuildTrace do
+RSpec.describe Ci::BuildTrace, feature_category: :continuous_integration do
let(:build) { build_stubbed(:ci_build) }
let(:state) { nil }
let(:data) { StringIO.new('the-stream') }
@@ -13,7 +13,7 @@ RSpec.describe Ci::BuildTrace do
subject { described_class.new(build: build, stream: stream, state: state) }
- shared_examples 'delegates methods' do
+ describe 'delegated methods' do
it { is_expected.to delegate_method(:state).to(:trace) }
it { is_expected.to delegate_method(:append).to(:trace) }
it { is_expected.to delegate_method(:truncated).to(:trace) }
@@ -25,7 +25,25 @@ RSpec.describe Ci::BuildTrace do
it { is_expected.to delegate_method(:complete?).to(:build).with_prefix }
end
- it_behaves_like 'delegates methods'
+ describe 'FF sign_and_verify_ansi2json_state' do
+ before do
+ stub_feature_flags(sign_and_verify_ansi2json_state: false)
+ end
+
+ it 'calls convert with verify_state: true when enabled for project' do
+ build.project = create(:project)
+ stub_feature_flags(sign_and_verify_ansi2json_state: build.project)
+
+ expect(Gitlab::Ci::Ansi2json).to receive(:convert).with(stream.stream, state, verify_state: true)
+
+ described_class.new(build: build, stream: stream, state: state)
+ end
+
+ it 'calls convert with verify_state: false when disabled' do
+ expect(Gitlab::Ci::Ansi2json).to receive(:convert).with(stream.stream, state, verify_state: false)
+ described_class.new(build: build, stream: stream, state: state)
+ end
+ end
it 'returns formatted trace' do
expect(subject.lines).to eq(
diff --git a/spec/models/resource_milestone_event_spec.rb b/spec/models/resource_milestone_event_spec.rb
index d237a16da8f..80351862fc1 100644
--- a/spec/models/resource_milestone_event_spec.rb
+++ b/spec/models/resource_milestone_event_spec.rb
@@ -18,6 +18,24 @@ RSpec.describe ResourceMilestoneEvent, feature_category: :team_planning, type: :
it { is_expected.to belong_to(:milestone) }
end
+ describe 'scopes' do
+ describe '.aliased_for_timebox_report', :freeze_time do
+ let!(:event) { create(:resource_milestone_event, milestone: milestone) }
+
+ let(:milestone) { create(:milestone) }
+ let(:scope) { described_class.aliased_for_timebox_report.first }
+
+ it 'returns correct values with aliased names', :aggregate_failures do
+ expect(scope.event_type).to eq('timebox')
+ expect(scope.id).to eq(event.id)
+ expect(scope.issue_id).to eq(event.issue_id)
+ expect(scope.value).to eq(milestone.id)
+ expect(scope.action).to eq(event.action)
+ expect(scope.created_at).to eq(event.created_at)
+ end
+ end
+ end
+
describe '#milestone_title' do
let(:milestone) { create(:milestone, title: 'v2.3') }
let(:event) { create(:resource_milestone_event, milestone: milestone) }
diff --git a/spec/models/resource_state_event_spec.rb b/spec/models/resource_state_event_spec.rb
index a6d6b507b69..699720b564a 100644
--- a/spec/models/resource_state_event_spec.rb
+++ b/spec/models/resource_state_event_spec.rb
@@ -41,6 +41,23 @@ RSpec.describe ResourceStateEvent, feature_category: :team_planning, type: :mode
end
end
+ describe 'scopes' do
+ describe '.aliased_for_timebox_report', :freeze_time do
+ let!(:event) { create(:resource_state_event, issue: issue) }
+
+ let(:scope) { described_class.aliased_for_timebox_report.first }
+
+ it 'returns correct values with aliased names', :aggregate_failures do
+ expect(scope.event_type).to eq('state')
+ expect(scope.id).to eq(event.id)
+ expect(scope.issue_id).to eq(event.issue_id)
+ expect(scope.value).to eq(issue.state_id)
+ expect(scope.action).to eq(nil)
+ expect(scope.created_at).to eq(event.created_at)
+ end
+ end
+ end
+
context 'callbacks' do
describe '#issue_usage_metrics' do
describe 'when an issue is closed' do
diff --git a/spec/requests/api/import_github_spec.rb b/spec/requests/api/import_github_spec.rb
index 0d75bb94144..9b5ae72526c 100644
--- a/spec/requests/api/import_github_spec.rb
+++ b/spec/requests/api/import_github_spec.rb
@@ -174,72 +174,54 @@ RSpec.describe API::ImportGithub, feature_category: :importers do
let_it_be(:user) { create(:user) }
let(:params) { { personal_access_token: token } }
- context 'when feature github_import_gists is enabled' do
+ context 'when gists import was started' do
before do
- stub_feature_flags(github_import_gists: true)
+ allow(Import::Github::GistsImportService)
+ .to receive(:new).with(user, client, access_params)
+ .and_return(double(execute: { status: :success }))
end
- context 'when gists import was started' do
- before do
- allow(Import::Github::GistsImportService)
- .to receive(:new).with(user, client, access_params)
- .and_return(double(execute: { status: :success }))
- end
-
- it 'returns 202' do
- post api('/import/github/gists', user), params: params
+ it 'returns 202' do
+ post api('/import/github/gists', user), params: params
- expect(response).to have_gitlab_http_status(:accepted)
- end
+ expect(response).to have_gitlab_http_status(:accepted)
end
+ end
- context 'when gists import is in progress' do
- before do
- allow(Import::Github::GistsImportService)
- .to receive(:new).with(user, client, access_params)
- .and_return(double(execute: { status: :error, message: 'Import already in progress', http_status: :unprocessable_entity }))
- end
-
- it 'returns 422 error' do
- post api('/import/github/gists', user), params: params
-
- expect(response).to have_gitlab_http_status(:unprocessable_entity)
- expect(json_response['errors']).to eq('Import already in progress')
- end
+ context 'when gists import is in progress' do
+ before do
+ allow(Import::Github::GistsImportService)
+ .to receive(:new).with(user, client, access_params)
+ .and_return(double(execute: { status: :error, message: 'Import already in progress', http_status: :unprocessable_entity }))
end
- context 'when unauthenticated user' do
- it 'returns 403 error' do
- post api('/import/github/gists'), params: params
+ it 'returns 422 error' do
+ post api('/import/github/gists', user), params: params
- expect(response).to have_gitlab_http_status(:unauthorized)
- end
+ expect(response).to have_gitlab_http_status(:unprocessable_entity)
+ expect(json_response['errors']).to eq('Import already in progress')
end
+ end
- context 'when rate limit reached' do
- before do
- allow(Import::Github::GistsImportService)
- .to receive(:new).with(user, client, access_params)
- .and_raise(Gitlab::GithubImport::RateLimitError)
- end
-
- it 'returns 429 error' do
- post api('/import/github/gists', user), params: params
+ context 'when unauthenticated user' do
+ it 'returns 403 error' do
+ post api('/import/github/gists'), params: params
- expect(response).to have_gitlab_http_status(:too_many_requests)
- end
+ expect(response).to have_gitlab_http_status(:unauthorized)
end
end
- context 'when feature github_import_gists is disabled' do
+ context 'when rate limit reached' do
before do
- stub_feature_flags(github_import_gists: false)
+ allow(Import::Github::GistsImportService)
+ .to receive(:new).with(user, client, access_params)
+ .and_raise(Gitlab::GithubImport::RateLimitError)
end
- it 'returns 404 error' do
+ it 'returns 429 error' do
post api('/import/github/gists', user), params: params
- expect(response).to have_gitlab_http_status(:not_found)
+ expect(response).to have_gitlab_http_status(:too_many_requests)
end
end
end
diff --git a/spec/tooling/lib/tooling/mappings/js_to_system_specs_mappings_spec.rb b/spec/tooling/lib/tooling/mappings/js_to_system_specs_mappings_spec.rb
index 156d656e0a1..c36d14cd267 100644
--- a/spec/tooling/lib/tooling/mappings/js_to_system_specs_mappings_spec.rb
+++ b/spec/tooling/lib/tooling/mappings/js_to_system_specs_mappings_spec.rb
@@ -181,6 +181,30 @@ RSpec.describe Tooling::Mappings::JsToSystemSpecsMappings, feature_category: :to
instance.system_specs_for_edition(edition)
end
+ let(:edition) { nil }
+
+ context 'when a file is not a ruby spec' do
+ before do
+ File.write("#{system_specs_base_folder}/issues_spec.tar.gz", "a test")
+ end
+
+ it 'does not return that file' do
+ expect(subject).to be_empty
+ end
+ end
+
+ context 'when a file is a ruby spec' do
+ let(:spec_pathname) { "#{system_specs_base_folder}/issues_spec.rb" }
+
+ before do
+ File.write(spec_pathname, "a test")
+ end
+
+ it 'returns that file' do
+ expect(subject).to match_array(spec_pathname)
+ end
+ end
+
context 'when FOSS' do
let(:edition) { nil }
diff --git a/tests.yml b/tests.yml
index 2bfb5a8c1a8..f6908a03a8b 100644
--- a/tests.yml
+++ b/tests.yml
@@ -108,3 +108,7 @@ mapping:
test: spec/db/docs_spec.rb
- source: config/feature_categories.yml
test: ee/spec/lib/ee/gitlab/database/docs/docs_spec.rb
+
+ # See https://gitlab.com/gitlab-org/quality/engineering-productivity/master-broken-incidents/-/issues/1360
+ - source: vendor/project_templates/.*
+ test: spec/lib/gitlab/project_template_spec.rb
diff --git a/tooling/lib/tooling/mappings/js_to_system_specs_mappings.rb b/tooling/lib/tooling/mappings/js_to_system_specs_mappings.rb
index f0fb5293a68..0c61b921f83 100644
--- a/tooling/lib/tooling/mappings/js_to_system_specs_mappings.rb
+++ b/tooling/lib/tooling/mappings/js_to_system_specs_mappings.rb
@@ -61,7 +61,7 @@ module Tooling
def system_specs_for_edition(edition)
all_files_in_folders_glob = File.join(@system_specs_base_folder, '**', '*')
all_files_in_folders_glob = File.join(edition, all_files_in_folders_glob) if edition
- Dir[all_files_in_folders_glob].select { |f| File.file?(f) }
+ Dir[all_files_in_folders_glob].select { |f| File.file?(f) && f.end_with?('_spec.rb') }
end
private