Add latest changes from gitlab-org/gitlab@master
This commit is contained in:
parent
d786065288
commit
b3e13e0dfd
|
@ -8,7 +8,7 @@ module InviteMembersHelper
|
|||
end
|
||||
|
||||
def can_invite_group_for_project?(project)
|
||||
Feature.enabled?(:invite_members_group_modal, project.group) && project.allowed_to_share_with_group?
|
||||
Feature.enabled?(:invite_members_group_modal, project.group) && can_manage_project_members?(project) && project.allowed_to_share_with_group?
|
||||
end
|
||||
|
||||
def directly_invite_members?
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
module Analytics
|
||||
module UsageTrends
|
||||
class Measurement < ApplicationRecord
|
||||
self.table_name = 'analytics_instance_statistics_measurements'
|
||||
self.table_name = 'analytics_usage_trends_measurements'
|
||||
|
||||
enum identifier: {
|
||||
projects: 1,
|
||||
|
|
|
@ -43,16 +43,15 @@ class ContainerRepository < ApplicationRecord
|
|||
end
|
||||
|
||||
def self.with_enabled_policy
|
||||
joins("INNER JOIN container_expiration_policies ON container_repositories.project_id = container_expiration_policies.project_id")
|
||||
joins('INNER JOIN container_expiration_policies ON container_repositories.project_id = container_expiration_policies.project_id')
|
||||
.where(container_expiration_policies: { enabled: true })
|
||||
end
|
||||
|
||||
def self.requiring_cleanup
|
||||
where(
|
||||
container_repositories: { expiration_policy_cleanup_status: REQUIRING_CLEANUP_STATUSES },
|
||||
project_id: ::ContainerExpirationPolicy.runnable_schedules
|
||||
.select(:project_id)
|
||||
)
|
||||
with_enabled_policy
|
||||
.where(container_repositories: { expiration_policy_cleanup_status: REQUIRING_CLEANUP_STATUSES })
|
||||
.where('container_repositories.expiration_policy_started_at IS NULL OR container_repositories.expiration_policy_started_at < container_expiration_policies.next_run_at')
|
||||
.where('container_expiration_policies.next_run_at < ?', Time.zone.now)
|
||||
end
|
||||
|
||||
def self.with_unfinished_cleanup
|
||||
|
|
|
@ -0,0 +1,13 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class RenameInstanceStatisticsMeasurements < ActiveRecord::Migration[6.0]
|
||||
include Gitlab::Database::MigrationHelpers
|
||||
|
||||
def up
|
||||
rename_table_safely(:analytics_instance_statistics_measurements, :analytics_usage_trends_measurements)
|
||||
end
|
||||
|
||||
def down
|
||||
undo_rename_table_safely(:analytics_instance_statistics_measurements, :analytics_usage_trends_measurements)
|
||||
end
|
||||
end
|
|
@ -0,0 +1,13 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class FinalizeRenameInstanceStatisticsMeasurements < ActiveRecord::Migration[6.0]
|
||||
include Gitlab::Database::MigrationHelpers
|
||||
|
||||
def up
|
||||
finalize_table_rename(:analytics_instance_statistics_measurements, :analytics_usage_trends_measurements)
|
||||
end
|
||||
|
||||
def down
|
||||
undo_finalize_table_rename(:analytics_instance_statistics_measurements, :analytics_usage_trends_measurements)
|
||||
end
|
||||
end
|
|
@ -0,0 +1 @@
|
|||
862deb2d2845aaa114ba4c56418ae6a041d3aed3ac205cff102414423b60c969
|
|
@ -0,0 +1 @@
|
|||
9ffb8d6b93f1e994eaa9dd4b16b9250fe007903dca3901d34bf66a81b2f3ad44
|
|
@ -9155,22 +9155,6 @@ CREATE SEQUENCE analytics_devops_adoption_snapshots_id_seq
|
|||
|
||||
ALTER SEQUENCE analytics_devops_adoption_snapshots_id_seq OWNED BY analytics_devops_adoption_snapshots.id;
|
||||
|
||||
CREATE TABLE analytics_instance_statistics_measurements (
|
||||
id bigint NOT NULL,
|
||||
count bigint NOT NULL,
|
||||
recorded_at timestamp with time zone NOT NULL,
|
||||
identifier smallint NOT NULL
|
||||
);
|
||||
|
||||
CREATE SEQUENCE analytics_instance_statistics_measurements_id_seq
|
||||
START WITH 1
|
||||
INCREMENT BY 1
|
||||
NO MINVALUE
|
||||
NO MAXVALUE
|
||||
CACHE 1;
|
||||
|
||||
ALTER SEQUENCE analytics_instance_statistics_measurements_id_seq OWNED BY analytics_instance_statistics_measurements.id;
|
||||
|
||||
CREATE TABLE analytics_language_trend_repository_languages (
|
||||
file_count integer DEFAULT 0 NOT NULL,
|
||||
programming_language_id bigint NOT NULL,
|
||||
|
@ -9181,6 +9165,22 @@ CREATE TABLE analytics_language_trend_repository_languages (
|
|||
snapshot_date date NOT NULL
|
||||
);
|
||||
|
||||
CREATE TABLE analytics_usage_trends_measurements (
|
||||
id bigint NOT NULL,
|
||||
count bigint NOT NULL,
|
||||
recorded_at timestamp with time zone NOT NULL,
|
||||
identifier smallint NOT NULL
|
||||
);
|
||||
|
||||
CREATE SEQUENCE analytics_usage_trends_measurements_id_seq
|
||||
START WITH 1
|
||||
INCREMENT BY 1
|
||||
NO MINVALUE
|
||||
NO MAXVALUE
|
||||
CACHE 1;
|
||||
|
||||
ALTER SEQUENCE analytics_usage_trends_measurements_id_seq OWNED BY analytics_usage_trends_measurements.id;
|
||||
|
||||
CREATE TABLE appearances (
|
||||
id integer NOT NULL,
|
||||
title character varying NOT NULL,
|
||||
|
@ -19507,7 +19507,7 @@ ALTER TABLE ONLY analytics_devops_adoption_segments ALTER COLUMN id SET DEFAULT
|
|||
|
||||
ALTER TABLE ONLY analytics_devops_adoption_snapshots ALTER COLUMN id SET DEFAULT nextval('analytics_devops_adoption_snapshots_id_seq'::regclass);
|
||||
|
||||
ALTER TABLE ONLY analytics_instance_statistics_measurements ALTER COLUMN id SET DEFAULT nextval('analytics_instance_statistics_measurements_id_seq'::regclass);
|
||||
ALTER TABLE ONLY analytics_usage_trends_measurements ALTER COLUMN id SET DEFAULT nextval('analytics_usage_trends_measurements_id_seq'::regclass);
|
||||
|
||||
ALTER TABLE ONLY appearances ALTER COLUMN id SET DEFAULT nextval('appearances_id_seq'::regclass);
|
||||
|
||||
|
@ -20598,12 +20598,12 @@ ALTER TABLE ONLY analytics_devops_adoption_segments
|
|||
ALTER TABLE ONLY analytics_devops_adoption_snapshots
|
||||
ADD CONSTRAINT analytics_devops_adoption_snapshots_pkey PRIMARY KEY (id);
|
||||
|
||||
ALTER TABLE ONLY analytics_instance_statistics_measurements
|
||||
ADD CONSTRAINT analytics_instance_statistics_measurements_pkey PRIMARY KEY (id);
|
||||
|
||||
ALTER TABLE ONLY analytics_language_trend_repository_languages
|
||||
ADD CONSTRAINT analytics_language_trend_repository_languages_pkey PRIMARY KEY (programming_language_id, project_id, snapshot_date);
|
||||
|
||||
ALTER TABLE ONLY analytics_usage_trends_measurements
|
||||
ADD CONSTRAINT analytics_usage_trends_measurements_pkey PRIMARY KEY (id);
|
||||
|
||||
ALTER TABLE ONLY appearances
|
||||
ADD CONSTRAINT appearances_pkey PRIMARY KEY (id);
|
||||
|
||||
|
@ -23853,7 +23853,7 @@ CREATE INDEX index_on_id_partial_with_legacy_storage ON projects USING btree (id
|
|||
|
||||
CREATE INDEX index_on_identities_lower_extern_uid_and_provider ON identities USING btree (lower((extern_uid)::text), provider);
|
||||
|
||||
CREATE UNIQUE INDEX index_on_instance_statistics_recorded_at_and_identifier ON analytics_instance_statistics_measurements USING btree (identifier, recorded_at);
|
||||
CREATE UNIQUE INDEX index_on_instance_statistics_recorded_at_and_identifier ON analytics_usage_trends_measurements USING btree (identifier, recorded_at);
|
||||
|
||||
CREATE INDEX index_on_label_links_all_columns ON label_links USING btree (target_id, label_id, target_type);
|
||||
|
||||
|
|
|
@ -275,7 +275,7 @@ installations from source.
|
|||
|
||||
It contains the JSON version of the logs in `application.log` like the example below:
|
||||
|
||||
``` json
|
||||
```json
|
||||
{
|
||||
"severity":"INFO",
|
||||
"time":"2020-01-14T13:35:15.466Z",
|
||||
|
|
|
@ -100,7 +100,7 @@ Consider the following pipeline, with jobs `A`, `B`, and `C`. Imagine you want:
|
|||
|
||||
To achieve this, you can configure your `.gitlab-ci.yml` file as follows:
|
||||
|
||||
``` yaml
|
||||
```yaml
|
||||
.only-default: &only-default
|
||||
only:
|
||||
- main
|
||||
|
|
|
@ -41,7 +41,7 @@ jobs:
|
|||
|
||||
Example of the same job definition in GitLab CI/CD:
|
||||
|
||||
``` yaml
|
||||
```yaml
|
||||
job1:
|
||||
script: "execute-script-for-job1"
|
||||
```
|
||||
|
|
|
@ -538,7 +538,7 @@ In this case, we could as well just use `render_ce` which would ignore any EE
|
|||
partials. One example would be
|
||||
`ee/app/views/shared/issuable/form/_default_templates.html.haml`:
|
||||
|
||||
``` haml
|
||||
```haml
|
||||
- if @project.feature_available?(:issuable_default_templates)
|
||||
= render_ce 'shared/issuable/form/default_templates'
|
||||
- elsif show_promotions?
|
||||
|
|
|
@ -68,7 +68,7 @@ objects are touching them, then it would be an acceptable use.
|
|||
We especially allow the case where a single instance variable is used with
|
||||
`||=` to set up the value. This would look like:
|
||||
|
||||
``` ruby
|
||||
```ruby
|
||||
module M
|
||||
def f
|
||||
@f ||= true
|
||||
|
@ -85,7 +85,7 @@ we could easily add to the cop, we should do it.
|
|||
Even if we could just disable the cop, we should avoid doing so. Some code
|
||||
could be easily rewritten in simple form. Consider this acceptable method:
|
||||
|
||||
``` ruby
|
||||
```ruby
|
||||
module Gitlab
|
||||
module Emoji
|
||||
def emoji_unicode_version(name)
|
||||
|
@ -104,7 +104,7 @@ cop is not smart enough to judge that this is fine.
|
|||
|
||||
On the other hand, we could split this method into two:
|
||||
|
||||
``` ruby
|
||||
```ruby
|
||||
module Gitlab
|
||||
module Emoji
|
||||
def emoji_unicode_version(name)
|
||||
|
@ -127,7 +127,7 @@ Now the cop doesn't complain.
|
|||
|
||||
Put the disabling comment right after your code in the same line:
|
||||
|
||||
``` ruby
|
||||
```ruby
|
||||
module M
|
||||
def violating_method
|
||||
@f + @g # rubocop:disable Gitlab/ModuleWithInstanceVariables
|
||||
|
@ -137,7 +137,7 @@ end
|
|||
|
||||
If there are multiple lines, you could also enable and disable for a section:
|
||||
|
||||
``` ruby
|
||||
```ruby
|
||||
module M
|
||||
# rubocop:disable Gitlab/ModuleWithInstanceVariables
|
||||
def violating_method
|
||||
|
@ -167,13 +167,13 @@ point of view), making it extremely hard to track data dependency.
|
|||
|
||||
We're trying to use something like this instead:
|
||||
|
||||
``` haml
|
||||
```haml
|
||||
= render 'projects/commits/commit', commit: commit, ref: ref, project: project
|
||||
```
|
||||
|
||||
And in the partial:
|
||||
|
||||
``` haml
|
||||
```haml
|
||||
- ref = local_assigns.fetch(:ref)
|
||||
- commit = local_assigns.fetch(:commit)
|
||||
- project = local_assigns.fetch(:project)
|
||||
|
|
|
@ -143,7 +143,7 @@ Service classes usually have an `execute` method, which can return a
|
|||
|
||||
In a successful case:
|
||||
|
||||
``` ruby
|
||||
```ruby
|
||||
response = ServiceResponse.success(message: 'Branch was deleted')
|
||||
|
||||
response.success? # => true
|
||||
|
@ -154,7 +154,7 @@ response.message # => 'Branch was deleted'
|
|||
|
||||
In a failed case:
|
||||
|
||||
``` ruby
|
||||
```ruby
|
||||
response = ServiceResponse.error(message: 'Unsupported operation')
|
||||
|
||||
response.success? # => false
|
||||
|
@ -165,7 +165,7 @@ response.message # => 'Unsupported operation'
|
|||
|
||||
An additional payload can also be attached:
|
||||
|
||||
``` ruby
|
||||
```ruby
|
||||
response = ServiceResponse.success(payload: { issue: issue })
|
||||
|
||||
response.payload[:issue] # => issue
|
||||
|
|
|
@ -14,7 +14,7 @@ Refer to [`merge_hash.rb`](https://gitlab.com/gitlab-org/gitlab/blob/master/lib/
|
|||
|
||||
- Deep merges an array of hashes:
|
||||
|
||||
``` ruby
|
||||
```ruby
|
||||
Gitlab::Utils::MergeHash.merge(
|
||||
[{ hello: ["world"] },
|
||||
{ hello: "Everyone" },
|
||||
|
@ -25,7 +25,7 @@ Refer to [`merge_hash.rb`](https://gitlab.com/gitlab-org/gitlab/blob/master/lib/
|
|||
|
||||
Gives:
|
||||
|
||||
``` ruby
|
||||
```ruby
|
||||
[
|
||||
{
|
||||
hello:
|
||||
|
@ -41,7 +41,7 @@ Refer to [`merge_hash.rb`](https://gitlab.com/gitlab-org/gitlab/blob/master/lib/
|
|||
|
||||
- Extracts all keys and values from a hash into an array:
|
||||
|
||||
``` ruby
|
||||
```ruby
|
||||
Gitlab::Utils::MergeHash.crush(
|
||||
{ hello: "world", this: { crushes: ["an entire", "hash"] } }
|
||||
)
|
||||
|
@ -49,7 +49,7 @@ Refer to [`merge_hash.rb`](https://gitlab.com/gitlab-org/gitlab/blob/master/lib/
|
|||
|
||||
Gives:
|
||||
|
||||
``` ruby
|
||||
```ruby
|
||||
[:hello, "world", :this, :crushes, "an entire", "hash"]
|
||||
```
|
||||
|
||||
|
@ -69,7 +69,7 @@ Refer to [`override.rb`](https://gitlab.com/gitlab-org/gitlab/blob/master/lib/gi
|
|||
|
||||
Here's a simple example:
|
||||
|
||||
``` ruby
|
||||
```ruby
|
||||
class Base
|
||||
def execute
|
||||
end
|
||||
|
@ -86,7 +86,7 @@ Refer to [`override.rb`](https://gitlab.com/gitlab-org/gitlab/blob/master/lib/gi
|
|||
|
||||
This also works on modules:
|
||||
|
||||
``` ruby
|
||||
```ruby
|
||||
module Extension
|
||||
extend ::Gitlab::Utils::Override
|
||||
|
||||
|
@ -164,7 +164,7 @@ Refer to [`strong_memoize.rb`](https://gitlab.com/gitlab-org/gitlab/blob/master/
|
|||
|
||||
Instead of writing patterns like this:
|
||||
|
||||
``` ruby
|
||||
```ruby
|
||||
class Find
|
||||
def result
|
||||
return @result if defined?(@result)
|
||||
|
@ -176,7 +176,7 @@ Refer to [`strong_memoize.rb`](https://gitlab.com/gitlab-org/gitlab/blob/master/
|
|||
|
||||
You could write it like:
|
||||
|
||||
``` ruby
|
||||
```ruby
|
||||
class Find
|
||||
include Gitlab::Utils::StrongMemoize
|
||||
|
||||
|
@ -190,7 +190,7 @@ Refer to [`strong_memoize.rb`](https://gitlab.com/gitlab-org/gitlab/blob/master/
|
|||
|
||||
- Clear memoization
|
||||
|
||||
``` ruby
|
||||
```ruby
|
||||
class Find
|
||||
include Gitlab::Utils::StrongMemoize
|
||||
end
|
||||
|
@ -209,7 +209,7 @@ method level values, and optional method arguments.
|
|||
|
||||
A simple example that only uses the instance level customised values is:
|
||||
|
||||
``` ruby
|
||||
```ruby
|
||||
class UserAccess
|
||||
extend Gitlab::Cache::RequestCache
|
||||
|
||||
|
@ -230,7 +230,7 @@ instance variable so the cache logic would be the same.
|
|||
|
||||
We can also set different strategies for different methods:
|
||||
|
||||
``` ruby
|
||||
```ruby
|
||||
class Commit
|
||||
extend Gitlab::Cache::RequestCache
|
||||
|
||||
|
|
|
@ -323,7 +323,7 @@ at the logs that are produced by the container scanning analyzer in `container_s
|
|||
|
||||
The log contains a list of found vulnerabilities as a table, for example:
|
||||
|
||||
```plainttext
|
||||
```plaintext
|
||||
+------------+-------------------------+------------------------+-----------------------+------------------------------------------------------------------------+
|
||||
| STATUS | CVE SEVERITY | PACKAGE NAME | PACKAGE VERSION | CVE DESCRIPTION |
|
||||
+------------+-------------------------+------------------------+-----------------------+------------------------------------------------------------------------+
|
||||
|
|
|
@ -9,7 +9,6 @@ module Gitlab
|
|||
# 'old_name' => 'new_name'
|
||||
# }.freeze
|
||||
TABLES_TO_BE_RENAMED = {
|
||||
'analytics_instance_statistics_measurements' => 'analytics_usage_trends_measurements',
|
||||
'services' => 'integrations'
|
||||
}.freeze
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@ module QA
|
|||
end
|
||||
end
|
||||
|
||||
it 'shows results for the original request and AJAX requests', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/478', quarantine: { only: { pipeline: :master }, issue: 'https://gitlab.com/gitlab-org/gitlab/-/issues/323051', type: :bug } do
|
||||
it 'shows results for the original request and AJAX requests', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/478', quarantine: { only: { pipeline: :main }, issue: 'https://gitlab.com/gitlab-org/gitlab/-/issues/323051', type: :bug } do
|
||||
# Issue pages always make AJAX requests
|
||||
Resource::Issue.fabricate_via_browser_ui! do |issue|
|
||||
issue.title = 'Performance bar test'
|
||||
|
|
|
@ -32,6 +32,14 @@ RSpec.describe 'Project > Members > Invite group', :js do
|
|||
|
||||
expect(page).to have_selector(expected_invite_group_selector)
|
||||
end
|
||||
|
||||
it 'does not display either the form or the button when visiting the page not signed in' do
|
||||
project = create(:project, namespace: create(:group))
|
||||
|
||||
visit project_project_members_path(project)
|
||||
|
||||
expect(page).not_to have_selector(expected_invite_group_selector)
|
||||
end
|
||||
end
|
||||
|
||||
describe 'Share with group lock' do
|
||||
|
|
|
@ -434,6 +434,14 @@ RSpec.describe ContainerRepository do
|
|||
|
||||
it { is_expected.to eq([repository]) }
|
||||
end
|
||||
|
||||
context 'with repository cleanup started at after policy next run at' do
|
||||
before do
|
||||
repository.update!(expiration_policy_started_at: policy.next_run_at + 5.minutes)
|
||||
end
|
||||
|
||||
it { is_expected.to eq([]) }
|
||||
end
|
||||
end
|
||||
|
||||
describe '.with_unfinished_cleanup' do
|
||||
|
|
|
@ -7,6 +7,11 @@ module CycleAnalyticsHelpers
|
|||
page.find('[data-testid="dropdown-value-streams"]').click
|
||||
end
|
||||
|
||||
def path_nav_stage_names_without_median
|
||||
# Returns the path names with the median value stripped out
|
||||
page.all('.gl-path-button').collect(&:text).map {|name_with_median| name_with_median.split("\n")[0] }
|
||||
end
|
||||
|
||||
def add_custom_stage_to_form
|
||||
page.find_button(s_('CreateValueStreamForm|Add another stage')).click
|
||||
|
||||
|
|
Loading…
Reference in New Issue