Add latest changes from gitlab-org/gitlab@master

This commit is contained in:
GitLab Bot 2023-06-30 15:10:49 +00:00
parent 8b03b8c00a
commit 3b28c7e3b2
53 changed files with 460 additions and 234 deletions

View File

@ -42,6 +42,9 @@ default:
workflow:
name: '$PIPELINE_NAME'
rules:
- if: '$CI_PROJECT_PATH == "gitlab/gitaly" && $CI_PIPELINE_SOURCE == "parent_pipeline" && $GITALY_TEST'
variables:
PIPELINE_NAME: 'Gitaly Rails Test Pipeline'
# If `$FORCE_GITLAB_CI` is set, create a pipeline.
- if: '$FORCE_GITLAB_CI'
variables:
@ -119,9 +122,6 @@ workflow:
variables:
<<: *default-ruby-variables
PIPELINE_NAME: 'Ruby $RUBY_VERSION $CI_COMMIT_BRANCH branch pipeline'
- if: '$CI_PROJECT_PATH == "gitlab/gitaly" && $CI_PIPELINE_SOURCE == "parent_pipeline" && $GITALY_TEST'
variables:
PIPELINE_NAME: 'Gitaly Rails Test Pipeline'
variables:
PG_VERSION: "14"

View File

@ -1,23 +1,10 @@
gems activerecord-gitlab:
extends:
- .gems:rules:activerecord-gitlab
needs: []
trigger:
include: gems/activerecord-gitlab/.gitlab-ci.yml
strategy: depend
gems gitlab-rspec:
extends:
- .gems:rules:gitlab-rspec
needs: []
trigger:
include: gems/gitlab-rspec/.gitlab-ci.yml
strategy: depend
gems gitlab-utils:
extends:
- .gems:rules:gitlab-utils
needs: []
trigger:
include: gems/gitlab-utils/.gitlab-ci.yml
strategy: depend
include:
- local: .gitlab/ci/templates/gem.gitlab-ci.yml
inputs:
gem_name: "activerecord-gitlab"
- local: .gitlab/ci/templates/gem.gitlab-ci.yml
inputs:
gem_name: "gitlab-rspec"
- local: .gitlab/ci/templates/gem.gitlab-ci.yml
inputs:
gem_name: "gitlab-utils"

View File

@ -0,0 +1,19 @@
# The template generates jobs that trigger child pipelines for gems vendored in the main GitLab project under `gems/`.
#
# Inputs:
# - `gem_name`: The name of the gem, i.e. if the gem is located at `gems/gitlab-rspec`, `gem_name` should be set to `gitlab-rspec`.
spec:
inputs:
gem_name:
---
.gems:rules:$[[inputs.gem_name]]:
rules:
- if: '$CI_MERGE_REQUEST_EVENT_TYPE == "merged_result" || $CI_MERGE_REQUEST_EVENT_TYPE == "detached"'
changes: ["gems/$[[inputs.gem_name]]/**/*"]
gems $[[inputs.gem_name]]:
extends: .gems:rules:$[[inputs.gem_name]]
needs: []
trigger:
include: gems/$[[inputs.gem_name]]/.gitlab-ci.yml
strategy: depend

View File

@ -1 +1 @@
6a3d3ddfd7f2f1791cdfcf410c0876253e8b1def
ed135330cadb3cdb766eea501dd15f3796cf2466

View File

@ -1 +1 @@
4.3.5
4.3.6

View File

