diff --git a/app/assets/stylesheets/framework/variables.scss b/app/assets/stylesheets/framework/variables.scss index 2f3db25f53b..31ef5ae0646 100644 --- a/app/assets/stylesheets/framework/variables.scss +++ b/app/assets/stylesheets/framework/variables.scss @@ -52,6 +52,11 @@ $spacing-scale: ( 5: #{4 * $grid-size} ); +/* Will be moved to @gitlab/ui by https://gitlab.com/gitlab-org/gitlab-ui/-/issues/1709 */ +$gl-spacing-scale-48: 48 * $grid-size; +$gl-spacing-scale-75: 75 * $grid-size; +/* End gitlab-ui#1709 */ + /* * Why another sizing scale??? * Great question, friend! diff --git a/app/assets/stylesheets/highlight/common.scss b/app/assets/stylesheets/highlight/common.scss index e4a8893a25e..bd327082e20 100644 --- a/app/assets/stylesheets/highlight/common.scss +++ b/app/assets/stylesheets/highlight/common.scss @@ -53,11 +53,11 @@ transition: border-left 0.1s ease-out; &.coverage { - border-left: 4px solid $coverage; + border-left: 2px solid $coverage; } &.no-coverage { - border-left: 2px solid $no-coverage; + border-left: 4px solid $no-coverage; } } diff --git a/app/assets/stylesheets/utilities.scss b/app/assets/stylesheets/utilities.scss index 57c9bcde024..bb085e3f5ce 100644 --- a/app/assets/stylesheets/utilities.scss +++ b/app/assets/stylesheets/utilities.scss @@ -285,25 +285,36 @@ $gl-line-height-42: px-to-rem(42px); padding-right: $gl-spacing-scale-10; } -/* Will be moved to @gitlab/ui by https://gitlab.com/gitlab-org/gitlab-ui/-/issues/1709 */ +/* +All of the following (up until the "End gitlab-ui#1709" comment) will be moved +to @gitlab/ui by https://gitlab.com/gitlab-org/gitlab-ui/-/issues/1709 +*/ +.gl-sm-grid-template-columns-2 { + @include media-breakpoint-up(sm) { + grid-template-columns: 1fr 1fr; + } +} + .gl-md-grid-template-columns-2 { @include media-breakpoint-up(md) { grid-template-columns: 1fr 1fr; } } +.gl-md-grid-template-columns-3 { + @include media-breakpoint-up(md) { + grid-template-columns: repeat(3, 1fr); + } +} + .gl-gap-6 { gap: $gl-spacing-scale-6; } -$gl-spacing-scale-48: 48 * $grid-size; - .gl-max-w-48 { max-width: $gl-spacing-scale-48; } -$gl-spacing-scale-75: 75 * $grid-size; - .gl-max-w-75 { max-width: $gl-spacing-scale-75; } @@ -313,4 +324,16 @@ $gl-spacing-scale-75: 75 * $grid-size; padding-top: $gl-spacing-scale-11 !important; // only need !important for now so that it overrides styles from @gitlab/ui which currently take precedence } } + +.gl-md-mb-6 { + @include media-breakpoint-up(md) { + margin-bottom: $gl-spacing-scale-6 !important; // only need !important for now so that it overrides styles from @gitlab/ui which currently take precedence + } +} + +.gl-md-mb-12 { + @include media-breakpoint-up(md) { + margin-bottom: $gl-spacing-scale-12 !important; // only need !important for now so that it overrides styles from @gitlab/ui which currently take precedence + } +} /* End gitlab-ui#1709 */ diff --git a/doc/development/contributing/style_guides.md b/doc/development/contributing/style_guides.md index fdb6e99fdcd..da926005466 100644 --- a/doc/development/contributing/style_guides.md +++ b/doc/development/contributing/style_guides.md @@ -51,20 +51,10 @@ This should return a fully qualified path command with no other output. ### Lefthook configuration -The current Lefthook configuration can be found in [`lefthook.yml`](https://gitlab.com/gitlab-org/gitlab/-/blob/master/lefthook.yml). +Lefthook is configured with a combination of: -Before you push your changes, Lefthook automatically runs the following checks: - -- Danger: Runs a subset of checks that `danger-review` runs on your merge requests. -- ES lint: Run `yarn run lint:eslint` checks (with the [`.eslintrc.yml`](https://gitlab.com/gitlab-org/gitlab/-/blob/master/.eslintrc.yml) configuration) on the modified `*.{js,vue}` files. Tags: `frontend`, `style`. -- HAML lint: Run `bundle exec haml-lint` checks (with the [`.haml-lint.yml`](https://gitlab.com/gitlab-org/gitlab/-/blob/master/.haml-lint.yml) configuration) on the modified `*.html.haml` files. Tags: `view`, `haml`, `style`. -- Markdown lint: Run `yarn markdownlint` checks on the modified `*.md` files. Tags: `documentation`, `style`. -- SCSS lint: Run `yarn lint:stylelint` checks (with the [`.stylelintrc`](https://gitlab.com/gitlab-org/gitlab/-/blob/master/.stylelintrc) configuration) on the modified `*.scss{,.css}` files. Tags: `stylesheet`, `css`, `style`. -- RuboCop: Run `bundle exec rubocop` checks (with the [`.rubocop.yml`](https://gitlab.com/gitlab-org/gitlab/-/blob/master/.rubocop.yml) configuration) on the modified `*.rb` files. Tags: `backend`, `style`. -- Vale: Run `vale` checks (with the [`.vale.ini`](https://gitlab.com/gitlab-org/gitlab/-/blob/master/.vale.ini) configuration) on the modified `*.md` files. Tags: `documentation`, `style`. -- Documentation metadata: Run checks for the absence of [documentation metadata](../documentation/index.md#metadata). - -In addition to the default configuration, you can define a [local configuration](https://github.com/Arkweid/lefthook/blob/master/docs/full_guide.md#local-config). +- Project configuration in [`lefthook.yml`](https://gitlab.com/gitlab-org/gitlab/-/blob/master/lefthook.yml). +- Any [local configuration](https://github.com/Arkweid/lefthook/blob/master/docs/full_guide.md#local-config). ### Disable Lefthook temporarily diff --git a/doc/user/application_security/vulnerabilities/severities.md b/doc/user/application_security/vulnerabilities/severities.md index f33c8d1d7f8..89464064ea3 100644 --- a/doc/user/application_security/vulnerabilities/severities.md +++ b/doc/user/application_security/vulnerabilities/severities.md @@ -35,9 +35,9 @@ the following tables: ## SAST -| GitLab analyzer | Outputs severity levels? | Native severity level type | Native severity level example | -|--------------------------------------------------------------------------------------------------------|--------------------------|----------------------------|------------------------------------| -| [`security-code-scan`](https://gitlab.com/gitlab-org/security-products/analyzers/security-code-scan) | **{check-circle}** Yes | N/A | Hardcodes all severity levels to `Unknown` | +| GitLab analyzer | Outputs severity levels? | Native severity level type | Native severity level example | +|----------------------------------------------------------------------------------------------------------|--------------------------|----------------------------|------------------------------------| +| [`security-code-scan`](https://gitlab.com/gitlab-org/security-products/analyzers/security-code-scan) | **{check-circle}** Yes | String | `CRITICAL`, `HIGH`, `MEDIUM` in [analyzer version 3.2.0 and later](https://gitlab.com/gitlab-org/security-products/analyzers/security-code-scan/-/blob/master/CHANGELOG.md#v320). In earlier versions, hardcoded to `Unknown`. | | [`brakeman`](https://gitlab.com/gitlab-org/security-products/analyzers/brakeman) | **{check-circle}** Yes | String | `HIGH`, `MEDIUM`, `LOW` | | [`sobelow`](https://gitlab.com/gitlab-org/security-products/analyzers/sobelow) | **{check-circle}** Yes | N/A | Hardcodes all severity levels to `Unknown` | | [`nodejs-scan`](https://gitlab.com/gitlab-org/security-products/analyzers/nodejs-scan) | **{check-circle}** Yes | String | `INFO`, `WARNING`, `ERROR` | diff --git a/lefthook.yml b/lefthook.yml index c5c51b53fb3..ce4aa14ea69 100644 --- a/lefthook.yml +++ b/lefthook.yml @@ -54,3 +54,13 @@ pre-push: files: git diff --name-only --diff-filter=d $(git merge-base origin/master HEAD)..HEAD glob: 'doc/*.md' run: scripts/lint-docs-metadata.sh {files} + docs-deprecations: + tags: documentation + files: git diff --name-only --diff-filter=d $(git merge-base origin/master HEAD)..HEAD + glob: 'data/deprecations/*.yml' + run: echo "Changes to deprecation files detected. Checking deprecations..\n"; bundle exec rake gitlab:docs:check_deprecations + docs-removals: + tags: documentation + files: git diff --name-only --diff-filter=d $(git merge-base origin/master HEAD)..HEAD + glob: 'data/removals/**/*.yml' + run: echo "Changes to removals files detected. Checking removals..\n"; bundle exec rake gitlab:docs:check_removals diff --git a/lib/tasks/gitlab/docs/compile_deprecations.rake b/lib/tasks/gitlab/docs/compile_deprecations.rake index 4ac68a9f850..f7821315f82 100644 --- a/lib/tasks/gitlab/docs/compile_deprecations.rake +++ b/lib/tasks/gitlab/docs/compile_deprecations.rake @@ -2,15 +2,19 @@ namespace :gitlab do namespace :docs do + COLOR_CODE_RESET = "\e[0m" + COLOR_CODE_RED = "\e[31m" + COLOR_CODE_GREEN = "\e[32m" + desc "Generate deprecation list from individual files" task :compile_deprecations do require_relative '../../../../tooling/docs/deprecation_handling' path = Rails.root.join("doc/update/deprecations.md") File.write(path, Docs::DeprecationHandling.new('deprecation').render) - puts "Deprecations compiled to #{path}" + puts "#{COLOR_CODE_GREEN}INFO: Deprecations compiled to #{path}.#{COLOR_CODE_RESET}" end - desc "Check that the deprecation doc is up to date" + desc "Check that the deprecation documentation is up to date" task :check_deprecations do require_relative '../../../../tooling/docs/deprecation_handling' path = Rails.root.join("doc/update/deprecations.md") @@ -19,9 +23,15 @@ namespace :gitlab do doc = File.read(path) if doc == contents - puts "Deprecations doc is up to date." + puts "#{COLOR_CODE_GREEN}INFO: Deprecations documentation is up to date.#{COLOR_CODE_RESET}" else - format_output('Deprecations doc is outdated! You (or your technical writer) can update it by running `bin/rake gitlab:docs:compile_deprecations`.') + warn <<~EOS + #{COLOR_CODE_RED}ERROR: Deprecations documentation is outdated!#{COLOR_CODE_RESET} + To update the deprecations documentation, either: + + - Run `bin/rake gitlab:docs:compile_deprecations` and commit the changes to this branch. + - Have a technical writer resolve the issue. + EOS abort end end @@ -31,10 +41,10 @@ namespace :gitlab do require_relative '../../../../tooling/docs/deprecation_handling' path = Rails.root.join("doc/update/removals.md") File.write(path, Docs::DeprecationHandling.new('removal').render) - puts "Removals compiled to #{path}" + puts "#{COLOR_CODE_GREEN}INFO: Removals compiled to #{path}.#{COLOR_CODE_RESET}" end - desc "Check that the removal doc is up to date" + desc "Check that the removal documentation is up to date" task :check_removals do require_relative '../../../../tooling/docs/deprecation_handling' path = Rails.root.join("doc/update/removals.md") @@ -42,9 +52,15 @@ namespace :gitlab do doc = File.read(path) if doc == contents - puts "Removals doc is up to date." + puts "#{COLOR_CODE_GREEN}INFO: Removals documentation is up to date.#{COLOR_CODE_RESET}" else - format_output('Removals doc is outdated! You (or your technical writer) can update it by running `bin/rake gitlab:docs:compile_removals`.') + warn <<~EOS + #{COLOR_CODE_RED}ERROR: Removals documentation is outdated!#{COLOR_CODE_RESET} + To update the removals documentation, either: + + - Run `bin/rake gitlab:docs:compile_removals` and commit the changes to this branch. + - Have a technical writer resolve the issue. + EOS abort end end diff --git a/locale/gitlab.pot b/locale/gitlab.pot index c057a3f57e3..3f787075cf4 100644 --- a/locale/gitlab.pot +++ b/locale/gitlab.pot @@ -18623,6 +18623,9 @@ msgstr "" msgid "InProductMarketing|3 ways to dive into GitLab CI/CD" msgstr "" +msgid "InProductMarketing|A single application eliminates complex integrations, data chokepoints, and toolchain maintenance, resulting in greater productivity and lower cost." +msgstr "" + msgid "InProductMarketing|Access advanced features, build more efficiently, strengthen security and compliance." msgstr "" @@ -18650,6 +18653,9 @@ msgstr "" msgid "InProductMarketing|Blog" msgstr "" +msgid "InProductMarketing|Break down silos to coordinate seamlessly across development, operations, and security with a consistent experience across the development lifecycle." +msgstr "" + msgid "InProductMarketing|By enabling code owners and required merge approvals the right person will review the right MR. This is a win-win: cleaner code and a more efficient review process." msgstr "" @@ -18662,6 +18668,9 @@ msgstr "" msgid "InProductMarketing|Collaboration across stages in GitLab" msgstr "" +msgid "InProductMarketing|Collaboration made easy" +msgstr "" + msgid "InProductMarketing|Create a custom CI runner with just a few clicks" msgstr "" @@ -18761,6 +18770,9 @@ msgstr "" msgid "InProductMarketing|GitLab is better with teammates to help out!" msgstr "" +msgid "InProductMarketing|GitLab is infrastructure agnostic (supporting GCP, AWS, Azure, OpenShift, VMWare, On Prem, Bare Metal, and more), offering a consistent workflow experience – irrespective of the environment." +msgstr "" + msgid "InProductMarketing|GitLab provides static application security testing (SAST), dynamic application security testing (DAST), container scanning, and dependency scanning to help you deliver secure applications along with license compliance." msgstr "" @@ -18854,6 +18866,9 @@ msgstr "" msgid "InProductMarketing|Launch GitLab CI/CD in 20 minutes or less" msgstr "" +msgid "InProductMarketing|Lower cost of development" +msgstr "" + msgid "InProductMarketing|Making the switch? It's easier than you think to import your projects into GitLab. Move %{github_link}, or import something %{bitbucket_link}." msgstr "" @@ -18890,6 +18905,9 @@ msgstr "" msgid "InProductMarketing|Sometimes you're not ready to make a full transition to a new tool. If you're not ready to fully commit, %{mirroring_link} gives you a safe way to try out GitLab in parallel with your current tool." msgstr "" +msgid "InProductMarketing|Speed. Efficiency. Trust." +msgstr "" + msgid "InProductMarketing|Spin up an autoscaling runner in GitLab" msgstr "" @@ -19025,6 +19043,9 @@ msgstr "" msgid "InProductMarketing|YouTube" msgstr "" +msgid "InProductMarketing|Your software, deployed your way" +msgstr "" + msgid "InProductMarketing|Your teams can be more efficient" msgstr "" diff --git a/qa/qa/service/praefect_manager.rb b/qa/qa/service/praefect_manager.rb index c2eb50a4f7f..8ffb7c47652 100644 --- a/qa/qa/service/praefect_manager.rb +++ b/qa/qa/service/praefect_manager.rb @@ -1,5 +1,7 @@ # frozen_string_literal: true +require 'digest' + module QA module Service class PraefectManager @@ -68,7 +70,7 @@ module QA def stop_secondary_node stop_node(@secondary_node) - wait_until_node_is_removed_from_healthy_storages(@stop_secondary_node) + wait_until_node_is_removed_from_healthy_storages(@secondary_node) end def start_secondary_node @@ -106,6 +108,8 @@ module QA end def stop_node(name) + return if node_state(name) == 'paused' + shell "docker pause #{name}" end @@ -200,7 +204,7 @@ module QA start_node(@primary_node) start_node(@secondary_node) start_node(@tertiary_node) - start_node(@praefect) + start_praefect wait_for_health_check_all_nodes end @@ -281,6 +285,48 @@ module QA end end + def praefect_dataloss_information(project_id) + dataloss_info = [] + cmd = "docker exec #{@praefect} praefect -config /var/opt/gitlab/praefect/config.toml dataloss --partially-unavailable=true" + shell(cmd) { |line| dataloss_info << line.strip } + + # Expected will have a record for each repository in the storage, in the following format + # @hashed/bc/52/bc52dd634277c4a34a2d6210994a9a5e2ab6d33bb4a3a8963410e00ca6c15a02.git: + # Primary: gitaly1 + # In-Sync Storages: + # gitaly1, assigned host + # gitaly3, assigned host + # Outdated Storages: + # gitaly2 is behind by 1 change or less, assigned host + # + # Alternatively, if all repositories are in sync, a concise message is returned + # Virtual storage: default + # All repositories are fully available on all assigned storages! + + # extract the relevant project under test info if it is identified + start_index = dataloss_info.index { |line| line.include?("#{Digest::SHA256.hexdigest(project_id.to_s)}.git") } + unless start_index.nil? + dataloss_info = dataloss_info[start_index, 7] + end + + dataloss_info&.each { |info| QA::Runtime::Logger.debug(info) } + dataloss_info + end + + def praefect_dataloss_info_for_project(project_id) + dataloss_info = [] + Support::Retrier.retry_until(max_duration: 60) do + dataloss_info = praefect_dataloss_information(project_id) + dataloss_info.include?("#{Digest::SHA256.hexdigest(project_id.to_s)}.git") + end + end + + def wait_for_project_synced_across_all_storages(project_id) + Support::Retrier.retry_until(max_duration: 60) do + praefect_dataloss_information(project_id).include?('All repositories are fully available on all assigned storages!') + end + end + def wait_for_health_check_all_nodes wait_for_gitaly_health_check(@primary_node) wait_for_gitaly_health_check(@secondary_node) diff --git a/qa/qa/specs/features/api/3_create/gitaly/praefect_dataloss_spec.rb b/qa/qa/specs/features/api/3_create/gitaly/praefect_dataloss_spec.rb new file mode 100644 index 00000000000..6e2a34afb3e --- /dev/null +++ b/qa/qa/specs/features/api/3_create/gitaly/praefect_dataloss_spec.rb @@ -0,0 +1,57 @@ +# frozen_string_literal: true + +module QA + RSpec.describe 'Create' do + context 'Praefect dataloss commands', :orchestrated, :gitaly_cluster do + let(:praefect_manager) { Service::PraefectManager.new } + + let(:project) do + Resource::Project.fabricate! do |project| + project.name = 'gitaly_cluster-dataloss-project' + project.initialize_with_readme = true + end + end + + before do + praefect_manager.start_all_nodes + end + + it 'confirms that changes are synced across all storages', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/352691' do + expect { praefect_manager.praefect_dataloss_information(project.id) } + .to(eventually_include('All repositories are fully available on all assigned storages!') + .within(max_duration: 60)) + end + + it 'identifies how many changes are not in sync across storages', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/352692' do + # Ensure our test repository is replicated and in a consistent state prior to test + praefect_manager.wait_for_project_synced_across_all_storages(project.id) + + # testing for gitaly2 'out of sync' + praefect_manager.stop_secondary_node + + number_of_changes = 3 + 1.upto(number_of_changes) do |i| + Resource::Repository::Commit.fabricate_via_api! do |commit| + commit.project = project + commit.branch = "newbranch-#{SecureRandom.hex(8)}" + commit.start_branch = project.default_branch + commit.commit_message = 'Add new file' + commit.add_files([ + { file_path: "new_file-#{SecureRandom.hex(8)}.txt", content: 'new file' } + ]) + end + end + + # testing for gitaly3 'in sync' but marked unhealthy + praefect_manager.stop_tertiary_node + + project_data_loss = praefect_manager.praefect_dataloss_information(project.id) + aggregate_failures "validate dataloss identified" do + expect(project_data_loss).to include('gitaly1, assigned host') + expect(project_data_loss).to include("gitaly2 is behind by #{number_of_changes} changes or less, assigned host, unhealthy") + expect(project_data_loss).to include('gitaly3, assigned host, unhealthy') + end + end + end + end +end diff --git a/qa/qa/specs/features/browser_ui/14_non_devops/service_ping_default_enabled_spec.rb b/qa/qa/specs/features/browser_ui/14_non_devops/service_ping_default_enabled_spec.rb index a7c846b2173..bb4e0d71710 100644 --- a/qa/qa/specs/features/browser_ui/14_non_devops/service_ping_default_enabled_spec.rb +++ b/qa/qa/specs/features/browser_ui/14_non_devops/service_ping_default_enabled_spec.rb @@ -2,7 +2,7 @@ module QA RSpec.describe 'Service ping default enabled' do - context 'When using default enabled from gitlab.yml config', :requires_admin do + context 'When using default enabled from gitlab.yml config', :requires_admin, except: { job: 'review-qa-*' } do before do Flow::Login.sign_in_as_admin diff --git a/qa/qa/specs/features/browser_ui/3_create/web_ide/open_fork_in_web_ide_spec.rb b/qa/qa/specs/features/browser_ui/3_create/web_ide/open_fork_in_web_ide_spec.rb index e9d8e35478f..96e85139e78 100644 --- a/qa/qa/specs/features/browser_ui/3_create/web_ide/open_fork_in_web_ide_spec.rb +++ b/qa/qa/specs/features/browser_ui/3_create/web_ide/open_fork_in_web_ide_spec.rb @@ -11,7 +11,7 @@ module QA end context 'when a user does not have permissions to commit to the project' do - let(:user) { Resource::User.fabricate_or_use(Runtime::Env.gitlab_qa_username_6, Runtime::Env.gitlab_qa_password_6) } + let(:user) { Resource::User.fabricate_or_use(Runtime::Env.gitlab_qa_username_2, Runtime::Env.gitlab_qa_password_2) } context 'when no fork is present' do it 'suggests to create a fork when a user clicks Web IDE in the main project', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347823' do diff --git a/qa/qa/tools/delete_test_resources.rb b/qa/qa/tools/delete_test_resources.rb index 31499559481..6f63c56f736 100644 --- a/qa/qa/tools/delete_test_resources.rb +++ b/qa/qa/tools/delete_test_resources.rb @@ -64,7 +64,7 @@ module QA transformed_values = resources.transform_values! do |v| v.reject do |attributes| attributes['info'] == "with full_path 'gitlab-qa-sandbox-group'" || - attributes['http_method'] == 'get' && !attributes['info'].include?("with username 'qa-") || + attributes['http_method'] == 'get' && !attributes['info']&.include?("with username 'qa-") || attributes['api_path'] == 'Cannot find resource API path' end end