Add latest changes from gitlab-org/gitlab@master

This commit is contained in:
GitLab Bot 2025-01-15 15:34:39 +00:00
parent a84dd7b588
commit fea53f4bc5
73 changed files with 628 additions and 191 deletions

View File

@ -2,26 +2,6 @@
# Cop supports --autocorrect.
Layout/SpaceInsideParens:
Exclude:
- 'spec/lib/gitlab/auth/o_auth/auth_hash_spec.rb'
- 'spec/lib/gitlab/database/migrations/runner_spec.rb'
- 'spec/lib/gitlab/database/reindexing/reindex_concurrently_spec.rb'
- 'spec/lib/gitlab/diff/highlight_cache_spec.rb'
- 'spec/lib/gitlab/exclusive_lease_helpers_spec.rb'
- 'spec/lib/gitlab/git/blob_spec.rb'
- 'spec/lib/gitlab/git/commit_spec.rb'
- 'spec/lib/gitlab/git/diff_spec.rb'
- 'spec/lib/gitlab/git/repository_spec.rb'
- 'spec/lib/gitlab/usage/metrics/instrumentations/generic_metric_spec.rb'
- 'spec/lib/gitlab/usage_data_spec.rb'
- 'spec/lib/gitlab/utils/delegator_override/validator_spec.rb'
- 'spec/lib/gitlab/utils/usage_data_spec.rb'
- 'spec/lib/gitlab/x509/commit_spec.rb'
- 'spec/lib/security/ci_configuration/container_scanning_build_action_spec.rb'
- 'spec/lib/security/ci_configuration/sast_build_action_spec.rb'
- 'spec/lib/security/ci_configuration/sast_iac_build_action_spec.rb'
- 'spec/lib/security/ci_configuration/secret_detection_build_action_spec.rb'
- 'spec/models/ml/candidate_metric_spec.rb'
- 'spec/models/ml/candidate_spec.rb'
- 'spec/policies/clusters/agent_policy_spec.rb'
- 'spec/presenters/ci/build_presenter_spec.rb'
- 'spec/presenters/packages/conan/package_presenter_spec.rb'

View File

@ -36,6 +36,10 @@ else
end
gem 'activerecord-gitlab', path: 'gems/activerecord-gitlab', feature_category: :shared
# This can be dropped after upgrading to Rails 7.2: https://github.com/rails/rails/pull/49674
gem 'mutex_m', '~> 0.3', feature_category: :shared
# Need by Rails
gem 'drb', '~> 2.2', feature_category: :shared
gem 'bootsnap', '~> 1.18.3', require: false, feature_category: :shared

View File

@ -132,6 +132,7 @@
{"name":"doorkeeper-device_authorization_grant","version":"1.0.3","platform":"ruby","checksum":"94c3ac12a0d50942850ecd58ed64298b397a5e903e8880cb68d4085600932679"},
{"name":"doorkeeper-openid_connect","version":"1.8.10","platform":"ruby","checksum":"b28efaa9b52cbe9aca4efc825a7ef63cc950ae6a96f4a72ed8362f278a453742"},
{"name":"dotenv","version":"2.7.6","platform":"ruby","checksum":"2451ed5e8e43776d7a787e51d6f8903b98e446146c7ad143d5678cc2c409d547"},
{"name":"drb","version":"2.2.1","platform":"ruby","checksum":"e9d472bf785f558b96b25358bae115646da0dbfd45107ad858b0bc0d935cb340"},
{"name":"dry-cli","version":"1.0.0","platform":"ruby","checksum":"28ead169f872954dd08910eb8ead59cf86cd18b4aab321e8eeefe945749569f0"},
{"name":"dry-core","version":"1.0.1","platform":"ruby","checksum":"f32f4245e0f54e787f3708584ed8f7545aaf8dd99072e36f169312468ec5450d"},
{"name":"dry-inflector","version":"1.0.0","platform":"ruby","checksum":"6ad22361ca2d6f3f001ae3037ffcfea01163f644280d13a9195d3c3a94dd1626"},
@ -409,6 +410,7 @@
{"name":"murmurhash3","version":"0.1.7","platform":"ruby","checksum":"370a2ce2e9ab0711e51554e530b5f63956927a6554a296855f42a1a4a5ed0936"},
{"name":"mustermann","version":"3.0.0","platform":"ruby","checksum":"6d3569aa3c3b2f048c60626f48d9b2d561cc8d2ef269296943b03da181c08b67"},
{"name":"mustermann-grape","version":"1.0.2","platform":"ruby","checksum":"6f5309d6a338f801f211c644e8c2d3cc2577a8693f9cd51dadfdb29c1260f5fe"},
{"name":"mutex_m","version":"0.3.0","platform":"ruby","checksum":"cfcb04ac16b69c4813777022fdceda24e9f798e48092a2b817eb4c0a782b0751"},
{"name":"nap","version":"1.1.0","platform":"ruby","checksum":"949691660f9d041d75be611bb2a8d2fd559c467537deac241f4097d9b5eea576"},
{"name":"neighbor","version":"0.3.2","platform":"ruby","checksum":"b795bbcc24b1b9ae82d9f7e97a3461b0b3607d24a85a7acbed776bd498e7eba8"},
{"name":"nenv","version":"0.3.0","platform":"ruby","checksum":"d9de6d8fb7072228463bf61843159419c969edb34b3cef51832b516ae7972765"},
@ -459,6 +461,7 @@
{"name":"omniauth_openid_connect","version":"0.8.0","platform":"ruby","checksum":"1f2f3890386e2a742221cee0d2e903b78d874e6fab9ea3bfa31c1462f4793d25"},
{"name":"open4","version":"1.3.4","platform":"ruby","checksum":"a1df037310624ecc1ea1d81264b11c83e96d0c3c1c6043108d37d396dcd0f4b1"},
{"name":"openid_connect","version":"2.3.0","platform":"ruby","checksum":"0dbb9cefeb11e0a65e706349266355bbbb060382ae138fc9e199ab1aa622744c"},
{"name":"opensearch-ruby","version":"3.4.0","platform":"ruby","checksum":"0a8621686bed3c59b4c23e08cbaef873685a3fe4568e9d2703155ca92b8ca05d"},
{"name":"openssl","version":"3.2.0","platform":"java","checksum":"9a1c870b4175ee90bcd233b5041a5ca8072f5f5f06d404ab3c786aa31daffa02"},
{"name":"openssl","version":"3.2.0","platform":"ruby","checksum":"3c4bb8760977b4becd2819c6c2569bcf5c6f48b32b9f7a4ce1fd37f996378d14"},
{"name":"openssl-signature_algorithm","version":"1.3.0","platform":"ruby","checksum":"a3b40b5e8276162d4a6e50c7c97cdaf1446f9b2c3946a6fa2c14628e0c957e80"},

View File

