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

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2023-09-27 12:08:07 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2023-09-27 12:08:07 +0300
commitb6f32e82a08a171debbb57236e8995b8d741e6a5 (patch)
tree44d876d957d94b7bb0e940cce64f96693997fe0f
parent605f9296cc7bb39665ea5d07b7dad9a8eda4c26d (diff)
Add latest changes from gitlab-org/gitlab@master
-rw-r--r--.gitlab/ci/test-on-gdk/main.gitlab-ci.yml2
-rw-r--r--.gitlab/issue_templates/Feature Flag Roll Out.md113
-rw-r--r--GITALY_SERVER_VERSION2
-rw-r--r--Gemfile2
-rw-r--r--Gemfile.checksum2
-rw-r--r--Gemfile.lock4
-rw-r--r--app/assets/javascripts/ref/components/ref_selector.vue16
-rw-r--r--app/assets/javascripts/ref/constants.js2
-rw-r--r--app/workers/all_queues.yml18
-rw-r--r--app/workers/click_house/events_sync_worker.rb1
-rw-r--r--config/sidekiq_queues.yml2
-rw-r--r--db/migrate/20230925024201_add_foreign_key_for_ci_pipelines_pipeline_id_bigint.rb22
-rw-r--r--db/post_migrate/20230926024201_async_validate_foreign_key_for_ci_pipelines_pipeline_id_bigint.rb15
-rw-r--r--db/schema_migrations/202309250242011
-rw-r--r--db/schema_migrations/202309260242011
-rw-r--r--db/structure.sql3
-rw-r--r--doc/administration/settings/import_and_export_settings.md9
-rw-r--r--doc/ci/jobs/ci_job_token.md11
-rw-r--r--doc/development/internal_analytics/service_ping/implement.md6
-rw-r--r--doc/development/internal_analytics/service_ping/usage_data.md69
-rw-r--r--doc/user/project/repository/code_suggestions/index.md7
-rw-r--r--lib/api/helpers.rb7
-rw-r--r--lib/api/merge_requests.rb2
-rw-r--r--lib/api/usage_data.rb1
-rw-r--r--lib/gitlab/internal_events.rb4
-rw-r--r--locale/gitlab.pot9
-rw-r--r--spec/frontend/ref/components/ref_selector_spec.js19
-rw-r--r--spec/lib/api/helpers_spec.rb62
-rw-r--r--spec/lib/gitlab/internal_events_spec.rb10
-rw-r--r--spec/requests/api/merge_requests_spec.rb2
-rw-r--r--spec/requests/api/usage_data_spec.rb2
-rw-r--r--spec/support/shared_examples/services/protected_branches_shared_examples.rb21
-rw-r--r--tooling/danger/analytics_instrumentation.rb2
33 files changed, 257 insertions, 192 deletions
diff --git a/.gitlab/ci/test-on-gdk/main.gitlab-ci.yml b/.gitlab/ci/test-on-gdk/main.gitlab-ci.yml
index 9e179fec458..dc75999ccac 100644
--- a/.gitlab/ci/test-on-gdk/main.gitlab-ci.yml
+++ b/.gitlab/ci/test-on-gdk/main.gitlab-ci.yml
@@ -160,7 +160,7 @@ gdk-qa-reliable:
QA_RUN_TYPE: gdk-qa-blocking
parallel: 10
rules:
- - if: '$CI_MERGE_REQUEST_LABELS =~ /devops::govern/'
+ - if: $CI_MERGE_REQUEST_LABELS =~ /devops::govern|devops::create/
- when: on_success
allow_failure: true
diff --git a/.gitlab/issue_templates/Feature Flag Roll Out.md b/.gitlab/issue_templates/Feature Flag Roll Out.md
index 52041c433fc..50dae8c5b2b 100644
--- a/.gitlab/issue_templates/Feature Flag Roll Out.md
+++ b/.gitlab/issue_templates/Feature Flag Roll Out.md
@@ -18,8 +18,7 @@ that is currently behind the `<feature-flag-name>` feature flag.
## Owners
-- Team: NAME_OF_TEAM
-- Most appropriate slack channel to reach out to: `#g_TEAM_NAME`
+- Most appropriate Slack channel to reach out to: `#g_TEAM_NAME`
- Best individual to reach out to: NAME_OF_DRI
- PM: NAME_OF_PM
@@ -66,80 +65,73 @@ _Consider adding links to check for Sentry errors, Production logs for 5xx, 302s
## Rollout Steps
-Note: Please make sure to run the chatops commands in the slack channel that gets impacted by the command.
+Note: Please make sure to run the chatops commands in the Slack channel that gets impacted by the command.
### Rollout on non-production environments
-- [ ] Verify the MR with the feature flag is merged to master.
-- Verify that the feature MRs have been deployed to non-production environments with:
- - [ ] `/chatops run auto_deploy status <merge-commit-of-your-feature>`
+- Verify the MR with the feature flag is merged to `master` and have been deployed to non-production environments with `/chatops run auto_deploy status <merge-commit-of-your-feature>`
<!-- Delete Incremental roll out if it is not relevant to this deploy -->
-- [ ] Deploy the feature flag at a percentage (recommended percentage: 50%)
- - If the feature flag in code has [an actor](https://docs.gitlab.com/ee/development/feature_flags/#feature-actors), perform **actor-based** rollout.
- - [ ] `/chatops run feature set <feature-flag-name> <rollout-percentage> --actors --dev --staging --staging-ref`
- - [Deprecated] If the feature flag in code does **NOT** have [an actor](https://docs.gitlab.com/ee/development/feature_flags/#feature-actors), perform time-based rollout (**random** rollout).
- - [ ] `/chatops run feature set <feature-flag-name> <rollout-percentage> --random --dev --staging --staging-ref`
- - [ ] Monitor that the error rates did not increase (repeat with a different percentage as necessary)
+- [ ] Deploy the feature flag at a percentage (recommended percentage: 50%) with `/chatops run feature set <feature-flag-name> <rollout-percentage> --actors --dev --staging --staging-ref`
+- [ ] Monitor that the error rates did not increase (repeat with a different percentage as necessary).
<!-- End of block for deletes -->
-- [ ] Enable the feature globally on non-production environments.
- - [ ] `/chatops run feature set <feature-flag-name> true --dev --staging --staging-ref`
- - If the feature flag causes QA end-to-end tests to fail:
- - [ ] Disable the feature flag on staging to avoid blocking [deployments](https://about.gitlab.com/handbook/engineering/deployments-and-releases/deployments/).
+- [ ] Enable the feature globally on non-production environments with `/chatops run feature set <feature-flag-name> true --dev --staging --staging-ref`
+- [ ] Verify that the feature works as expected.
+ The best environment to validate the feature in is [`staging-canary`](https://about.gitlab.com/handbook/engineering/infrastructure/environments/#staging-canary)
+ as this is the first environment deployed to. Make sure you are [configured to use canary](https://next.gitlab.com/).
+- [ ] If the feature flag causes end-to-end tests to fail, disable the feature flag on staging to avoid blocking [deployments](https://about.gitlab.com/handbook/engineering/deployments-and-releases/deployments/).
-- [ ] Verify that the feature works as expected. Posting the QA result in this issue is preferable.
- The best environment to validate the feature in is [staging-canary](https://about.gitlab.com/handbook/engineering/infrastructure/environments/#staging-canary)
- as this is the first environment deployed to. Note you will need to make sure you are configured to use canary as outlined [here](https://about.gitlab.com/handbook/engineering/infrastructure/environments/canary-stage/)
- when accessing the staging environment in order to make sure you are testing appropriately.
-
-For assistance with QA end-to-end test failures, please reach out via the `#quality` Slack channel. Note that QA test failures on staging-ref [don't block deployments](https://about.gitlab.com/handbook/engineering/infrastructure/environments/staging-ref/#how-to-use-staging-ref).
+For assistance with end-to-end test failures, please reach out via the [`#quality` Slack channel](https://gitlab.slack.com/archives/C3JJET4Q6). Note that end-to-end test failures on `staging-ref` [don't block deployments](https://about.gitlab.com/handbook/engineering/infrastructure/environments/staging-ref/#how-to-use-staging-ref).
### Specific rollout on production
-For visibility, all `/chatops` commands that target production should be executed in the `#production` slack channel and cross-posted (with the command results) to the responsible team's slack channel (`#g_TEAM_NAME`).
+For visibility, all `/chatops` commands that target production should be executed in the [`#production` Slack channel](https://gitlab.slack.com/archives/C101F3796)
+and cross-posted (with the command results) to the responsible team's Slack channel (`#g_TEAM_NAME`).
-- Ensure that the feature MRs have been deployed to both production and canary.
- - [ ] `/chatops run auto_deploy status <merge-commit-of-your-feature>`
-- Depending on the [type of actor](https://docs.gitlab.com/ee/development/feature_flags/#feature-actors) you are using, pick one of these options:
- - If you're using **project-actor**, you must enable the feature on these entries:
- - [ ] `/chatops run feature set --project=gitlab-org/gitlab,gitlab-org/gitlab-foss,gitlab-com/www-gitlab-com <feature-flag-name> true`
- - If you're using **group-actor**, you must enable the feature on these entries:
- - [ ] `/chatops run feature set --group=gitlab-org,gitlab-com <feature-flag-name> true`
- - If you're using **user-actor**, you must enable the feature on these entries:
- - [ ] `/chatops run feature set --user=<your-username> <feature-flag-name> true`
-- [ ] Verify that the feature works on the specific entries. Posting the QA result in this issue is preferable.
+- Ensure that the feature MRs have been deployed to both production and canary with `/chatops run auto_deploy status <merge-commit-of-your-feature>`
+- [ ] Depending on the [type of actor](https://docs.gitlab.com/ee/development/feature_flags/#feature-actors) you are using, pick one of these options:
+ - For **project-actor**: `/chatops run feature set --project=gitlab-org/gitlab,gitlab-org/gitlab-foss,gitlab-com/www-gitlab-com <feature-flag-name> true`
+ - For **group-actor**: `/chatops run feature set --group=gitlab-org,gitlab-com <feature-flag-name> true`
+ - For **user-actor**: `/chatops run feature set --user=<your-username> <feature-flag-name> true`
+- [ ] Verify that the feature works for the specific actors.
### Preparation before global rollout
-- [ ] Set a milestone to the rollout issue to signal for enabling and removing the feature flag when it is stable.
+- [ ] Set a milestone to this rollout issue to signal for enabling and removing the feature flag when it is stable.
- [ ] Check if the feature flag change needs to be accompanied with a
[change management issue](https://about.gitlab.com/handbook/engineering/infrastructure/change-management/#feature-flags-and-the-change-management-process).
Cross link the issue here if it does.
- [ ] Ensure that you or a representative in development can be available for at least 2 hours after feature flag updates in production.
If a different developer will be covering, or an exception is needed, please inform the oncall SRE by using the `@sre-oncall` Slack alias.
-- [ ] Ensure that documentation has been updated ([More info](https://docs.gitlab.com/ee/development/documentation/feature_flags.html#features-that-became-enabled-by-default)).
+- [ ] Ensure that [documentation has been updated](https://docs.gitlab.com/ee/development/documentation/feature_flags.html).
- [ ] Leave a comment on [the feature issue][main-issue] announcing estimated time when this feature flag will be enabled on GitLab.com.
- [ ] Ensure that any breaking changes have been announced following the [release post process](https://about.gitlab.com/handbook/marketing/blog/release-posts/#deprecations-removals-and-breaking-changes) to ensure GitLab customers are aware.
-- [ ] Notify `#support_gitlab-com` and your team channel ([more guidance when this is necessary in the dev docs](https://docs.gitlab.com/ee/development/feature_flags/controls.html#communicate-the-change)).
+- [ ] Notify the [`#support_gitlab-com` Slack channel](https://gitlab.slack.com/archives/C4XFU81LG) and your team channel ([more guidance when this is necessary in the dev docs](https://docs.gitlab.com/ee/development/feature_flags/controls.html#communicate-the-change)).
- [ ] Ensure that the feature flag rollout plan is reviewed by another developer familiar with the domain.
### Global rollout on production
-For visibility, all `/chatops` commands that target production should be executed in the `#production` slack channel and cross-posted (with the command results) to the responsible team's slack channel (`#g_TEAM_NAME`).
+For visibility, all `/chatops` commands that target production should be executed in the [`#production` Slack channel](https://gitlab.slack.com/archives/C101F3796)
+and cross-posted (with the command results) to the responsible team's Slack channel (`#g_TEAM_NAME`).
-- [ ] [Incrementally roll out](https://docs.gitlab.com/ee/development/feature_flags/controls.html#process) the feature.
- - [ ] Between every step wait for at least 15 minutes and monitor the appropriate graphs on https://dashboards.gitlab.net.
- - If the feature flag in code has [an actor](https://docs.gitlab.com/ee/development/feature_flags/#feature-actors), perform **actor-based** rollout. For a reference on how to choose the percentages, see [here](https://docs.gitlab.com/ee/development/feature_flags/controls.html#process)
- - [ ] `/chatops run feature set <feature-flag-name> <rollout-percentage> --actors`
- - [Deprecated] If the feature flag in code does **NOT** have [an actor](https://docs.gitlab.com/ee/development/feature_flags/#feature-actors), perform time-based rollout (**random** rollout).
- - [ ] `/chatops run feature set <feature-flag-name> <rollout-percentage> --random`
- - Enable the feature globally on production environment.
- - [ ] `/chatops run feature set <feature-flag-name> true`
+- [ ] (Optional) [Incrementally roll out](https://docs.gitlab.com/ee/development/feature_flags/controls.html#process) the feature on production environment.
+ - Between every step wait for at least 15 minutes and monitor the appropriate graphs on https://dashboards.gitlab.net.
+ - Perform **actor-based** rollout: `/chatops run feature set <feature-flag-name> <rollout-percentage> --actors`
+- [ ] Enable the feature globally on production environment: `/chatops run feature set <feature-flag-name> true`
- [ ] Observe appropriate graphs on https://dashboards.gitlab.net and verify that services are not affected.
- [ ] Leave a comment on [the feature issue][main-issue] announcing that the feature has been globally enabled.
- [ ] Wait for [at least one day for the verification term](https://about.gitlab.com/handbook/product-development-flow/feature-flag-lifecycle/#including-a-feature-behind-feature-flag-in-the-final-release).
### (Optional) Release the feature with the feature flag
+**WARNING:** This approach has the downside that it makes it difficult for us to
+[clean up](https://docs.gitlab.com/ee/development/feature_flags/controls.html#cleaning-up) the flag.
+For example, on-premise users could disable the feature on their GitLab instance. But when you
+remove the flag at some point, they suddenly see the feature as enabled and they can't roll it back
+to the previous behavior. To avoid this potential breaking change, use this approach only for urgent
+matters.
+
+<details><summary>See instructions if you're sure about enabling the feature globally through the feature flag definition</summary>
+
If you're still unsure whether the feature is [deemed stable](https://about.gitlab.com/handbook/product-development-flow/feature-flag-lifecycle/#including-a-feature-behind-feature-flag-in-the-final-release)
but want to release it in the current milestone, you can change the default state of the feature flag to be enabled.
To do so, follow these steps:
@@ -149,10 +141,8 @@ To do so, follow these steps:
- [ ] Review [what warrants a changelog entry](https://docs.gitlab.com/ee/development/changelog.html#what-warrants-a-changelog-entry) and decide if [a changelog entry](https://docs.gitlab.com/ee/development/feature_flags/#changelog) is needed.
- [ ] Ensure that the default-enabling MR has been included in the release package.
If the merge request was deployed before [the monthly release was tagged](https://about.gitlab.com/handbook/engineering/releases/#self-managed-releases-1),
- the feature can be officially announced in a release blog post.
- - [ ] `/chatops run release check <merge-request-url> <milestone>`
-- [ ] Consider cleaning up the feature flag from all environments by running these chatops command in `#production` channel. Otherwise these settings may override the default enabled.
- - [ ] `/chatops run feature delete <feature-flag-name> --dev --staging --staging-ref --production`
+ the feature can be officially announced in a release blog post: `/chatops run release check <merge-request-url> <milestone>`
+- [ ] Consider cleaning up the feature flag from all environments by running these chatops command in `#production` channel. Otherwise these settings may override the default enabled: `/chatops run feature delete <feature-flag-name> --dev --staging --staging-ref --production`
- [ ] Close [the feature issue][main-issue] to indicate the feature will be released in the current milestone.
- [ ] Set the next milestone to this rollout issue for scheduling [the flag removal](#release-the-feature).
- [ ] (Optional) You can [create a separate issue](https://gitlab.com/gitlab-org/gitlab/-/issues/new?issuable_template=Feature%20Flag%20Cleanup) for scheduling the steps below to [Release the feature](#release-the-feature).
@@ -161,12 +151,7 @@ To do so, follow these steps:
- [ ] Link this rollout issue as a related issue.
- [ ] Close this rollout issue.
-**WARNING:** This approach has the downside that it makes it difficult for us to
-[clean up](https://docs.gitlab.com/ee/development/feature_flags/controls.html#cleaning-up) the flag.
-For example, on-premise users could disable the feature on their GitLab instance. But when you
-remove the flag at some point, they suddenly see the feature as enabled and they can't roll it back
-to the previous behavior. To avoid this potential breaking change, use this approach only for urgent
-matters.
+</details>
### Release the feature
@@ -178,17 +163,15 @@ codebase.
You can either [create a follow-up issue for Feature Flag Cleanup](https://gitlab.com/gitlab-org/gitlab/-/issues/new?issuable_template=Feature%20Flag%20Cleanup) or use the checklist below in this same issue.
<!-- The checklist here is to help stakeholders keep track of the feature flag status -->
-- [ ] Create a merge request to remove `<feature-flag-name>` feature flag. Ask for review and merge it.
- - [ ] Remove all references to the feature flag from the codebase.
- - [ ] Remove the YAML definitions for the feature from the repository.
- - [ ] Create [a changelog entry](https://docs.gitlab.com/ee/development/feature_flags/#changelog).
+- [ ] Create a merge request to remove the `<feature-flag-name>` feature flag. Ask for review/approval/merge as usual. The MR should include the following changes:
+ - Remove all references to the feature flag from the codebase.
+ - Remove the YAML definitions for the feature from the repository.
+ - Create [a changelog entry](https://docs.gitlab.com/ee/development/feature_flags/#changelog).
- [ ] Ensure that the cleanup MR has been included in the release package.
If the merge request was deployed before [the monthly release was tagged](https://about.gitlab.com/handbook/engineering/releases/#self-managed-releases-1),
- the feature can be officially announced in a release blog post.
- - [ ] `/chatops run release check <merge-request-url> <milestone>`
+ the feature can be officially announced in a release blog post: `/chatops run release check <merge-request-url> <milestone>`
- [ ] Close [the feature issue][main-issue] to indicate the feature will be released in the current milestone.
-- [ ] Clean up the feature flag from all environments by running these chatops command in `#production` channel:
- - [ ] `/chatops run feature delete <feature-flag-name> --dev --staging --staging-ref --production`
+- [ ] Clean up the feature flag from all environments by running these chatops command in `#production` channel: `/chatops run feature delete <feature-flag-name> --dev --staging --staging-ref --production`
- [ ] Close this rollout issue.
## Rollback Steps
@@ -210,8 +193,6 @@ Template placeholders
description: the URL of the issue introducing the feature flag
- name: <feature-flag-name>
description: the feature flag name
-- name: NAME_OF_TEAM
- description: the label of the responsible team, e.g. group::foo
- name: #g_TEAM_NAME
description: the Slack channel name of the responsible team, e.g. #g_foo
- name: NAME_OF_DRI
@@ -225,4 +206,4 @@ Template placeholders
/label ~group::
/label ~"feature flag"
/assign me
-/due in 1 month
+/due in 2 weeks
diff --git a/GITALY_SERVER_VERSION b/GITALY_SERVER_VERSION
index d74f67e7d3b..e8408e278c6 100644
--- a/GITALY_SERVER_VERSION
+++ b/GITALY_SERVER_VERSION
@@ -1 +1 @@
-0d02e2dfdd429b7c5cda79c8f2af1132566ade65
+b7074c08d5e57806fda21f77dec30185db6043a1
diff --git a/Gemfile b/Gemfile
index 8d02c67f3a2..6dcdb41a3b8 100644
--- a/Gemfile
+++ b/Gemfile
@@ -188,7 +188,7 @@ gem 'elasticsearch-rails', '~> 7.2', require: 'elasticsearch/rails/instrumentati
gem 'elasticsearch-api', '7.13.3'
gem 'aws-sdk-core', '~> 3.183.1'
gem 'aws-sdk-cloudformation', '~> 1'
-gem 'aws-sdk-s3', '~> 1.135.0'
+gem 'aws-sdk-s3', '~> 1.136.0'
gem 'faraday_middleware-aws-sigv4', '~>0.3.0'
gem 'typhoeus', '~> 1.4.0' # Used with Elasticsearch to support http keep-alive connections
diff --git a/Gemfile.checksum b/Gemfile.checksum
index 2d18ec81893..b359c8c28b9 100644
--- a/Gemfile.checksum
+++ b/Gemfile.checksum
@@ -38,7 +38,7 @@
{"name":"aws-sdk-cloudformation","version":"1.41.0","platform":"ruby","checksum":"31e47539719734413671edf9b1a31f8673fbf9688549f50c41affabbcb1c6b26"},
{"name":"aws-sdk-core","version":"3.183.1","platform":"ruby","checksum":"3c99995d39b821fba06f3f9e328e974ef81ba6488ff7348913891c825e4655ed"},
{"name":"aws-sdk-kms","version":"1.64.0","platform":"ruby","checksum":"40de596c95047bfc6e1aacea24f3df6241aa716b6f7ce08ac4c5f7e3120395ad"},
-{"name":"aws-sdk-s3","version":"1.135.0","platform":"ruby","checksum":"80507daf642d04fbd9311e5804ec37201901293b474737400982f77efc36116b"},
+{"name":"aws-sdk-s3","version":"1.136.0","platform":"ruby","checksum":"3547302a85d51de6cc75b48fb37d328f65f6526e7fc73a27a5b1b871f99a8d63"},
{"name":"aws-sigv4","version":"1.6.0","platform":"ruby","checksum":"ca9e6a15cd424f1f32b524b9760995331459bc22e67d3daad4fcf0c0084b087d"},
{"name":"axe-core-api","version":"4.6.0","platform":"ruby","checksum":"1b0ddec3353f108dc10363baf2282f43a5ff7f13d4e25f99071294e78f8a6c62"},
{"name":"axe-core-rspec","version":"4.6.0","platform":"ruby","checksum":"11c25bc9dd388c137ba4e5e63d64d20092bf22c884d8ffc829a22acfbacd747f"},
diff --git a/Gemfile.lock b/Gemfile.lock
index f463a80e50d..dadb5b7996e 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -278,7 +278,7 @@ GEM
aws-sdk-kms (1.64.0)
aws-sdk-core (~> 3, >= 3.165.0)
aws-sigv4 (~> 1.1)
- aws-sdk-s3 (1.135.0)
+ aws-sdk-s3 (1.136.0)
aws-sdk-core (~> 3, >= 3.181.0)
aws-sdk-kms (~> 1)
aws-sigv4 (~> 1.6)
@@ -1747,7 +1747,7 @@ DEPENDENCIES
awesome_print
aws-sdk-cloudformation (~> 1)
aws-sdk-core (~> 3.183.1)
- aws-sdk-s3 (~> 1.135.0)
+ aws-sdk-s3 (~> 1.136.0)
axe-core-rspec
babosa (~> 2.0)
base32 (~> 0.3.0)
diff --git a/app/assets/javascripts/ref/components/ref_selector.vue b/app/assets/javascripts/ref/components/ref_selector.vue
index e5f5800c99c..ed9fd521e67 100644
--- a/app/assets/javascripts/ref/components/ref_selector.vue
+++ b/app/assets/javascripts/ref/components/ref_selector.vue
@@ -11,6 +11,10 @@ import {
REF_TYPE_BRANCHES,
REF_TYPE_TAGS,
REF_TYPE_COMMITS,
+ TAG_REF_TYPE,
+ BRANCH_REF_TYPE,
+ TAG_REF_TYPE_ICON,
+ BRANCH_REF_TYPE_ICON,
} from '../constants';
import createStore from '../stores';
import { formatListBoxItems, formatErrors } from '../format_refs';
@@ -159,6 +163,17 @@ export default {
})
: this.i18n.noResults;
},
+ dropdownIcon() {
+ let icon;
+
+ if (this.selectedRef.includes(`refs/${TAG_REF_TYPE}`)) {
+ icon = TAG_REF_TYPE_ICON;
+ } else if (this.selectedRef.includes(`refs/${BRANCH_REF_TYPE}`)) {
+ icon = BRANCH_REF_TYPE_ICON;
+ }
+
+ return icon;
+ },
},
watch: {
// Keep the Vuex store synchronized if the parent
@@ -246,6 +261,7 @@ export default {
:search-placeholder="i18n.searchPlaceholder"
:toggle-class="extendedToggleButtonClass"
:toggle-text="buttonText"
+ :icon="dropdownIcon"
v-bind="$attrs"
v-on="$listeners"
@hidden="$emit('hide')"
diff --git a/app/assets/javascripts/ref/constants.js b/app/assets/javascripts/ref/constants.js
index 4b5b18cf6c1..7699c4fd863 100644
--- a/app/assets/javascripts/ref/constants.js
+++ b/app/assets/javascripts/ref/constants.js
@@ -7,6 +7,8 @@ export const REF_TYPE_COMMITS = 'REF_TYPE_COMMITS';
export const ALL_REF_TYPES = Object.freeze([REF_TYPE_BRANCHES, REF_TYPE_TAGS, REF_TYPE_COMMITS]);
export const BRANCH_REF_TYPE = 'heads';
export const TAG_REF_TYPE = 'tags';
+export const TAG_REF_TYPE_ICON = 'tag';
+export const BRANCH_REF_TYPE_ICON = 'branch';
export const X_TOTAL_HEADER = 'x-total';
diff --git a/app/workers/all_queues.yml b/app/workers/all_queues.yml
index 12c6fb3c0d2..4932e0f0f74 100644
--- a/app/workers/all_queues.yml
+++ b/app/workers/all_queues.yml
@@ -327,6 +327,15 @@
:weight: 1
:idempotent: false
:tags: []
+- :name: cronjob:click_house_events_sync
+ :worker_name: ClickHouse::EventsSyncWorker
+ :feature_category: :value_stream_management
+ :has_external_dependencies: true
+ :urgency: :low
+ :resource_boundary: :unknown
+ :weight: 1
+ :idempotent: true
+ :tags: []
- :name: cronjob:container_expiration_policy
:worker_name: ContainerExpirationPolicyWorker
:feature_category: :container_registry
@@ -2685,15 +2694,6 @@
:weight: 1
:idempotent: true
:tags: []
-- :name: click_house_events_sync
- :worker_name: ClickHouse::EventsSyncWorker
- :feature_category: :value_stream_management
- :has_external_dependencies: true
- :urgency: :low
- :resource_boundary: :unknown
- :weight: 1
- :idempotent: true
- :tags: []
- :name: counters_cleanup_refresh
:worker_name: Counters::CleanupRefreshWorker
:feature_category: :not_owned
diff --git a/app/workers/click_house/events_sync_worker.rb b/app/workers/click_house/events_sync_worker.rb
index 5b7398cb071..e884a43b1e3 100644
--- a/app/workers/click_house/events_sync_worker.rb
+++ b/app/workers/click_house/events_sync_worker.rb
@@ -6,6 +6,7 @@ module ClickHouse
include Gitlab::ExclusiveLeaseHelpers
idempotent!
+ queue_namespace :cronjob
data_consistency :delayed
worker_has_external_dependencies! # the worker interacts with a ClickHouse database
feature_category :value_stream_management
diff --git a/config/sidekiq_queues.yml b/config/sidekiq_queues.yml
index 065e970dfd1..5854c60b351 100644
--- a/config/sidekiq_queues.yml
+++ b/config/sidekiq_queues.yml
@@ -161,8 +161,6 @@
- 1
- - ci_upstream_projects_subscriptions_cleanup
- 1
-- - click_house_events_sync
- - 1
- - cluster_agent
- 1
- - compliance_management_chain_of_custody_report
diff --git a/db/migrate/20230925024201_add_foreign_key_for_ci_pipelines_pipeline_id_bigint.rb b/db/migrate/20230925024201_add_foreign_key_for_ci_pipelines_pipeline_id_bigint.rb
new file mode 100644
index 00000000000..f28dc9ec335
--- /dev/null
+++ b/db/migrate/20230925024201_add_foreign_key_for_ci_pipelines_pipeline_id_bigint.rb
@@ -0,0 +1,22 @@
+# frozen_string_literal: true
+
+class AddForeignKeyForCiPipelinesPipelineIdBigint < Gitlab::Database::Migration[2.1]
+ TABLE_NAME = :ci_pipelines
+ REFERENCING_TABLE_NAME = :ci_pipelines
+ COLUMN_NAME = :auto_canceled_by_id_convert_to_bigint
+
+ disable_ddl_transaction!
+
+ def up
+ add_concurrent_foreign_key(
+ TABLE_NAME, REFERENCING_TABLE_NAME,
+ column: COLUMN_NAME, on_delete: :nullify, validate: false, reverse_lock_order: true
+ )
+ end
+
+ def down
+ with_lock_retries do
+ remove_foreign_key_if_exists TABLE_NAME, column: COLUMN_NAME
+ end
+ end
+end
diff --git a/db/post_migrate/20230926024201_async_validate_foreign_key_for_ci_pipelines_pipeline_id_bigint.rb b/db/post_migrate/20230926024201_async_validate_foreign_key_for_ci_pipelines_pipeline_id_bigint.rb
new file mode 100644
index 00000000000..32c193b5b3f
--- /dev/null
+++ b/db/post_migrate/20230926024201_async_validate_foreign_key_for_ci_pipelines_pipeline_id_bigint.rb
@@ -0,0 +1,15 @@
+# frozen_string_literal: true
+
+class AsyncValidateForeignKeyForCiPipelinesPipelineIdBigint < Gitlab::Database::Migration[2.1]
+ TABLE_NAME = :ci_pipelines
+ COLUMN_NAME = :auto_canceled_by_id_convert_to_bigint
+ FK_NAME = :fk_67e4288f3a
+
+ def up
+ prepare_async_foreign_key_validation TABLE_NAME, COLUMN_NAME, name: FK_NAME
+ end
+
+ def down
+ unprepare_async_foreign_key_validation TABLE_NAME, COLUMN_NAME, name: FK_NAME
+ end
+end
diff --git a/db/schema_migrations/20230925024201 b/db/schema_migrations/20230925024201
new file mode 100644
index 00000000000..8ff937935a4
--- /dev/null
+++ b/db/schema_migrations/20230925024201
@@ -0,0 +1 @@
+b092d4d11d0bfc4a7d20328ed6184e247b94cebe74db9f55586a8cc5eb76616d \ No newline at end of file
diff --git a/db/schema_migrations/20230926024201 b/db/schema_migrations/20230926024201
new file mode 100644
index 00000000000..7719c2d2f59
--- /dev/null
+++ b/db/schema_migrations/20230926024201
@@ -0,0 +1 @@
+5d1f9f29f61306de9f57176e9649ff5f29cfb7f66a803295133ee896c1cc17e1 \ No newline at end of file
diff --git a/db/structure.sql b/db/structure.sql
index 97144891aad..33aca5c85ef 100644
--- a/db/structure.sql
+++ b/db/structure.sql
@@ -36814,6 +36814,9 @@ ALTER TABLE ONLY merge_requests
ALTER TABLE p_ci_builds
ADD CONSTRAINT fk_6661f4f0e8 FOREIGN KEY (resource_group_id) REFERENCES ci_resource_groups(id) ON DELETE SET NULL;
+ALTER TABLE ONLY ci_pipelines
+ ADD CONSTRAINT fk_67e4288f3a FOREIGN KEY (auto_canceled_by_id_convert_to_bigint) REFERENCES ci_pipelines(id) ON DELETE SET NULL NOT VALID;
+
ALTER TABLE ONLY merge_requests
ADD CONSTRAINT fk_6a5165a692 FOREIGN KEY (milestone_id) REFERENCES milestones(id) ON DELETE SET NULL;
diff --git a/doc/administration/settings/import_and_export_settings.md b/doc/administration/settings/import_and_export_settings.md
index 343bc08c801..2a0ec96bd2f 100644
--- a/doc/administration/settings/import_and_export_settings.md
+++ b/doc/administration/settings/import_and_export_settings.md
@@ -36,13 +36,16 @@ To enable the export of
1. Select the **Enabled** checkbox.
1. Select **Save changes**.
-## Enable migration of groups and projects by direct transfer
+## Enable migration of groups and projects by direct transfer **(BETA)**
> [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/383268) in GitLab 15.8.
-You can enable migration of groups by direct transfer using the UI.
+WARNING:
+This feature is in [Beta](../../policy/experiment-beta-support.md#beta) and subject to change without notice.
+The feature is not ready for production use.
-To enable migration of groups by direct transfer:
+Migration of groups and projects by direct transfer is disabled by default.
+To enable migration of groups and projects by direct transfer:
1. Sign in to GitLab as a user with Administrator access level.
1. On the left sidebar, select **Search or go to**.
diff --git a/doc/ci/jobs/ci_job_token.md b/doc/ci/jobs/ci_job_token.md
index 8453c413015..a335794b209 100644
--- a/doc/ci/jobs/ci_job_token.md
+++ b/doc/ci/jobs/ci_job_token.md
@@ -73,6 +73,12 @@ to access specific private resources. The job token scope only controls access
to private projects. If an accessed project is public or internal, token scoping does
not apply.
+When enabled, and the job token is being used to access a different project:
+
+- The user that executes the job must be a member of the project that is being accessed.
+- The user must have the [permissions](../../user/permissions.md) to perform the action.
+- The accessed project must have the project attempting to access it [added to the allowlist](#add-a-project-to-the-job-token-scope-allowlist).
+
If a job token is leaked, it could potentially be used to access private data
to the job token's user. By limiting the job token access scope, private data cannot
be accessed unless projects are explicitly authorized.
@@ -255,10 +261,5 @@ While troubleshooting CI/CD job token authentication issues, be aware that:
- Enable the inbound token access scope.
- Give access to project B from project A, or add B to A's allowlist.
- To remove project access.
-- When the [CI/CD job token scopes](#configure-cicd-job-token-access) are enabled,
- and the job token is being used to access a different project:
- - The user that executes the job must be a member of the project that is being accessed.
- - The user must have the [permissions](../../user/permissions.md) to perform the action.
- - The accessed project must have the project attempting to access it [added to the allowlist](#add-a-project-to-the-job-token-scope-allowlist).
- The CI job token becomes invalid if the job is no longer running, has been erased,
or if the project is in the process of being deleted.
diff --git a/doc/development/internal_analytics/service_ping/implement.md b/doc/development/internal_analytics/service_ping/implement.md
index ae8c624a47c..d00934f6069 100644
--- a/doc/development/internal_analytics/service_ping/implement.md
+++ b/doc/development/internal_analytics/service_ping/implement.md
@@ -80,7 +80,7 @@ add_metric('CountIssuesMetric', time_frame: 'all')
Examples:
-Examples using `usage_data.rb` have been [deprecated](usage_data.md). We recommend to use [instrumentation classes](metrics_instrumentation.md).
+Examples using `usage_data.rb` have been deprecated. We recommend to use [instrumentation classes](metrics_instrumentation.md).
#### Distinct batch counters
@@ -97,7 +97,7 @@ Counting over non-unique columns can lead to performance issues. For more inform
Examples:
-Examples using `usage_data.rb` have been [deprecated](usage_data.md). We recommend to use [instrumentation classes](metrics_instrumentation.md).
+Examples using `usage_data.rb` have been deprecated. We recommend to use [instrumentation classes](metrics_instrumentation.md).
#### Sum batch operation
@@ -122,7 +122,7 @@ add_metric('CountIssuesWeightAverageMetric')
Examples:
-Examples using `usage_data.rb` have been [deprecated](usage_data.md). We recommend to use [instrumentation classes](metrics_instrumentation.md).
+Examples using `usage_data.rb` have been deprecated. We recommend to use [instrumentation classes](metrics_instrumentation.md).
#### Grouping and batch operations
diff --git a/doc/development/internal_analytics/service_ping/usage_data.md b/doc/development/internal_analytics/service_ping/usage_data.md
deleted file mode 100644
index 8742bc03fbb..00000000000
--- a/doc/development/internal_analytics/service_ping/usage_data.md
+++ /dev/null
@@ -1,69 +0,0 @@
----
-stage: Analyze
-group: Analytics Instrumentation
-info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/product/ux/technical-writing/#assignments
----
-
-# Usage Data Metrics guide
-
-This guide describes deprecated usage for metrics in `usage_data.rb`.
-
-NOTE:
-Implementing metrics direct in `usage_data.rb` is deprecated, We recommend you use [instrumentation classes](metrics_instrumentation.md).
-
-## Ordinary batch counters
-
-Simple count of a given `ActiveRecord_Relation`, does a non-distinct batch count, smartly reduces `batch_size`, and handles errors.
-Handles the `ActiveRecord::StatementInvalid` error.
-
-Method:
-
-```ruby
-count(relation, column = nil, batch: true, start: nil, finish: nil)
-```
-
-Arguments:
-
-- `relation` the ActiveRecord_Relation to perform the count
-- `column` the column to perform the count on, by default is the primary key
-- `batch`: default `true` to use batch counting
-- `start`: custom start of the batch counting to avoid complex min calculations
-- `end`: custom end of the batch counting to avoid complex min calculations
-
-Examples:
-
-```ruby
-count(User.active)
-count(::Clusters::Cluster.aws_installed.enabled, :cluster_id)
-count(::Clusters::Cluster.aws_installed.enabled, :cluster_id, start: ::Clusters::Cluster.minimum(:id), finish: ::Clusters::Cluster.maximum(:id))
-```
-
-## Distinct batch counters
-
-Distinct count of a given `ActiveRecord_Relation` on given column, a distinct batch count, smartly reduces `batch_size`, and handles errors.
-Handles the `ActiveRecord::StatementInvalid` error.
-
-Method:
-
-```ruby
-distinct_count(relation, column = nil, batch: true, batch_size: nil, start: nil, finish: nil)
-```
-
-Arguments:
-
-- `relation`: the ActiveRecord_Relation to perform the count
-- `column`: the column to perform the distinct count, by default is the primary key
-- `batch`: default `true` to use batch counting
-- `batch_size`: if none set it uses default value 10000 from `Gitlab::Database::BatchCounter`
-- `start`: custom start of the batch counting to avoid complex min calculations
-- `end`: custom end of the batch counting to avoid complex min calculations
-
-WARNING:
-Counting over non-unique columns can lead to performance issues. For more information, see the [iterating tables in batches](../../database/iterating_tables_in_batches.md) guide.
-
-Examples:
-
-```ruby
-distinct_count(::Project, :creator_id)
-distinct_count(::Note.with_suggestions.where(time_period), :author_id, start: ::User.minimum(:id), finish: ::User.maximum(:id))
-```
diff --git a/doc/user/project/repository/code_suggestions/index.md b/doc/user/project/repository/code_suggestions/index.md
index 4f0c0b2c9a6..b957313fb35 100644
--- a/doc/user/project/repository/code_suggestions/index.md
+++ b/doc/user/project/repository/code_suggestions/index.md
@@ -22,13 +22,6 @@ GitLab Duo Code Suggestions are available:
- In VS Code, Microsoft Visual Studio, JetBrains IDEs, and Neovim. You must have the corresponding GitLab extension installed.
- In the GitLab WebIDE.
-<div class="video-fallback">
- <a href="https://www.youtube.com/watch?v=WnxBYxN2-p4">View an end-to-end demo of Code Suggestions in VS Code</a>.
-</div>
-<figure class="video-container">
- <iframe src="https://www.youtube-nocookie.com/embed/WnxBYxN2-p4" frameborder="0" allowfullscreen> </iframe>
-</figure>
-
Usage of Code Suggestions is governed by the [GitLab Testing Agreement](https://about.gitlab.com/handbook/legal/testing-agreement/).
Learn about [data usage when using Code Suggestions](#code-suggestions-data-usage).
diff --git a/lib/api/helpers.rb b/lib/api/helpers.rb
index 3bbc1d71852..db08bc6c63a 100644
--- a/lib/api/helpers.rb
+++ b/lib/api/helpers.rb
@@ -462,8 +462,8 @@ module API
items.search(text)
end
- def order_options_with_tie_breaker
- order_by = if params[:order_by] == 'created_at'
+ def order_options_with_tie_breaker(override_created_at: true)
+ order_by = if params[:order_by] == 'created_at' && override_created_at
'id'
else
params[:order_by]
@@ -700,7 +700,7 @@ module API
Gitlab::AppLogger.warn("Redis tracking event failed for event: #{event_name}, message: #{error.message}")
end
- def track_event(event_name, user:, namespace_id: nil, project_id: nil)
+ def track_event(event_name, user:, send_snowplow_event: true, namespace_id: nil, project_id: nil)
return unless user.present?
namespace = Namespace.find(namespace_id) if namespace_id
@@ -708,6 +708,7 @@ module API
Gitlab::InternalEvents.track_event(
event_name,
+ send_snowplow_event: send_snowplow_event,
user: user,
namespace: namespace,
project: project
diff --git a/lib/api/merge_requests.rb b/lib/api/merge_requests.rb
index 6b67e3aba19..11f25599be5 100644
--- a/lib/api/merge_requests.rb
+++ b/lib/api/merge_requests.rb
@@ -69,7 +69,7 @@ module API
args[:scope] = args[:scope].underscore if args[:scope]
merge_requests = MergeRequestsFinder.new(current_user, args).execute
- .reorder(order_options_with_tie_breaker)
+ .reorder(order_options_with_tie_breaker(override_created_at: false))
merge_requests = paginate(merge_requests)
.preload(:source_project, :target_project)
diff --git a/lib/api/usage_data.rb b/lib/api/usage_data.rb
index a228aa1c45a..0d1c6cb2281 100644
--- a/lib/api/usage_data.rb
+++ b/lib/api/usage_data.rb
@@ -77,6 +77,7 @@ module API
track_event(
event_name,
+ send_snowplow_event: false,
user: current_user,
namespace_id: namespace_id,
project_id: project_id
diff --git a/lib/gitlab/internal_events.rb b/lib/gitlab/internal_events.rb
index 27e8d2ca3a3..2790bc8ee24 100644
--- a/lib/gitlab/internal_events.rb
+++ b/lib/gitlab/internal_events.rb
@@ -9,12 +9,12 @@ module Gitlab
class << self
include Gitlab::Tracking::Helpers
- def track_event(event_name, **kwargs)
+ def track_event(event_name, send_snowplow_event: true, **kwargs)
raise UnknownEventError, "Unknown event: #{event_name}" unless EventDefinitions.known_event?(event_name)
increase_total_counter(event_name)
update_unique_counter(event_name, kwargs)
- trigger_snowplow_event(event_name, kwargs)
+ trigger_snowplow_event(event_name, kwargs) if send_snowplow_event
rescue StandardError => e
Gitlab::ErrorTracking.track_and_raise_for_dev_exception(e, event_name: event_name, kwargs: kwargs)
nil
diff --git a/locale/gitlab.pot b/locale/gitlab.pot
index e0cfd7e299f..a928d0f5e00 100644
--- a/locale/gitlab.pot
+++ b/locale/gitlab.pot
@@ -40715,6 +40715,9 @@ msgstr ""
msgid "Runners|No description"
msgstr ""
+msgid "Runners|No jobs have been run by instance runners in the past 3 hours."
+msgstr ""
+
msgid "Runners|No results found"
msgstr ""
@@ -41104,6 +41107,9 @@ msgstr ""
msgid "Runners|Token expiry"
msgstr ""
+msgid "Runners|UTC Time"
+msgstr ""
+
msgid "Runners|Understand how long it takes for runners to pick up a job. %{linkStart}How is this calculated?%{linkEnd}"
msgstr ""
@@ -41155,6 +41161,9 @@ msgstr ""
msgid "Runners|View metrics"
msgstr ""
+msgid "Runners|Wait time (secs)"
+msgstr ""
+
msgid "Runners|Wait time to pick a job"
msgstr ""
diff --git a/spec/frontend/ref/components/ref_selector_spec.js b/spec/frontend/ref/components/ref_selector_spec.js
index 12ca0d053e9..26010a1cfa6 100644
--- a/spec/frontend/ref/components/ref_selector_spec.js
+++ b/spec/frontend/ref/components/ref_selector_spec.js
@@ -23,13 +23,17 @@ import {
REF_TYPE_BRANCHES,
REF_TYPE_TAGS,
REF_TYPE_COMMITS,
+ BRANCH_REF_TYPE_ICON,
+ TAG_REF_TYPE_ICON,
} from '~/ref/constants';
import createStore from '~/ref/stores/';
Vue.use(Vuex);
describe('Ref selector component', () => {
- const fixtures = { branches, tags, commit };
+ const branchRefTypeMock = { name: 'refs/heads/test_branch' };
+ const tagRefTypeMock = { name: 'refs/tags/test_tag' };
+ const fixtures = { branches: [branchRefTypeMock, tagRefTypeMock, ...branches], tags, commit };
const projectId = '8';
const totalBranchesCount = 123;
@@ -614,6 +618,19 @@ describe('Ref selector component', () => {
});
it.each`
+ selectedBranch | icon
+ ${branchRefTypeMock.name} | ${BRANCH_REF_TYPE_ICON}
+ ${tagRefTypeMock.name} | ${TAG_REF_TYPE_ICON}
+ ${branches[0].name} | ${''}
+ `('renders the correct icon for the selected ref', async ({ selectedBranch, icon }) => {
+ createComponent();
+ findListbox().vm.$emit('select', selectedBranch);
+ await nextTick();
+
+ expect(findListbox().props('icon')).toBe(icon);
+ });
+
+ it.each`
enabledRefType | findVisibleSection | findHiddenSections
${REF_TYPE_BRANCHES} | ${findBranchesSection} | ${[findTagsSection, findCommitsSection]}
${REF_TYPE_TAGS} | ${findTagsSection} | ${[findBranchesSection, findCommitsSection]}
diff --git a/spec/lib/api/helpers_spec.rb b/spec/lib/api/helpers_spec.rb
index 9e7e174f4f0..5d343ec2777 100644
--- a/spec/lib/api/helpers_spec.rb
+++ b/spec/lib/api/helpers_spec.rb
@@ -782,12 +782,34 @@ RSpec.describe API::Helpers, feature_category: :shared do
it 'tracks internal event' do
expect(Gitlab::InternalEvents).to receive(:track_event).with(
event_name,
+ send_snowplow_event: true,
user: user,
namespace: namespace,
project: project
)
- helper.track_event(event_name, user: user, namespace_id: namespace.id, project_id: project.id)
+ helper.track_event(event_name,
+ user: user,
+ namespace_id: namespace.id,
+ project_id: project.id
+ )
+ end
+
+ it 'passes send_snowplow_event on to InternalEvents.track_event' do
+ expect(Gitlab::InternalEvents).to receive(:track_event).with(
+ event_name,
+ send_snowplow_event: false,
+ user: user,
+ namespace: namespace,
+ project: project
+ )
+
+ helper.track_event(event_name,
+ send_snowplow_event: false,
+ user: user,
+ namespace_id: namespace.id,
+ project_id: project.id
+ )
end
it 'logs an exception for unknown event' do
@@ -798,18 +820,28 @@ RSpec.describe API::Helpers, feature_category: :shared do
event_name: unknown_event
)
- helper.track_event(unknown_event, user: user, namespace_id: namespace.id, project_id: project.id)
+ helper.track_event(unknown_event,
+ user: user,
+ namespace_id: namespace.id,
+ project_id: project.id
+ )
end
it 'does not track event for nil user' do
expect(Gitlab::InternalEvents).not_to receive(:track_event)
- helper.track_event(unknown_event, user: nil, namespace_id: namespace.id, project_id: project.id)
+ helper.track_event(unknown_event,
+ user: nil,
+ namespace_id: namespace.id,
+ project_id: project.id
+ )
end
end
shared_examples '#order_options_with_tie_breaker' do
- subject { Class.new.include(described_class).new.order_options_with_tie_breaker }
+ subject { Class.new.include(described_class).new.order_options_with_tie_breaker(**reorder_params) }
+
+ let(:reorder_params) { {} }
before do
allow_any_instance_of(described_class).to receive(:params).and_return(params)
@@ -853,11 +885,25 @@ RSpec.describe API::Helpers, feature_category: :shared do
describe '#order_options_with_tie_breaker' do
include_examples '#order_options_with_tie_breaker'
- context 'with created_at order given' do
- let(:params) { { order_by: 'created_at', sort: 'asc' } }
+ context 'by default' do
+ context 'with created_at order given' do
+ let(:params) { { order_by: 'created_at', sort: 'asc' } }
- it 'converts to id' do
- is_expected.to eq({ 'id' => 'asc' })
+ it 'converts to id' do
+ is_expected.to eq({ 'id' => 'asc' })
+ end
+ end
+ end
+
+ context 'when override_created_at is false' do
+ let(:reorder_params) { { override_created_at: false } }
+
+ context 'with created_at order given' do
+ let(:params) { { order_by: 'created_at', sort: 'asc' } }
+
+ it 'does not convert to id' do
+ is_expected.to eq({ "created_at" => "asc", "id" => "asc" })
+ end
end
end
end
diff --git a/spec/lib/gitlab/internal_events_spec.rb b/spec/lib/gitlab/internal_events_spec.rb
index 4d679e1049c..20625add292 100644
--- a/spec/lib/gitlab/internal_events_spec.rb
+++ b/spec/lib/gitlab/internal_events_spec.rb
@@ -142,6 +142,16 @@ RSpec.describe Gitlab::InternalEvents, :snowplow, feature_category: :product_ana
.with(described_class::InvalidMethodError, event_name: event_name, kwargs: { project: 'a_string' })
end
end
+
+ context 'when send_snowplow_event is false' do
+ it 'logs to Redis and RedisHLL but not Snowplow' do
+ described_class.track_event(event_name, send_snowplow_event: false, user: user, project: project)
+
+ expect_redis_tracking(event_name)
+ expect_redis_hll_tracking(event_name)
+ expect(fake_snowplow).not_to have_received(:event)
+ end
+ end
end
context 'when unique key is not defined' do
diff --git a/spec/requests/api/merge_requests_spec.rb b/spec/requests/api/merge_requests_spec.rb
index 4a11cddc79f..2cf8872cd40 100644
--- a/spec/requests/api/merge_requests_spec.rb
+++ b/spec/requests/api/merge_requests_spec.rb
@@ -27,10 +27,10 @@ RSpec.describe API::MergeRequests, :aggregate_failures, feature_category: :sourc
shared_context 'with merge requests' do
let_it_be(:milestone1) { create(:milestone, title: '0.9', project: project) }
+ let_it_be(:merge_request_merged) { create(:merge_request, state: "merged", author: user, assignees: [user], source_project: project, target_project: project, title: "Merged test", created_at: base_time + 2.seconds, updated_at: base_time + 1.hour, merge_commit_sha: '9999999999999999999999999999999999999999') }
let_it_be(:merge_request) { create(:merge_request, :simple, milestone: milestone1, author: user, assignees: [user], source_project: project, target_project: project, source_branch: 'markdown', title: "Test", created_at: base_time, updated_at: base_time + 3.hours) }
let_it_be(:merge_request_closed) { create(:merge_request, state: "closed", milestone: milestone1, author: user, assignees: [user], source_project: project, target_project: project, title: "Closed test", created_at: base_time + 1.second, updated_at: base_time) }
let_it_be(:merge_request_locked) { create(:merge_request, state: "locked", milestone: milestone1, author: user, assignees: [user], source_project: project, target_project: project, title: "Locked test", created_at: base_time + 1.second, updated_at: base_time + 2.hours) }
- let_it_be(:merge_request_merged) { create(:merge_request, state: "merged", author: user, assignees: [user], source_project: project, target_project: project, title: "Merged test", created_at: base_time + 2.seconds, updated_at: base_time + 1.hour, merge_commit_sha: '9999999999999999999999999999999999999999') }
let_it_be(:note) { create(:note_on_merge_request, author: user, project: project, noteable: merge_request, note: "a comment on a MR") }
let_it_be(:note2) { create(:note_on_merge_request, author: user, project: project, noteable: merge_request, note: "another comment on a MR") }
end
diff --git a/spec/requests/api/usage_data_spec.rb b/spec/requests/api/usage_data_spec.rb
index d296566853e..37fa75a812c 100644
--- a/spec/requests/api/usage_data_spec.rb
+++ b/spec/requests/api/usage_data_spec.rb
@@ -211,7 +211,7 @@ RSpec.describe API::UsageData, feature_category: :service_ping do
context 'with correct params' do
it 'returns status ok' do
expect(Gitlab::InternalEvents).to receive(:track_event)
- .with(known_event, user: user, namespace: namespace, project: project)
+ .with(known_event, send_snowplow_event: false, user: user, namespace: namespace, project: project)
post api(endpoint, user), params: { event: known_event, namespace_id: namespace.id, project_id: project.id }
diff --git a/spec/support/shared_examples/services/protected_branches_shared_examples.rb b/spec/support/shared_examples/services/protected_branches_shared_examples.rb
index ce607a6b956..15c63865720 100644
--- a/spec/support/shared_examples/services/protected_branches_shared_examples.rb
+++ b/spec/support/shared_examples/services/protected_branches_shared_examples.rb
@@ -1,11 +1,24 @@
# frozen_string_literal: true
RSpec.shared_context 'with scan result policy blocking protected branches' do
+ include RepoHelpers
+
+ let(:policy_path) { Security::OrchestrationPolicyConfiguration::POLICY_PATH }
+ let_it_be(:policy_project) { create(:project, :repository) }
+ let(:default_branch) { policy_project.default_branch }
+
+ let(:policy_yaml) do
+ build(:orchestration_policy_yaml, scan_execution_policy: [], scan_result_policy: [scan_result_policy])
+ end
+
+ let(:scan_result_policy) do
+ build(:scan_result_policy, branches: [branch_name], approval_settings: { block_unprotecting_branches: true })
+ end
+
before do
- create(
- :scan_result_policy_read,
- :blocking_protected_branches,
- project: project)
+ policy_configuration.update_attribute(:security_policy_management_project, policy_project)
+
+ create_file_in_repo(policy_project, default_branch, default_branch, policy_path, policy_yaml)
stub_licensed_features(security_orchestration_policies: true)
end
diff --git a/tooling/danger/analytics_instrumentation.rb b/tooling/danger/analytics_instrumentation.rb
index 69cc30f51fb..8f6a8b8fc7d 100644
--- a/tooling/danger/analytics_instrumentation.rb
+++ b/tooling/danger/analytics_instrumentation.rb
@@ -23,7 +23,7 @@ module Tooling
MSG
CHANGED_USAGE_DATA_MESSAGE = <<~MSG
- Notice that implementing metrics directly in usage_data.rb has been deprecated. ([Deprecated Usage Metrics](https://docs.gitlab.com/ee/development/service_ping/usage_data.html#usage-data-metrics-guide))
+ Notice that implementing metrics directly in usage_data.rb has been deprecated.
Please use [Instrumentation Classes](https://docs.gitlab.com/ee/development/service_ping/metrics_instrumentation.html) instead.
MSG