diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-07-22 03:09:11 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-07-22 03:09:11 +0300 |
commit | 4407fa18edc418f6db9004d09e3c45ab4bca8a1e (patch) | |
tree | 13165cd61ef68b7bf6c4c3b8de79765e998422c2 | |
parent | 7e3f469a40a784f8eb41138361b18aaa0de491cf (diff) |
Add latest changes from gitlab-org/gitlab@master
18 files changed, 202 insertions, 15 deletions
diff --git a/app/controllers/registrations/welcome_controller.rb b/app/controllers/registrations/welcome_controller.rb index 6482d02761e..ced21b8f291 100644 --- a/app/controllers/registrations/welcome_controller.rb +++ b/app/controllers/registrations/welcome_controller.rb @@ -16,7 +16,7 @@ module Registrations result = ::Users::SignupService.new(current_user, update_params).execute if result[:status] == :success - return redirect_to new_users_sign_up_group_path if show_signup_onboarding? + return redirect_to new_users_sign_up_group_path(trial_params) if show_signup_onboarding? members = current_user.members @@ -67,6 +67,10 @@ module Registrations def show_signup_onboarding? false end + + def trial_params + nil + end end end diff --git a/app/experiments/force_company_trial_experiment.rb b/app/experiments/force_company_trial_experiment.rb new file mode 100644 index 00000000000..00bdd5d693d --- /dev/null +++ b/app/experiments/force_company_trial_experiment.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +class ForceCompanyTrialExperiment < ApplicationExperiment # rubocop:disable Gitlab/NamespacedClass + exclude :setup_for_personal + + private + + def setup_for_personal + !context.user.setup_for_company + end +end diff --git a/app/services/projects/transfer_service.rb b/app/services/projects/transfer_service.rb index fb0fea756bc..43eafc18255 100644 --- a/app/services/projects/transfer_service.rb +++ b/app/services/projects/transfer_service.rb @@ -89,6 +89,8 @@ module Projects update_integrations + remove_paid_features + project.old_path_with_namespace = @old_path update_repository_configuration(@new_path) @@ -109,6 +111,10 @@ module Projects move_pages(project) end + # Overridden in EE + def remove_paid_features + end + def transfer_missing_group_resources(group) Labels::TransferService.new(current_user, group, project).execute diff --git a/config/feature_flags/experiment/force_company_trial.yml b/config/feature_flags/experiment/force_company_trial.yml new file mode 100644 index 00000000000..85fc789085d --- /dev/null +++ b/config/feature_flags/experiment/force_company_trial.yml @@ -0,0 +1,8 @@ +--- +name: force_company_trial +introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/65287 +rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/335050 +milestone: '14.1' +type: experiment +group: group::adoption +default_enabled: false diff --git a/config/initializers/1_settings.rb b/config/initializers/1_settings.rb index 42c7063378b..76912befebb 100644 --- a/config/initializers/1_settings.rb +++ b/config/initializers/1_settings.rb @@ -701,6 +701,9 @@ Gitlab.ee do Settings.cron_jobs['security_orchestration_policy_rule_schedule_worker'] ||= Settingslogic.new({}) Settings.cron_jobs['security_orchestration_policy_rule_schedule_worker']['cron'] ||= '*/15 * * * *' Settings.cron_jobs['security_orchestration_policy_rule_schedule_worker']['job_class'] = 'Security::OrchestrationPolicyRuleScheduleWorker' + Settings.cron_jobs['app_sec_dast_profile_schedule_worker'] ||= Settingslogic.new({}) + Settings.cron_jobs['app_sec_dast_profile_schedule_worker']['cron'] ||= '7-59/15 * * * *' + Settings.cron_jobs['app_sec_dast_profile_schedule_worker']['job_class'] = 'AppSec::Dast::ProfileScheduleWorker' end # diff --git a/db/migrate/20210713123345_create_dast_profile_schedule.rb b/db/migrate/20210713123345_create_dast_profile_schedule.rb new file mode 100644 index 00000000000..951aab63579 --- /dev/null +++ b/db/migrate/20210713123345_create_dast_profile_schedule.rb @@ -0,0 +1,36 @@ +# frozen_string_literal: true + +class CreateDastProfileSchedule < ActiveRecord::Migration[6.1] + include Gitlab::Database::MigrationHelpers + + INDEX_NAME = 'index_dast_profile_schedules_active_next_run_at' + + def up + table_comment = { + owner: 'group::dynamic analysis', description: 'Scheduling for scans using DAST Profiles' + } + + create_table_with_constraints :dast_profile_schedules, comment: table_comment.to_json do |t| + t.bigint :project_id, null: false + t.bigint :dast_profile_id, null: false + t.bigint :user_id + + t.datetime_with_timezone :next_run_at, null: false + t.timestamps_with_timezone null: false + t.boolean :active, default: true, null: false + t.text :cron, null: false + t.text_limit :cron, 255 + + t.index %i[active next_run_at], name: INDEX_NAME + t.index %i[project_id dast_profile_id], unique: true + t.index :dast_profile_id + t.index :user_id + end + end + + def down + with_lock_retries do + drop_table :dast_profile_schedules + end + end +end diff --git a/db/migrate/20210715074359_add_foreign_key_to_dast_profile_schedules_on_dast_profile.rb b/db/migrate/20210715074359_add_foreign_key_to_dast_profile_schedules_on_dast_profile.rb new file mode 100644 index 00000000000..c042a875f57 --- /dev/null +++ b/db/migrate/20210715074359_add_foreign_key_to_dast_profile_schedules_on_dast_profile.rb @@ -0,0 +1,17 @@ +# frozen_string_literal: true + +class AddForeignKeyToDastProfileSchedulesOnDastProfile < ActiveRecord::Migration[6.1] + include Gitlab::Database::MigrationHelpers + + disable_ddl_transaction! + + def up + add_concurrent_foreign_key :dast_profile_schedules, :dast_profiles, column: :dast_profile_id, on_delete: :cascade + end + + def down + with_lock_retries do + remove_foreign_key_if_exists :dast_profile_schedules, column: :dast_profile_id + end + end +end diff --git a/db/migrate/20210715074933_add_foreign_key_to_dast_profile_schedules_on_user.rb b/db/migrate/20210715074933_add_foreign_key_to_dast_profile_schedules_on_user.rb new file mode 100644 index 00000000000..576cee090ff --- /dev/null +++ b/db/migrate/20210715074933_add_foreign_key_to_dast_profile_schedules_on_user.rb @@ -0,0 +1,17 @@ +# frozen_string_literal: true + +class AddForeignKeyToDastProfileSchedulesOnUser < ActiveRecord::Migration[6.1] + include Gitlab::Database::MigrationHelpers + + disable_ddl_transaction! + + def up + add_concurrent_foreign_key :dast_profile_schedules, :users, column: :user_id, on_delete: :nullify + end + + def down + with_lock_retries do + remove_foreign_key_if_exists :dast_profile_schedules, column: :user_id + end + end +end diff --git a/db/migrate/20210715075203_add_foreign_key_to_dast_profile_schedules_on_project.rb b/db/migrate/20210715075203_add_foreign_key_to_dast_profile_schedules_on_project.rb new file mode 100644 index 00000000000..cfc76c4a12c --- /dev/null +++ b/db/migrate/20210715075203_add_foreign_key_to_dast_profile_schedules_on_project.rb @@ -0,0 +1,17 @@ +# frozen_string_literal: true + +class AddForeignKeyToDastProfileSchedulesOnProject < ActiveRecord::Migration[6.1] + include Gitlab::Database::MigrationHelpers + + disable_ddl_transaction! + + def up + add_concurrent_foreign_key :dast_profile_schedules, :projects, column: :project_id, on_delete: :cascade + end + + def down + with_lock_retries do + remove_foreign_key_if_exists :dast_profile_schedules, column: :project_id + end + end +end diff --git a/db/schema_migrations/20210713123345 b/db/schema_migrations/20210713123345 new file mode 100644 index 00000000000..f145ecc3d6b --- /dev/null +++ b/db/schema_migrations/20210713123345 @@ -0,0 +1 @@ +d1226fdefe839aae4c7425924058e1944f883824c43a299b154bb6873d6c3855
\ No newline at end of file diff --git a/db/schema_migrations/20210715074359 b/db/schema_migrations/20210715074359 new file mode 100644 index 00000000000..35cbbf55463 --- /dev/null +++ b/db/schema_migrations/20210715074359 @@ -0,0 +1 @@ +7bc0654a97f85100df93b9dbbbdab374873f6d3d379a4393f718bad923b064ba
\ No newline at end of file diff --git a/db/schema_migrations/20210715074933 b/db/schema_migrations/20210715074933 new file mode 100644 index 00000000000..721e9d8d32c --- /dev/null +++ b/db/schema_migrations/20210715074933 @@ -0,0 +1 @@ +e29240947b2e0e6fa7c91643c5d1a2efa02ec062b5ccdffdf382dff993ab6225
\ No newline at end of file diff --git a/db/schema_migrations/20210715075203 b/db/schema_migrations/20210715075203 new file mode 100644 index 00000000000..d123de45c42 --- /dev/null +++ b/db/schema_migrations/20210715075203 @@ -0,0 +1 @@ +9d29f4d776031e90cb42122146f65bb13e8778d223467a83dc311f4adab31565
\ No newline at end of file diff --git a/db/structure.sql b/db/structure.sql index ed0b7b09da5..e27e23e38ba 100644 --- a/db/structure.sql +++ b/db/structure.sql @@ -12006,6 +12006,30 @@ CREATE SEQUENCE custom_emoji_id_seq ALTER SEQUENCE custom_emoji_id_seq OWNED BY custom_emoji.id; +CREATE TABLE dast_profile_schedules ( + id bigint NOT NULL, + project_id bigint NOT NULL, + dast_profile_id bigint NOT NULL, + user_id bigint, + next_run_at timestamp with time zone NOT NULL, + created_at timestamp with time zone NOT NULL, + updated_at timestamp with time zone NOT NULL, + active boolean DEFAULT true NOT NULL, + cron text NOT NULL, + CONSTRAINT check_86531ea73f CHECK ((char_length(cron) <= 255)) +); + +COMMENT ON TABLE dast_profile_schedules IS '{"owner":"group::dynamic analysis","description":"Scheduling for scans using DAST Profiles"}'; + +CREATE SEQUENCE dast_profile_schedules_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + +ALTER SEQUENCE dast_profile_schedules_id_seq OWNED BY dast_profile_schedules.id; + CREATE TABLE dast_profiles ( id bigint NOT NULL, project_id bigint NOT NULL, @@ -20024,6 +20048,8 @@ ALTER TABLE ONLY csv_issue_imports ALTER COLUMN id SET DEFAULT nextval('csv_issu ALTER TABLE ONLY custom_emoji ALTER COLUMN id SET DEFAULT nextval('custom_emoji_id_seq'::regclass); +ALTER TABLE ONLY dast_profile_schedules ALTER COLUMN id SET DEFAULT nextval('dast_profile_schedules_id_seq'::regclass); + ALTER TABLE ONLY dast_profiles ALTER COLUMN id SET DEFAULT nextval('dast_profiles_id_seq'::regclass); ALTER TABLE ONLY dast_scanner_profiles ALTER COLUMN id SET DEFAULT nextval('dast_scanner_profiles_id_seq'::regclass); @@ -21295,6 +21321,9 @@ ALTER TABLE ONLY csv_issue_imports ALTER TABLE ONLY custom_emoji ADD CONSTRAINT custom_emoji_pkey PRIMARY KEY (id); +ALTER TABLE ONLY dast_profile_schedules + ADD CONSTRAINT dast_profile_schedules_pkey PRIMARY KEY (id); + ALTER TABLE ONLY dast_profiles_pipelines ADD CONSTRAINT dast_profiles_pipelines_pkey PRIMARY KEY (dast_profile_id, ci_pipeline_id); @@ -23386,6 +23415,14 @@ CREATE UNIQUE INDEX index_custom_emoji_on_namespace_id_and_name ON custom_emoji CREATE UNIQUE INDEX index_daily_build_group_report_results_unique_columns ON ci_daily_build_group_report_results USING btree (project_id, ref_path, date, group_name); +CREATE INDEX index_dast_profile_schedules_active_next_run_at ON dast_profile_schedules USING btree (active, next_run_at); + +CREATE INDEX index_dast_profile_schedules_on_dast_profile_id ON dast_profile_schedules USING btree (dast_profile_id); + +CREATE UNIQUE INDEX index_dast_profile_schedules_on_project_id_and_dast_profile_id ON dast_profile_schedules USING btree (project_id, dast_profile_id); + +CREATE INDEX index_dast_profile_schedules_on_user_id ON dast_profile_schedules USING btree (user_id); + CREATE INDEX index_dast_profiles_on_dast_scanner_profile_id ON dast_profiles USING btree (dast_scanner_profile_id); CREATE INDEX index_dast_profiles_on_dast_site_profile_id ON dast_profiles USING btree (dast_site_profile_id); @@ -26001,6 +26038,9 @@ ALTER TABLE ONLY project_access_tokens ALTER TABLE ONLY merge_requests ADD CONSTRAINT fk_6149611a04 FOREIGN KEY (assignee_id) REFERENCES users(id) ON DELETE SET NULL; +ALTER TABLE ONLY dast_profile_schedules + ADD CONSTRAINT fk_61d52aa0e7 FOREIGN KEY (dast_profile_id) REFERENCES dast_profiles(id) ON DELETE CASCADE; + ALTER TABLE ONLY events ADD CONSTRAINT fk_61fbf6ca48 FOREIGN KEY (group_id) REFERENCES namespaces(id) ON DELETE CASCADE; @@ -26022,6 +26062,9 @@ ALTER TABLE ONLY merge_requests ALTER TABLE ONLY geo_event_log ADD CONSTRAINT fk_6ada82d42a FOREIGN KEY (container_repository_updated_event_id) REFERENCES geo_container_repository_updated_events(id) ON DELETE CASCADE; +ALTER TABLE ONLY dast_profile_schedules + ADD CONSTRAINT fk_6cca0d8800 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE; + ALTER TABLE ONLY projects ADD CONSTRAINT fk_6e5c14658a FOREIGN KEY (pool_repository_id) REFERENCES pool_repositories(id) ON DELETE SET NULL; @@ -26259,6 +26302,9 @@ ALTER TABLE ONLY ci_variables ALTER TABLE ONLY merge_request_metrics ADD CONSTRAINT fk_ae440388cc FOREIGN KEY (latest_closed_by_id) REFERENCES users(id) ON DELETE SET NULL; +ALTER TABLE ONLY dast_profile_schedules + ADD CONSTRAINT fk_aef03d62e5 FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE SET NULL; + ALTER TABLE ONLY analytics_cycle_analytics_group_stages ADD CONSTRAINT fk_analytics_cycle_analytics_group_stages_group_value_stream_id FOREIGN KEY (group_value_stream_id) REFERENCES analytics_cycle_analytics_group_value_streams(id) ON DELETE CASCADE; diff --git a/doc/api/index.md b/doc/api/index.md index f1059904ac3..1d3a85c8ec7 100644 --- a/doc/api/index.md +++ b/doc/api/index.md @@ -483,7 +483,7 @@ pass the following parameters: In the following example, we list 50 [namespaces](namespaces.md) per page: ```shell -curl --request PUT --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/namespaces?per_page=50" +curl --request GET --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/namespaces?per_page=50" ``` #### Pagination `Link` header diff --git a/doc/development/documentation/styleguide/index.md b/doc/development/documentation/styleguide/index.md index a5345f3b52d..ca1dcfeb5b8 100644 --- a/doc/development/documentation/styleguide/index.md +++ b/doc/development/documentation/styleguide/index.md @@ -129,22 +129,14 @@ the documentation. All GitLab documentation is written using [Markdown](https://en.wikipedia.org/wiki/Markdown). -The [documentation website](https://docs.gitlab.com) uses GitLab Kramdown as its -Markdown rendering engine. For a complete Kramdown reference, see the -[GitLab Markdown Kramdown Guide](https://about.gitlab.com/handbook/markdown-guide/). - -The [`gitlab-kramdown`](https://gitlab.com/gitlab-org/gitlab_kramdown) Ruby gem -plans to support all [GitLab Flavored Markdown](../../../user/markdown.md) in the future, which is -all Markdown supported for display in the GitLab application itself. For now, use -regular Markdown and follow the rules in the linked style guide. - -Kramdown-specific markup (for example, `{:.class}`) doesn't render -properly on GitLab instances under [`/help`](../index.md#gitlab-help). +The [documentation website](https://docs.gitlab.com) uses [GitLab Kramdown](https://gitlab.com/gitlab-org/gitlab_kramdown), +a "flavored" Kramdown engine to render pages from Markdown to HTML. The use of Kramdown's +features is limited by our linters, so, use regular Markdown and follow the rules in the +linked style guide. You can't use Kramdown-specific markup (for example, `{:.class}`). ### HTML in Markdown -Hard-coded HTML is valid, although it's discouraged from being used while we -have `/help`. HTML is permitted if: +Hard-coded HTML is valid, although it's discouraged from being used. HTML is permitted if: - There's no equivalent markup in Markdown. - Advanced tables are necessary. diff --git a/doc/user/project/web_ide/index.md b/doc/user/project/web_ide/index.md index 722505304c0..80490887c4a 100644 --- a/doc/user/project/web_ide/index.md +++ b/doc/user/project/web_ide/index.md @@ -362,6 +362,8 @@ terminal: After the terminal has started, the console is displayed and we could access the project repository files. +When you use the image keyword, a container with the specified image is created. If you specify an image, it has no effect. This is the case when you use the [shell executor](https://docs.gitlab.com/runner/executors/shell.html). + **Important**. The terminal job is branch dependent. This means that the configuration file used to trigger and configure the terminal is the one in the selected branch of the Web IDE. diff --git a/spec/experiments/force_company_trial_experiment_spec.rb b/spec/experiments/force_company_trial_experiment_spec.rb new file mode 100644 index 00000000000..42a3245771a --- /dev/null +++ b/spec/experiments/force_company_trial_experiment_spec.rb @@ -0,0 +1,24 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe ForceCompanyTrialExperiment, :experiment do + subject { described_class.new(current_user: user) } + + let(:user) { create(:user, setup_for_company: setup_for_company) } + let(:setup_for_company) { true } + + context 'when a user is setup_for_company' do + it 'is not excluded' do + expect(subject).not_to exclude(user: user) + end + end + + context 'when a user is not setup_for_company' do + let(:setup_for_company) { nil } + + it 'is excluded' do + expect(subject).to exclude(user: user) + end + end +end |