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

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--app/controllers/admin/users_controller.rb27
-rw-r--r--app/models/user.rb8
-rw-r--r--app/services/users/update_assigned_open_issue_count_service.rb33
-rw-r--r--app/views/admin/users/_access_levels.html.haml14
-rw-r--r--app/workers/all_queues.yml10
-rw-r--r--app/workers/build_hooks_worker.rb2
-rw-r--r--app/workers/users/update_open_issue_count_worker.rb26
-rw-r--r--config/feature_flags/development/assigned_open_issues_cache.yml7
-rw-r--r--config/feature_flags/development/load_balancing_for_build_hooks_worker.yml8
-rw-r--r--config/sidekiq_queues.yml2
-rw-r--r--data/whats_new/202105220001_13_12.yml127
-rw-r--r--doc/api/job_artifacts.md14
-rw-r--r--doc/ci/merge_request_pipelines/pipelines_for_merged_results/merge_trains/index.md3
-rw-r--r--doc/ci/multi_project_pipelines.md2
-rw-r--r--doc/ci/triggers/README.md14
-rw-r--r--doc/ci/yaml/README.md38
-rw-r--r--doc/user/application_security/api_fuzzing/create_har_files.md2
-rw-r--r--doc/user/application_security/api_fuzzing/index.md10
-rw-r--r--doc/user/application_security/coverage_fuzzing/index.md2
-rw-r--r--doc/user/project/issues/due_dates.md24
-rw-r--r--lib/gitlab/experimentation.rb3
-rw-r--r--locale/gitlab.pot9
-rw-r--r--qa/qa/resource/group.rb6
-rw-r--r--qa/qa/specs/features/browser_ui/5_package/maven_repository_spec.rb2
-rw-r--r--qa/qa/specs/features/browser_ui/5_package/npm_registry_spec.rb2
-rw-r--r--qa/qa/specs/features/browser_ui/5_package/nuget_repository_spec.rb10
-rw-r--r--spec/controllers/admin/users_controller_spec.rb89
-rw-r--r--spec/models/user_spec.rb41
-rw-r--r--spec/services/users/update_assigned_open_issue_count_service_spec.rb49
-rw-r--r--spec/workers/build_hooks_worker_spec.rb1
-rw-r--r--spec/workers/users/update_open_issue_count_worker_spec.rb65
31 files changed, 338 insertions, 312 deletions
diff --git a/app/controllers/admin/users_controller.rb b/app/controllers/admin/users_controller.rb
index 2e9229db56c..e397ecbadaf 100644
--- a/app/controllers/admin/users_controller.rb
+++ b/app/controllers/admin/users_controller.rb
@@ -209,6 +209,9 @@ class Admin::UsersController < Admin::ApplicationController
user_params_with_pass.merge!(password_params)
end
+ cc_validation_params = process_credit_card_validation_params(user_params_with_pass.delete(:credit_card_validation_attributes))
+ user_params_with_pass.merge!(cc_validation_params)
+
respond_to do |format|
result = Users::UpdateService.new(current_user, user_params_with_pass.merge(user: user)).execute do |user|
user.skip_reconfirmation!
@@ -253,6 +256,27 @@ class Admin::UsersController < Admin::ApplicationController
protected
+ def process_credit_card_validation_params(cc_validation_params)
+ return unless cc_validation_params && cc_validation_params[:credit_card_validated_at]
+
+ cc_validation = cc_validation_params[:credit_card_validated_at]
+
+ if cc_validation == "1" && !user.credit_card_validated_at
+ {
+ credit_card_validation_attributes: {
+ credit_card_validated_at: Time.zone.now
+ }
+ }
+
+ elsif cc_validation == "0" && user.credit_card_validated_at
+ {
+ credit_card_validation_attributes: {
+ _destroy: true
+ }
+ }
+ end
+ end
+
def paginate_without_count?
counts = Gitlab::Database::Count.approximate_counts([User])
@@ -330,7 +354,8 @@ class Admin::UsersController < Admin::ApplicationController
:twitter,
:username,
:website_url,
- :note
+ :note,
+ credit_card_validation_attributes: [:credit_card_validated_at]
]
end
diff --git a/app/models/user.rb b/app/models/user.rb
index b059bd8dd13..c3efb3b71ce 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -321,7 +321,7 @@ class User < ApplicationRecord
accepts_nested_attributes_for :user_preference, update_only: true
accepts_nested_attributes_for :user_detail, update_only: true
- accepts_nested_attributes_for :credit_card_validation, update_only: true
+ accepts_nested_attributes_for :credit_card_validation, update_only: true, allow_destroy: true
state_machine :state, initial: :active do
event :block do
@@ -1706,12 +1706,6 @@ class User < ApplicationRecord
def invalidate_issue_cache_counts
Rails.cache.delete(['users', id, 'assigned_open_issues_count'])
-
- if Feature.enabled?(:assigned_open_issues_cache, default_enabled: :yaml)
- run_after_commit do
- Users::UpdateOpenIssueCountWorker.perform_async(self.id)
- end
- end
end
def invalidate_merge_request_cache_counts
diff --git a/app/services/users/update_assigned_open_issue_count_service.rb b/app/services/users/update_assigned_open_issue_count_service.rb
deleted file mode 100644
index 2ed05853b2f..00000000000
--- a/app/services/users/update_assigned_open_issue_count_service.rb
+++ /dev/null
@@ -1,33 +0,0 @@
-# frozen_string_literal: true
-
-module Users
- # Service class for calculating and caching the number of assigned open issues for a user.
- class UpdateAssignedOpenIssueCountService
- attr_accessor :target_user
-
- def initialize(target_user:)
- @target_user = target_user
-
- raise ArgumentError, "Please provide a target user" unless target_user.is_a?(User)
- end
-
- def execute
- value = calculate_count
- Rails.cache.write(cache_key, value, expires_in: User::COUNT_CACHE_VALIDITY_PERIOD)
-
- ServiceResponse.success(payload: { count: value })
- rescue StandardError => e
- ServiceResponse.error(message: e.message)
- end
-
- private
-
- def cache_key
- ['users', target_user.id, 'assigned_open_issues_count']
- end
-
- def calculate_count
- IssuesFinder.new(target_user, assignee_id: target_user.id, state: 'opened', non_archived: true).execute.count
- end
- end
-end
diff --git a/app/views/admin/users/_access_levels.html.haml b/app/views/admin/users/_access_levels.html.haml
index 573580bc5c5..aeb274fe2cb 100644
--- a/app/views/admin/users/_access_levels.html.haml
+++ b/app/views/admin/users/_access_levels.html.haml
@@ -48,3 +48,17 @@
%row.hidden#warning_external_automatically_set.hidden
.badge.badge-warning.text-white
= s_('AdminUsers|Automatically marked as default internal user')
+
+ .form-group.row
+ - @user.credit_card_validation || @user.build_credit_card_validation
+ = f.fields_for :credit_card_validation do |ff|
+ .col-sm-2.col-form-label.gl-pt-0
+ = ff.label s_("AdminUsers|Validate user account")
+ .col-sm-10.gl-display-flex.gl-align-items-baseline
+ = ff.check_box :credit_card_validated_at, checked: @user.credit_card_validated_at.present?
+ .gl-pl-2
+ .light
+ = s_('AdminUsers|User is validated and can use free CI minutes on shared runners.')
+ .gl-text-gray-600
+ = s_('AdminUsers|A user can validate themselves by inputting a credit/debit card, or an admin can manually validate a user.')
+
diff --git a/app/workers/all_queues.yml b/app/workers/all_queues.yml
index 4357bf301b0..a57b208f476 100644
--- a/app/workers/all_queues.yml
+++ b/app/workers/all_queues.yml
@@ -2901,16 +2901,6 @@
:weight: 1
:idempotent:
:tags: []
-- :name: users_update_open_issue_count
- :worker_name: Users::UpdateOpenIssueCountWorker
- :feature_category: :users
- :has_external_dependencies:
- :urgency: :low
- :resource_boundary: :unknown
- :weight: 1
- :idempotent: true
- :tags:
- - :exclude_from_kubernetes
- :name: web_hook
:worker_name: WebHookWorker
:feature_category: :integrations
diff --git a/app/workers/build_hooks_worker.rb b/app/workers/build_hooks_worker.rb
index be79d6b2afb..c3ba3e5b715 100644
--- a/app/workers/build_hooks_worker.rb
+++ b/app/workers/build_hooks_worker.rb
@@ -9,7 +9,7 @@ class BuildHooksWorker # rubocop:disable Scalability/IdempotentWorker
queue_namespace :pipeline_hooks
feature_category :continuous_integration
urgency :high
- data_consistency :delayed, feature_flag: :load_balancing_for_build_hooks_worker
+ data_consistency :delayed
DATA_CONSISTENCY_DELAY = 3
diff --git a/app/workers/users/update_open_issue_count_worker.rb b/app/workers/users/update_open_issue_count_worker.rb
deleted file mode 100644
index d9e313d53df..00000000000
--- a/app/workers/users/update_open_issue_count_worker.rb
+++ /dev/null
@@ -1,26 +0,0 @@
-# frozen_string_literal: true
-
-module Users
- class UpdateOpenIssueCountWorker
- include ApplicationWorker
-
- feature_category :users
- tags :exclude_from_kubernetes
- idempotent!
-
- def perform(target_user_ids)
- target_user_ids = Array.wrap(target_user_ids)
-
- raise ArgumentError, 'No target user ID provided' if target_user_ids.empty?
-
- target_users = User.id_in(target_user_ids)
- raise ArgumentError, 'No valid target user ID provided' if target_users.empty?
-
- target_users.each do |user|
- Users::UpdateAssignedOpenIssueCountService.new(target_user: user).execute
- end
- rescue StandardError => exception
- Gitlab::ErrorTracking.track_and_raise_for_dev_exception(exception)
- end
- end
-end
diff --git a/config/feature_flags/development/assigned_open_issues_cache.yml b/config/feature_flags/development/assigned_open_issues_cache.yml
deleted file mode 100644
index 6075407c6ce..00000000000
--- a/config/feature_flags/development/assigned_open_issues_cache.yml
+++ /dev/null
@@ -1,7 +0,0 @@
----
-name: assigned_open_issues_cache
-introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/59961
-rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/325470
-group: group::product planning
-type: development
-default_enabled: false
diff --git a/config/feature_flags/development/load_balancing_for_build_hooks_worker.yml b/config/feature_flags/development/load_balancing_for_build_hooks_worker.yml
deleted file mode 100644
index 41c066c4de9..00000000000
--- a/config/feature_flags/development/load_balancing_for_build_hooks_worker.yml
+++ /dev/null
@@ -1,8 +0,0 @@
----
-name: load_balancing_for_build_hooks_worker
-introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/57575
-rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/326095
-milestone: '13.11'
-type: development
-group: group::memory
-default_enabled: false
diff --git a/config/sidekiq_queues.yml b/config/sidekiq_queues.yml
index 6cb09f098f6..e638af29d79 100644
--- a/config/sidekiq_queues.yml
+++ b/config/sidekiq_queues.yml
@@ -404,8 +404,6 @@
- 1
- - upload_checksum
- 1
-- - users_update_open_issue_count
- - 1
- - vulnerabilities_statistics_adjustment
- 1
- - vulnerability_exports_export
diff --git a/data/whats_new/202105220001_13_12.yml b/data/whats_new/202105220001_13_12.yml
new file mode 100644
index 00000000000..f298decd75c
--- /dev/null
+++ b/data/whats_new/202105220001_13_12.yml
@@ -0,0 +1,127 @@
+- title: On-demand DAST GA launch
+ body: |
+ After months of work, we are pleased to announce that our on-demand DAST scanning has reached a General Availability (GA) maturity level. It is ready for usage by anyone who needs to scan an already-deployed application or API outside of a CI/CD pipeline job. With the 13.11 release, we added to on-demand DAST Site profiles the ability to specify authentication information, exclude URLs, add additional request headers, and switch between scanning web applications and APIs. This is in addition to the ability to save scans for quick reusability that was added in 13.9, and the ability to select the branch that a scan is associated with that was added in 13.10. We believe this feature set meets the needs of a majority of GitLab customers.
+
+ As we continue to add features, such as scan scheduling, we expect on-demand DAST scanning to cover an ever-increasing range of use cases. As always, we would love as much feedback about these features as possible. Please let us know how things are working for you by leaving a comment in [issue 327396](https://gitlab.com/gitlab-org/gitlab/-/issues/327396).
+ stage: secure
+ self-managed: true
+ gitlab-com: true
+ packages: [Ultimate]
+ url: https://docs.gitlab.com/ee/user/application_security/dast/#on-demand-scans
+ image_url: https://about.gitlab.com/images/13_12/dast_on_demand_auth.png
+ published_at: 2021-05-22
+ release: 13.12
+- title: Filter Project Vulnerability Report by vendor name
+ body: |
+ GitLab strives to play well with others and security is no exception. We provide many security scanners as part of our Secure offering. We also encourage 3rd party vendors to [integrate their scanning tools](https://docs.gitlab.com/ee/development/integrations/secure.html) using our open API and data interchange formats. A benefit of using GitLab is managing vulnerabilities from multiple scanners in a unified experience. While you were already able to filter by scanner type (SAST, DAST), it wasn't possible to drill down by the tool provider.
+
+ You now have even more granularity when managing vulnerabilities with the new ability to filter by scanner and vendor. You can look at all results across a single vendor's scanners or gain confidence in findings from one scan type (e.g. SAST) that are confirmed by both GitLab and the 3rd party tool. The new filtering capability is available now in Project Vulnerability Reports.
+ stage: secure
+ self-managed: true
+ gitlab-com: true
+ packages: [Ultimate]
+ url: https://docs.gitlab.com/ee/user/application_security/security_dashboard/#vulnerability-report
+ image_url: https://about.gitlab.com/images/13_12/select_scanner_by_vendor.png
+ published_at: 2021-05-22
+ release: 13.12
+- title: Lock latest pipeline artifact to prevent deletion
+ body: |
+ GitLab now automatically locks the latest artifact produced from a successful pipeline on any active branch, merge request, or tag to prevent it from being deleted based on expiration if it is still the most recent artifact.
+
+ This makes it easier to set a more aggressive expiration policy to clean up older artifacts, helps reduce disk space consumption, and ensures you have always got a copy of the latest artifact from your pipeline.
+
+ Pipeline artifacts, such as those used by the [test coverage visualization feature](https://docs.gitlab.com/ee/user/project/merge_requests/test_coverage_visualization.html), are not explicitly managed by the `.gitlab-ci.yml` definitions.
+ stage: verify
+ self-managed: true
+ gitlab-com: true
+ packages: [Free, Premium, Ultimate]
+ url: https://docs.gitlab.com/ee/ci/yaml/README.html#artifactsexpire_in
+ image_url: https://about.gitlab.com/images/growth/verify.png
+ published_at: 2021-05-22
+ release: 13.12
+- title: Delete associated package files via API
+ body: |
+ You use the GitLab Package Registry to publish, install, and share your dependencies. You may do this using a variety of package manager formats, such as Maven or npm. If you do this as part of your CI workflow, you may publish many packages to your registry. When you publish a dependency, it generates several files including the package archive.
+
+ Prior to GitLab 13.12, GitLab didn't provide a way to delete the files from a package. You could only delete the package itself. These extra files can clutter the user interface or result in someone installing an incorrect or outdated dependency.
+
+ In GitLab 13.12, you can now use the Packages API to delete files related to a given package, as well as the package itself. You can easily integrate this new endpoint into your CI workflow and start removing old, unused files. To give you another option for managing your registry, future releases will add the ability to [delete such files through the user interface](https://gitlab.com/gitlab-org/gitlab/-/issues/13537).
+ stage: package
+ self-managed: true
+ gitlab-com: true
+ packages: [Free, Premium, Ultimate]
+ url: https://docs.gitlab.com/ee/api/packages.html#delete-a-package-file
+ image_url: https://about.gitlab.com/images/growth/package.png
+ published_at: 2021-05-22
+ release: 13.12
+- title: Configuration tool for Secret Detection
+ body: |
+ Following in the footsteps of the [GitLab SAST configuration tool](https://docs.gitlab.com/ee/user/application_security/sast/index.html#configure-sast-in-the-ui) we are adding support for Secret Detection on the Security Configuration page. We believe that [security is a team effort](https://about.gitlab.com/direction/secure/#security-is-a-team-effort) and this configuration experience makes it easier for non-CI experts to get started with [GitLab Secret Detection](https://docs.gitlab.com/ee/user/application_security/secret_detection/). The tool helps a user create a merge request to enable Secret Detection scanning while leveraging best configuration practices like using the GitLab-managed [`SAST.gitlab-ci.yml` template](https://gitlab.com/gitlab-org/gitlab/blob/master/lib/gitlab/ci/templates/Security/SAST.gitlab-ci.yml). The Configuration tool can create a new `.gitlab-ci.yml` file if one does not exist or update existing simple GitLab CI files, allowing the tool to be used with projects that already have GitLab CI setup.
+ stage: secure
+ self-managed: true
+ gitlab-com: true
+ packages: [Free, Premium, Ultimate]
+ url: https://docs.gitlab.com/ee/user/application_security/configuration/
+ image_url: https://about.gitlab.com/images/13_12/secret_config_button_13_12.png
+ published_at: 2021-05-22
+ release: 13.12
+- title: Code quality violation notices in MR diffs
+ body: |
+ During code reviews, you may have wanted to highlight Code Quality violations and how to resolve them. Previously, this involved having a browser window open to see the violations on the Merge Request summary and another window reviewing the changes in the MR or your IDE. You may have found switching between them too difficult and given up.
+
+ Now, you can see if the file you are reviewing has new code quality violations that are part of the changes right in the Merge Request diff view. This gives you the necessary context to suggest a fix as part of your normal workflow within GitLab without having to keep additional windows open and context switch back and forth between them.
+ stage: verify
+ self-managed: true
+ gitlab-com: true
+ packages: [Ultimate]
+ url: https://docs.gitlab.com/ee/user/project/merge_requests/code_quality.html#code-quality-in-diff-view
+ image_url: https://about.gitlab.com/images/13_12/code-quality-mr-diff-mvc.png
+ published_at: 2021-05-22
+ release: 13.12
+- title: Group-level deployment frequency CI/CD chart
+ body: |
+ As part of our efforts to natively support [DORA4 metrics](https://docs.gitlab.com/ee/user/analytics/ci_cd_analytics.html#devops-research-and-assessment-dora-key-metrics) in GitLab, the group-level deployment frequency chart is now available. This chart will show the aggregated deployment frequency metrics for all the projects that are part of the group, and allow you to get a full picture of the deployment frequency across multiple projects and teams, so that you can comprehend their efficiency more accurately. Monitoring deployment frequency helps you understand the efficiency of your deployments over time, find bottlenecks, and focus on improvement areas that span across your projects and teams.
+ stage: Release
+ self-managed: true
+ gitlab-com: true
+ packages: [Ultimate]
+ url: https://docs.gitlab.com/ee/user/analytics/ci_cd_analytics.html#deployment-frequency-charts
+ image_url: https://about.gitlab.com/images/13_12/group_deployment_frequency.png
+ published_at: 2021-05-22
+ release: 13.12
+- title: Enforce delayed project removal for all subgroups
+ body: |
+ Group owners can now enable and enforce [delayed project removal](https://docs.gitlab.com/ee/user/group/#enable-delayed-project-removal) for all subgroups and projects in their group. Delayed project removal protects your data by placing deleted projects in a read-only state after deletion and can be restored, if required. We plan to expand our settings model and allow more settings to be inherited and enforced in subgroups and projects in future milestones. Our new settings management model gives group owners a way to ensure that their subgroups and projects settings adhere to their organization's security and compliance needs.
+ stage: manage
+ self-managed: true
+ gitlab-com: true
+ packages: [Premium, Ultimate]
+ url: https://docs.gitlab.com/ee/user/group/#enable-delayed-project-removal
+ image_url: https://about.gitlab.com/images/13_12/mushakov_delayed_deletion.png
+ published_at: 2021-05-22
+ release: 13.12
+- title: Mobile application binary scanning support
+ body: |
+ Since GitLab 13.6, we've offered [SAST for Android and iOS mobile projects](https://about.gitlab.com/releases/2020/10/22/gitlab-13-5-released/#sast-support-for-ios-and-android-mobile-apps). Initially our Mobile App SAST supported the automatic detection of Xcode projects and Android manifest files. With this release and contribution from community contributor [@proletarius101](https://gitlab.com/proletarius101), GitLab SAST now also supports the automatic detection of .ipa (iOS) and .apk (Android) binary files enabling the security scanning of fully built mobile application artifacts. This offers mobile teams more flexibility with how they build and scan their mobile projects with GitLab SAST for security vulnerabilities.
+ Please note that mobile application scanning is still an experimental feature and [requires enabling the experimental flag](https://docs.gitlab.com/ee/user/application_security/sast/#experimental-features) in your CI template. We will make the mobile application scanner generally available without this flag [in the near future](https://gitlab.com/groups/gitlab-org/-/epics/5977).
+ stage: secure
+ self-managed: true
+ gitlab-com: true
+ packages: [Free, Premium, Ultimate]
+ url: https://docs.gitlab.com/ee/user/application_security/sast/#supported-languages-and-frameworks
+ image_url: https://about.gitlab.com/images/growth/verify.png
+ published_at: 2021-05-22
+ release: 13.12
+- title: Instance-level Federated Learning of Cohorts (FLoC) opt-in
+ body: |
+ [Federated Learning of Cohorts (FLoC)](https://en.wikipedia.org/wiki/Federated_Learning_of_Cohorts) is a new type of web tracking, intended to replace the use of third-party cookies. It does this by grouping users into cohorts based on their browsing history, for the primary purpose of interest-based advertising. FLoC is being activated in the Chrome browser in some regions.
+
+ With GitLab 13.12, FLoC will not incorporate GitLab browsing activity by default. If an instance administrator would like their users' GitLab instance usage to contribute to FLoC, they can re-enable in instance settings.
+ stage: enablement
+ self-managed: true
+ gitlab-com: true
+ packages: [Free, Premium, Ultimate]
+ url: https://docs.gitlab.com/ee/user/admin_area/settings/floc.html
+ image_url: https://about.gitlab.com/images/growth/enablement.png
+ published_at: 2021-05-22
+ release: 13.12
diff --git a/doc/api/job_artifacts.md b/doc/api/job_artifacts.md
index 0dbb35a62cd..64e7aebb19d 100644
--- a/doc/api/job_artifacts.md
+++ b/doc/api/job_artifacts.md
@@ -90,7 +90,7 @@ Parameters
Example request using the `PRIVATE-TOKEN` header:
```shell
-curl --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/projects/1/jobs/artifacts/master/download?job=test"
+curl --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/projects/1/jobs/artifacts/main/download?job=test"
```
To use this in a [`script` definition](../ci/yaml/README.md#script) inside
@@ -98,25 +98,25 @@ To use this in a [`script` definition](../ci/yaml/README.md#script) inside
- The `JOB-TOKEN` header with the GitLab-provided `CI_JOB_TOKEN` variable.
For example, the following job downloads the artifacts of the `test` job
- of the `master` branch. Note that the command is wrapped into single quotes
+ of the `main` branch. Note that the command is wrapped into single quotes
because it contains a colon (`:`):
```yaml
artifact_download:
stage: test
script:
- - 'curl --location --output artifacts.zip --header "JOB-TOKEN: $CI_JOB_TOKEN" "https://gitlab.example.com/api/v4/projects/$CI_PROJECT_ID/jobs/artifacts/master/download?job=test"'
+ - 'curl --location --output artifacts.zip --header "JOB-TOKEN: $CI_JOB_TOKEN" "https://gitlab.example.com/api/v4/projects/$CI_PROJECT_ID/jobs/artifacts/main/download?job=test"'
```
- Or the `job_token` attribute with the GitLab-provided `CI_JOB_TOKEN` variable.
For example, the following job downloads the artifacts of the `test` job
- of the `master` branch:
+ of the `main` branch:
```yaml
artifact_download:
stage: test
script:
- - 'curl --location --output artifacts.zip "https://gitlab.example.com/api/v4/projects/$CI_PROJECT_ID/jobs/artifacts/master/download?job=test&job_token=$CI_JOB_TOKEN"'
+ - 'curl --location --output artifacts.zip "https://gitlab.example.com/api/v4/projects/$CI_PROJECT_ID/jobs/artifacts/main/download?job=test&job_token=$CI_JOB_TOKEN"'
```
Possible response status codes:
@@ -193,7 +193,7 @@ Parameters:
Example request:
```shell
-curl --location --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/projects/1/jobs/artifacts/master/raw/some/release/file.pdf?job=pdf"
+curl --location --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/projects/1/jobs/artifacts/main/raw/some/release/file.pdf?job=pdf"
```
Possible response status codes:
@@ -243,7 +243,7 @@ Example response:
"download_url": null,
"id": 42,
"name": "rubocop",
- "ref": "master",
+ "ref": "main",
"artifacts": [],
"runner": null,
"stage": "test",
diff --git a/doc/ci/merge_request_pipelines/pipelines_for_merged_results/merge_trains/index.md b/doc/ci/merge_request_pipelines/pipelines_for_merged_results/merge_trains/index.md
index b8ddc547156..aa209e6dd30 100644
--- a/doc/ci/merge_request_pipelines/pipelines_for_merged_results/merge_trains/index.md
+++ b/doc/ci/merge_request_pipelines/pipelines_for_merged_results/merge_trains/index.md
@@ -59,8 +59,7 @@ to run. If more merge requests are added to the train, they now include the `A`
changes that are included in the target branch, and the `C` changes that are from
the merge request already in the train.
-Read more about
-[how merge trains keep your master green](https://about.gitlab.com/blog/2020/01/30/all-aboard-merge-trains/).
+Read more about [how merge trains keep your master green](https://about.gitlab.com/blog/2020/01/30/all-aboard-merge-trains/).
<i class="fa fa-youtube-play youtube" aria-hidden="true"></i>
Watch this video for a demonstration on [how parallel execution
diff --git a/doc/ci/multi_project_pipelines.md b/doc/ci/multi_project_pipelines.md
index c1e552f5a9d..acdbe0455ba 100644
--- a/doc/ci/multi_project_pipelines.md
+++ b/doc/ci/multi_project_pipelines.md
@@ -271,7 +271,7 @@ trigger_job:
### Mirroring status from upstream pipeline
You can mirror the pipeline status from an upstream pipeline to a bridge job by
-using the `needs:pipeline` keyword. The latest pipeline status from master is
+using the `needs:pipeline` keyword. The latest pipeline status from the default branch is
replicated to the bridge job.
Example:
diff --git a/doc/ci/triggers/README.md b/doc/ci/triggers/README.md
index 434adb0c8f3..cec4429629f 100644
--- a/doc/ci/triggers/README.md
+++ b/doc/ci/triggers/README.md
@@ -140,21 +140,21 @@ By using cURL you can trigger a pipeline rerun with minimal effort, for example:
```shell
curl --request POST \
--form token=TOKEN \
- --form ref=master \
+ --form ref=main \
"https://gitlab.example.com/api/v4/projects/9/trigger/pipeline"
```
-In this case, the pipeline for the project with ID `9` runs on the `master` branch.
+In this case, the pipeline for the project with ID `9` runs on the `main` branch.
Alternatively, you can pass the `token` and `ref` arguments in the query string:
```shell
curl --request POST \
- "https://gitlab.example.com/api/v4/projects/9/trigger/pipeline?token=TOKEN&ref=master"
+ "https://gitlab.example.com/api/v4/projects/9/trigger/pipeline?token=TOKEN&ref=main"
```
You can also benefit by using triggers in your `.gitlab-ci.yml`. Let's say that
-you have two projects, A and B, and you want to trigger a pipeline on the `master`
+you have two projects, A and B, and you want to trigger a pipeline on the `main`
branch of project B whenever a tag on project A is created. This is the job you
need to add in project A's `.gitlab-ci.yml`:
@@ -162,7 +162,7 @@ need to add in project A's `.gitlab-ci.yml`:
trigger_pipeline:
stage: deploy
script:
- - 'curl --request POST --form token=TOKEN --form ref=master "https://gitlab.example.com/api/v4/projects/9/trigger/pipeline"'
+ - 'curl --request POST --form token=TOKEN --form ref=main "https://gitlab.example.com/api/v4/projects/9/trigger/pipeline"'
only:
- tags
```
@@ -261,11 +261,11 @@ of all types of variables.
## Using cron to trigger nightly pipelines
Whether you craft a script or just run cURL directly, you can trigger jobs
-in conjunction with cron. The example below triggers a job on the `master`
+in conjunction with cron. The example below triggers a job on the `main` branch
branch of project with ID `9` every night at `00:30`:
```shell
-30 0 * * * curl --request POST --form token=TOKEN --form ref=master "https://gitlab.example.com/api/v4/projects/9/trigger/pipeline"
+30 0 * * * curl --request POST --form token=TOKEN --form ref=main "https://gitlab.example.com/api/v4/projects/9/trigger/pipeline"
```
This behavior can also be achieved through the GitLab UI with
diff --git a/doc/ci/yaml/README.md b/doc/ci/yaml/README.md
index 1d166ed0ca2..856f86256cc 100644
--- a/doc/ci/yaml/README.md
+++ b/doc/ci/yaml/README.md
@@ -253,7 +253,7 @@ variables:
workflow:
rules:
- - if: $CI_COMMIT_REF_NAME =~ /master/
+ - if: $CI_COMMIT_REF_NAME == $CI_DEFAULT_BRANCH
variables:
DEPLOY_VARIABLE: "deploy-production" # Override globally-defined DEPLOY_VARIABLE
- if: $CI_COMMIT_REF_NAME =~ /feature/
@@ -265,7 +265,7 @@ job1:
variables:
DEPLOY_VARIABLE: "job1-default-deploy"
rules:
- - if: $CI_COMMIT_REF_NAME =~ /master/
+ - if: $CI_COMMIT_REF_NAME == $CI_DEFAULT_BRANCH
variables: # Override DEPLOY_VARIABLE defined
DEPLOY_VARIABLE: "job1-deploy-production" # at the job level.
- when: on_success # Run the job in other cases
@@ -279,7 +279,7 @@ job2:
- echo "Run another script if $IS_A_FEATURE exists"
```
-When the branch is `master`:
+When the branch is the default branch:
- job1's `DEPLOY_VARIABLE` is `job1-deploy-production`.
- job2's `DEPLOY_VARIABLE` is `deploy-production`.
@@ -559,7 +559,7 @@ You can also specify a `ref`. If you do not specify a value, the ref defaults to
```yaml
include:
- project: 'my-group/my-project'
- ref: master
+ ref: main
file: '/templates/.gitlab-ci-template.yml'
- project: 'my-group/my-project'
@@ -584,7 +584,7 @@ You can include multiple files from the same project:
```yaml
include:
- project: 'my-group/my-project'
- ref: master
+ ref: main
file:
- '/templates/.builds.yml'
- '/templates/.tests.yml'
@@ -598,7 +598,7 @@ authentication in the remote URL is not supported. For example:
```yaml
include:
- - remote: 'https://gitlab.com/example-project/-/raw/master/.gitlab-ci.yml'
+ - remote: 'https://gitlab.com/example-project/-/raw/main/.gitlab-ci.yml'
```
All [nested includes](#nested-includes) execute without context as a public user,
@@ -1137,7 +1137,7 @@ For example:
docker build:
script: docker build -t my-image:$CI_COMMIT_REF_SLUG .
rules:
- - if: '$CI_COMMIT_BRANCH == "master"'
+ - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
when: delayed
start_in: '3 hours'
allow_failure: true
@@ -1335,7 +1335,7 @@ For example:
job:
script: echo "Hello, Rules!"
rules:
- - if: '$CI_MERGE_REQUEST_SOURCE_BRANCH_NAME =~ /^feature/ && $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "master"'
+ - if: '$CI_MERGE_REQUEST_SOURCE_BRANCH_NAME =~ /^feature/ && $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == $CI_DEFAULT_BRANCH'
when: always
- if: '$CI_MERGE_REQUEST_SOURCE_BRANCH_NAME =~ /^feature/'
when: manual
@@ -1533,7 +1533,7 @@ the particular rule triggers the job.
job:
script: echo "Hello, Rules!"
rules:
- - if: '$CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "master"'
+ - if: '$CI_MERGE_REQUEST_TARGET_BRANCH_NAME == $CI_DEFAULT_BRANCH'
when: manual
allow_failure: true
```
@@ -1554,7 +1554,7 @@ job:
variables:
DEPLOY_VARIABLE: "default-deploy"
rules:
- - if: $CI_COMMIT_REF_NAME =~ /master/
+ - if: $CI_COMMIT_REF_NAME == $CI_DEFAULT_BRANCH
variables: # Override DEPLOY_VARIABLE defined
DEPLOY_VARIABLE: "deploy-production" # at the job level.
- if: $CI_COMMIT_REF_NAME =~ /feature/
@@ -1602,7 +1602,7 @@ job1:
script:
- echo This rule uses parentheses.
rules:
- if: ($CI_COMMIT_BRANCH == "master" || $CI_COMMIT_BRANCH == "develop") && $MY_VARIABLE
+ if: ($CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH || $CI_COMMIT_BRANCH == "develop") && $MY_VARIABLE
```
WARNING:
@@ -1968,12 +1968,12 @@ build_job:
needs:
- project: namespace/group/project-name
job: build-1
- ref: master
+ ref: main
artifacts: true
```
`build_job` downloads the artifacts from the latest successful `build-1` job
-on the `master` branch in the `group/project-name` project. If the project is in the
+on the `main` branch in the `group/project-name` project. If the project is in the
same group or namespace, you can omit them from the `project:` keyword. For example,
`project: group/project-name` or `project: project-name`.
@@ -2084,9 +2084,9 @@ error similar to:
In this example:
-- When the branch is `master`, the `build` job exists in the pipeline, and the `rspec`
+- When the branch is the default branch, the `build` job exists in the pipeline, and the `rspec`
job waits for it to complete before starting.
-- When the branch is not `master`, the `build` job does not exist in the pipeline.
+- When the branch is not the default branch, the `build` job does not exist in the pipeline.
The `rspec` job runs immediately (similar to `needs: []`) because its `needs`
relationship to the `build` job is optional.
@@ -2094,7 +2094,7 @@ In this example:
build:
stage: build
rules:
- - if: $CI_COMMIT_REF_NAME == "master"
+ - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
rspec:
stage: test
@@ -2330,7 +2330,7 @@ To protect a manual job:
url: https://example.com
when: manual
only:
- - master
+ - main
```
1. In the [protected environments settings](../environments/protected_environments.md#protecting-environments),
@@ -4039,7 +4039,7 @@ child-pipeline:
trigger:
include:
- project: 'my-group/my-pipeline-library'
- ref: 'master'
+ ref: 'main'
file: '/path/to/child-pipeline.yml'
```
@@ -4638,7 +4638,7 @@ pages:
paths:
- public
only:
- - master
+ - main
```
View the [GitLab Pages user documentation](../../user/project/pages/index.md).
diff --git a/doc/user/application_security/api_fuzzing/create_har_files.md b/doc/user/application_security/api_fuzzing/create_har_files.md
index 220d00adc7b..7f0b41b8c11 100644
--- a/doc/user/application_security/api_fuzzing/create_har_files.md
+++ b/doc/user/application_security/api_fuzzing/create_har_files.md
@@ -1,6 +1,6 @@
---
stage: Secure
-group: Fuzz Testing
+group: Dynamic Analysis
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#designated-technical-writers
type: howto
---
diff --git a/doc/user/application_security/api_fuzzing/index.md b/doc/user/application_security/api_fuzzing/index.md
index 8511c919c14..30b908d3495 100644
--- a/doc/user/application_security/api_fuzzing/index.md
+++ b/doc/user/application_security/api_fuzzing/index.md
@@ -1,6 +1,6 @@
---
stage: Secure
-group: Fuzz Testing
+group: Dynamic Analysis
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#assignments
type: reference, howto
---
@@ -116,8 +116,8 @@ To generate an API Fuzzing configuration snippet:
> Support for OpenAPI Specification v3.0 was
> [introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/228652) in GitLab 13.9.
-The [OpenAPI Specification](https://www.openapis.org/) (formerly the Swagger Specification) is an API description format for REST APIs.
-This section shows you how to configure API fuzzing using an OpenAPI Specification to provide information about the target API to test.
+The [OpenAPI Specification](https://www.openapis.org/) (formerly the Swagger Specification) is an API description format for REST APIs.
+This section shows you how to configure API fuzzing using an OpenAPI Specification to provide information about the target API to test.
OpenAPI Specifications are provided as a file system resource or URL. Both JSON and YAML OpenAPI formats are supported.
API fuzzing uses an OpenAPI document to generate the request body. When a request body is required,
@@ -1171,7 +1171,7 @@ The best-suited solution will depend on whether or not your target API changes f
#### Static environment solution
-This solution is for pipelines in which the target API URL doesn't change (is static).
+This solution is for pipelines in which the target API URL doesn't change (is static).
**Add environmental variable**
@@ -1188,7 +1188,7 @@ include:
#### Dynamic environment solutions
-In a dynamic environment your target API changes for each different deployment. In this case, there is more than one possible solution, we recommend to use the `environment_url.txt` file when dealing with dynamic environments.
+In a dynamic environment your target API changes for each different deployment. In this case, there is more than one possible solution, we recommend to use the `environment_url.txt` file when dealing with dynamic environments.
**Use environment_url.txt**
diff --git a/doc/user/application_security/coverage_fuzzing/index.md b/doc/user/application_security/coverage_fuzzing/index.md
index 8b0a84eae4b..e65d9de1e06 100644
--- a/doc/user/application_security/coverage_fuzzing/index.md
+++ b/doc/user/application_security/coverage_fuzzing/index.md
@@ -1,6 +1,6 @@
---
stage: Secure
-group: Fuzz Testing
+group: Dynamic Analysis
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#assignments
type: reference, howto
---
diff --git a/doc/user/project/issues/due_dates.md b/doc/user/project/issues/due_dates.md
index a82823947dc..5b8dd617ab9 100644
--- a/doc/user/project/issues/due_dates.md
+++ b/doc/user/project/issues/due_dates.md
@@ -4,13 +4,9 @@ group: Project Management
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#assignments
---
-# Due dates
+# Due dates **(FREE)**
-> [Introduced](https://gitlab.com/gitlab-org/gitlab-foss/-/merge_requests/3614) in GitLab 8.7.
-
-Please read through the [GitLab Issue Documentation](index.md) for an overview on GitLab Issues.
-
-Due dates can be used in issues to keep track of deadlines and make sure features are
+Due dates can be used in [issues](index.md) to keep track of deadlines and make sure features are
shipped on time. Users need at least [Reporter permissions](../../permissions.md)
to be able to edit the due date. All users with permission to view
the issue can view the due date.
@@ -24,11 +20,11 @@ the user setting the due date.
![Create a due date](img/due_dates_create.png)
-You can also set a due date via the issue sidebar. Expand the
-sidebar and click **Edit** to pick a due date or remove the existing one.
+You can also set a due date by using the issue sidebar. Expand the
+sidebar and select **Edit** to pick a due date or remove the existing one.
Changes are saved immediately.
-![Edit a due date via the sidebar](img/due_dates_edit_sidebar.png)
+![Edit a due date with the sidebar](img/due_dates_edit_sidebar.png)
The last way to set a due date is by using [quick actions](../quick_actions.md), directly in an issue's description or comment:
@@ -52,9 +48,9 @@ of the issue. Like the due date, the "day before the due date" is determined by
server's timezone.
Issues with due dates can also be exported as an iCalendar feed. The URL of the
-feed can be added to calendar applications. The feed is accessible by clicking
-on the **Subscribe to calendar** button on the following pages:
+feed can be added to calendar applications. The feed is accessible by selecting
+the **Subscribe to calendar** button on the following pages:
-- on the **Assigned Issues** page that is linked on the right-hand side of the GitLab header
-- on the **Project Issues** page
-- on the **Group Issues** page
+- The **Assigned Issues** page linked on the right side of the GitLab header
+- The **Project Issues** page
+- The **Group Issues** page
diff --git a/lib/gitlab/experimentation.rb b/lib/gitlab/experimentation.rb
index e4233b8a935..87fe7bd857a 100644
--- a/lib/gitlab/experimentation.rb
+++ b/lib/gitlab/experimentation.rb
@@ -48,9 +48,6 @@ module Gitlab
invite_members_empty_project_version_a: {
tracking_category: 'Growth::Expansion::Experiment::InviteMembersEmptyProjectVersionA'
},
- trial_during_signup: {
- tracking_category: 'Growth::Conversion::Experiment::TrialDuringSignup'
- },
invite_members_new_dropdown: {
tracking_category: 'Growth::Expansion::Experiment::InviteMembersNewDropdown'
},
diff --git a/locale/gitlab.pot b/locale/gitlab.pot
index 1c362578eb2..2d06c304a3c 100644
--- a/locale/gitlab.pot
+++ b/locale/gitlab.pot
@@ -2461,6 +2461,9 @@ msgstr ""
msgid "AdminUsers|2FA Enabled"
msgstr ""
+msgid "AdminUsers|A user can validate themselves by inputting a credit/debit card, or an admin can manually validate a user."
+msgstr ""
+
msgid "AdminUsers|Access"
msgstr ""
@@ -2719,6 +2722,9 @@ msgstr ""
msgid "AdminUsers|Unlock user %{username}?"
msgstr ""
+msgid "AdminUsers|User is validated and can use free CI minutes on shared runners."
+msgstr ""
+
msgid "AdminUsers|User will be blocked"
msgstr ""
@@ -2734,6 +2740,9 @@ msgstr ""
msgid "AdminUsers|Users can still be invited to your instance and/or add themselves if permitted based on your settings. They will not have access to your instance, nor count towards your subscribed seat count until you %{approve_link}."
msgstr ""
+msgid "AdminUsers|Validate user account"
+msgstr ""
+
msgid "AdminUsers|View pending member requests"
msgstr ""
diff --git a/qa/qa/resource/group.rb b/qa/qa/resource/group.rb
index c7565871b0b..a263b11c0ca 100644
--- a/qa/qa/resource/group.rb
+++ b/qa/qa/resource/group.rb
@@ -47,6 +47,12 @@ module QA
resource_web_url(api_get)
rescue ResourceNotFoundError
super
+
+ Support::Retrier.retry_on_exception(sleep_interval: 5) do
+ resource = resource_web_url(api_get)
+ populate(:runners_token)
+ resource
+ end
end
def api_get_path
diff --git a/qa/qa/specs/features/browser_ui/5_package/maven_repository_spec.rb b/qa/qa/specs/features/browser_ui/5_package/maven_repository_spec.rb
index 09cc1bf58bc..9c00f1f6d17 100644
--- a/qa/qa/specs/features/browser_ui/5_package/maven_repository_spec.rb
+++ b/qa/qa/specs/features/browser_ui/5_package/maven_repository_spec.rb
@@ -44,7 +44,7 @@ module QA
runner.name = "qa-runner-#{Time.now.to_i}"
runner.tags = ["runner-for-#{project.group.name}"]
runner.executor = :docker
- runner.token = project.group.sandbox.runners_token
+ runner.token = project.group.runners_token
end
end
diff --git a/qa/qa/specs/features/browser_ui/5_package/npm_registry_spec.rb b/qa/qa/specs/features/browser_ui/5_package/npm_registry_spec.rb
index 0f5406bda57..c4bfaacca11 100644
--- a/qa/qa/specs/features/browser_ui/5_package/npm_registry_spec.rb
+++ b/qa/qa/specs/features/browser_ui/5_package/npm_registry_spec.rb
@@ -37,7 +37,7 @@ module QA
runner.name = "qa-runner-#{Time.now.to_i}"
runner.tags = ["runner-for-#{project.group.name}"]
runner.executor = :docker
- runner.token = project.group.sandbox.runners_token
+ runner.token = project.group.runners_token
end
end
diff --git a/qa/qa/specs/features/browser_ui/5_package/nuget_repository_spec.rb b/qa/qa/specs/features/browser_ui/5_package/nuget_repository_spec.rb
index 3db5b9671d9..daf41f1c6ab 100644
--- a/qa/qa/specs/features/browser_ui/5_package/nuget_repository_spec.rb
+++ b/qa/qa/specs/features/browser_ui/5_package/nuget_repository_spec.rb
@@ -31,9 +31,9 @@ module QA
let!(:runner) do
Resource::Runner.fabricate! do |runner|
runner.name = "qa-runner-#{Time.now.to_i}"
- runner.tags = ["runner-for-#{project.group.sandbox.name}"]
+ runner.tags = ["runner-for-#{project.group.name}"]
runner.executor = :docker
- runner.token = project.group.sandbox.runners_token
+ runner.token = project.group.runners_token
end
end
@@ -69,7 +69,7 @@ module QA
only:
- "#{project.default_branch}"
tags:
- - "runner-for-#{project.group.sandbox.name}"
+ - "runner-for-#{project.group.name}"
YAML
}
]
@@ -128,7 +128,7 @@ module QA
only:
- "#{another_project.default_branch}"
tags:
- - "runner-for-#{project.group.sandbox.name}"
+ - "runner-for-#{project.group.name}"
YAML
}
]
@@ -145,7 +145,7 @@ module QA
expect(job).to be_successful(timeout: 800)
end
- project.group.sandbox.visit!
+ project.group.visit!
Page::Group::Menu.perform(&:go_to_group_packages)
diff --git a/spec/controllers/admin/users_controller_spec.rb b/spec/controllers/admin/users_controller_spec.rb
index 722c9c322cc..da57e5f8a92 100644
--- a/spec/controllers/admin/users_controller_spec.rb
+++ b/spec/controllers/admin/users_controller_spec.rb
@@ -651,6 +651,95 @@ RSpec.describe Admin::UsersController do
expect { post :update, params: params }.to change { user.reload.note }.to(note)
end
end
+
+ context 'when updating credit card validation for user account' do
+ let(:params) do
+ {
+ id: user.to_param,
+ user: user_params
+ }
+ end
+
+ shared_examples 'no credit card validation param' do
+ let(:user_params) { { name: 'foo' } }
+
+ it 'does not change credit card validation' do
+ expect { post :update, params: params }.not_to change(Users::CreditCardValidation, :count)
+ end
+ end
+
+ context 'when user has a credit card validation' do
+ before do
+ user.create_credit_card_validation!(credit_card_validated_at: Time.zone.now)
+ end
+
+ context 'with unchecked credit card validation' do
+ let(:user_params) do
+ { credit_card_validation_attributes: { credit_card_validated_at: '0' } }
+ end
+
+ it 'deletes credit_card_validation' do
+ expect { post :update, params: params }.to change { Users::CreditCardValidation.count }.by(-1)
+ end
+ end
+
+ context 'with checked credit card validation' do
+ let(:user_params) do
+ { credit_card_validation_attributes: { credit_card_validated_at: '1' } }
+ end
+
+ it 'does not change credit_card_validated_at' do
+ expect { post :update, params: params }.not_to change { user.credit_card_validated_at }
+ end
+ end
+
+ it_behaves_like 'no credit card validation param'
+ end
+
+ context 'when user does not have a credit card validation' do
+ context 'with checked credit card validation' do
+ let(:user_params) do
+ { credit_card_validation_attributes: { credit_card_validated_at: '1' } }
+ end
+
+ it 'creates new credit card validation' do
+ expect { post :update, params: params }.to change { Users::CreditCardValidation.count }.by 1
+ end
+ end
+
+ context 'with unchecked credit card validation' do
+ let(:user_params) do
+ { credit_card_validation_attributes: { credit_card_validated_at: '0' } }
+ end
+
+ it 'does not blow up' do
+ expect { post :update, params: params }.not_to change(Users::CreditCardValidation, :count)
+ end
+ end
+
+ it_behaves_like 'no credit card validation param'
+ end
+
+ context 'invalid parameters' do
+ let(:user_params) do
+ { credit_card_validation_attributes: { credit_card_validated_at: Time.current.iso8601 } }
+ end
+
+ it_behaves_like 'no credit card validation param'
+ end
+
+ context 'with non permitted params' do
+ let(:user_params) do
+ { credit_card_validation_attributes: { _destroy: true } }
+ end
+
+ before do
+ user.create_credit_card_validation!(credit_card_validated_at: Time.zone.now)
+ end
+
+ it_behaves_like 'no credit card validation param'
+ end
+ end
end
describe "DELETE #remove_email" do
diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb
index e52e26cf148..6f19f3d44b1 100644
--- a/spec/models/user_spec.rb
+++ b/spec/models/user_spec.rb
@@ -4260,45 +4260,16 @@ RSpec.describe User do
end
describe '#invalidate_issue_cache_counts' do
- let_it_be(:user) { create(:user) }
-
- subject do
- user.invalidate_issue_cache_counts
- user.save!
- end
-
- shared_examples 'invalidates the cached value' do
- it 'invalidates cache for issue counter' do
- expect(Rails.cache).to receive(:delete).with(['users', user.id, 'assigned_open_issues_count'])
-
- subject
- end
- end
-
- it_behaves_like 'invalidates the cached value'
-
- context 'if feature flag assigned_open_issues_cache is enabled' do
- it 'calls the recalculate worker' do
- expect(Users::UpdateOpenIssueCountWorker).to receive(:perform_async).with(user.id)
-
- subject
- end
-
- it_behaves_like 'invalidates the cached value'
- end
+ let(:user) { build_stubbed(:user) }
- context 'if feature flag assigned_open_issues_cache is disabled' do
- before do
- stub_feature_flags(assigned_open_issues_cache: false)
- end
+ it 'invalidates cache for issue counter' do
+ cache_mock = double
- it 'does not call the recalculate worker' do
- expect(Users::UpdateOpenIssueCountWorker).not_to receive(:perform_async).with(user.id)
+ expect(cache_mock).to receive(:delete).with(['users', user.id, 'assigned_open_issues_count'])
- subject
- end
+ allow(Rails).to receive(:cache).and_return(cache_mock)
- it_behaves_like 'invalidates the cached value'
+ user.invalidate_issue_cache_counts
end
end
diff --git a/spec/services/users/update_assigned_open_issue_count_service_spec.rb b/spec/services/users/update_assigned_open_issue_count_service_spec.rb
deleted file mode 100644
index 55fc60a7893..00000000000
--- a/spec/services/users/update_assigned_open_issue_count_service_spec.rb
+++ /dev/null
@@ -1,49 +0,0 @@
-# frozen_string_literal: true
-
-require 'spec_helper'
-
-RSpec.describe Users::UpdateAssignedOpenIssueCountService do
- let_it_be(:user) { create(:user) }
-
- describe '#initialize' do
- context 'incorrect arguments provided' do
- it 'raises an error if there are no target user' do
- expect { described_class.new(target_user: nil) }.to raise_error(ArgumentError, /Please provide a target user/)
- expect { described_class.new(target_user: "nonsense") }.to raise_error(ArgumentError, /Please provide a target user/)
- end
- end
-
- context 'when correct arguments provided' do
- it 'is successful' do
- expect { described_class.new(target_user: user) }.not_to raise_error
- end
- end
- end
-
- describe "#execute", :clean_gitlab_redis_cache do
- let(:fake_update_service) { double }
- let(:fake_issue_count_service) { double }
- let(:provided_value) { nil }
-
- subject { described_class.new(target_user: user).execute }
-
- context 'successful' do
- it 'returns a success response' do
- expect(subject).to be_success
- end
-
- it 'writes the cache with the new value' do
- expect(Rails.cache).to receive(:write).with(['users', user.id, 'assigned_open_issues_count'], 0, expires_in: User::COUNT_CACHE_VALIDITY_PERIOD)
-
- subject
- end
-
- it 'calls the issues finder to get the latest value' do
- expect(IssuesFinder).to receive(:new).with(user, assignee_id: user.id, state: 'opened', non_archived: true).and_return(fake_issue_count_service)
- expect(fake_issue_count_service).to receive(:execute)
-
- subject
- end
- end
- end
-end
diff --git a/spec/workers/build_hooks_worker_spec.rb b/spec/workers/build_hooks_worker_spec.rb
index 3628ebc7260..62e1a4fd294 100644
--- a/spec/workers/build_hooks_worker_spec.rb
+++ b/spec/workers/build_hooks_worker_spec.rb
@@ -45,6 +45,5 @@ RSpec.describe BuildHooksWorker do
it_behaves_like 'worker with data consistency',
described_class,
- feature_flag: :load_balancing_for_build_hooks_worker,
data_consistency: :delayed
end
diff --git a/spec/workers/users/update_open_issue_count_worker_spec.rb b/spec/workers/users/update_open_issue_count_worker_spec.rb
deleted file mode 100644
index 700055980d8..00000000000
--- a/spec/workers/users/update_open_issue_count_worker_spec.rb
+++ /dev/null
@@ -1,65 +0,0 @@
-# frozen_string_literal: true
-
-require 'spec_helper'
-
-RSpec.describe Users::UpdateOpenIssueCountWorker do
- let_it_be(:first_user) { create(:user) }
- let_it_be(:second_user) { create(:user) }
-
- describe '#perform' do
- let(:target_user_ids) { [first_user.id, second_user.id] }
-
- subject { described_class.new.perform(target_user_ids) }
-
- context 'when arguments are missing' do
- context 'when target_user_ids are missing' do
- context 'when nil' do
- let(:target_user_ids) { nil }
-
- it 'raises an error' do
- expect { subject }.to raise_error(ArgumentError, /No target user ID provided/)
- end
- end
-
- context 'when empty array' do
- let(:target_user_ids) { [] }
-
- it 'raises an error' do
- expect { subject }.to raise_error(ArgumentError, /No target user ID provided/)
- end
- end
-
- context 'when not an ID' do
- let(:target_user_ids) { "nonsense" }
-
- it 'raises an error' do
- expect { subject }.to raise_error(ArgumentError, /No valid target user ID provided/)
- end
- end
- end
- end
-
- context 'when successful' do
- let(:job_args) { [target_user_ids] }
- let(:fake_service1) { double }
- let(:fake_service2) { double }
-
- it 'calls the user update service' do
- expect(Users::UpdateAssignedOpenIssueCountService).to receive(:new).with(target_user: first_user).and_return(fake_service1)
- expect(Users::UpdateAssignedOpenIssueCountService).to receive(:new).with(target_user: second_user).and_return(fake_service2)
- expect(fake_service1).to receive(:execute)
- expect(fake_service2).to receive(:execute)
-
- subject
- end
-
- it_behaves_like 'an idempotent worker' do
- it 'recalculates' do
- subject
-
- expect(first_user.assigned_open_issues_count).to eq(0)
- end
- end
- end
- end
-end