diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-11-24 09:09:56 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-11-24 09:09:56 +0300 |
commit | 3d1f123313fc350f217081c6ccf38169420bf92d (patch) | |
tree | 8c2849e22d07e1db01f2748613060a5dadebf71f | |
parent | bec5b7b1b68ddc670a1566a36037402c3c37e0f3 (diff) |
Add latest changes from gitlab-org/gitlab@master
-rw-r--r-- | .gitlab/ci/preflight.gitlab-ci.yml | 2 | ||||
-rw-r--r-- | .gitlab/ci/qa-common/main.gitlab-ci.yml | 8 | ||||
-rw-r--r-- | .gitlab/ci/rules.gitlab-ci.yml | 12 | ||||
-rw-r--r-- | .gitlab/ci/test-on-gdk/main.gitlab-ci.yml | 49 | ||||
-rw-r--r-- | app/controllers/groups/work_items_controller.rb | 2 | ||||
-rw-r--r-- | app/models/description_version.rb | 2 | ||||
-rw-r--r-- | app/models/work_item.rb | 4 | ||||
-rw-r--r-- | config/feature_flags/development/api_redirect_moved_projects.yml | 8 | ||||
-rw-r--r-- | doc/api/rest/index.md | 8 | ||||
-rw-r--r-- | lib/api/helpers.rb | 3 | ||||
-rw-r--r-- | qa/qa/resource/project.rb | 12 | ||||
-rw-r--r-- | qa/qa/specs/features/api/1_manage/import/import_large_github_repo_spec.rb | 13 | ||||
-rw-r--r-- | qa/qa/specs/features/api/3_create/repository/files_spec.rb | 2 | ||||
-rw-r--r-- | qa/qa/specs/features/browser_ui/3_create/repository/clone_spec.rb | 2 | ||||
-rw-r--r-- | qa/qa/specs/features/browser_ui/4_verify/runner/register_group_runner_spec.rb | 13 | ||||
-rw-r--r-- | qa/tasks/knapsack.rake | 16 | ||||
-rw-r--r-- | spec/requests/api/projects_spec.rb | 10 |
17 files changed, 72 insertions, 94 deletions
diff --git a/.gitlab/ci/preflight.gitlab-ci.yml b/.gitlab/ci/preflight.gitlab-ci.yml index 745d85ab084..6723608d0db 100644 --- a/.gitlab/ci/preflight.gitlab-ci.yml +++ b/.gitlab/ci/preflight.gitlab-ci.yml @@ -77,5 +77,5 @@ qa:selectors: qa:selectors-as-if-foss: extends: - qa:selectors - - .qa:rules:as-if-foss + - .qa:rules:selectors-as-if-foss - .as-if-foss diff --git a/.gitlab/ci/qa-common/main.gitlab-ci.yml b/.gitlab/ci/qa-common/main.gitlab-ci.yml index f263c72aed7..90a4d3fb008 100644 --- a/.gitlab/ci/qa-common/main.gitlab-ci.yml +++ b/.gitlab/ci/qa-common/main.gitlab-ci.yml @@ -86,11 +86,11 @@ stages: KNAPSACK_DIR: ${CI_PROJECT_DIR}/qa/knapsack GIT_STRATEGY: none script: - - echo "KNAPSACK_TEST_FILE_PATTERN is ${KNAPSACK_TEST_FILE_PATTERN}" - # when using qa-image, code runs in /home/gitlab/qa folder - bundle exec rake "knapsack:download[test]" - - '[ -n "$QA_TESTS" ] && bundle exec rake "knapsack:create_reports_for_selective"' - - mkdir -p "$KNAPSACK_DIR" && cp knapsack/*.json "${KNAPSACK_DIR}/" + - bundle exec rake "knapsack:create_reports_for_selective" + after_script: + # when using qa-image, code runs in /home/gitlab/qa folder + - mkdir -p "$KNAPSACK_DIR" && cp /home/gitlab/qa/knapsack/*.json "${KNAPSACK_DIR}/" allow_failure: true artifacts: paths: diff --git a/.gitlab/ci/rules.gitlab-ci.yml b/.gitlab/ci/rules.gitlab-ci.yml index 1e13d3862d6..fad05f8eb50 100644 --- a/.gitlab/ci/rules.gitlab-ci.yml +++ b/.gitlab/ci/rules.gitlab-ci.yml @@ -418,6 +418,12 @@ - ".dockerignore" - "{,jh/}qa/**/*" +# Frontend view patterns + .qa-patterns +.frontend-qa-patterns: &frontend-qa-patterns + - "{,ee/,jh/}{app/assets,app/components,app/helpers,app/presenters,app/views}/**/*" + # QA changes + - "{,jh/}qa/**/*" + # Code patterns + .ci-patterns .code-patterns: &code-patterns - "{package.json,yarn.lock}" @@ -1470,11 +1476,11 @@ - <<: *if-default-refs changes: *code-qa-patterns -.qa:rules:as-if-foss: +.qa:rules:selectors-as-if-foss: rules: - !reference [".strict-ee-only-rules", rules] - - <<: *if-security-merge-request - changes: *code-qa-patterns + - <<: *if-merge-request + changes: *frontend-qa-patterns - <<: *if-merge-request-labels-as-if-foss - <<: *if-merge-request-labels-run-all-rspec diff --git a/.gitlab/ci/test-on-gdk/main.gitlab-ci.yml b/.gitlab/ci/test-on-gdk/main.gitlab-ci.yml index d56564b1295..d8685641fa9 100644 --- a/.gitlab/ci/test-on-gdk/main.gitlab-ci.yml +++ b/.gitlab/ci/test-on-gdk/main.gitlab-ci.yml @@ -3,18 +3,6 @@ include: - local: .gitlab/ci/qa-common/main.gitlab-ci.yml - local: .gitlab/ci/qa-common/rules.gitlab-ci.yml - local: .gitlab/ci/qa-common/variables.gitlab-ci.yml - - component: "gitlab.com/gitlab-org/quality/pipeline-common/allure-report@7.3.0" - inputs: - job_name: "e2e-test-report" - job_stage: "report" - aws_access_key_id_variable_name: "QA_ALLURE_AWS_ACCESS_KEY_ID" - aws_secret_access_key_variable_name: "QA_ALLURE_AWS_SECRET_ACCESS_KEY" - gitlab_auth_token_variable_name: "PROJECT_TOKEN_FOR_CI_SCRIPTS_API_USAGE" - allure_results_glob: "qa/tmp/allure-results" - allure_ref_slug: "${CI_COMMIT_REF_SLUG}" - allure_project_path: "${CI_PROJECT_PATH}" - allure_merge_request_iid: "${CI_MERGE_REQUEST_IID}" - allure_job_name: "${QA_RUN_TYPE}" # code pattern changes .code-pattern-changes: &code-pattern-changes @@ -24,12 +12,6 @@ include: .qa-run-all-tests: &qa-run-all-tests if: $QA_FRAMEWORK_CHANGES == "true" || $QA_RUN_ALL_TESTS == "true" || $QA_RUN_ALL_E2E_LABEL == "true" || $QA_FEATURE_FLAGS =~ /deleted/ -variables: - COLORIZED_LOGS: "true" - GIT_DEPTH: "20" - GIT_STRATEGY: "clone" # 'GIT_STRATEGY: clone' optimizes the pack-objects cache hit ratio - GIT_SUBMODULE_STRATEGY: "none" - .rules:gdk:qa-selective: rules: - <<: *code-pattern-changes @@ -42,6 +24,7 @@ variables: - *code-pattern-changes - !reference [.rules:test:qa-parallel, rules] - if: $QA_SUITES =~ /Test::Instance::Blocking/ + - !reference [.rules:test:manual, rules] .rules:gdk:qa-smoke: rules: @@ -52,6 +35,7 @@ variables: variables: QA_TESTS: "" - if: $QA_SUITES =~ /Test::Instance::Smoke/ + - !reference [.rules:test:manual, rules] .gdk-qa-base: image: ${REGISTRY_HOST}/${REGISTRY_GROUP}/gitlab-build-images/debian-${DEBIAN_VERSION}-ruby-${RUBY_VERSION}:bundler-2.3-git-2.36-lfs-2.9-chrome-${CHROME_VERSION}-docker-${DOCKER_VERSION}-gcloud-383-kubectl-1.23 @@ -119,11 +103,6 @@ variables: expire_in: 7 days when: always -download-knapsack-report: - extends: - - .download-knapsack-report - - .rules:download-knapsack - # Take the existing GDK docker image and reconfigure it with Postgres load # balancing. Adding 5s lag to 1 of the replicas to validate robustness of # the load balancer. @@ -138,11 +117,31 @@ download-knapsack-report: gdk reconfigure &&\ gdk restart" +# ========================================== +# Pre stage +# ========================================== +# override .download-knapsack-report job to not depend on qa-image build +download-knapsack-report: + extends: + - .download-knapsack-report + - .ruby-image + - .bundler-variables + - .qa-cache + - .rules:download-knapsack + variables: + GIT_STRATEGY: clone + before_script: + - cd qa && bundle install + after_script: [] + download-fast-quarantine-report: extends: - .download-fast-quarantine-report - .rules:download-fast-quarantine-report +# ========================================== +# Test stage +# ========================================== gdk-qa-smoke: extends: - .gdk-qa-base @@ -216,13 +215,15 @@ gdk-qa-non-blocking: QA_RUN_TYPE: gdk-qa-non-blocking rules: - when: manual - allow_failure: true + allow_failure: true # ========================================== # Post test stage # ========================================== e2e-test-report: extends: .rules:report:allure-report + variables: + ALLURE_REPORT_RESULTS_GLOB: "qa/tmp/allure-results" upload-knapsack-report: extends: diff --git a/app/controllers/groups/work_items_controller.rb b/app/controllers/groups/work_items_controller.rb index ece279da778..bfb5b74d2a5 100644 --- a/app/controllers/groups/work_items_controller.rb +++ b/app/controllers/groups/work_items_controller.rb @@ -20,3 +20,5 @@ module Groups end end end + +Groups::WorkItemsController.prepend_mod diff --git a/app/models/description_version.rb b/app/models/description_version.rb index 05cca9f931f..71c16621c9e 100644 --- a/app/models/description_version.rb +++ b/app/models/description_version.rb @@ -31,4 +31,4 @@ class DescriptionVersion < ApplicationRecord end end -DescriptionVersion.prepend_mod_with('DescriptionVersion') +DescriptionVersion.prepend_mod diff --git a/app/models/work_item.rb b/app/models/work_item.rb index a62d77939bf..05c230628ce 100644 --- a/app/models/work_item.rb +++ b/app/models/work_item.rb @@ -37,6 +37,10 @@ class WorkItem < Issue } class << self + def find_by_namespace_and_iid!(namespace, iid) + find_by!(namespace: namespace, iid: iid) + end + def assignee_association_name 'issue' end diff --git a/config/feature_flags/development/api_redirect_moved_projects.yml b/config/feature_flags/development/api_redirect_moved_projects.yml deleted file mode 100644 index 56c01d3862b..00000000000 --- a/config/feature_flags/development/api_redirect_moved_projects.yml +++ /dev/null @@ -1,8 +0,0 @@ ---- -name: api_redirect_moved_projects -introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/128642 -rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/421992 -milestone: '16.3' -type: development -group: group::source code -default_enabled: false diff --git a/doc/api/rest/index.md b/doc/api/rest/index.md index 4ec226c0888..1d5d447c871 100644 --- a/doc/api/rest/index.md +++ b/doc/api/rest/index.md @@ -347,12 +347,8 @@ The following table shows the possible return codes for API requests. ## Redirects -> Introduced in GitLab 16.4 [with a flag](../../user/feature_flags.md) named `api_redirect_moved_projects`. Disabled by default. - -FLAG: -On GitLab.com, this feature is not available. -On self-managed GitLab, by default this feature is not available. To make it available, -an administrator can [enable the feature flag](../../user/feature_flags.md) named `api_redirect_moved_projects`. +> - Introduced in GitLab 16.4 [with a flag](../../user/feature_flags.md) named `api_redirect_moved_projects`. Disabled by default. +> - [Generally available](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/137578) in GitLab 16.7. Feature flag `api_redirect_moved_projects` removed. After [path changes](../../user/project/repository/index.md#what-happens-when-a-repository-path-changes) the REST API can respond with a redirect and users should be able to handle such responses. diff --git a/lib/api/helpers.rb b/lib/api/helpers.rb index bb94d5d14d0..7c57666b843 100644 --- a/lib/api/helpers.rb +++ b/lib/api/helpers.rb @@ -146,7 +146,7 @@ module API if id.is_a?(Integer) || id =~ INTEGER_ID_REGEX projects.find_by(id: id) elsif id.include?("/") - projects.find_by_full_path(id, follow_redirects: Feature.enabled?(:api_redirect_moved_projects)) + projects.find_by_full_path(id, follow_redirects: true) end end # rubocop: enable CodeReuse/ActiveRecord @@ -905,7 +905,6 @@ module API end def project_moved?(id, project) - return false unless Feature.enabled?(:api_redirect_moved_projects) return false unless id.is_a?(String) && id.include?('/') return false if project.blank? || project.full_path.casecmp?(id) return false unless params[:id] == id diff --git a/qa/qa/resource/project.rb b/qa/qa/resource/project.rb index b2a5e5df4a9..01786d3d4b6 100644 --- a/qa/qa/resource/project.rb +++ b/qa/qa/resource/project.rb @@ -342,17 +342,7 @@ module QA raise ResourceQueryError, "Could not get import status. Request returned (#{response.code}): `#{response}`." end - result = parse_body(response) - - if result[:import_status] == "failed" - Runtime::Logger.error(<<~ERR) - Import of project '#{full_path}' failed! - error: '#{result[:import_error]}' - failed relations: '#{result[:failed_relations]}' - ERR - end - - result + parse_body(response) end def commits(auto_paginate: false, attempts: 0) diff --git a/qa/qa/specs/features/api/1_manage/import/import_large_github_repo_spec.rb b/qa/qa/specs/features/api/1_manage/import/import_large_github_repo_spec.rb index e140b37e137..c9c35079c12 100644 --- a/qa/qa/specs/features/api/1_manage/import/import_large_github_repo_spec.rb +++ b/qa/qa/specs/features/api/1_manage/import/import_large_github_repo_spec.rb @@ -208,7 +208,7 @@ module QA end end - let(:import_status) { imported_project.project_import_status } + let(:status_details) { (@import_status || {}).slice(:import_error, :failed_relations, :correlation_id) } before do QA::Support::Helpers::ImportSource.enable('github') @@ -221,7 +221,7 @@ module QA importer: :github, import_finished: false, import_time: Time.now - @start - })) + }.merge(status_details))) end # add additional import time metric @@ -232,18 +232,14 @@ module QA status: example.exception ? "failed" : "passed", import_time: @import_time, import_finished: true, - errors: import_status[:failed_relations], - correlation_id: import_status[:correlation_id], reported_stats: @stats - })) + }.merge(status_details))) end save_data_json(test_result_data({ status: example.exception ? "failed" : "passed", import_time: @import_time, import_finished: true, - errors: import_status[:failed_relations], - correlation_id: import_status[:correlation_id], reported_stats: @stats, source: { data: { @@ -277,7 +273,7 @@ module QA mrs: @mr_diff, issues: @issue_diff } - })) + }.merge(status_details))) end it( @@ -298,6 +294,7 @@ module QA import_status = -> { imported_project.project_import_status.then do |status| + @import_status = status @stats = status[:stats]&.slice(:fetched, :imported) # fail fast if import explicitly failed diff --git a/qa/qa/specs/features/api/3_create/repository/files_spec.rb b/qa/qa/specs/features/api/3_create/repository/files_spec.rb index 2aeb56c1c2b..90e6e2e6918 100644 --- a/qa/qa/specs/features/api/3_create/repository/files_spec.rb +++ b/qa/qa/specs/features/api/3_create/repository/files_spec.rb @@ -4,7 +4,7 @@ require 'airborne' module QA RSpec.describe 'Create' do - describe 'API basics', product_group: :source_code do + describe 'API basics', :reliable, product_group: :source_code do before(:context) do @api_client = Runtime::API::Client.new(:gitlab) end diff --git a/qa/qa/specs/features/browser_ui/3_create/repository/clone_spec.rb b/qa/qa/specs/features/browser_ui/3_create/repository/clone_spec.rb index 15bd324da7c..bb98ab5c5be 100644 --- a/qa/qa/specs/features/browser_ui/3_create/repository/clone_spec.rb +++ b/qa/qa/specs/features/browser_ui/3_create/repository/clone_spec.rb @@ -2,7 +2,7 @@ module QA RSpec.describe 'Create' do - describe 'Git clone over HTTP', product_group: :source_code do + describe 'Git clone over HTTP', :reliable, product_group: :source_code do let(:project) { create(:project, name: 'project-with-code', description: 'project for git clone tests') } before do diff --git a/qa/qa/specs/features/browser_ui/4_verify/runner/register_group_runner_spec.rb b/qa/qa/specs/features/browser_ui/4_verify/runner/register_group_runner_spec.rb index 9fe0f1c54b3..3b4ac0af0b1 100644 --- a/qa/qa/specs/features/browser_ui/4_verify/runner/register_group_runner_spec.rb +++ b/qa/qa/specs/features/browser_ui/4_verify/runner/register_group_runner_spec.rb @@ -1,12 +1,7 @@ # frozen_string_literal: true module QA - RSpec.describe 'Verify', :runner, product_group: :runner, - quarantine: { - only: { job: 'airgapped' }, - issue: 'https://gitlab.com/gitlab-org/gitlab/-/issues/390184', - type: :stale - } do + RSpec.describe 'Verify', :runner, product_group: :runner do describe 'Group runner registration' do let(:executor) { "qa-runner-#{Time.now.to_i}" } @@ -21,7 +16,7 @@ module QA end it( - 'user registers a new group runner', :reliable, + 'user registers a new group runner', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/388740' ) do Flow::Login.sign_in @@ -30,7 +25,9 @@ module QA Page::Group::Menu.perform(&:go_to_runners) - expect(page).to have_content(executor) + Support::Retrier.retry_on_exception(sleep_interval: 2, message: "Retry failed when looking for runner name") do + expect(page).to have_content(executor) + end end end end diff --git a/qa/tasks/knapsack.rake b/qa/tasks/knapsack.rake index b8a8d6e1145..e1282bca4db 100644 --- a/qa/tasks/knapsack.rake +++ b/qa/tasks/knapsack.rake @@ -38,20 +38,24 @@ namespace :knapsack do reports.each do |report_name| QA::Support::KnapsackReport.new(report_name).download_report rescue StandardError => e - QA::Runtime::Logger.error(e) + QA::Runtime::Logger.error("Failed to download knapsack report '#{report_name}', error: #{e}") end end desc "Create knapsack reports from existing reports for selective jobs" task :create_reports_for_selective do - reports = Dir.glob("knapsack/*").map { |file| file.match(%r{.*/(.*)?\.json})[1] } + qa_tests = ENV["QA_TESTS"] + if qa_tests.blank? + next QA::Runtime::Logger.info("QA_TESTS not set, skipping report creation for selective execution") + end + reports = Dir.glob("knapsack/*").map { |file| file.match(%r{.*/(.*)?\.json})[1] } reports.each do |report_name| - unless report_name.include?('-selective-parallel') - QA::Support::KnapsackReport.new(report_name).create_for_selective(ENV['QA_TESTS']) - end + next unless report_name.include?('-selective-parallel') + + QA::Support::KnapsackReport.new(report_name).create_for_selective(qa_tests) rescue StandardError => e - QA::Runtime::Logger.error(e) + QA::Runtime::Logger.error("Failed to create report '#{report_name}', error: #{e}") end end diff --git a/spec/requests/api/projects_spec.rb b/spec/requests/api/projects_spec.rb index 1ed185ad5a8..41ea27f95de 100644 --- a/spec/requests/api/projects_spec.rb +++ b/spec/requests/api/projects_spec.rb @@ -2852,16 +2852,6 @@ RSpec.describe API::Projects, :aggregate_failures, feature_category: :groups_and expect(response).to have_gitlab_http_status(:not_found) end end - - context 'when api_redirect_moved_projects is disabled' do - it 'returns a 404 error' do - stub_feature_flags(api_redirect_moved_projects: false) - - perform_request - - expect(response).to have_gitlab_http_status(:not_found) - end - end end it 'returns a 404 error if not found' do |