@ -30,6 +30,7 @@ PATH
activesupport
connection_pool
elasticsearch
opensearch-ruby
pg
zeitwerk
@ -113,7 +114,7 @@ PATH
grpc (= 1.63.0)
grpc-tools (= 1.63.0)
parallel (~> 1.22)
re2 (~> 2.4)
re2 (~> 2.7)
toml-rb (~> 2.2)
PATH
@ -155,7 +156,7 @@ PATH
specs:
cloud_profiler_agent (0.0.1.pre)
google-cloud-profiler-v2 (~> 0.3)
google-protobuf (~> 3.13)
google-protobuf (~> 3.25)
googleauth (>= 0.14)
stackprof (~> 0.2)
@ -556,6 +557,7 @@ GEM
doorkeeper (>= 5.5, < 5.9)
jwt (>= 2.5)
dotenv (2.7.6)
drb (2.2.1)
dry-cli (1.0.0)
dry-core (1.0.1)
concurrent-ruby (~> 1.0)
@ -1184,6 +1186,7 @@ GEM
ruby2_keywords (~> 0.0.1)
mustermann-grape (1.0.2)
mustermann (>= 1.0.0)
mutex_m (0.3.0)
nap (1.1.0)
neighbor (0.3.2)
activerecord (>= 6.1)
@ -1293,6 +1296,9 @@ GEM
tzinfo
validate_url
webfinger (~> 2.0)
opensearch-ruby (3.4.0)
faraday (>= 1.0, < 3)
multi_json (>= 1.0)
openssl (3.2.0)
openssl-signature_algorithm (1.3.0)
openssl (> 2.0)
@ -2048,6 +2054,7 @@ DEPENDENCIES
doorkeeper (~> 5.8, >= 5.8.1)
doorkeeper-device_authorization_grant (~> 1.0.0)
doorkeeper-openid_connect (~> 1.8.10)
drb (~> 2.2)
duo_api (~> 1.3)
ed25519 (~> 1.3.0)
elasticsearch-api (= 7.17.11)
@ -2185,6 +2192,7 @@ DEPENDENCIES
mini_magick (~> 4.12)
minitest (~> 5.11.0)
multi_json (~> 1.14.1)
mutex_m (~> 0.3)
neighbor (~> 0.3.2)
net-http (= 0.6.0)
net-ldap (~> 0.17.1)

View File

@ -464,6 +464,7 @@
{"name":"omniauth_openid_connect","version":"0.8.0","platform":"ruby","checksum":"1f2f3890386e2a742221cee0d2e903b78d874e6fab9ea3bfa31c1462f4793d25"},
{"name":"open4","version":"1.3.4","platform":"ruby","checksum":"a1df037310624ecc1ea1d81264b11c83e96d0c3c1c6043108d37d396dcd0f4b1"},
{"name":"openid_connect","version":"2.3.0","platform":"ruby","checksum":"0dbb9cefeb11e0a65e706349266355bbbb060382ae138fc9e199ab1aa622744c"},
{"name":"opensearch-ruby","version":"3.4.0","platform":"ruby","checksum":"0a8621686bed3c59b4c23e08cbaef873685a3fe4568e9d2703155ca92b8ca05d"},
{"name":"openssl","version":"3.2.0","platform":"java","checksum":"9a1c870b4175ee90bcd233b5041a5ca8072f5f5f06d404ab3c786aa31daffa02"},
{"name":"openssl","version":"3.2.0","platform":"ruby","checksum":"3c4bb8760977b4becd2819c6c2569bcf5c6f48b32b9f7a4ce1fd37f996378d14"},
{"name":"openssl-signature_algorithm","version":"1.3.0","platform":"ruby","checksum":"a3b40b5e8276162d4a6e50c7c97cdaf1446f9b2c3946a6fa2c14628e0c957e80"},

View File

@ -30,6 +30,7 @@ PATH
activesupport
connection_pool
elasticsearch
opensearch-ruby
pg
zeitwerk
@ -113,7 +114,7 @@ PATH
grpc (= 1.63.0)
grpc-tools (= 1.63.0)
parallel (~> 1.22)
re2 (~> 2.4)
re2 (~> 2.7)
toml-rb (~> 2.2)
PATH
@ -155,7 +156,7 @@ PATH
specs:
cloud_profiler_agent (0.0.1.pre)
google-cloud-profiler-v2 (~> 0.3)
google-protobuf (~> 3.13)
google-protobuf (~> 3.25)
googleauth (>= 0.14)
stackprof (~> 0.2)
@ -1311,6 +1312,9 @@ GEM
tzinfo
validate_url
webfinger (~> 2.0)
opensearch-ruby (3.4.0)
faraday (>= 1.0, < 3)
multi_json (>= 1.0)
openssl (3.2.0)
openssl-signature_algorithm (1.3.0)
openssl (> 2.0)
@ -2081,6 +2085,7 @@ DEPENDENCIES
doorkeeper (~> 5.8, >= 5.8.1)
doorkeeper-device_authorization_grant (~> 1.0.0)
doorkeeper-openid_connect (~> 1.8.10)
drb (~> 2.2)
duo_api (~> 1.3)
ed25519 (~> 1.3.0)
elasticsearch-api (= 7.17.11)
@ -2218,6 +2223,7 @@ DEPENDENCIES
mini_magick (~> 4.12)
minitest (~> 5.11.0)
multi_json (~> 1.14.1)
mutex_m (~> 0.3)
neighbor (~> 0.3.2)
net-http (= 0.6.0)
net-ldap (~> 0.17.1)

View File

