From 8b1036168b0d395c379cbbaf457e256860147405 Mon Sep 17 00:00:00 2001 From: GitLab Bot Date: Wed, 1 Mar 2023 15:10:00 +0000 Subject: [PATCH] Add latest changes from gitlab-org/gitlab@master --- .gitlab-ci.yml | 3 + .gitlab/CODEOWNERS | 2 +- .../ci/package-and-test/main.gitlab-ci.yml | 2 + .../package-and-test/variables.gitlab-ci.yml | 1 + .gitlab/ci/qa.gitlab-ci.yml | 3 + .gitlab/ci/release-environments.gitlab-ci.yml | 22 ++++++ .../release-environments/main.gitlab-ci.yml | 62 +++++++++++++++ .gitlab/ci/rules.gitlab-ci.yml | 18 +++++ app/assets/javascripts/{flash.js => alert.js} | 2 +- .../javascripts/service_ping_consent.js | 2 +- .../super_sidebar/components/nav_item.vue | 19 ++++- .../super_sidebar/components/user_bar.vue | 18 ++++- .../concerns/authenticates_with_two_factor.rb | 2 - app/helpers/sidebars_helper.rb | 1 + .../ci_batch_project_includes_context.yml | 8 ++ .../use_traversal_ids_for_ancestor_scopes.yml | 2 +- config/initializers/1_settings.rb | 2 +- config/settings.rb | 7 ++ config/webpack.config.js | 3 + ...s_source_partition_id_and_source_job_id.rb | 15 ++++ ...s_ci_sources_pipelines_on_source_job_id.rb | 35 +++++++++ db/schema_migrations/20230227123949 | 1 + db/schema_migrations/20230227123950 | 1 + db/structure.sql | 5 +- doc/user/project/repository/tags/index.md | 7 +- jest.config.base.js | 3 + lib/gitlab/ci/config/external/file/base.rb | 12 +++ lib/gitlab/ci/config/external/file/project.rb | 68 +++++++++++++--- .../ci/config/external/mapper/verifier.rb | 33 ++++++++ .../vulnerability_reports_comparer.rb | 29 ++++--- lib/sidebars/menu.rb | 1 + lib/sidebars/menu_item.rb | 6 +- spec/config/settings_spec.rb | 14 ++++ spec/db/schema_spec.rb | 2 +- .../frontend/{flash_spec.js => alert_spec.js} | 2 +- .../clusters_list/store/actions_spec.js | 2 +- .../contributors/store/actions_spec.js | 2 +- .../deploy_freeze/store/actions_spec.js | 2 +- .../design_management/pages/index_spec.js | 2 +- .../utils/cache_update_spec.js | 2 +- .../error_tracking/store/actions_spec.js | 2 +- .../store/details/actions_spec.js | 2 +- .../error_tracking/store/list/actions_spec.js | 2 +- .../merge_conflicts/store/actions_spec.js | 2 +- .../components/details/store/actions_spec.js | 2 +- .../components/list/stores/actions_spec.js | 2 +- .../test_reports/stores/actions_spec.js | 2 +- .../test_reports/stores/mutations_spec.js | 2 +- .../projects/commit/store/actions_spec.js | 2 +- .../super_sidebar/components/nav_item_spec.js | 34 ++++++++ .../super_sidebar/components/user_bar_spec.js | 25 +++++- spec/frontend/super_sidebar/mock_data.js | 2 + spec/helpers/sidebars_helper_spec.rb | 1 + .../ci/config/external/file/project_spec.rb | 30 ++++++++ .../config/external/mapper/verifier_spec.rb | 77 ++++++++++++++++--- .../vulnerability_reports_comparer_spec.rb | 26 ++++++- spec/lib/gitlab/sidekiq_queue_spec.rb | 10 +-- spec/lib/sidebars/menu_spec.rb | 36 +++++++-- spec/lib/sidebars/static_menu_spec.rb | 6 +- spec/support/helpers/query_recorder.rb | 4 + spec/support/rspec_order_todo.yml | 5 -- .../concerns/cluster_agent_queue_spec.rb | 1 - spec/workers/concerns/cluster_queue_spec.rb | 21 ----- spec/workers/concerns/cronjob_queue_spec.rb | 4 - .../gitlab/github_import/queue_spec.rb | 18 ----- .../pipeline_background_queue_spec.rb | 21 ----- spec/workers/concerns/pipeline_queue_spec.rb | 21 ----- .../concerns/repository_check_queue_spec.rb | 4 - .../expired_notification_worker_spec.rb | 1 - .../expiring_soon_notification_worker_spec.rb | 1 - 70 files changed, 606 insertions(+), 183 deletions(-) create mode 100644 .gitlab/ci/release-environments.gitlab-ci.yml create mode 100644 .gitlab/ci/release-environments/main.gitlab-ci.yml rename app/assets/javascripts/{flash.js => alert.js} (98%) create mode 100644 config/feature_flags/development/ci_batch_project_includes_context.yml create mode 100644 db/post_migrate/20230227123949_validate_fk_on_ci_sources_pipelines_source_partition_id_and_source_job_id.rb create mode 100644 db/post_migrate/20230227123950_remove_fk_to_ci_builds_ci_sources_pipelines_on_source_job_id.rb create mode 100644 db/schema_migrations/20230227123949 create mode 100644 db/schema_migrations/20230227123950 rename spec/frontend/{flash_spec.js => alert_spec.js} (99%) create mode 100644 spec/frontend/super_sidebar/components/nav_item_spec.js delete mode 100644 spec/workers/concerns/cluster_queue_spec.rb delete mode 100644 spec/workers/concerns/gitlab/github_import/queue_spec.rb delete mode 100644 spec/workers/concerns/pipeline_background_queue_spec.rb delete mode 100644 spec/workers/concerns/pipeline_queue_spec.rb diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 3b22e2fc21e..29e51b25200 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -12,6 +12,7 @@ stages: - post-qa - pages - notify + - release-environments # always use `gitlab-org` runners, however # in cases where jobs require Docker-in-Docker, the job @@ -32,6 +33,8 @@ default: .ruby2-variables: &ruby2-variables RUBY_VERSION: "2.7" + OMNIBUS_GITLAB_RUBY2_BUILD: "true" + OMNIBUS_GITLAB_CACHE_EDITION: "GITLAB_RUBY2" .default-branch-incident-variables: &default-branch-incident-variables CREATE_INCIDENT_FOR_PIPELINE_FAILURE: "true" diff --git a/.gitlab/CODEOWNERS b/.gitlab/CODEOWNERS index 67bd749d3e0..53933fe3ee0 100644 --- a/.gitlab/CODEOWNERS +++ b/.gitlab/CODEOWNERS @@ -798,7 +798,7 @@ lib/gitlab/checks/** @proglottis @toon @zj-gitlab /doc/integration/jenkins.md @ashrafkhamis /doc/integration/jira/ @ashrafkhamis /doc/integration/mattermost/ @axil -/doc/integration/partner_marketplace.md @drcatherinepope +/doc/integration/partner_marketplace.md @fneill /doc/integration/recaptcha.md @phillipwells /doc/integration/security_partners/ @rdickenson /doc/integration/slash_commands.md @ashrafkhamis diff --git a/.gitlab/ci/package-and-test/main.gitlab-ci.yml b/.gitlab/ci/package-and-test/main.gitlab-ci.yml index 301a2ddb5f1..9a8acbb3af0 100644 --- a/.gitlab/ci/package-and-test/main.gitlab-ci.yml +++ b/.gitlab/ci/package-and-test/main.gitlab-ci.yml @@ -122,6 +122,7 @@ trigger-omnibus-env: echo "OMNIBUS_GITLAB_CACHE_UPDATE=${OMNIBUS_GITLAB_CACHE_UPDATE:-false}" >> $BUILD_ENV for version_file in *_VERSION; do echo "$version_file=$(cat $version_file)" >> $BUILD_ENV; done echo "OMNIBUS_GITLAB_RUBY3_BUILD=${OMNIBUS_GITLAB_RUBY3_BUILD:-false}" >> $BUILD_ENV + echo "OMNIBUS_GITLAB_RUBY2_BUILD=${OMNIBUS_GITLAB_RUBY2_BUILD:-false}" >> $BUILD_ENV echo "OMNIBUS_GITLAB_CACHE_EDITION=${OMNIBUS_GITLAB_CACHE_EDITION:-GITLAB}" >> $BUILD_ENV echo "GITLAB_ASSETS_TAG=$(assets_image_tag)" >> $BUILD_ENV echo "Built environment file for omnibus build:" @@ -152,6 +153,7 @@ trigger-omnibus: SECURITY_SOURCES: $SECURITY_SOURCES CACHE_UPDATE: $OMNIBUS_GITLAB_CACHE_UPDATE RUBY3_BUILD: $OMNIBUS_GITLAB_RUBY3_BUILD + RUBY2_BUILD: $OMNIBUS_GITLAB_RUBY2_BUILD CACHE_EDITION: $OMNIBUS_GITLAB_CACHE_EDITION SKIP_QA_DOCKER: "true" SKIP_QA_TEST: "true" diff --git a/.gitlab/ci/package-and-test/variables.gitlab-ci.yml b/.gitlab/ci/package-and-test/variables.gitlab-ci.yml index c45807e5a23..1ba046308a8 100644 --- a/.gitlab/ci/package-and-test/variables.gitlab-ci.yml +++ b/.gitlab/ci/package-and-test/variables.gitlab-ci.yml @@ -6,6 +6,7 @@ variables: SKIP_REPORT_IN_ISSUES: "true" OMNIBUS_GITLAB_CACHE_UPDATE: "false" OMNIBUS_GITLAB_RUBY3_BUILD: "false" + OMNIBUS_GITLAB_RUBY2_BUILD: "false" OMNIBUS_GITLAB_CACHE_EDITION: "GITLAB" QA_LOG_LEVEL: "info" QA_TESTS: "" diff --git a/.gitlab/ci/qa.gitlab-ci.yml b/.gitlab/ci/qa.gitlab-ci.yml index a72e6fc0137..aea85dfd084 100644 --- a/.gitlab/ci/qa.gitlab-ci.yml +++ b/.gitlab/ci/qa.gitlab-ci.yml @@ -89,6 +89,9 @@ e2e:package-and-test: - DOCKER_VERSION - REGISTRY_GROUP - REGISTRY_HOST + - OMNIBUS_GITLAB_CACHE_EDITION + - OMNIBUS_GITLAB_RUBY3_BUILD + - OMNIBUS_GITLAB_RUBY2_BUILD trigger: strategy: depend forward: diff --git a/.gitlab/ci/release-environments.gitlab-ci.yml b/.gitlab/ci/release-environments.gitlab-ci.yml new file mode 100644 index 00000000000..a9d9c938ee0 --- /dev/null +++ b/.gitlab/ci/release-environments.gitlab-ci.yml @@ -0,0 +1,22 @@ +--- +start-release-environments-pipeline: + allow_failure: true + extends: + - .release-environments:rules:start-release-environments-pipeline + stage: release-environments + # We do not want to have ALL global variables passed as trigger variables, + # as they cannot be overridden. See this issue for more context: + # + # https://gitlab.com/gitlab-org/gitlab/-/issues/387183 + inherit: + variables: false + + # These variables are set in the pipeline schedules. + # They need to be explicitly passed on to the child pipeline. + # https://docs.gitlab.com/ee/ci/pipelines/multi_project_pipelines.html#pass-cicd-variables-to-a-downstream-pipeline-by-using-the-variables-keyword + variables: + # This is needed by `release-environments-build-cng-env` (`.gitlab/ci/release-environments/main.gitlab-ci.yml`). + PARENT_PIPELINE_ID: $CI_PIPELINE_ID + trigger: + strategy: depend + include: .gitlab/ci/release-environments/main.gitlab-ci.yml diff --git a/.gitlab/ci/release-environments/main.gitlab-ci.yml b/.gitlab/ci/release-environments/main.gitlab-ci.yml new file mode 100644 index 00000000000..e2fed0a6dbd --- /dev/null +++ b/.gitlab/ci/release-environments/main.gitlab-ci.yml @@ -0,0 +1,62 @@ +--- +default: + interruptible: true + +stages: + - prepare + +include: + - local: .gitlab/ci/global.gitlab-ci.yml + +release-environments-build-cng-env: + allow_failure: true + image: ${GITLAB_DEPENDENCY_PROXY_ADDRESS}ruby:${RUBY_VERSION}-alpine3.16 + stage: prepare + needs: + # We need this job because we need its `cached-assets-hash.txt` artifact, so that we can pass the assets image tag to the downstream CNG pipeline. + - pipeline: $PARENT_PIPELINE_ID + job: build-assets-image + variables: + BUILD_ENV: build.env + before_script: + - source ./scripts/utils.sh + - install_gitlab_gem + script: + - 'ruby -r./scripts/trigger-build.rb -e "puts Trigger.variables_for_env_file(Trigger::CNG.new.variables)" > $BUILD_ENV' + - echo "GITLAB_ASSETS_TAG=$(assets_image_tag)" >> $BUILD_ENV + - ruby -e 'puts "FULL_RUBY_VERSION=#{RUBY_VERSION}"' >> build.env + - cat $BUILD_ENV + artifacts: + reports: + dotenv: $BUILD_ENV + paths: + - $BUILD_ENV + expire_in: 7 days + when: always + +release-environments-build-cng: + allow_failure: true + stage: prepare + needs: ["release-environments-build-cng-env"] + inherit: + variables: false + variables: + GITLAB_REF_SLUG: "${GITLAB_REF_SLUG}" + # CNG pipeline specific variables + GITLAB_VERSION: "${GITLAB_VERSION}" + GITLAB_TAG: "${GITLAB_TAG}" + GITLAB_ASSETS_TAG: "${GITLAB_ASSETS_TAG}" + FORCE_RAILS_IMAGE_BUILDS: "${FORCE_RAILS_IMAGE_BUILDS}" + CE_PIPELINE: "${CE_PIPELINE}" # Based on https://docs.gitlab.com/ee/ci/jobs/job_control.html#check-if-a-variable-exists, `if: '$CE_PIPELINE'` will evaluate to `false` when this variable is empty + EE_PIPELINE: "${EE_PIPELINE}" # Based on https://docs.gitlab.com/ee/ci/jobs/job_control.html#check-if-a-variable-exists, `if: '$EE_PIPELINE'` will evaluate to `false` when this variable is empty + GITLAB_ELASTICSEARCH_INDEXER_VERSION: "${GITLAB_ELASTICSEARCH_INDEXER_VERSION}" + GITLAB_KAS_VERSION: "${GITLAB_KAS_VERSION}" + GITLAB_METRICS_EXPORTER_VERSION: "${GITLAB_METRICS_EXPORTER_VERSION}" + GITLAB_PAGES_VERSION: "${GITLAB_PAGES_VERSION}" + GITLAB_SHELL_VERSION: "${GITLAB_SHELL_VERSION}" + GITALY_SERVER_VERSION: "${GITALY_SERVER_VERSION}" + RUBY_VERSION: "${FULL_RUBY_VERSION}" + trigger: + project: gitlab-org/build/CNG-mirror + branch: $TRIGGER_BRANCH + strategy: depend diff --git a/.gitlab/ci/rules.gitlab-ci.yml b/.gitlab/ci/rules.gitlab-ci.yml index 894dafca8c3..066654565b2 100644 --- a/.gitlab/ci/rules.gitlab-ci.yml +++ b/.gitlab/ci/rules.gitlab-ci.yml @@ -1905,6 +1905,13 @@ when: never - if: '$CI_SERVER_HOST == "gitlab.com" && $CI_PROJECT_PATH == "gitlab-org/gitlab" && $CI_COMMIT_REF_NAME =~ /^[\d-]+-stable-ee$/' +.releases:rules:canonical-dot-com-gitlab-stable-branch-only-setup-test-env-patterns: + rules: + - if: '$CI_COMMIT_MESSAGE =~ /\[merge-train skip\]/' + when: never + - if: '$CI_SERVER_HOST == "gitlab.com" && $CI_PROJECT_PATH == "gitlab-org/gitlab" && $CI_COMMIT_REF_NAME =~ /^[\d-]+-stable-ee$/' + changes: *setup-test-env-patterns + .releases:rules:canonical-dot-com-security-gitlab-stable-branch-only: rules: - if: '$CI_COMMIT_MESSAGE =~ /\[merge-train skip\]/' @@ -2299,3 +2306,14 @@ - <<: *if-dot-com-gitlab-org-merge-request changes: *feature-flag-development-config-patterns allow_failure: true # See https://gitlab.com/gitlab-org/gitlab/-/issues/351136 + +############################## +# release-environments rules # +############################## +.release-environments:rules:start-release-environments-pipeline: + rules: + - <<: *if-not-ee + when: never + - <<: *if-merge-request-labels-pipeline-expedite + when: never + - !reference [".releases:rules:canonical-dot-com-gitlab-stable-branch-only-setup-test-env-patterns", rules] diff --git a/app/assets/javascripts/flash.js b/app/assets/javascripts/alert.js similarity index 98% rename from app/assets/javascripts/flash.js rename to app/assets/javascripts/alert.js index 483f1d2c7a0..006c4f50d09 100644 --- a/app/assets/javascripts/flash.js +++ b/app/assets/javascripts/alert.js @@ -15,7 +15,7 @@ export const VARIANT_TIP = 'tip'; * * @example * // Render a new alert - * import { createAlert, VARIANT_WARNING } from '~/flash'; + * import { createAlert, VARIANT_WARNING } from '~/alert'; * * createAlert({ message: 'My error message' }); * createAlert({ message: 'My warning message', variant: VARIANT_WARNING }); diff --git a/app/assets/javascripts/service_ping_consent.js b/app/assets/javascripts/service_ping_consent.js index 654263ba27b..1cb4e188e54 100644 --- a/app/assets/javascripts/service_ping_consent.js +++ b/app/assets/javascripts/service_ping_consent.js @@ -1,5 +1,5 @@ import $ from 'jquery'; -import { createAlert } from './flash'; +import { createAlert } from '~/flash'; import axios from './lib/utils/axios_utils'; import { parseBoolean } from './lib/utils/common_utils'; import { __ } from './locale'; diff --git a/app/assets/javascripts/super_sidebar/components/nav_item.vue b/app/assets/javascripts/super_sidebar/components/nav_item.vue index 100f1d18793..173e62cefbd 100644 --- a/app/assets/javascripts/super_sidebar/components/nav_item.vue +++ b/app/assets/javascripts/super_sidebar/components/nav_item.vue @@ -1,11 +1,12 @@