@ -18,6 +18,7 @@
*/
import { GlAvatarLink, GlTooltipDirective } from '@gitlab/ui';
import { getIdFromGraphQLId } from '~/graphql_shared/utils';
import UserAvatarImage from './user_avatar_image.vue';
export default {
@ -74,6 +75,16 @@ export default {
required: false,
default: 'top',
},
popoverUserId: {
type: [String, Number],
required: false,
default: '',
},
popoverUsername: {
type: String,
required: false,
default: '',
},
username: {
type: String,
required: false,
@ -81,10 +92,17 @@ export default {
},
},
computed: {
userId() {
return getIdFromGraphQLId(this.popoverUserId);
},
shouldShowUsername() {
return this.username.length > 0;
},
avatarTooltipText() {
// Prevent showing tooltip when popoverUserId is present
if (this.popoverUserId) {
return '';
}
return this.shouldShowUsername ? '' : this.tooltipText;
},
},
@ -92,7 +110,12 @@ export default {
</script>
<template>
<gl-avatar-link :href="linkHref" class="user-avatar-link">
<gl-avatar-link
:href="linkHref"
:data-user-id="userId"
:data-username="popoverUsername"
class="user-avatar-link js-user-link"
>
<user-avatar-image
:class="imgCssWrapperClasses"
:img-src="imgSrc"

View File

@ -81,6 +81,8 @@ export default {
:img-alt="item.name"
:tooltip-text="item.name"
:img-size="imgSize"
:popover-user-id="item.id"
:popover-username="item.username"
img-css-classes="gl-mr-3"
/>
<template v-if="hasBreakpoint">

View File

@ -19,13 +19,23 @@ class Projects::NotesController < Projects::ApplicationController
override :feature_category
def feature_category
if %w[index create].include?(params[:action]) && params[:target_type] == 'merge_request'
return 'code_review_workflow'
if %w[index create].include?(params[:action])
category = feature_category_override_for_target_type(params[:target_type])
return category if category
end
super
end
def feature_category_override_for_target_type(target_type)
case target_type
when 'merge_request'
'code_review_workflow'
when 'commit', 'project_snippet'
'source_code_management'
end
end
def delete_attachment
note.remove_attachment!
note.update_attribute(:attachment, nil)

View File

@ -21,6 +21,10 @@ module Types
field :protected, GraphQL::Types::Boolean,
null: true,
description: 'Indicates whether the variable is protected.'
field :description, GraphQL::Types::String,
null: true,
description: 'Description of the variable.'
end
end
end

View File

@ -21,6 +21,10 @@ module Types
field :masked, GraphQL::Types::Boolean,
null: true,
description: 'Indicates whether the variable is masked.'
field :description, GraphQL::Types::String,
null: true,
description: 'Description of the variable.'
end
end
end

View File

@ -14,6 +14,7 @@ module Ci
alias_attribute :secret_value, :value
validates :description, length: { maximum: 255 }, allow_blank: true
validates :key, uniqueness: {
scope: [:group_id, :environment_scope],
message: "(%{value}) has already been taken"

View File

@ -14,6 +14,7 @@ module Ci
alias_attribute :secret_value, :value
validates :description, length: { maximum: 255 }, allow_blank: true
validates :key, uniqueness: {
scope: [:project_id, :environment_scope],
message: "(%{value}) has already been taken"

View File

@ -0,0 +1,11 @@
- title: "OmniAuth Facebook is deprecated" # (required) Clearly explain the change, or planned change. For example, "The `confidential` field for a `Note` is deprecated" or "CI/CD job names will be limited to 250 characters."
removal_milestone: "17.0" # (required) The milestone when this feature is planned to be removed
announcement_milestone: "16.2" # (required) The milestone when this feature was first announced as deprecated.
announcement_date: "2023-07-22" # (required) The date of the milestone release when this feature was first announced as deprecated. This should almost always be the 22nd of a month (YYYY-MM-22), unless you did an out of band blog post.
removal_date: "2024-05-22" # (required) The date of the milestone release when this feature is planned to be removed. This should almost always be the 22nd of a month (YYYY-MM-22), unless you did an out of band blog post.
breaking_change: true # (required) Change to false if this is not a breaking change.
reporter: hsutor # (required) GitLab username of the person reporting the change
stage: Manage # (required) String value of the stage that the feature was created in. e.g., Growth
issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/416000 # (required) Link to the deprecation issue in GitLab
body: | # (required) Do not modify this line, instead modify the lines below.
OmniAuth Facebook support will be removed in GitLab 17.0. The last gem release was in 2021 and it is currently unmaintained. The current usage is less than 0.1%. If you use OmniAuth Facebook, switch to a [supported provider](https://docs.gitlab.com/ee/integration/omniauth.html#supported-providers) in advance of support removal.

View File

@ -0,0 +1,12 @@
# frozen_string_literal: true
class AddDescriptionToCiVariable < Gitlab::Database::Migration[2.1]
enable_lock_retries!
# rubocop:disable Migration/AddLimitToTextColumns
# text limit is added in a 20230621072848_add_text_limit_to_ci_variable_description.rb migration
def change
add_column(:ci_variables, :description, :text)
end
# rubocop:enable Migration/AddLimitToTextColumns
end

View File

@ -0,0 +1,12 @@
# frozen_string_literal: true
class AddDescriptionToCiGroupVariable < Gitlab::Database::Migration[2.1]
enable_lock_retries!
# rubocop:disable Migration/AddLimitToTextColumns
# text limit is added in a 20230621083052_add_text_limit_to_ci_group_variable_description.rb migration
def change
add_column(:ci_group_variables, :description, :text)
end
# rubocop:enable Migration/AddLimitToTextColumns
end

View File

@ -0,0 +1,16 @@
# frozen_string_literal: true
class AddTextLimitToCiVariableDescription < Gitlab::Database::Migration[2.1]
disable_ddl_transaction!
TABLE_NAME = :ci_variables
COLUMN_NAME = :description
def up
add_text_limit(TABLE_NAME, COLUMN_NAME, 255)
end
def down
remove_text_limit(TABLE_NAME, COLUMN_NAME)
end
end

View File

@ -0,0 +1,16 @@
# frozen_string_literal: true
class AddTextLimitToCiGroupVariableDescription < Gitlab::Database::Migration[2.1]
disable_ddl_transaction!
TABLE_NAME = :ci_group_variables
COLUMN_NAME = :description
def up
add_text_limit(TABLE_NAME, COLUMN_NAME, 255)
end
def down
remove_text_limit(TABLE_NAME, COLUMN_NAME)
end
end

View File

@ -0,0 +1 @@
56bf488ec781f8db5ec1723c6a749c0d80140781a1eb3a07984abeddd7d6e88e

View File

@ -0,0 +1 @@
4add5ff0aacac0f287e7aad63a5c0361091d9467bbabc03117750fdbd83681b5

View File

@ -0,0 +1 @@
e5b653b4cdee96f1160950ca6885609f393d49f9b7a4cdd3be3e1dac07fc3add

View File

@ -0,0 +1 @@
7aa6e43678d3e7421fc80c6705daab68c219fa715b8a18ef6c9fdc5df304f8c0

View File

@ -13338,7 +13338,9 @@ CREATE TABLE ci_group_variables (
variable_type smallint DEFAULT 1 NOT NULL,
environment_scope text DEFAULT '*'::text NOT NULL,
raw boolean DEFAULT false NOT NULL,
CONSTRAINT check_dfe009485a CHECK ((char_length(environment_scope) <= 255))
description text,
CONSTRAINT check_dfe009485a CHECK ((char_length(environment_scope) <= 255)),
CONSTRAINT check_e2e50ff879 CHECK ((char_length(description) <= 255))
);
CREATE SEQUENCE ci_group_variables_id_seq
@ -14185,7 +14187,9 @@ CREATE TABLE ci_variables (
environment_scope character varying DEFAULT '*'::character varying NOT NULL,
masked boolean DEFAULT false NOT NULL,
variable_type smallint DEFAULT 1 NOT NULL,
raw boolean DEFAULT false NOT NULL
raw boolean DEFAULT false NOT NULL,
description text,
CONSTRAINT check_7e46c006aa CHECK ((char_length(description) <= 255))
);
CREATE SEQUENCE ci_variables_id_seq

View File

@ -12749,12 +12749,11 @@ Represents the total number of issues and their weights for a particular day.
##### `CiCatalogResource.versions`
Versions of the catalog resource.
Versions of the catalog resource. This field can only be resolved for one catalog resource in any single request.
WARNING:
**Deprecated** in 16.1.
Causes performance degradation.
Use: `latest_version`.
**Introduced** in 16.2.
This feature is an Experiment. It can be changed or removed at any time.
Returns [`ReleaseConnection`](#releaseconnection).
@ -12908,6 +12907,7 @@ CI/CD variables for a group.
| Name | Type | Description |
| ---- | ---- | ----------- |
| <a id="cigroupvariabledescription"></a>`description` | [`String`](#string) | Description of the variable. |
| <a id="cigroupvariableenvironmentscope"></a>`environmentScope` | [`String`](#string) | Scope defining the environments that can use the variable. |
| <a id="cigroupvariableid"></a>`id` | [`ID!`](#id) | ID of the variable. |
| <a id="cigroupvariablekey"></a>`key` | [`String`](#string) | Name of the variable. |
@ -13091,6 +13091,7 @@ CI/CD variables for a project.
| Name | Type | Description |
| ---- | ---- | ----------- |
| <a id="ciprojectvariabledescription"></a>`description` | [`String`](#string) | Description of the variable. |
| <a id="ciprojectvariableenvironmentscope"></a>`environmentScope` | [`String`](#string) | Scope defining the environments that can use the variable. |
| <a id="ciprojectvariableid"></a>`id` | [`ID!`](#id) | ID of the variable. |
| <a id="ciprojectvariablekey"></a>`key` | [`String`](#string) | Name of the variable. |

View File

@ -31,7 +31,8 @@ curl --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/a
"protected": false,
"masked": false,
"raw": false,
"environment_scope": "*"
"environment_scope": "*",
"description": null
},
{
"key": "TEST_VARIABLE_2",
@ -40,7 +41,8 @@ curl --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/a
"protected": false,
"masked": false,
"raw": false,
"environment_scope": "*"
"environment_scope": "*",
"description": null
}
]
```
@ -70,7 +72,8 @@ curl --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/a
"protected": false,
"masked": false,
"raw": false,
"environment_scope": "*"
"environment_scope": "*",
"description": null
}
```
@ -92,6 +95,7 @@ POST /groups/:id/variables
| `masked` | boolean | No | Whether the variable is masked |
| `raw` | boolean | No | Whether the variable is treated as a raw string. Default: `false`. When `true`, variables in the value are not [expanded](../ci/variables/index.md#prevent-cicd-variable-expansion). |
| `environment_scope` **(PREMIUM)** | string | No | The [environment scope](../ci/environments/index.md#limit-the-environment-scope-of-a-cicd-variable) of a variable |
| `description` | string | No | The `description` of the variable. Default: `null` |
```shell
curl --request POST --header "PRIVATE-TOKEN: <your_access_token>" \
@ -106,7 +110,8 @@ curl --request POST --header "PRIVATE-TOKEN: <your_access_token>" \
"protected": false,
"masked": false,
"raw": false,
"environment_scope": "*"
"environment_scope": "*",
"description": null
}
```
@ -128,6 +133,7 @@ PUT /groups/:id/variables/:key
| `masked` | boolean | No | Whether the variable is masked |
| `raw` | boolean | No | Whether the variable is treated as a raw string. Default: `false`. When `true`, variables in the value are not [expanded](../ci/variables/index.md#prevent-cicd-variable-expansion). |
| `environment_scope` **(PREMIUM)** | string | No | The [environment scope](../ci/environments/index.md#limit-the-environment-scope-of-a-cicd-variable) of a variable |
| `description` | string | No | The description of the variable. Default: `null`. [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/409641) in GitLab 16.2. |
```shell
curl --request PUT --header "PRIVATE-TOKEN: <your_access_token>" \
@ -142,7 +148,8 @@ curl --request PUT --header "PRIVATE-TOKEN: <your_access_token>" \
"protected": true,
"masked": true,
"raw": true,
"environment_scope": "*"
"environment_scope": "*",
"description": null
}
```

View File

@ -32,7 +32,8 @@ curl --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/a
"protected": false,
"masked": true,
"raw": false,
"environment_scope": "*"
"environment_scope": "*",
"description": null
},
{
"variable_type": "env_var",
@ -41,7 +42,8 @@ curl --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/a
"protected": false,
"masked": false,
"raw": false,
"environment_scope": "*"
"environment_scope": "*",
"description": null
}
]
```
@ -73,7 +75,8 @@ curl --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/a
"protected": false,
"masked": true,
"raw": false,
"environment_scope": "*"
"environment_scope": "*",
"description": null
}
```
@ -97,6 +100,7 @@ POST /projects/:id/variables
| `masked` | boolean | No | Whether the variable is masked. Default: `false` |
| `raw` | boolean | No | Whether the variable is treated as a raw string. Default: `false`. When `true`, variables in the value are not [expanded](../ci/variables/index.md#prevent-cicd-variable-expansion). |
| `environment_scope` | string | No | The `environment_scope` of the variable. Default: `*` |
| `description` | string | No | The description of the variable. Default: `null`. [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/409641) in GitLab 16.2. |
```shell
curl --request POST --header "PRIVATE-TOKEN: <your_access_token>" \
@ -111,7 +115,8 @@ curl --request POST --header "PRIVATE-TOKEN: <your_access_token>" \
"protected": false,
"masked": false,
"raw": false,
"environment_scope": "*"
"environment_scope": "*",
"description": null
}
```
@ -135,6 +140,7 @@ PUT /projects/:id/variables/:key
| `raw` | boolean | No | Whether the variable is treated as a raw string. Default: `false`. When `true`, variables in the value are not [expanded](../ci/variables/index.md#prevent-cicd-variable-expansion). |
| `environment_scope` | string | No | The `environment_scope` of the variable |
| `filter` | hash | No | Available filters: `[environment_scope]`. See the [`filter` parameter details](#the-filter-parameter). |
| `description` | string | No | The description of the variable. Default: `null`. [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/409641) in GitLab 16.2. |
```shell
curl --request PUT --header "PRIVATE-TOKEN: <your_access_token>" \
@ -149,7 +155,8 @@ curl --request PUT --header "PRIVATE-TOKEN: <your_access_token>" \
"protected": true,
"masked": false,
"raw": false,
"environment_scope": "*"
"environment_scope": "*",
"description": "null"
}
```

View File

@ -40,7 +40,7 @@ package "AI API" as AIF {
node "Vertex AI"
}
package GitLab {
package GitLab {
node "Web IDE"
package "Web" {
@ -106,3 +106,24 @@ The following models have been approved for use:
The following vector stores have been approved for use:
- [`pgvector`](https://github.com/pgvector/pgvector) is a Postgres extension adding support for storing vector embeddings and calculating ANN (approximate nearest neighbor).
### Indexing Update
We are currently using sequential scan, which provides perfect recall. We are considering adding an index if we can ensure that it still produces accurate results, as noted in the `pgvector` indexing [documentation](https://github.com/pgvector/pgvector#indexing).
Given that the table contains thousands of entries, indexing with these updated settings would likely improve search speed while maintaining high accuracy. However, more testing may be needed to verify the optimal configuration for this dataset size before deploying to production.
A [draft MR](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/122035) has been created to update the index.
The index function has been updated to improve search quality. This was tested locally by setting the `ivfflat.probes` value to `10` with the following SQL command:
```ruby
Embedding::TanukiBotMvc.connection.execute("SET ivfflat.probes = 10")
```
Setting the `probes` value for indexing improves results, as per the neighbor [documentation](https://github.com/ankane/neighbor#indexing).
For optimal `probes` and `lists` values:
- Use `lists` equal to `rows / 1000` for tables with up to 1 million rows and `sqrt(rows)` for larger datasets.
- For `probes` start with `lists / 10` for tables up to 1 million rows and `sqrt(lists)` for larger datasets.

View File

@ -26,8 +26,8 @@ Each table of GitLab needs to have a `gitlab_schema` assigned:
- `gitlab_main`: describes all tables that are being stored in the `main:` database (for example, like `projects`, `users`).
- `gitlab_ci`: describes all CI tables that are being stored in the `ci:` database (for example, `ci_pipelines`, `ci_builds`).
- `gitlab_geo`: describes all Geo tables that are being stored in the `geo:` database (for example, like `project_registry`, `secondary_usage_data`).
- `gitlab_shared`: describe all application tables that contain data across all decomposed databases (for example, `loose_foreign_keys_deleted_records`) for models that inherit from `Gitlab::Database::SharedModel`.
- `gitlab_internal`: describe all internal tables of Rails and PostgreSQL (for example, `ar_internal_metadata`, `schema_migrations`, `pg_*`).
- `gitlab_shared`: describes all application tables that contain data across all decomposed databases (for example, `loose_foreign_keys_deleted_records`) for models that inherit from `Gitlab::Database::SharedModel`.
- `gitlab_internal`: describes all internal tables of Rails and PostgreSQL (for example, `ar_internal_metadata`, `schema_migrations`, `pg_*`).
- `gitlab_pm`: describes all tables that store `package_metadata` (it is an alias for `gitlab_main`).
- `...`: more schemas to be introduced with additional decomposed databases

View File

@ -93,7 +93,7 @@ You can see example adding a new gem: [!121676](https://gitlab.com/gitlab-org/gi
end
```
1. Update `gems/gitlab-<name-of-gem>/.rubocop` with:
1. Update `gems/<name-of-gem>/.rubocop` with:
```yaml
inherit_from:
@ -112,60 +112,28 @@ You can see example adding a new gem: [!121676](https://gitlab.com/gitlab-org/gi
1. Configure CI for a newly added Gem:
- Add `gems/gitlab-<name-of-gem>/.gitlab-ci.yml`:
- Add `gems/<name-of-gem>/.gitlab-ci.yml`:
```yaml
workflow:
rules:
- if: $CI_MERGE_REQUEST_ID
rspec:
image: "ruby:${RUBY_VERSION}"
cache:
key: gitlab-<name-of-gem>-${RUBY_VERSION}
paths:
- gitlab-<name-of-gem>/vendor/ruby
before_script:
- cd gems/gitlab-<name-of-gem>
- ruby -v # Print out ruby version for debugging
- gem install bundler --no-document # Bundler is not installed with the image
- bundle config set --local path 'vendor' # Install dependencies into ./vendor/ruby
- bundle config set with 'development'
- bundle config set --local frozen 'true' # Disallow Gemfile.lock changes on CI
- bundle config # Show bundler configuration
- bundle install -j $(nproc)
script:
- bundle exec rspec
parallel:
matrix:
- RUBY_VERSION: ["2.7", "3.0", "3.1", "3.2"]
```
- To `.gitlab/ci/rules.gitlab-ci.yml` add:
```yaml
.gems:rules:gitlab-<name-of-gem>:
rules:
- <<: *if-merge-request
changes: ["gems/gitlab-<name-of-gem>/**/*"]
include:
- local: gems/gem.gitlab-ci.yml
inputs:
gem_name: "<name-of-gem>"
```
- To `.gitlab/ci/gitlab-gems.gitlab-ci.yml` add:
```yaml
gems gitlab-<name-of-gem>:
extends:
- .gems:rules:gitlab-<name-of-gem>
needs: []
trigger:
include: gems/gitlab-<name-of-gem>/.gitlab-ci.yml
strategy: depend
include:
- local: .gitlab/ci/templates/gem.gitlab-ci.yml
inputs:
gem_name: "<name-of-gem>"
```
1. Reference Gem in `Gemfile` with:
```ruby
gem 'gitlab-<name-of-gem>', path: 'gems/gitlab-<name-of-gem>'
gem '<name-of-gem>', path: 'gems/<name-of-gem>'
```
### Examples of Gem extractions

View File

@ -342,6 +342,20 @@ settings for the group using either the GitLab UI or GraphQL API.
<div class="deprecation breaking-change" data-milestone="17.0">
### OmniAuth Facebook is deprecated
<div class="deprecation-notes">
- Announced in: GitLab <span class="milestone">16.2</span>
- This is a [breaking change](https://docs.gitlab.com/ee/update/terminology.html#breaking-change).
- To discuss this change or learn more, see the [deprecation issue](https://gitlab.com/gitlab-org/gitlab/-/issues/416000).
</div>
OmniAuth Facebook support will be removed in GitLab 17.0. The last gem release was in 2021 and it is currently unmaintained. The current usage is less than 0.1%. If you use OmniAuth Facebook, switch to a [supported provider](https://docs.gitlab.com/ee/integration/omniauth.html#supported-providers) in advance of support removal.
</div>
<div class="deprecation breaking-change" data-milestone="17.0">
### Package pipelines in API payload is paginated
<div class="deprecation-notes">

View File

@ -1,24 +1,4 @@
workflow:
rules:
- if: $CI_MERGE_REQUEST_ID
rspec:
image: "ruby:${RUBY_VERSION}"
cache:
key: activerecord-gitlab
paths:
- activerecord-gitlab/vendor/ruby
before_script:
- cd gems/activerecord-gitlab
- ruby -v # Print out ruby version for debugging
- gem install bundler --no-document # Bundler is not installed with the image
- bundle config set --local path 'vendor' # Install dependencies into ./vendor/ruby
- bundle config set with 'development'
- bundle config set --local frozen 'true' # Disallow Gemfile.lock changes on CI
- bundle config # Show bundler configuration
- bundle install -j $(nproc)
script:
- bundle exec rspec
parallel:
matrix:
- RUBY_VERSION: ["2.7", "3.0", "3.1", "3.2"]
include:
- local: gems/gem.gitlab-ci.yml
inputs:
gem_name: "activerecord-gitlab"

41
gems/gem.gitlab-ci.yml Normal file
View File

@ -0,0 +1,41 @@
# The template generates jobs for gems vendored in the main GitLab project under `gems/`.
#
# Inputs
# - `gem_name`: The name of the gem, i.e. if the gem is located at `gems/gitlab-rspec`, `gem_name` should be set to `gitlab-rspec`.
spec:
inputs:
gem_name:
---
workflow:
rules:
- if: $CI_MERGE_REQUEST_ID
default:
image: "ruby:${RUBY_VERSION}"
cache:
key: "$[[inputs.gem_name]]-${RUBY_VERSION}"
paths:
- "gems/$[[inputs.gem_name]]/vendor/ruby"
before_script:
- cd gems/$[[inputs.gem_name]]
- ruby -v # Print out ruby version for debugging
- gem install bundler --no-document # Bundler is not installed with the image
- bundle config set --local path 'vendor' # Install dependencies into ./vendor/ruby
- bundle config set with 'development'
- bundle config set --local frozen 'true' # Disallow Gemfile.lock changes on CI
- bundle config # Show bundler configuration
- bundle install -j $(nproc)
rubocop:
script:
- bundle exec rubocop --config .rubocop.yml
parallel:
matrix:
- RUBY_VERSION: ["3.0", "3.1", "3.2"]
rspec:
script:
- bundle exec rspec
parallel:
matrix:
- RUBY_VERSION: ["3.0", "3.1", "3.2"]

View File

@ -1,31 +1,4 @@
# You can override the included template(s) by including variable overrides
# SAST customization: https://docs.gitlab.com/ee/user/application_security/sast/#customizing-the-sast-settings
# Secret Detection customization: https://docs.gitlab.com/ee/user/application_security/secret_detection/#customizing-settings
# Dependency Scanning customization: https://docs.gitlab.com/ee/user/application_security/dependency_scanning/#customizing-the-dependency-scanning-settings
# Note that environment variables can be set in several places
# See https://docs.gitlab.com/ee/ci/variables/#cicd-variable-precedence
workflow:
rules:
- if: $CI_MERGE_REQUEST_ID
rspec:
image: "ruby:${RUBY_VERSION}"
cache:
key: gitlab-rspec-${RUBY_VERSION}
paths:
- gitlab-rspec/vendor/ruby
before_script:
- cd gems/gitlab-rspec
- ruby -v # Print out ruby version for debugging
- gem install bundler --no-document # Bundler is not installed with the image
- bundle config set --local path 'vendor' # Install dependencies into ./vendor/ruby
- bundle config set with 'development'
- bundle config set --local frozen 'true' # Disallow Gemfile.lock changes on CI
- bundle config # Show bundler configuration
- bundle install -j $(nproc)
script:
- bundle exec rspec
parallel:
matrix:
- RUBY_VERSION: ["2.7", "3.0", "3.1", "3.2"]
include:
- local: gems/gem.gitlab-ci.yml
inputs:
gem_name: "gitlab-rspec"

View File

@ -3,16 +3,3 @@
source "https://rubygems.org"
gemspec
gem "rspec", "~> 3.0"
gem 'nokogiri', '~> 1.15.2'
group :development, :test do
gem 'rubocop'
gem 'rubocop-rspec', '~> 2.18.1'
gem 'factory_bot_rails', '~> 6.2.0'
gem 'gitlab-styles', '~> 10.0.0', require: false
gem 'rspec-rails', '~> 6.0.1'
gem 'rspec-parameterized', '~> 1.0'
gem 'rspec-benchmark', '~> 0.6.0'
end

View File

@ -168,12 +168,10 @@ DEPENDENCIES
factory_bot_rails (~> 6.2.0)
gitlab-rspec!
gitlab-styles (~> 10.0.0)
nokogiri (~> 1.15.2)
rspec (~> 3.0)
rspec-benchmark (~> 0.6.0)
rspec-parameterized (~> 1.0)
rspec-rails (~> 6.0.1)
rubocop
rubocop (~> 1.21)
rubocop-rspec (~> 2.18.1)
BUNDLED WITH

View File

@ -8,15 +8,23 @@ Gem::Specification.new do |spec|
spec.authors = ["group::tenant-scale"]
spec.email = ["engineering@gitlab.com"]
spec.summary = "GitLab's RSpec extensions"
spec.summary = "GitLab RSpec extensions"
spec.description = "A set of useful helpers to configure RSpec with various stubs and CI configs."
spec.homepage = "https://gitlab.com/gitlab-org/gitlab/-/tree/master/gems/gitlab-rspec"
spec.license = "MIT"
spec.required_ruby_version = ">= 3.0"
spec.metadata["rubygems_mfa_required"] = "true"
spec.files = Dir['lib/**/*.rb']
spec.test_files = Dir['spec/**/*']
spec.files = Dir["lib/**/*.rb"]
spec.require_paths = ["lib"]
spec.add_dependency "rspec", "~> 3.0"
spec.add_runtime_dependency "rspec", "~> 3.0"
spec.add_development_dependency "factory_bot_rails", "~> 6.2.0"
spec.add_development_dependency "gitlab-styles", "~> 10.0.0"
spec.add_development_dependency "rspec-benchmark", "~> 0.6.0"
spec.add_development_dependency "rspec-parameterized", "~> 1.0"
spec.add_development_dependency "rspec-rails", "~> 6.0.1"
spec.add_development_dependency "rubocop", "~> 1.21"
spec.add_development_dependency "rubocop-rspec", "~> 2.18.1"
end

View File

@ -1,30 +1,4 @@
# You can override the included template(s) by including variable overrides
# SAST customization: https://docs.gitlab.com/ee/user/application_security/sast/#customizing-the-sast-settings
# Secret Detection customization: https://docs.gitlab.com/ee/user/application_security/secret_detection/#customizing-settings
# Dependency Scanning customization: https://docs.gitlab.com/ee/user/application_security/dependency_scanning/#customizing-the-dependency-scanning-settings
# Note that environment variables can be set in several places
# See https://docs.gitlab.com/ee/ci/variables/#cicd-variable-precedence
workflow:
rules:
- if: $CI_MERGE_REQUEST_ID
rspec:
image: "ruby:${RUBY_VERSION}"
cache:
key: gitlab-utils-${RUBY_VERSION}
paths:
- gitlab-utils/vendor/ruby
before_script:
- cd gems/gitlab-utils
- ruby -v # Print out ruby version for debugging
- gem install bundler --no-document # Bundler is not installed with the image
- bundle config set --local path 'vendor' # Install dependencies into ./vendor/ruby
- bundle config set with 'development'
- bundle config set --local frozen 'true' # Disallow Gemfile.lock changes on CI
- bundle config # Show bundler configuration
- bundle install -j $(nproc)
script:
- bundle exec rspec
parallel:
matrix:
- RUBY_VERSION: ["2.7", "3.0", "3.1", "3.2"]
include:
- local: gems/gem.gitlab-ci.yml
inputs:
gem_name: "gitlab-utils"

View File

@ -8,27 +8,27 @@ Gem::Specification.new do |spec|
spec.authors = ["group::tenant scale"]
spec.email = ["engineering@gitlab.com"]
spec.summary = "GitLab's common helper methods"
spec.summary = "GitLab common helper methods"
spec.description = "A set of useful helpers methods to perform various conversions and checks."
spec.homepage = 'https://gitlab.com/gitlab-org/gitlab/-/tree/master/gems/gitlab-utils'
spec.license = 'MIT'
spec.homepage = "https://gitlab.com/gitlab-org/gitlab/-/tree/master/gems/gitlab-utils"
spec.license = "MIT"
spec.required_ruby_version = ">= 3.0"
spec.metadata["rubygems_mfa_required"] = "true"
spec.files = Dir['lib/**/*.rb']
spec.test_files = Dir['spec/**/*']
spec.files = Dir["lib/**/*.rb"]
spec.require_paths = ["lib"]
spec.add_runtime_dependency 'actionview', '>= 6.1.7.2'
spec.add_runtime_dependency 'activesupport', '>= 6.1.7.2'
spec.add_runtime_dependency 'addressable', '~> 2.8'
spec.add_runtime_dependency 'nokogiri', '~> 1.15.2'
spec.add_runtime_dependency 'rake', '~> 13.0'
spec.add_runtime_dependency "actionview", ">= 6.1.7.2"
spec.add_runtime_dependency "activesupport", ">= 6.1.7.2"
spec.add_runtime_dependency "addressable", "~> 2.8"
spec.add_runtime_dependency "nokogiri", "~> 1.15.2"
spec.add_runtime_dependency "rake", "~> 13.0"
spec.add_development_dependency 'factory_bot_rails', '~> 6.2.0'
spec.add_development_dependency 'gitlab-styles', '~> 10.0.0'
spec.add_development_dependency 'rspec-benchmark', '~> 0.6.0'
spec.add_development_dependency 'rspec-parameterized', '~> 1.0'
spec.add_development_dependency 'rspec-rails', '~> 6.0.1'
spec.add_development_dependency 'rubocop', '~> 1.21'
spec.add_development_dependency 'rubocop-rspec', '~> 2.18.1'
spec.add_development_dependency "factory_bot_rails", "~> 6.2.0"
spec.add_development_dependency "gitlab-styles", "~> 10.0.0"
spec.add_development_dependency "rspec-benchmark", "~> 0.6.0"
spec.add_development_dependency "rspec-parameterized", "~> 1.0"
spec.add_development_dependency "rspec-rails", "~> 6.0.1"
spec.add_development_dependency "rubocop", "~> 1.21"
spec.add_development_dependency "rubocop-rspec", "~> 2.18.1"
end

View File

@ -63,6 +63,7 @@ module API
optional :raw, type: Boolean, desc: 'Whether the variable will be expanded'
optional :variable_type, type: String, values: ::Ci::Variable.variable_types.keys, desc: 'The type of the variable. Default: env_var'
optional :environment_scope, type: String, desc: 'The environment_scope of the variable'
optional :description, type: String, desc: 'The description of the variable'
end
post ':id/variables' do
variable = ::Ci::ChangeVariableService.new(
@ -95,6 +96,7 @@ module API
optional :filter, type: Hash, desc: 'Available filters: [environment_scope]. Example: filter[environment_scope]=production' do
optional :environment_scope, type: String, desc: 'The environment scope of a variable'
end
optional :description, type: String, desc: 'The description of the variable'
end
# rubocop: disable CodeReuse/ActiveRecord
put ':id/variables/:key' do

View File

@ -14,6 +14,8 @@ module API
expose :raw?, as: :raw, if: -> (entity, _) { entity.respond_to?(:raw?) }, documentation: { type: 'boolean' }
expose :environment_scope, if: -> (entity, _) { entity.respond_to?(:environment_scope) },
documentation: { type: 'string', example: '*' }
expose :description, if: -> (entity, _) { entity.respond_to?(:description) },
documentation: { type: 'string', example: 'This variable is being used for ...' }
end
end
end

View File

@ -59,6 +59,8 @@ module API
optional :raw, type: String, desc: 'Whether the variable will be expanded'
optional :variable_type, type: String, values: ::Ci::GroupVariable.variable_types.keys, desc: 'The type of the variable. Default: env_var'
optional :environment_scope, type: String, desc: 'The environment scope of a variable'
optional :description, type: String, desc: 'The description of the variable'
use :optional_group_variable_params_ee
end
post ':id/variables' do
@ -94,6 +96,7 @@ module API
optional :raw, type: String, desc: 'Whether the variable will be expanded'
optional :variable_type, type: String, values: ::Ci::GroupVariable.variable_types.keys, desc: 'The type of the variable. Default: env_var'
optional :environment_scope, type: String, desc: 'The environment scope of a variable'
optional :description, type: String, desc: 'The description of the variable'
use :optional_group_variable_params_ee
end

View File

@ -128,8 +128,8 @@ module QA
'/users/sign_in'
end
def has_sign_in_tab?
has_element?(:sign_in_tab)
def has_sign_in_tab?(wait: Capybara.default_max_wait_time)
has_element?(:sign_in_tab, wait: wait)
end
def has_ldap_tab?
@ -203,7 +203,6 @@ module QA
def sign_out_and_sign_in_as(user:)
Menu.perform(&:sign_out_if_signed_in)
has_sign_in_tab?
sign_in_using_credentials(user: user)
end
@ -225,7 +224,7 @@ module QA
def sign_in_using_gitlab_credentials(user:, skip_page_validation: false)
wait_if_retry_later
switch_to_sign_in_tab if has_sign_in_tab?
switch_to_sign_in_tab if has_sign_in_tab?(wait: 0)
switch_to_standard_tab if has_standard_tab?
fill_in_credential(user)

View File

@ -19,17 +19,17 @@ module QA
end
end
let!(:project_access_token) do
QA::Resource::ProjectAccessToken.fabricate_via_api! do |pat|
pat.project = project
let!(:runner) do
Resource::ProjectRunner.fabricate! do |runner|
runner.project = project
runner.name = "runner-for-#{project.name}"
runner.tags = ["runner-for-#{project.name}"]
end
end
let(:registry) do
Resource::RegistryRepository.init do |repository|
repository.name = project.path_with_namespace
repository.project = project
repository.tag_name = 'master'
let!(:project_access_token) do
QA::Resource::ProjectAccessToken.fabricate_via_api! do |pat|
pat.project = project
end
end
@ -61,6 +61,8 @@ module QA
- docker build -t $IMAGE_TAG .
- docker push $IMAGE_TAG
- docker pull $IMAGE_TAG
tags:
- "runner-for-#{project.name}"
test:
image: dwdraju/alpine-curl-jq:latest
@ -74,9 +76,15 @@ module QA
- if [ $status_code -ne 200 ]; then exit 1; fi;
- 'status_code=$(curl --head --output /dev/null --write-out "%{http_code}\n" --header "PRIVATE-TOKEN: #{masked_token}" "https://${CI_SERVER_HOST}/api/v4/projects/#{project.id}/registry/repositories/$id/tags/master")'
- if [ $status_code -ne 404 ]; then exit 1; fi;
tags:
- "runner-for-#{project.name}"
YAML
end
after do
runner.remove_via_api!
end
it 'pushes, pulls image to the registry and deletes tag',
testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/348001' do
Support::Retrier.retry_on_exception(max_attempts: 3, sleep_interval: 2, message: "Commit push") do

View File

@ -155,6 +155,12 @@ RSpec.describe Projects::NotesController, type: :controller, feature_category: :
expect(note_json[:discussion_line_code]).to be_nil
end
it 'sets the correct feature category' do
get :index, params: params
expect(::Gitlab::ApplicationContext.current_context_attribute(:feature_category)).to eq('source_code_management')
end
context 'when user cannot read commit' do
before do
allow(Ability).to receive(:allowed?).and_call_original
@ -170,6 +176,28 @@ RSpec.describe Projects::NotesController, type: :controller, feature_category: :
end
end
context 'for a snippet note' do
let(:project_snippet) { create(:project_snippet, project: project) }
let!(:note) { create(:note_on_project_snippet, project: project, noteable: project_snippet) }
let(:params) { request_params.merge(target_type: 'project_snippet', target_id: project_snippet.id, html: true) }
it 'responds with the expected attributes' do
get :index, params: params
expect(note_json[:id]).to eq(note.id)
expect(note_json[:discussion_html]).to be_nil
expect(note_json[:diff_discussion_html]).to be_nil
expect(note_json[:discussion_line_code]).to be_nil
end
it 'sets the correct feature category' do
get :index, params: params
expect(::Gitlab::ApplicationContext.current_context_attribute(:feature_category)).to eq('source_code_management')
end
end
context 'for a merge request note' do
let!(:note) { create(:note_on_merge_request, project: project) }
@ -289,6 +317,44 @@ RSpec.describe Projects::NotesController, type: :controller, feature_category: :
end
end
context 'on a commit' do
let(:commit_id) { RepoHelpers.sample_commit.id }
let(:request_params) do
{
note: { note: note_text, commit_id: commit_id, noteable_type: 'Commit' },
namespace_id: project.namespace,
project_id: project,
target_type: 'commit',
target_id: commit_id
}
end
it 'sets the correct feature category' do
create!
expect(::Gitlab::ApplicationContext.current_context_attribute(:feature_category)).to eq('source_code_management')
end
end
context 'on a project snippet' do
let(:project_snippet) { create(:project_snippet, project: project) }
let(:request_params) do
{
note: { note: note_text, noteable_id: project_snippet.id, noteable_type: 'ProjectSnippet' },
namespace_id: project.namespace,
project_id: project,
target_type: 'project_snippet',
target_id: project_snippet.id
}
end
it 'sets the correct feature category' do
create!
expect(::Gitlab::ApplicationContext.current_context_attribute(:feature_category)).to eq('source_code_management')
end
end
context 'the project is publically available' do
context 'for HTML' do
it "returns status 302" do

View File

@ -12,6 +12,8 @@ exports[`Repository last commit component renders commit widget 1`] = `
imgsize="32"
imgsrc="https://test.com"
linkhref="/test"
popoveruserid=""
popoverusername=""
tooltipplacement="top"
tooltiptext=""
username=""

View File

@ -95,4 +95,18 @@ describe('User Avatar Link Component', () => {
expect(wrapper.html()).toContain(badge);
});
});
describe('when popover props provided', () => {
beforeEach(() => {
createWrapper({ popoverUserId: 1, popoverUsername: defaultProps.username });
});
it('should render GlAvatarLink with popover support', () => {
expect(wrapper.attributes()).toMatchObject({
href: defaultProps.linkHref,
'data-user-id': '1',
'data-username': `${defaultProps.username}`,
});
});
});
});

View File

@ -14,6 +14,7 @@ const DEFAULT_EMPTY_MESSAGE = 'None';
const createUser = (id) => ({
id,
name: 'Lorem',
username: 'lorem.ipsum',
web_url: `${TEST_HOST}/${id}`,
avatar_url: `${TEST_HOST}/${id}/avatar`,
});
@ -90,6 +91,8 @@ describe('UserAvatarList', () => {
imgAlt: x.name,
tooltipText: x.name,
imgSize: TEST_IMAGE_SIZE,
popoverUserId: x.id,
popoverUsername: x.username,
}),
),
);
@ -107,6 +110,8 @@ describe('UserAvatarList', () => {
imgAlt: x.name,
tooltipText: x.name,
imgSize: TEST_IMAGE_SIZE,
popoverUserId: x.id,
popoverUsername: x.username,
}),
),
);

View File

@ -5,5 +5,7 @@ require 'spec_helper'
RSpec.describe GitlabSchema.types['CiGroupVariable'] do
specify { expect(described_class.interfaces).to contain_exactly(Types::Ci::VariableInterface) }
specify { expect(described_class).to have_graphql_fields(:environment_scope, :masked, :protected).at_least }
specify do
expect(described_class).to have_graphql_fields(:environment_scope, :masked, :protected, :description).at_least
end
end

View File

@ -5,5 +5,7 @@ require 'spec_helper'
RSpec.describe GitlabSchema.types['CiProjectVariable'] do
specify { expect(described_class.interfaces).to contain_exactly(Types::Ci::VariableInterface) }
specify { expect(described_class).to have_graphql_fields(:environment_scope, :masked, :protected).at_least }
specify do
expect(described_class).to have_graphql_fields(:environment_scope, :masked, :protected, :description).at_least
end
end

View File

@ -13,7 +13,13 @@ RSpec.describe Ci::GroupVariable, feature_category: :secrets_management do
it { is_expected.to include_module(Presentable) }
it { is_expected.to include_module(Ci::Maskable) }
it { is_expected.to include_module(HasEnvironmentScope) }
it { is_expected.to validate_uniqueness_of(:key).scoped_to([:group_id, :environment_scope]).with_message(/\(\w+\) has already been taken/) }
describe 'validations' do
it { is_expected.to validate_uniqueness_of(:key).scoped_to([:group_id, :environment_scope]).with_message(/\(\w+\) has already been taken/) }
it { is_expected.to allow_values('').for(:description) }
it { is_expected.to allow_values(nil).for(:description) }
it { is_expected.to validate_length_of(:description).is_at_most(255) }
end
describe '.by_environment_scope' do
let!(:matching_variable) { create(:ci_group_variable, environment_scope: 'production ') }

View File

@ -15,6 +15,9 @@ RSpec.describe Ci::Variable, feature_category: :secrets_management do
it { is_expected.to include_module(Ci::Maskable) }
it { is_expected.to include_module(HasEnvironmentScope) }
it { is_expected.to validate_uniqueness_of(:key).scoped_to(:project_id, :environment_scope).with_message(/\(\w+\) has already been taken/) }
it { is_expected.to allow_values('').for(:description) }
it { is_expected.to allow_values(nil).for(:description) }
it { is_expected.to validate_length_of(:description).is_at_most(255) }
end
describe '.by_environment_scope' do

View File

@ -48,6 +48,7 @@ RSpec.describe API::Ci::Variables, feature_category: :secrets_management do
expect(json_response['masked']).to eq(variable.masked?)
expect(json_response['raw']).to eq(variable.raw?)
expect(json_response['variable_type']).to eq('env_var')
expect(json_response['description']).to be_nil
end
it 'responds with 404 Not Found if requesting non-existing variable' do
@ -140,7 +141,7 @@ RSpec.describe API::Ci::Variables, feature_category: :secrets_management do
it 'creates variable with optional attributes' do
expect do
post api("/projects/#{project.id}/variables", user), params: { variable_type: 'file', key: 'TEST_VARIABLE_2', value: 'VALUE_2' }
post api("/projects/#{project.id}/variables", user), params: { variable_type: 'file', key: 'TEST_VARIABLE_2', value: 'VALUE_2', description: 'description' }
end.to change { project.variables.count }.by(1)
expect(response).to have_gitlab_http_status(:created)
@ -150,6 +151,7 @@ RSpec.describe API::Ci::Variables, feature_category: :secrets_management do
expect(json_response['masked']).to be_falsey
expect(json_response['raw']).to be_falsey
expect(json_response['variable_type']).to eq('file')
expect(json_response['description']).to eq('description')
end
it 'does not allow to duplicate variable key' do
@ -226,7 +228,7 @@ RSpec.describe API::Ci::Variables, feature_category: :secrets_management do
initial_variable = project.variables.reload.first
value_before = initial_variable.value
put api("/projects/#{project.id}/variables/#{variable.key}", user), params: { variable_type: 'file', value: 'VALUE_1_UP', protected: true }
put api("/projects/#{project.id}/variables/#{variable.key}", user), params: { variable_type: 'file', value: 'VALUE_1_UP', protected: true, description: 'updated' }
updated_variable = project.variables.reload.first
@ -235,6 +237,7 @@ RSpec.describe API::Ci::Variables, feature_category: :secrets_management do
expect(updated_variable.value).to eq('VALUE_1_UP')
expect(updated_variable).to be_protected
expect(updated_variable.variable_type).to eq('file')
expect(updated_variable.description).to eq('updated')
end
it 'masks the new value when logging' do

View File

@ -56,6 +56,7 @@ RSpec.describe API::GroupVariables, feature_category: :secrets_management do
expect(json_response['protected']).to eq(variable.protected?)
expect(json_response['variable_type']).to eq(variable.variable_type)
expect(json_response['environment_scope']).to eq(variable.environment_scope)
expect(json_response['description']).to be_nil
end
it 'responds with 404 Not Found if requesting non-existing variable' do
@ -115,7 +116,7 @@ RSpec.describe API::GroupVariables, feature_category: :secrets_management do
it 'creates variable with optional attributes' do
expect do
post api("/groups/#{group.id}/variables", user), params: { variable_type: 'file', key: 'TEST_VARIABLE_2', value: 'VALUE_2' }
post api("/groups/#{group.id}/variables", user), params: { variable_type: 'file', key: 'TEST_VARIABLE_2', value: 'VALUE_2', description: 'description' }
end.to change { group.variables.count }.by(1)
expect(response).to have_gitlab_http_status(:created)
@ -126,6 +127,7 @@ RSpec.describe API::GroupVariables, feature_category: :secrets_management do
expect(json_response['raw']).to be_falsey
expect(json_response['variable_type']).to eq('file')
expect(json_response['environment_scope']).to eq('*')
expect(json_response['description']).to eq('description')
end
it 'does not allow to duplicate variable key' do
@ -182,7 +184,7 @@ RSpec.describe API::GroupVariables, feature_category: :secrets_management do
initial_variable = group.variables.reload.first
value_before = initial_variable.value
put api("/groups/#{group.id}/variables/#{variable.key}", user), params: { variable_type: 'file', value: 'VALUE_1_UP', protected: true, masked: true, raw: true }
put api("/groups/#{group.id}/variables/#{variable.key}", user), params: { variable_type: 'file', value: 'VALUE_1_UP', protected: true, masked: true, raw: true, description: 'updated' }
updated_variable = group.variables.reload.first
@ -193,6 +195,7 @@ RSpec.describe API::GroupVariables, feature_category: :secrets_management do
expect(json_response['variable_type']).to eq('file')
expect(json_response['masked']).to be_truthy
expect(json_response['raw']).to be_truthy
expect(json_response['description']).to eq('updated')
end
it 'masks the new value when logging' do

View File

@ -211,6 +211,7 @@ RSpec.describe Trigger, feature_category: :tooling do
context "when set in a file" do
before do
allow(File).to receive(:read).and_call_original
stub_env(version_file, nil)
end
it 'includes the version from the file' do