@ -118,6 +118,7 @@ export default {
@workItemCreated="workItemCreated"
/>
<create-work-item-cancel-confirmation-modal
v-if="workItemType"
:is-visible="isCancelConfirmationModalVisible"
:work-item-type-name="workItemType"
@continueEditing="handleContinueEditing"

View File

@ -18,5 +18,6 @@ tiers:
- ultimate
performance_indicator_type:
- customer_health_score
- leading_indicator
milestone: "12.9"
introduced_by_url: "https://gitlab.com/gitlab-org/gitlab/-/merge_requests/26441"

View File

@ -18,5 +18,6 @@ tiers:
- ultimate
performance_indicator_type:
- customer_health_score
- leading_indicator
milestone: "12.9"
introduced_by_url: "https://gitlab.com/gitlab-org/gitlab/-/merge_requests/26441"

View File

@ -21,5 +21,6 @@ performance_indicator_type:
- gmau
- paid_gmau
- customer_health_score
- lighthouse
milestone: "12.9"
introduced_by_url: "https://gitlab.com/gitlab-org/gitlab/-/merge_requests/26441"

View File

@ -22,5 +22,6 @@ tiers:
- ultimate
performance_indicator_type:
- customer_health_score
- leading_indicator
milestone: "<13.9"
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/54332

View File

@ -2,7 +2,8 @@
key_path: redis_hll_counters.count_distinct_project_id_from_create_ci_internal_pipeline_monthly
description: Monthly count of unique projects where an internal CI pipeline was created
product_group: pipeline_execution
performance_indicator_type: []
performance_indicator_type:
- leading_indicator
value_type: number
status: active
milestone: '17.4'

View File

@ -2,7 +2,8 @@
key_path: counts.count_total_commit_change_to_ciconfigfile_monthly
description: Monthly count of commits that include a change to the CI config file.
product_group: pipeline_authoring
performance_indicator_type: []
performance_indicator_type:
- leading_indicator
value_type: number
status: active
milestone: '17.5'

View File

@ -2,7 +2,8 @@
key_path: counts.count_total_create_ci_build_monthly
description: Monthly count of ci builds created across all projects and project types
product_group: pipeline_execution
performance_indicator_type: []
performance_indicator_type:
- lighthouse
value_type: number
status: active
milestone: '16.9'

View File

@ -18,5 +18,6 @@ tiers:
- ultimate
performance_indicator_type:
- customer_health_score
- leading_indicator
milestone: "<13.9"
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/54332

View File

@ -18,5 +18,6 @@ tiers:
- ultimate
performance_indicator_type:
- customer_health_score
- leading_indicator
milestone: "<13.9"
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/54332

View File

@ -11,6 +11,7 @@ time_frame: all
data_source: database
performance_indicator_type:
- customer_health_score
- leading_indicator
distribution:
- ce
- ee

View File

@ -11,6 +11,7 @@ time_frame: all
data_source: database
performance_indicator_type:
- customer_health_score
- leading_indicator
distribution:
- ce
- ee

View File

@ -8,14 +8,6 @@ description: Keeps relation between approval group rules and protected branches.
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/132651
milestone: '16.5'
gitlab_schema: gitlab_main_cell
desired_sharding_key:
group_id:
references: namespaces
backfill_via:
parent:
foreign_key: approval_group_rule_id
table: approval_group_rules
sharding_key: group_id
belongs_to: approval_group_rule
desired_sharding_key_migration_job_name: BackfillApprovalGroupRulesProtectedBranchesGroupId
table_size: small
sharding_key:
group_id: namespaces

View File

@ -8,14 +8,6 @@ description: Represents a HTTP header sent with streaming audit events
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/88063
milestone: '15.1'
gitlab_schema: gitlab_main_cell
desired_sharding_key:
group_id:
references: namespaces
backfill_via:
parent:
foreign_key: external_audit_event_destination_id
table: audit_events_external_audit_event_destinations
sharding_key: namespace_id
belongs_to: external_audit_event_destination
desired_sharding_key_migration_job_name: BackfillAuditEventsStreamingHeadersGroupId
table_size: small
sharding_key:
group_id: namespaces

View File

@ -2,7 +2,7 @@
migration_job_name: BackfillPCiPipelinesTriggerId
description: Backfill p_ci_pipelines.trigger_id by going through ci_trigger_requests
feature_category: continuous_integration
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/174132
milestone: '17.7'
queued_migration_version: 20241204050830
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/176645
milestone: '17.9'
queued_migration_version: 20250114055621
finalized_by: # version of the migration that finalized this BBM

View File

@ -9,14 +9,6 @@ description: The epic_ids used to create swimlanes on issue boards; stored per u
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/40360
milestone: '13.4'
gitlab_schema: gitlab_main_cell
desired_sharding_key:
group_id:
references: namespaces
backfill_via:
parent:
foreign_key: epic_id
table: epics
sharding_key: group_id
belongs_to: epic
desired_sharding_key_migration_job_name: BackfillBoardsEpicUserPreferencesGroupId
sharding_key:
group_id: namespaces
table_size: small

View File

@ -9,14 +9,6 @@ description: Stores additional information for vulnerabilities, for example if a
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/65573
milestone: '14.1'
gitlab_schema: gitlab_sec
desired_sharding_key:
project_id:
references: projects
backfill_via:
parent:
foreign_key: vulnerability_occurrence_id
table: vulnerability_occurrences
sharding_key: project_id
belongs_to: finding
desired_sharding_key_migration_job_name: BackfillVulnerabilityFlagsProjectId
table_size: small
sharding_key:
project_id: projects

View File

@ -0,0 +1,14 @@
# frozen_string_literal: true
class AddBoardsEpicUserPreferencesGroupIdNotNullConstraint < Gitlab::Database::Migration[2.2]
disable_ddl_transaction!
milestone '17.9'
def up
add_not_null_constraint :boards_epic_user_preferences, :group_id
end
def down
remove_not_null_constraint :boards_epic_user_preferences, :group_id
end
end

View File

@ -0,0 +1,14 @@
# frozen_string_literal: true
class AddVulnerabilityFlagsProjectIdNotNullConstraint < Gitlab::Database::Migration[2.2]
disable_ddl_transaction!
milestone '17.9'
def up
add_not_null_constraint :vulnerability_flags, :project_id
end
def down
remove_not_null_constraint :vulnerability_flags, :project_id
end
end

View File

@ -0,0 +1,14 @@
# frozen_string_literal: true
class AddAuditEventsStreamingHeadersGroupIdNotNullConstraint < Gitlab::Database::Migration[2.2]
disable_ddl_transaction!
milestone '17.9'
def up
add_not_null_constraint :audit_events_streaming_headers, :group_id
end
def down
remove_not_null_constraint :audit_events_streaming_headers, :group_id
end
end

View File

@ -0,0 +1,14 @@
# frozen_string_literal: true
class AddApprovalGroupRulesProtectedBranchesGroupIdNotNullConstraint < Gitlab::Database::Migration[2.2]
disable_ddl_transaction!
milestone '17.9'
def up
add_not_null_constraint :approval_group_rules_protected_branches, :group_id
end
def down
remove_not_null_constraint :approval_group_rules_protected_branches, :group_id
end
end

View File

@ -0,0 +1,23 @@
# frozen_string_literal: true
class RequeueBackfillPCiPipelinesTriggerId < Gitlab::Database::Migration[2.2]
milestone '17.9'
restrict_gitlab_migration gitlab_schema: :gitlab_ci
TABLE = :ci_trigger_requests
PRIMARY_KEY = :id
MIGRATION = "BackfillPCiPipelinesTriggerId"
DELAY_INTERVAL = 2.minutes
def up
queue_batched_background_migration(
MIGRATION, TABLE, PRIMARY_KEY, job_interval: DELAY_INTERVAL
)
end
def down
delete_batched_background_migration(
MIGRATION, TABLE, PRIMARY_KEY, []
)
end
end

View File

@ -0,0 +1 @@
624dc954c3c95cf95a59026f4bfb6b34d34fbce31e4ad5831f8c91df81ee1ffe

View File

@ -0,0 +1 @@
625d27f1baffa7995025d5236d98c756f3d9e11882bced2cdb95c4d759f7454e

View File

@ -0,0 +1 @@
5bff0b26958dc54f6a49b5d669d0bc439334241e221c34afc7b0d155becc857e

View File

@ -0,0 +1 @@
409f8f38fd95d3a17b352a48b671eba4a4db060094687db224751109e89207e9

View File

@ -0,0 +1 @@
d9384ac8c88a646af88d1d67fe079c875c2dbdccd4dd98ce0b94a1c9bb8c4fe1

View File

@ -8086,7 +8086,8 @@ CREATE TABLE approval_group_rules_protected_branches (
id bigint NOT NULL,
approval_group_rule_id bigint NOT NULL,
protected_branch_id bigint NOT NULL,
group_id bigint
group_id bigint,
CONSTRAINT check_b14ec67f68 CHECK ((group_id IS NOT NULL))
);
CREATE SEQUENCE approval_group_rules_protected_branches_id_seq
@ -8689,6 +8690,7 @@ CREATE TABLE audit_events_streaming_headers (
value text NOT NULL,
active boolean DEFAULT true NOT NULL,
group_id bigint,
CONSTRAINT check_3feba4e364 CHECK ((group_id IS NOT NULL)),
CONSTRAINT check_53c3152034 CHECK ((char_length(key) <= 255)),
CONSTRAINT check_ac213cca22 CHECK ((char_length(value) <= 255))
);
@ -9206,7 +9208,8 @@ CREATE TABLE boards_epic_user_preferences (
user_id bigint NOT NULL,
epic_id bigint NOT NULL,
collapsed boolean DEFAULT false NOT NULL,
group_id bigint
group_id bigint,
CONSTRAINT check_e23d7636e9 CHECK ((group_id IS NOT NULL))
);
CREATE SEQUENCE boards_epic_user_preferences_id_seq
@ -22556,6 +22559,7 @@ CREATE TABLE vulnerability_flags (
origin text NOT NULL,
description text NOT NULL,
project_id bigint,
CONSTRAINT check_36177ddefa CHECK ((project_id IS NOT NULL)),
CONSTRAINT check_45e743349f CHECK ((char_length(description) <= 1024)),
CONSTRAINT check_49c1d00032 CHECK ((char_length(origin) <= 255))
);

View File

@ -372,3 +372,12 @@ deploy-pages:
The `FF_USE_FASTZIP` variable enables the [feature flag](https://docs.gitlab.com/runner/configuration/feature-flags.html#available-feature-flags) which is needed for [`ARTIFACT_COMPRESSION_LEVEL`](../../../ci/runners/configure_runners.md#artifact-and-cache-settings).
The previous YAML example uses [user-defined job names](index.md#user-defined-job-names).
### `401` error when accessing private GitLab Pages sites in multiple browser tabs
When you try to access a private Pages URL in two different tabs simultaneously without prior authentication,
two different `state` values are returned for each tab.
However, in the Pages session, only the most recent `state` value is stored for the given client.
As a result, after submitting credentials, one of the tabs returns a `401 Unauthorized` error.
To resolve the `401` error, refresh the page.

View File

@ -5,6 +5,7 @@ PATH
activesupport
connection_pool
elasticsearch
opensearch-ruby
pg
zeitwerk
@ -43,6 +44,15 @@ GEM
addressable (2.8.7)
public_suffix (>= 2.0.2, < 7.0)
ast (2.4.2)
aws-eventstream (1.3.0)
aws-partitions (1.1001.0)
aws-sdk-core (3.214.0)
aws-eventstream (~> 1, >= 1.3.0)
aws-partitions (~> 1, >= 1.992.0)
aws-sigv4 (~> 1.9)
jmespath (~> 1, >= 1.6.1)
aws-sigv4 (1.9.1)
aws-eventstream (~> 1, >= 1.0.2)
base64 (0.2.0)
benchmark (0.4.0)
bigdecimal (3.1.8)
@ -73,6 +83,9 @@ GEM
logger
faraday-net_http (3.4.0)
net-http (>= 0.5.0)
faraday_middleware-aws-sigv4 (1.0.1)
aws-sigv4 (~> 1.0)
faraday (>= 2.0, < 3)
gitlab-styles (13.0.2)
rubocop (~> 1.68.0)
rubocop-capybara (~> 2.21.0)
@ -89,6 +102,7 @@ GEM
irb (1.14.1)
rdoc (>= 4.0.0)
reline (>= 0.4.2)
jmespath (1.6.2)
json (2.9.0)
language_server-protocol (3.17.0.3)
logger (1.6.2)
@ -105,6 +119,9 @@ GEM
racc (~> 1.4)
nokogiri (1.17.1-arm64-darwin)
racc (~> 1.4)
opensearch-ruby (3.4.0)
faraday (>= 1.0, < 3)
multi_json (>= 1.0)
parallel (1.26.3)
parser (3.3.6.0)
ast (~> 2.4.1)
@ -218,7 +235,9 @@ PLATFORMS
DEPENDENCIES
activesupport
aws-sdk-core
byebug
faraday_middleware-aws-sigv4
gitlab-active-context!
gitlab-styles
rake (~> 13.0)

View File

@ -22,9 +22,12 @@ Gem::Specification.new do |spec|
spec.add_dependency 'activesupport'
spec.add_dependency 'connection_pool'
spec.add_dependency 'elasticsearch'
spec.add_dependency 'opensearch-ruby'
spec.add_dependency 'pg'
spec.add_dependency 'zeitwerk'
spec.add_development_dependency 'aws-sdk-core'
spec.add_development_dependency 'faraday_middleware-aws-sigv4'
spec.add_development_dependency 'gitlab-styles'
spec.add_development_dependency 'rspec-rails'
spec.add_development_dependency 'rubocop-rspec'

View File

@ -0,0 +1,15 @@
# frozen_string_literal: true
module ActiveContext
module Databases
module Opensearch
class Adapter
include ActiveContext::Databases::Concerns::Adapter
def client_klass
ActiveContext::Databases::Opensearch::Client
end
end
end
end
end

View File

@ -0,0 +1,67 @@
# frozen_string_literal: true
require 'opensearch'
require 'faraday_middleware/aws_sigv4'
module ActiveContext
module Databases
module Opensearch
class Client
include ActiveContext::Databases::Concerns::Client
OPEN_TIMEOUT = 5
NO_RETRY = 0
def initialize(options)
@options = options
end
def search(_query)
res = client.search
QueryResult.new(res)
end
def client
::OpenSearch::Client.new(opensearch_config) do |fmid|
next unless options[:aws]
fmid.request(
:aws_sigv4,
credentials_provider: aws_credentials,
service: 'es',
region: options[:aws_region]
)
end
end
def aws_credentials
static_credentials = ::Aws::Credentials.new(options[:aws_access_key], options[:aws_secret_access_key])
return static_credentials if static_credentials&.set?
aws_credential_provider = ::Aws::CredentialProviderChain.new.resolve
aws_credential_provider if aws_credential_provider&.set?
end
private
def opensearch_config
{
adapter: :net_http,
urls: options[:url],
transport_options: {
request: {
timeout: options[:client_request_timeout],
open_timeout: OPEN_TIMEOUT
}
},
randomize_hosts: true,
retry_on_failure: options[:retry_on_failure] || NO_RETRY,
log: options[:debug],
debug: options[:debug]
}.compact
end
end
end
end
end

View File

@ -0,0 +1,31 @@
# frozen_string_literal: true
module ActiveContext
module Databases
module Opensearch
class QueryResult
include ActiveContext::Databases::Concerns::QueryResult
def initialize(result)
@result = result
end
def count
result['hits']['total']['value']
end
def each
return enum_for(:each) unless block_given?
result['hits']['hits'].each do |hit|
yield hit['_source']
end
end
private
attr_reader :result
end
end
end
end

View File

@ -0,0 +1,14 @@
# frozen_string_literal: true
RSpec.describe ActiveContext::Databases::Opensearch::Adapter do
let(:options) { { url: 'http://localhost:9200' } }
subject(:adapter) { described_class.new(options) }
it 'delegates search to client' do
query = ActiveContext::Query.filter(foo: :bar)
expect(adapter.client).to receive(:search).with(query)
adapter.search(query)
end
end

View File

@ -0,0 +1,92 @@
# frozen_string_literal: true
RSpec.describe ActiveContext::Databases::Opensearch::Client do
let(:options) { { url: 'http://localhost:9200' } }
subject(:client) { described_class.new(options) }
describe '#search' do
let(:opensearch_client) { instance_double(OpenSearch::Client) }
let(:search_response) { { 'hits' => { 'total' => 5, 'hits' => [] } } }
before do
allow(client).to receive(:client).and_return(opensearch_client)
allow(opensearch_client).to receive(:search).and_return(search_response)
end
it 'calls search on the Opensearch client' do
expect(opensearch_client).to receive(:search)
client.search('query')
end
it 'returns a QueryResult object' do
result = client.search('query')
expect(result).to be_a(ActiveContext::Databases::Opensearch::QueryResult)
end
end
describe '#client' do
it 'returns an instance of OpenSearch::Client' do
expect(OpenSearch::Client).to receive(:new).with(client.send(:opensearch_config))
client.client
end
end
describe '#aws_credentials' do
context 'when static credentials are provided' do
let(:options) do
{
url: 'http://localhost:9200',
aws: true,
aws_access_key: 'access_key',
aws_secret_access_key: 'secret_key'
}
end
it 'returns static credentials' do
credentials = client.aws_credentials
expect(credentials).to be_a(Aws::Credentials)
expect(credentials.access_key_id).to eq('access_key')
expect(credentials.secret_access_key).to eq('secret_key')
end
end
context 'when static credentials are not provided' do
let(:options) { { url: 'http://localhost:9200', aws: true } }
let(:mock_provider) { instance_double(Aws::Credentials, set?: true) }
let(:mock_chain) { instance_double(Aws::CredentialProviderChain, resolve: mock_provider) }
before do
allow(Aws::CredentialProviderChain).to receive(:new).and_return(mock_chain)
end
it 'uses the AWS credential provider chain' do
expect(client.aws_credentials).to eq(mock_provider)
end
end
context 'when no valid credentials are found' do
let(:options) { { url: 'http://localhost:9200', aws: true } }
let(:mock_chain) { instance_double(Aws::CredentialProviderChain, resolve: nil) }
before do
allow(Aws::CredentialProviderChain).to receive(:new).and_return(mock_chain)
end
it 'returns nil' do
expect(client.aws_credentials).to be_nil
end
end
end
describe '#prefix' do
it 'returns default prefix when not specified' do
expect(client.prefix).to eq('gitlab_active_context')
end
it 'returns configured prefix' do
client = described_class.new(options.merge(prefix: 'custom'))
expect(client.prefix).to eq('custom')
end
end
end

View File

@ -0,0 +1,45 @@
# frozen_string_literal: true
RSpec.describe ActiveContext::Databases::Opensearch::QueryResult do
let(:elasticsearch_result) do
{
'hits' => {
'total' => { 'value' => 2 },
'hits' => [
{ '_source' => { 'id' => 1, 'name' => 'test1' } },
{ '_source' => { 'id' => 2, 'name' => 'test2' } }
]
}
}
end
subject(:query_result) { described_class.new(elasticsearch_result) }
describe '#count' do
it 'returns the total number of hits' do
expect(query_result.count).to eq(2)
end
end
describe '#each' do
it 'yields each hit source' do
expected_sources = [
{ 'id' => 1, 'name' => 'test1' },
{ 'id' => 2, 'name' => 'test2' }
]
expect { |b| query_result.each(&b) }.to yield_successive_args(*expected_sources)
end
it 'returns an enumerator when no block is given' do
expect(query_result.each).to be_a(Enumerator)
end
end
describe 'enumerable behavior' do
it 'implements Enumerable methods' do
expect(query_result.map { |hit| hit['id'] }).to eq([1, 2]) # rubocop: disable Rails/Pluck -- pluck not implemented
expect(query_result.select { |hit| hit['id'] == 1 }).to eq([{ 'id' => 1, 'name' => 'test1' }])
end
end
end

View File

@ -3,6 +3,8 @@
require "active_context"
require 'logger'
require 'elasticsearch'
require 'opensearch'
require 'aws-sdk-core'
RSpec.configure do |config|
# Enable flags like --only-failures and --next-failure

View File

@ -5,7 +5,7 @@ PATH
grpc (= 1.63.0)
grpc-tools (= 1.63.0)
parallel (~> 1.22)
re2 (~> 2.4)
re2 (~> 2.7)
toml-rb (~> 2.2)
GEM
@ -73,7 +73,7 @@ GEM
racc (1.7.3)
rack (3.1.8)
rainbow (3.1.1)
re2 (2.4.3)
re2 (2.10.0)
mini_portile2 (~> 2.8.5)
regexp_parser (2.8.2)
rexml (3.3.9)

View File

@ -27,7 +27,7 @@ Gem::Specification.new do |spec|
spec.add_runtime_dependency "grpc", "= 1.63.0"
spec.add_runtime_dependency "grpc-tools", "= 1.63.0"
spec.add_runtime_dependency "parallel", "~> 1.22"
spec.add_runtime_dependency "re2", "~> 2.4"
spec.add_runtime_dependency "re2", "~> 2.7"
spec.add_runtime_dependency "toml-rb", "~> 2.2"
spec.add_development_dependency "benchmark-malloc", "~> 0.2"

View File

@ -8,21 +8,46 @@ module Gitlab
def perform
each_sub_batch do |sub_batch|
sub_query =
sub_batch
.select('p_ci_builds.commit_id AS pipeline_id, p_ci_builds.partition_id, ci_trigger_requests.trigger_id')
.joins('INNER JOIN p_ci_builds ON p_ci_builds.id = ci_trigger_requests.commit_id')
.order(trigger_id: :asc)
connection.execute(<<~SQL)
UPDATE p_ci_pipelines
SET trigger_id = sub_trigger_query.trigger_id
FROM (#{sub_query.to_sql}) AS sub_trigger_query
WHERE p_ci_pipelines.id = sub_trigger_query.pipeline_id
AND p_ci_pipelines.partition_id = sub_trigger_query.partition_id
SQL
correct_existing_trigger_id_for(sub_batch)
backfill_trigger_id_from_commit_id(sub_batch)
end
end
private
def correct_existing_trigger_id_for(sub_batch)
prev_incorrect_sub_query =
sub_batch
.select('p_ci_builds.commit_id AS pipeline_id, p_ci_builds.partition_id')
.joins('INNER JOIN p_ci_builds ON p_ci_builds.id = ci_trigger_requests.commit_id')
connection.execute(<<~SQL)
UPDATE p_ci_pipelines
SET trigger_id = (
SELECT trigger_id
FROM ci_trigger_requests
WHERE commit_id = p_ci_pipelines.id
LIMIT 1
)
FROM (#{prev_incorrect_sub_query.to_sql}) AS sub_trigger_query
WHERE p_ci_pipelines.id = sub_trigger_query.pipeline_id
AND p_ci_pipelines.partition_id = sub_trigger_query.partition_id
SQL
end
def backfill_trigger_id_from_commit_id(sub_batch)
sub_query =
sub_batch
.select('commit_id AS pipeline_id, trigger_id')
.where.not(commit_id: nil)
connection.execute(<<~SQL)
UPDATE p_ci_pipelines
SET trigger_id = sub_trigger_query.trigger_id
FROM (#{sub_query.to_sql}) AS sub_trigger_query
WHERE p_ci_pipelines.id = sub_trigger_query.pipeline_id
SQL
end
end
end
end

View File

@ -15,10 +15,6 @@ module Gitlab
MergeRequestDiff.arel_table
end
def mr_diff_commits_table
MergeRequestDiffCommit.arel_table
end
def mr_closing_issues_table
MergeRequestsClosingIssues.arel_table
end

View File

@ -36,10 +36,27 @@ module QA
Support::Waiter.wait_until(sleep_interval: 0.5) do
page.has_content?("Username is available.")
network_password_requirements.each do |requirement|
page_has_success_requirement?(requirement) if page.has_content?(requirement, wait: 0.5)
end
end
click_element 'new-user-register-button' if has_element?('new-user-register-button')
end
private
def network_password_requirements
[
'Cannot use common phrases (e.g. "password")',
'Cannot include your name, username, or email'
]
end
def page_has_success_requirement?(requirement)
has_element?('password-rule-text', class: 'gl-text-success', text: requirement)
end
end
end
end

View File

@ -76,7 +76,7 @@ RSpec.describe Gitlab::Auth::OAuth::AuthHash, :aggregate_failures, feature_categ
end
it 'generates a temp email' do
expect( auth_hash.email).to start_with('temp-email-for-oauth')
expect(auth_hash.email).to start_with('temp-email-for-oauth')
end
end

View File

@ -2,9 +2,9 @@
require 'spec_helper'
RSpec.describe Gitlab::BackgroundMigration::BackfillPCiPipelinesTriggerId, quarantine: 'https://gitlab.com/gitlab-org/gitlab/-/issues/510352',
RSpec.describe Gitlab::BackgroundMigration::BackfillPCiPipelinesTriggerId,
migration: :gitlab_ci, feature_category: :continuous_integration do
let!(:migration) do
let(:migration) do
described_class.new(
batch_table: :ci_trigger_requests,
batch_column: :id,
@ -25,8 +25,8 @@ RSpec.describe Gitlab::BackgroundMigration::BackfillPCiPipelinesTriggerId, quara
let!(:trigger3) { ci_trigger.create!(owner_id: 1) }
let!(:trigger4) { ci_trigger.create!(owner_id: 1) }
let!(:pipeline1) { ci_pipeline.create!(partition_id: 100, project_id: 1) }
let!(:pipeline2) { ci_pipeline.create!(partition_id: 101, project_id: 1) }
let!(:pipeline3) { ci_pipeline.create!(partition_id: 102, project_id: 1) }
let!(:pipeline2) { ci_pipeline.create!(partition_id: 100, project_id: 1) }
let!(:pipeline3) { ci_pipeline.create!(partition_id: 100, project_id: 1) }
let!(:build1) { ci_build.create!(partition_id: pipeline1.partition_id, commit_id: pipeline1.id, project_id: 1) }
let!(:build11) { ci_build.create!(partition_id: pipeline1.partition_id, commit_id: pipeline1.id, project_id: 1) }
@ -37,11 +37,39 @@ RSpec.describe Gitlab::BackgroundMigration::BackfillPCiPipelinesTriggerId, quara
context 'when ci_trigger_requests belongs to only one pipeline' do
before do
ci_trigger_request.create!(commit_id: build1.id, trigger_id: trigger1.id)
ci_trigger_request.create!(commit_id: build11.id, trigger_id: trigger1.id)
ci_trigger_request.create!(commit_id: build2.id, trigger_id: trigger2.id)
ci_trigger_request.create!(commit_id: build22.id, trigger_id: trigger2.id)
ci_trigger_request.create!(commit_id: build3.id, trigger_id: trigger3.id)
ci_trigger_request.create!(commit_id: pipeline1.id, trigger_id: trigger1.id)
ci_trigger_request.create!(commit_id: pipeline2.id, trigger_id: trigger2.id)
ci_trigger_request.create!(commit_id: pipeline3.id, trigger_id: trigger3.id)
ci_trigger_request.create!(commit_id: nil, trigger_id: trigger4.id)
end
it 'updates p_ci_pipelines.trigger_id' do
expect { migration.perform }
.to change { pipeline1.reload.trigger_id }.from(nil).to(trigger1.id)
.and change { pipeline2.reload.trigger_id }.from(nil).to(trigger2.id)
.and change { pipeline3.reload.trigger_id }.from(nil).to(trigger3.id)
end
context 'when pipeline has incorrect trigger_id' do
let!(:pipeline1) { ci_pipeline.create!(partition_id: 100, project_id: 1, trigger_id: trigger3.id) }
let!(:pipeline2) { ci_pipeline.create!(partition_id: 100, project_id: 1, trigger_id: trigger1.id) }
it 'updates p_ci_pipelines.trigger_id' do
expect { migration.perform }
.to change { pipeline1.reload.trigger_id }.from(trigger3.id).to(trigger1.id)
.and change { pipeline2.reload.trigger_id }.from(trigger1.id).to(trigger2.id)
.and change { pipeline3.reload.trigger_id }.from(nil).to(trigger3.id)
end
end
end
context 'when ci_trigger_requests belongs to multiple pipelines' do
before do
ci_trigger_request.create!(commit_id: pipeline1.id, trigger_id: trigger1.id)
ci_trigger_request.create!(commit_id: pipeline1.id, trigger_id: trigger1.id)
ci_trigger_request.create!(commit_id: pipeline1.id, trigger_id: trigger1.id)
ci_trigger_request.create!(commit_id: pipeline2.id, trigger_id: trigger2.id)
ci_trigger_request.create!(commit_id: pipeline3.id, trigger_id: trigger3.id)
ci_trigger_request.create!(commit_id: nil, trigger_id: trigger4.id)
end
@ -52,22 +80,4 @@ RSpec.describe Gitlab::BackgroundMigration::BackfillPCiPipelinesTriggerId, quara
.and change { pipeline3.reload.trigger_id }.from(nil).to(trigger3.id)
end
end
context 'when ci_trigger_requests belongs to multiple pipelines' do
before do
ci_trigger_request.create!(commit_id: build1.id, trigger_id: trigger1.id)
ci_trigger_request.create!(commit_id: build11.id, trigger_id: trigger2.id)
ci_trigger_request.create!(commit_id: build2.id, trigger_id: trigger2.id)
ci_trigger_request.create!(commit_id: build22.id, trigger_id: trigger3.id)
ci_trigger_request.create!(commit_id: build3.id, trigger_id: trigger3.id)
ci_trigger_request.create!(commit_id: nil, trigger_id: trigger4.id)
end
it 'updates p_ci_pipelines.trigger_id with the first trigger' do
expect { migration.perform }
.to change { pipeline1.reload.trigger_id }.from(nil).to(trigger1.id)
.and change { pipeline2.reload.trigger_id }.from(nil).to(trigger2.id)
.and change { pipeline3.reload.trigger_id }.from(nil).to(trigger3.id)
end
end
end

View File

@ -192,7 +192,7 @@ RSpec.describe Gitlab::Database::Migrations::Runner, :reestablished_active_recor
it 'is configured with a result dir of /background_migrations' do
runner = described_class.background_migrations
expect(runner.result_dir).to eq(described_class::BASE_RESULT_DIR.join( 'background_migrations'))
expect(runner.result_dir).to eq(described_class::BASE_RESULT_DIR.join('background_migrations'))
end
end

View File

@ -9,7 +9,7 @@ RSpec.describe Gitlab::Database::Reindexing::ReindexConcurrently, '#perform' do
let(:column_name) { '_test_column' }
let(:index_name) { '_test_reindex_index' }
let(:index) { Gitlab::Database::PostgresIndex.by_identifier("public.#{iname(index_name)}") }
let(:logger) { double('logger', debug: nil, info: nil, error: nil ) }
let(:logger) { double('logger', debug: nil, info: nil, error: nil) }
let(:connection) { ActiveRecord::Base.connection }
before do

View File

@ -88,7 +88,7 @@ RSpec.describe Gitlab::Diff::HighlightCache, :clean_gitlab_redis_cache, feature_
#
diff_file_size_kb = (diff_file.diff.diff.bytesize * 10)
stub_const("#{diff_file.diff.class}::DEFAULT_MAX_PATCH_BYTES", diff_file_size_kb - 1 )
stub_const("#{diff_file.diff.class}::DEFAULT_MAX_PATCH_BYTES", diff_file_size_kb - 1)
expect(diff_file.diff.class).to receive(:patch_safe_limit_bytes).and_return(diff_file_size_kb + 1)
expect(diff_file.diff.class)
.to receive(:patch_safe_limit_bytes)

View File

@ -58,7 +58,7 @@ RSpec.describe Gitlab::ExclusiveLeaseHelpers, :clean_gitlab_redis_shared_state d
let(:options) { { ttl: 10.minutes } }
it 'receives the specified argument' do
expect(Gitlab::ExclusiveLease).to receive(:new).with(unique_key, { timeout: 10.minutes } )
expect(Gitlab::ExclusiveLease).to receive(:new).with(unique_key, { timeout: 10.minutes })
expect { subject }.to raise_error('Failed to obtain a lock')
end

View File

@ -312,7 +312,7 @@ RSpec.describe Gitlab::Git::Blob do
blobs = described_class.batch_lfs_pointers(repository, [lfs_blob.id])
expect(blobs.count).to eq(1)
expect(blobs).to all( be_a(described_class) )
expect(blobs).to all(be_a(described_class))
expect(blobs).to be_an(Array)
end
@ -320,7 +320,7 @@ RSpec.describe Gitlab::Git::Blob do
blobs = described_class.batch_lfs_pointers(repository, [lfs_blob.id].lazy)
expect(blobs.count).to eq(1)
expect(blobs).to all( be_a(described_class) )
expect(blobs).to all(be_a(described_class))
end
it 'handles empty list of IDs gracefully' do

View File

@ -407,7 +407,7 @@ RSpec.describe Gitlab::Git::Commit, feature_category: :source_code_management do
it 'returns a collection of commits' do
commits = described_class.find_all(repository)
expect(commits).to all( be_a_kind_of(described_class) )
expect(commits).to all(be_a_kind_of(described_class))
end
context 'max_count' do
@ -504,7 +504,7 @@ RSpec.describe Gitlab::Git::Commit, feature_category: :source_code_management do
commits = described_class.batch_by_oid(repository, oids)
expect(commits.count).to eq(2)
expect(commits).to all( be_a(described_class) )
expect(commits).to all(be_a(described_class))
expect(commits.first.sha).to eq(SeedRepo::Commit::ID)
expect(commits.second.sha).to eq(SeedRepo::FirstCommit::ID)
end

View File

@ -288,8 +288,8 @@ EOT
end
context 'when replace_invalid_utf8_chars is false' do
let(:not_replaced_diff) { described_class.new(@raw_diff_hash.merge({ diff: bad_string, replace_invalid_utf8_chars: false }) ) }
let(:not_replaced_diff_two) { described_class.new(@raw_diff_hash.merge({ diff: bad_string_two, replace_invalid_utf8_chars: false }) ) }
let(:not_replaced_diff) { described_class.new(@raw_diff_hash.merge({ diff: bad_string, replace_invalid_utf8_chars: false })) }
let(:not_replaced_diff_two) { described_class.new(@raw_diff_hash.merge({ diff: bad_string_two, replace_invalid_utf8_chars: false })) }
it 'will not try to convert invalid characters' do
expect(Gitlab::EncodingHelper).not_to receive(:encode_utf8_with_replacement_character?)

View File

@ -649,7 +649,7 @@ RSpec.describe Gitlab::Git::Repository, feature_category: :source_code_managemen
end
it 'has valid commit ids as keys' do
expect(subject.keys).to all( match(Commit::COMMIT_SHA_PATTERN) )
expect(subject.keys).to all(match(Commit::COMMIT_SHA_PATTERN))
end
it 'does not error when dereferenced_target is nil' do

View File

@ -50,7 +50,7 @@ RSpec.describe Gitlab::Usage::Metrics::Instrumentations::GenericMetric, feature_
describe '#value' do
it 'gives the correct value' do
expect(subject.value).to eq(ApplicationRecord.database.version )
expect(subject.value).to eq(ApplicationRecord.database.version)
end
context 'when raising an exception' do

View File

@ -80,7 +80,7 @@ RSpec.describe Gitlab::UsageData, :aggregate_failures, feature_category: :servic
describe 'usage_activity_by_stage_package' do
it 'includes accurate usage_activity_by_stage data' do
for_defined_days_back do
create(:project, packages: [create(:package)] )
create(:project, packages: [create(:package)])
end
expect(described_class.usage_activity_by_stage_package({})).to eq(

View File

@ -58,7 +58,7 @@ RSpec.describe Gitlab::Utils::DelegatorOverride::Validator do
it 'adds the allowlist in the ancestors' do
ancestor_validator = described_class.new(ee_delegator_extension)
ancestor_validator.add_allowlist([:bar])
validator.expand_on_ancestors( { ee_delegator_extension => ancestor_validator })
validator.expand_on_ancestors({ ee_delegator_extension => ancestor_validator })
expect(validator.allowed_method_names).to contain_exactly(:bar)
end
@ -73,7 +73,7 @@ RSpec.describe Gitlab::Utils::DelegatorOverride::Validator do
validator.add_allowlist([:foo])
ancestor_validator = described_class.new(ee_delegator_extension)
ancestor_validator.add_allowlist([:bar])
validator.expand_on_ancestors( { ee_delegator_extension => ancestor_validator })
validator.expand_on_ancestors({ ee_delegator_extension => ancestor_validator })
expect { validator.validate_overrides! }.not_to raise_error
end

View File

@ -461,7 +461,7 @@ RSpec.describe Gitlab::Utils::UsageData do
end
it 'returns the evaluated block when give' do
expect(described_class.alt_usage_data { Gitlab::CurrentSettings.uuid } ).to eq(Gitlab::CurrentSettings.uuid)
expect(described_class.alt_usage_data { Gitlab::CurrentSettings.uuid }).to eq(Gitlab::CurrentSettings.uuid)
end
it 'returns the value when given' do

View File

@ -5,7 +5,7 @@ RSpec.describe Gitlab::X509::Commit, feature_category: :source_code_management d
let(:commit_sha) { '189a6c924013fc3fe40d6f1ec1dc20214183bc97' }
let_it_be(:user) { create(:user, email: X509Helpers::User1.certificate_email) }
let_it_be(:project) { create(:project, :repository, path: X509Helpers::User1.path, creator: user) }
let(:commit) { project.commit_by(oid: commit_sha ) }
let(:commit) { project.commit_by(oid: commit_sha) }
let(:signature) { described_class.new(commit).signature }
let(:store) { OpenSSL::X509::Store.new }
let(:certificate) { OpenSSL::X509::Certificate.new(X509Helpers::User1.trust_cert) }

View File

@ -185,7 +185,7 @@ RSpec.describe Security::CiConfiguration::ContainerScanningBuildAction do
# stubbing this method allows this spec file to use fast_spec_helper
def fast_auto_devops_stages
auto_devops_template = YAML.safe_load( File.read('lib/gitlab/ci/templates/Auto-DevOps.gitlab-ci.yml') )
auto_devops_template = YAML.safe_load(File.read('lib/gitlab/ci/templates/Auto-DevOps.gitlab-ci.yml'))
auto_devops_template['stages']
end
end

View File

@ -30,47 +30,43 @@ RSpec.describe Security::CiConfiguration::SastBuildAction do
end
let(:params_with_analyzer_info) do
params.merge( { analyzers:
[
{
name: "bandit",
enabled: false
},
{
name: "brakeman",
enabled: true,
variables: [
{ field: "SAST_BRAKEMAN_LEVEL",
default_value: "1",
value: "2" }
]
},
{
name: "flawfinder",
enabled: true,
variables: [
{ field: "SAST_FLAWFINDER_LEVEL",
default_value: "1",
value: "1" }
]
}
] }
)
params.merge({
analyzers: [
{
name: "bandit",
enabled: false
},
{
name: "brakeman",
enabled: true,
variables: [
{ field: "SAST_BRAKEMAN_LEVEL", default_value: "1", value: "2" }
]
},
{
name: "flawfinder",
enabled: true,
variables: [
{ field: "SAST_FLAWFINDER_LEVEL", default_value: "1", value: "1" }
]
}
]
})
end
let(:params_with_all_analyzers_enabled) do
params.merge( { analyzers:
[
{
name: "flawfinder",
enabled: true
},
{
name: "brakeman",
enabled: true
}
] }
)
params.merge({
analyzers: [
{
name: "flawfinder",
enabled: true
},
{
name: "brakeman",
enabled: true
}
]
})
end
context 'with existing .gitlab-ci.yml' do
@ -314,7 +310,7 @@ RSpec.describe Security::CiConfiguration::SastBuildAction do
# stubbing this method allows this spec file to use fast_spec_helper
def fast_auto_devops_stages
auto_devops_template = YAML.safe_load( File.read('lib/gitlab/ci/templates/Auto-DevOps.gitlab-ci.yml') )
auto_devops_template = YAML.safe_load(File.read('lib/gitlab/ci/templates/Auto-DevOps.gitlab-ci.yml'))
auto_devops_template['stages']
end

View File

@ -175,7 +175,7 @@ RSpec.describe Security::CiConfiguration::SastIacBuildAction do
# stubbing this method allows this spec file to use fast_spec_helper
def fast_auto_devops_stages
auto_devops_template = YAML.safe_load( File.read('lib/gitlab/ci/templates/Auto-DevOps.gitlab-ci.yml') )
auto_devops_template = YAML.safe_load(File.read('lib/gitlab/ci/templates/Auto-DevOps.gitlab-ci.yml'))
auto_devops_template['stages']
end
end

View File

@ -161,7 +161,7 @@ RSpec.describe Security::CiConfiguration::SecretDetectionBuildAction do
# stubbing this method allows this spec file to use fast_spec_helper
def fast_auto_devops_stages
auto_devops_template = YAML.safe_load( File.read('lib/gitlab/ci/templates/Auto-DevOps.gitlab-ci.yml') )
auto_devops_template = YAML.safe_load(File.read('lib/gitlab/ci/templates/Auto-DevOps.gitlab-ci.yml'))
auto_devops_template['stages']
end
end

View File

@ -0,0 +1,26 @@
# frozen_string_literal: true
require 'spec_helper'
require_migration!
RSpec.describe RequeueBackfillPCiPipelinesTriggerId,
migration: :gitlab_ci, feature_category: :continuous_integration do
let!(:batched_migration) { described_class::MIGRATION }
it 'schedules a new batched migration' do
reversible_migration do |migration|
migration.before -> {
expect(batched_migration).not_to have_scheduled_batched_migration
}
migration.after -> {
expect(batched_migration).to have_scheduled_batched_migration(
gitlab_schema: :gitlab_ci,
table_name: :ci_trigger_requests,
column_name: :id,
interval: described_class::DELAY_INTERVAL
)
}
end
end
end

View File

@ -10,13 +10,13 @@ RSpec.describe Ml::CandidateMetric, feature_category: :mlops do
describe 'scope :latest' do
let_it_be(:candidate) { create(:ml_candidates) }
let!(:metric1) { create(:ml_candidate_metrics, candidate: candidate) }
let!(:metric2) { create(:ml_candidate_metrics, candidate: candidate ) }
let!(:metric2) { create(:ml_candidate_metrics, candidate: candidate) }
let!(:metric3) { create(:ml_candidate_metrics, name: metric1.name, candidate: candidate) }
subject { described_class.latest }
it 'fetches only the last metric for the name' do
expect(subject).to match_array([metric2, metric3] )
expect(subject).to match_array([metric2, metric3])
end
end
end

View File

@ -282,13 +282,13 @@ RSpec.describe Ml::Candidate, factory_default: :keep, feature_category: :mlops d
describe "#latest_metrics" do
let_it_be(:candidate3) { create(:ml_candidates, experiment: candidate.experiment) }
let_it_be(:metric1) { create(:ml_candidate_metrics, candidate: candidate3) }
let_it_be(:metric2) { create(:ml_candidate_metrics, candidate: candidate3 ) }
let_it_be(:metric2) { create(:ml_candidate_metrics, candidate: candidate3) }
let_it_be(:metric3) { create(:ml_candidate_metrics, name: metric1.name, candidate: candidate3) }
subject { candidate3.latest_metrics }
it 'fetches only the last metric for the name' do
expect(subject).to match_array([metric2, metric3] )
expect(subject).to match_array([metric2, metric3])
end
end

View File

@ -3,7 +3,7 @@ PATH
specs:
cloud_profiler_agent (0.0.1.pre)
google-cloud-profiler-v2 (~> 0.3)
google-protobuf (~> 3.13)
google-protobuf (~> 3.25)
googleauth (>= 0.14)
stackprof (~> 0.2)
@ -37,7 +37,7 @@ GEM
faraday-patron (1.0.0)
faraday-rack (1.0.0)
faraday-retry (1.0.3)
gapic-common (0.17.1)
gapic-common (0.20.0)
faraday (>= 1.9, < 3.a)
faraday-retry (>= 1.0, < 3.a)
google-protobuf (~> 3.14)
@ -46,10 +46,10 @@ GEM
googleauth (~> 1.0)
grpc (~> 1.36)
google-cloud-errors (1.3.0)
google-cloud-profiler-v2 (0.3.0)
gapic-common (>= 0.10, < 2.a)
google-cloud-profiler-v2 (0.8.0)
gapic-common (>= 0.20.0, < 2.a)
google-cloud-errors (~> 1.0)
google-protobuf (3.22.0)
google-protobuf (3.25.5)
googleapis-common-protos (1.4.0)
google-protobuf (~> 3.14)
googleapis-common-protos-types (~> 1.2)
@ -63,8 +63,8 @@ GEM
multi_json (~> 1.11)
os (>= 0.9, < 2.0)
signet (>= 0.16, < 2.a)
grpc (1.52.0)
google-protobuf (~> 3.21)
grpc (1.69.0)
google-protobuf (>= 3.25, < 5.0)
googleapis-common-protos-types (~> 1.0)
json (2.6.2)
jwt (2.1.0)

View File

@ -21,7 +21,7 @@ Gem::Specification.new do |spec|
spec.add_runtime_dependency 'googleauth', '>= 0.14'
spec.add_runtime_dependency 'google-cloud-profiler-v2', '~> 0.3'
spec.add_runtime_dependency 'google-protobuf', '~> 3.13'
spec.add_runtime_dependency 'google-protobuf', '~> 3.25'
spec.add_runtime_dependency 'stackprof', '~> 0.2'
spec.add_development_dependency 'rspec', '>= 3.10'