From 6b1cf9e9ce2308c3867a241cbbcade8099540604 Mon Sep 17 00:00:00 2001 From: GitLab Bot Date: Thu, 21 Jul 2022 21:10:17 +0000 Subject: [PATCH] Add latest changes from gitlab-org/gitlab@master --- .gitlab/ci/review-apps/main.gitlab-ci.yml | 2 +- .gitlab/ci/review.gitlab-ci.yml | 2 + app/assets/images/auth_buttons/jwt_64.png | Bin 2457 -> 824 bytes .../concerns/gitlab_style_deprecations.rb | 5 +- app/graphql/types/issue_type_enum.rb | 2 +- app/graphql/types/mutation_type.rb | 14 ++-- app/graphql/types/project_type.rb | 2 +- app/graphql/types/query_type.rb | 2 +- .../use_traversal_ids_for_root_ancestor.yml | 2 +- doc/ci/testing/load_performance_testing.md | 2 +- doc/ci/testing/unit_test_report_examples.md | 2 +- doc/development/adding_service_component.md | 4 +- doc/development/api_graphql_styleguide.md | 7 +- doc/development/architecture.md | 2 +- .../backend/create_source_code_be/index.md | 2 +- doc/development/caching.md | 4 +- doc/development/code_review.md | 2 +- doc/development/contributing/design.md | 6 +- .../contributing/issue_workflow.md | 2 +- .../database/database_reviewer_guidelines.md | 2 +- .../database/transaction_guidelines.md | 2 +- .../documentation/styleguide/word_list.md | 2 +- doc/development/documentation/testing.md | 12 ++-- doc/development/documentation/versions.md | 2 +- doc/development/ee_features.md | 2 +- doc/development/elasticsearch.md | 2 +- doc/development/fe_guide/accessibility.md | 2 +- doc/development/fe_guide/architecture.md | 2 +- doc/development/fe_guide/graphql.md | 2 +- doc/development/fe_guide/performance.md | 2 +- doc/development/fe_guide/source_editor.md | 2 +- doc/development/fe_guide/storybook.md | 2 +- .../advanced_search/elasticsearch.md | 2 +- doc/update/index.md | 9 ++- lib/gitlab/graphql/deprecation.rb | 14 +++- qa/Rakefile | 5 ++ qa/qa/service/docker_run/gitlab_runner.rb | 3 +- qa/qa/tools/delete_projects.rb | 16 +---- qa/qa/tools/delete_user_projects.rb | 64 ++++++++++++++++++ qa/qa/tools/lib/project.rb | 33 +++++++++ .../service/docker_run/gitlab_runner_spec.rb | 52 ++++++++------ scripts/undercoverage | 3 +- spec/lib/gitlab/graphql/deprecation_spec.rb | 53 +++++++++++---- ...tlab_style_deprecations_shared_examples.rb | 17 +++++ 44 files changed, 271 insertions(+), 100 deletions(-) create mode 100644 qa/qa/tools/delete_user_projects.rb create mode 100644 qa/qa/tools/lib/project.rb diff --git a/.gitlab/ci/review-apps/main.gitlab-ci.yml b/.gitlab/ci/review-apps/main.gitlab-ci.yml index a01c6327cda..37ccecc0562 100644 --- a/.gitlab/ci/review-apps/main.gitlab-ci.yml +++ b/.gitlab/ci/review-apps/main.gitlab-ci.yml @@ -73,7 +73,6 @@ review-build-cng: extends: - .default-retry image: ${REVIEW_APPS_IMAGE} - resource_group: "review/${CI_COMMIT_REF_NAME}" variables: HOST_SUFFIX: "${CI_ENVIRONMENT_SLUG}" DOMAIN: "-${CI_ENVIRONMENT_SLUG}.${REVIEW_APPS_DOMAIN}" @@ -139,6 +138,7 @@ review-stop: extends: - .review-stop-base - .review:rules:review-stop + resource_group: review/${CI_COMMIT_REF_SLUG}${SCHEDULE_TYPE} # CI_ENVIRONMENT_SLUG is not available here and we want this to be the same as the environment stage: deploy needs: [] script: diff --git a/.gitlab/ci/review.gitlab-ci.yml b/.gitlab/ci/review.gitlab-ci.yml index ef4b37aff4d..3d50b71bb3b 100644 --- a/.gitlab/ci/review.gitlab-ci.yml +++ b/.gitlab/ci/review.gitlab-ci.yml @@ -6,6 +6,7 @@ review-cleanup: - .default-retry - .review:rules:review-cleanup image: ${REVIEW_APPS_IMAGE} + resource_group: review/${CI_COMMIT_REF_SLUG}${SCHEDULE_TYPE} # CI_ENVIRONMENT_SLUG is not available here and we want this to be the same as the environment stage: prepare environment: name: review/${CI_COMMIT_REF_SLUG}${SCHEDULE_TYPE} # No separator for SCHEDULE_TYPE so it's compatible as before and looks nice without it @@ -25,6 +26,7 @@ review-cleanup: start-review-app-pipeline: extends: - .review:rules:start-review-app-pipeline + resource_group: review/${CI_COMMIT_REF_SLUG}${SCHEDULE_TYPE} # CI_ENVIRONMENT_SLUG is not available here and we want this to be the same as the environment stage: review needs: - job: build-assets-image diff --git a/app/assets/images/auth_buttons/jwt_64.png b/app/assets/images/auth_buttons/jwt_64.png index ca97ae47002c1a96da1fa969b3c10e7b2e25d6bc..fcfecde23d38e0284011cba5234e4c68333f46b8 100644 GIT binary patch delta 802 zcmV+-1Ks?Y6SxMDBYy!VP)t-s0001BU||3M{{SByKL8g15Dox{fdKO604^&Z01W#9 zTa5uT5C8@M)X4x34%`7yAOH*iY+myo}|znuU%Hh&I4cp;F;Ht(P-zW@vm z0J-r1I!quSAn)(*-{0RY1RK^m|H(G*07hE?uHpcevp_&V>j75107SJVuuv9Y0BMK- zTUTBHBWoRh08wcGmc#%rJSYn=UKwx=1Q4z-&ublk8wVf&MOpxhwE$>{04_X+B%r%8 z-@7y4g(aT=Qh#b*8EC$%K7ya7Z2m9u#vkN`SM01FSD0Xb~}D85j403ID501E&u zERFy)A*b3^0005aNklMPz9vQNR0w@P8uLh=(XCNE`S~r z`h#$IFyz7zz-T;~LTk1pv^&eLLxGjmwG|3@>*9K2V`H-kovkHld#5J?*bQOG_x2Cy znjAu>wSS}>xyLyOjg#W(hBAfD+4+)kfw@cn{t9{()i{TAeKWtly@R33{loU-6BLYI zyqsP&VXk>Kef4?-1>MK(hph?>-JMQ1{<>*GQXlD!N#iYDOP82?S|YLm9smB;K6wY> zI2U_dQd-bC+>j>kKkV@#Lc8cQ*88}dBA$%!WirNo4E0s+`^#L6=8Bh3WI zg*l6pyc*RUBN-UW&R19krNZURYH4)rx2=u1}i+KtW3O4e<1e^9A$lNk<5Y`)ff7kg!49B!o}^;q(p&jr@Ut z37W;Ac>!+pf&{8W#~Ts?peYq$K%iL#4aP(Q~c3FJXBi}e%ye<}7hh_aI;L`H&AY-cH2U}`2oqZkq?Q+6`IV@i$4 zC{xyempd1X^7$4Q3B%-GJc5v5uo zG)1nm5dp3QYhUnQ-NgNRukoycMXFoIzF*ijoCluozuqf0tIocikL_4> zBiN_ZKyz7LKkWPcjGCdE^n~s`M%Csy&5U`X=u7lRi{E!nm^uCPM5waoG5+UQHlsc< z{La&T<&oj%9=0=*5*$KPgL4SEE<4VohL(NNH|qN}R4Y8P`1^otIrLcGpv#BB*rCt} zQeWFJdn~yu?v8P;0s0&$AM^J3IUw=ibm4CyxG(GfPNCs&W|exB1F80jHq&N{|aHyR#_iTbujkwSP@ez^EqQt6!s{+q&& zU_!IpGs{;v_H*MKBhOIQVXlPvDjh#-N~~stfq-S^@D8Lg=9&lJboAvzk z9ETUECA7VjsKYo(-RF&JhB?f3%#;!E{%ief(En}_qHi`GKhJxEG!?F#de3Y02 zoE4Z0ttIbT66?dNPW)S_k`*1j;yER$gs=WfC9@)+%KY8tFwQCpE0}8^A7iBT!)>jV z+n~vciqgwvni%^P-bu>z=CONr-5!^B8P{_9$sV)n=I{PI>;KRlU#Gfq-28kFtb|mJ z5K#80eKMi|{3Wsz^zwa*80bA1NVMt{5Ze&i=R zZXbv%{cTwD#Nqbxj)U|hMzqTWa44L=X0~n6!kl_x)Fihz>e-8c;|Ddqt)txwD8$#& zV?t!c8LQJDP(c6lgZqxXBz4}rDKarUYEZ42HgH&Nn)H}-dZO%yzHauJ;Xf53%+C4V zKUK-#l?g|Pp(_pRor|7a?MhL{^aKUn2c~;`U6k*qZoSp=X13?8D&AYoVNvn(v8|V8 z^G+?-5o-D;SW1a9or|fZx68H^rHp@An}o@GJs5GL+T{ z4JPr@W87{`5V#%@uiV|UHy>=L+=|{8z~~pPyX!^ZXN>P6 znb$M35$IN@y-?Wg$dB-|bhsL!nSF4o;kC(nExWC!JL*HH74CQSrl#X-+Ozj&zweV( zQ}b-LR6QzwqgeCrr@y*?WUAWUycxJlKjd7@iS0)>k1f-GiaK!nifd_+^u?t6D&oTq zUH$!i%e!LBw3qxlXLQ32vQ*7_xo>*uH|c9sq6LnD-h#iAECL*CUi(&xdrAsM)@v2* zY$Q>{t_!> zth<8y9v~UFwd*ii7)Yn4v17J}jSpcP#v{wV>SHXQ{JO=7-f2)&c(?X)iAk!!07TLI zCq7TNWtJ@OBwIqo3_XwIGF$Hgt5ogggxM)?Kic&+&%g~;7L~puRiO$R!DA1iW7V!~ z)l5#0Nb2}KuFJx(s^E#Py(-4M_Z+i=3sF8Pfe4}R=*pmUPWsk z_&^%8q=YC3(|W)A_GwpM+py~DyWe*?(3>j%7*{Ij?jBL@`r2uC=#U?Gy^sDF)}iob z*B`c_I)?9cpL_q9Yd&XAcgSy=nepbK-Gp z+BGKj?hPik@u+>MS&);SQF2~l{sXo4IqaXFxn8OtgDP-VS|hkfs*_c#qd~=GRV^#6 zK9fncb4o8?YM2k<+b*tCDSyDwYitbod*;F>73aDUPj_=##b7%LDO&CNM{6VPjww9*_~{AH(k(pWMv<30CC_ft nsV%%#jv^T!wp&k@u&j8`;AFO*=LSdgivixAejb0hho%1)j&2SZ diff --git a/app/graphql/types/concerns/gitlab_style_deprecations.rb b/app/graphql/types/concerns/gitlab_style_deprecations.rb index cd8e393b235..e404f1fcad9 100644 --- a/app/graphql/types/concerns/gitlab_style_deprecations.rb +++ b/app/graphql/types/concerns/gitlab_style_deprecations.rb @@ -14,7 +14,10 @@ module GitlabStyleDeprecations 'See https://docs.gitlab.com/ee/development/api_graphql_styleguide.html#deprecating-schema-items' end - deprecation = ::Gitlab::Graphql::Deprecation.parse(kwargs.delete(:deprecated)) + # GitLab allows items to be marked as "alpha", which leverages GraphQL deprecations. + deprecation_args = kwargs.extract!(:alpha, :deprecated) + + deprecation = ::Gitlab::Graphql::Deprecation.parse(**deprecation_args) return unless deprecation raise ArgumentError, "Bad deprecation. #{deprecation.errors.full_messages.to_sentence}" unless deprecation.valid? diff --git a/app/graphql/types/issue_type_enum.rb b/app/graphql/types/issue_type_enum.rb index bc21b802179..1044c2ceea4 100644 --- a/app/graphql/types/issue_type_enum.rb +++ b/app/graphql/types/issue_type_enum.rb @@ -11,6 +11,6 @@ module Types value 'TASK', value: 'task', description: 'Task issue type. Available only when feature flag `work_items` is enabled.', - deprecated: { milestone: '15.2', reason: :alpha } + alpha: { milestone: '15.2' } end end diff --git a/app/graphql/types/mutation_type.rb b/app/graphql/types/mutation_type.rb index 46ab3f3f432..49424cb43ba 100644 --- a/app/graphql/types/mutation_type.rb +++ b/app/graphql/types/mutation_type.rb @@ -139,13 +139,13 @@ module Types mount_mutation Mutations::Packages::DestroyFiles mount_mutation Mutations::Packages::Cleanup::Policy::Update mount_mutation Mutations::Echo - mount_mutation Mutations::WorkItems::Create, deprecated: { milestone: '15.1', reason: :alpha } - mount_mutation Mutations::WorkItems::CreateFromTask, deprecated: { milestone: '15.1', reason: :alpha } - mount_mutation Mutations::WorkItems::Delete, deprecated: { milestone: '15.1', reason: :alpha } - mount_mutation Mutations::WorkItems::DeleteTask, deprecated: { milestone: '15.1', reason: :alpha } - mount_mutation Mutations::WorkItems::Update, deprecated: { milestone: '15.1', reason: :alpha } - mount_mutation Mutations::WorkItems::UpdateWidgets, deprecated: { milestone: '15.1', reason: :alpha } - mount_mutation Mutations::WorkItems::UpdateTask, deprecated: { milestone: '15.1', reason: :alpha } + mount_mutation Mutations::WorkItems::Create, alpha: { milestone: '15.1' } + mount_mutation Mutations::WorkItems::CreateFromTask, alpha: { milestone: '15.1' } + mount_mutation Mutations::WorkItems::Delete, alpha: { milestone: '15.1' } + mount_mutation Mutations::WorkItems::DeleteTask, alpha: { milestone: '15.1' } + mount_mutation Mutations::WorkItems::Update, alpha: { milestone: '15.1' } + mount_mutation Mutations::WorkItems::UpdateWidgets, alpha: { milestone: '15.1' } + mount_mutation Mutations::WorkItems::UpdateTask, alpha: { milestone: '15.1' } mount_mutation Mutations::SavedReplies::Create mount_mutation Mutations::SavedReplies::Update mount_mutation Mutations::Pages::MarkOnboardingComplete diff --git a/app/graphql/types/project_type.rb b/app/graphql/types/project_type.rb index 7e3800c6a13..f13063d6f70 100644 --- a/app/graphql/types/project_type.rb +++ b/app/graphql/types/project_type.rb @@ -147,7 +147,7 @@ module Types field :work_items, Types::WorkItemType.connection_type, null: true, - deprecated: { milestone: '15.1', reason: :alpha }, + alpha: { milestone: '15.1' }, description: 'Work items of the project.', extras: [:lookahead], resolver: Resolvers::WorkItemsResolver diff --git a/app/graphql/types/query_type.rb b/app/graphql/types/query_type.rb index 9207a867639..6036a34cdc4 100644 --- a/app/graphql/types/query_type.rb +++ b/app/graphql/types/query_type.rb @@ -91,7 +91,7 @@ module Types field :work_item, Types::WorkItemType, null: true, resolver: Resolvers::WorkItemResolver, - deprecated: { milestone: '15.1', reason: :alpha }, + alpha: { milestone: '15.1' }, description: 'Find a work item. Returns `null` if `work_items` feature flag is disabled.' field :merge_request, Types::MergeRequestType, diff --git a/config/feature_flags/development/use_traversal_ids_for_root_ancestor.yml b/config/feature_flags/development/use_traversal_ids_for_root_ancestor.yml index 74ae139b68a..00c6edfc148 100644 --- a/config/feature_flags/development/use_traversal_ids_for_root_ancestor.yml +++ b/config/feature_flags/development/use_traversal_ids_for_root_ancestor.yml @@ -5,4 +5,4 @@ rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/331907 milestone: '14.0' type: development group: group::workspace -default_enabled: false +default_enabled: true diff --git a/doc/ci/testing/load_performance_testing.md b/doc/ci/testing/load_performance_testing.md index ae177958beb..e15b3944c2b 100644 --- a/doc/ci/testing/load_performance_testing.md +++ b/doc/ci/testing/load_performance_testing.md @@ -121,7 +121,7 @@ the k6 test. NOTE: For Kubernetes setups a different template should be used: [`Jobs/Load-Performance-Testing.gitlab-ci.yml`](https://gitlab.com/gitlab-org/gitlab/-/blob/master/lib/gitlab/ci/templates/Jobs/Load-Performance-Testing.gitlab-ci.yml). -k6 has [various options](https://k6.io/docs/using-k6/options) to configure how it will run tests, such as what throughput (RPS) to run with, +k6 has [various options](https://k6.io/docs/using-k6/k6-options/reference/) to configure how it will run tests, such as what throughput (RPS) to run with, how long the test should run, and so on. Almost all options can be configured in the test itself, but as you can also pass command line options via the `K6_OPTIONS` variable. diff --git a/doc/ci/testing/unit_test_report_examples.md b/doc/ci/testing/unit_test_report_examples.md index a54deb254b7..b49ac29be65 100644 --- a/doc/ci/testing/unit_test_report_examples.md +++ b/doc/ci/testing/unit_test_report_examples.md @@ -250,7 +250,7 @@ test: This example uses [PHPUnit](https://phpunit.de/) with the `--log-junit` flag. You can also add this option using -[XML](https://phpunit.readthedocs.io/en/stable/configuration.html#the-junit-element) +[XML](https://phpunit.readthedocs.io/en/9.5/configuration.html#the-junit-element) in the `phpunit.xml` configuration file. ```yaml diff --git a/doc/development/adding_service_component.md b/doc/development/adding_service_component.md index 51c6e86bb49..c00d9da5d16 100644 --- a/doc/development/adding_service_component.md +++ b/doc/development/adding_service_component.md @@ -60,7 +60,7 @@ NOTE: Code shipped with GitLab needs to use a license approved by the Legal team. See the list of [existing approved licenses](https://about.gitlab.com/handbook/engineering/open-source/#using-open-source-libraries). -Notify the [Distribution team](https://about.gitlab.com/handbook/engineering/development/enablement/distribution/) when adding a new dependency that must be compiled. We must be able to compile the dependency on all supported platforms. +Notify the [Distribution team](https://about.gitlab.com/handbook/engineering/development/enablement/systems/distribution/) when adding a new dependency that must be compiled. We must be able to compile the dependency on all supported platforms. New services to be bundled with GitLab need to be available in the following environments. @@ -83,7 +83,7 @@ In order for a service to be bundled for end-users or GitLab.com, it needs to be Dependencies should be kept up to date and be tracked for security updates. For the Rails codebase, the JavaScript and Ruby dependencies are scanned for vulnerabilities using GitLab [dependency scanning](../user/application_security/dependency_scanning/index.md). -In addition, any system dependencies used in Omnibus packages or the Cloud Native images should be added to the [dependency update automation](https://about.gitlab.com/handbook/engineering/development/enablement/distribution/maintenance/dependencies.io.html#adding-new-dependencies). +In addition, any system dependencies used in Omnibus packages or the Cloud Native images should be added to the [dependency update automation](https://about.gitlab.com/handbook/engineering/development/enablement/systems/distribution/maintenance/dependencies.io.html#adding-new-dependencies). ## Release management diff --git a/doc/development/api_graphql_styleguide.md b/doc/development/api_graphql_styleguide.md index 37de7044765..a584df50ce4 100644 --- a/doc/development/api_graphql_styleguide.md +++ b/doc/development/api_graphql_styleguide.md @@ -558,7 +558,7 @@ Example: ```ruby field :foo, GraphQL::Types::String, null: true, - deprecated: { reason: :alpha, milestone: '10.0' }, + alpha: { milestone: '10.0' }, description: 'Some test field. Returns `null`' \ 'if `my_feature_flag` feature flag is disabled.' @@ -586,6 +586,7 @@ To deprecate a schema item in GraphQL: See also: - [Aliasing and deprecating mutations](#aliasing-and-deprecating-mutations). +- [Marking schema items as Alpha](#marking-schema-items-as-alpha). - [How to filter Kibana for queries that used deprecated fields](graphql_guide/monitoring.md#queries-that-used-a-deprecated-field). ### Create a deprecation issue @@ -756,14 +757,14 @@ at any time without notice. This leverages GraphQL deprecations to cause the schema item to appear as deprecated, and will be described as being in "alpha" in our generated docs and its GraphQL description. -To mark a schema item as being in "alpha", use the `deprecated:` keyword with `reason: :alpha`. +To mark a schema item as being in "alpha", use the `alpha:` keyword. You must provide the `milestone:` that introduced the alpha item. For example: ```ruby field :token, GraphQL::Types::String, null: true, - deprecated: { reason: :alpha, milestone: '10.0' }, + alpha: { milestone: '10.0' }, description: 'Token for login.' ``` diff --git a/doc/development/architecture.md b/doc/development/architecture.md index a61a891b096..10d6c0ae9c9 100644 --- a/doc/development/architecture.md +++ b/doc/development/architecture.md @@ -89,7 +89,7 @@ new features and services must be written to consider Kubernetes compatibility * The simplest way to ensure this, is to add support for your feature or service to [the official GitLab Helm chart](https://docs.gitlab.com/charts/) or reach out to -[the Distribution team](https://about.gitlab.com/handbook/engineering/development/enablement/distribution/#how-to-work-with-distribution). +[the Distribution team](https://about.gitlab.com/handbook/engineering/development/enablement/systems/distribution/#how-to-work-with-distribution). Refer to the [process for adding new service components](adding_service_component.md) for more details. diff --git a/doc/development/backend/create_source_code_be/index.md b/doc/development/backend/create_source_code_be/index.md index ad4e25dc815..e1ee78731de 100644 --- a/doc/development/backend/create_source_code_be/index.md +++ b/doc/development/backend/create_source_code_be/index.md @@ -13,7 +13,7 @@ of the [Create stage](https://about.gitlab.com/handbook/product/categories/#crea of the [DevOps lifecycle](https://about.gitlab.com/handbook/product/categories/#devops-stages). We interface with the Gitaly and Code Review teams, and work closely with the -[Create:Source Code Frontend team](https://about.gitlab.com/handbook/engineering/development/dev/create-source-code-fe). The features +[Create:Source Code Frontend team](https://about.gitlab.com/handbook/engineering/development/dev/create/create-source-code-fe/). The features we work with are listed on the [Features by Group Page](https://about.gitlab.com/handbook/product/categories/features/#createsource-code-group). diff --git a/doc/development/caching.md b/doc/development/caching.md index 7c51bd595f7..362e4c4cded 100644 --- a/doc/development/caching.md +++ b/doc/development/caching.md @@ -301,10 +301,10 @@ it's time to look at a custom solution: In short: the oldest stuff is replaced with new stuff: -- A [useful article](https://redis.io/topics/lru-cache) about configuring Redis as an LRU cache. +- A [useful article](https://redis.io/docs/manual/eviction/) about configuring Redis as an LRU cache. - Lots of options for different cache eviction strategies. - You probably want `allkeys-lru`, which is functionally similar to Memcached. -- In Redis 4.0 and later, [allkeys-lfu is available](https://redis.io/topics/lru-cache#the-new-lfu-mode), +- In Redis 4.0 and later, [allkeys-lfu is available](https://redis.io/docs/manual/eviction/#the-new-lfu-mode), which is similar but different. - We handle all explicit deletes using UNLINK instead of DEL now, which allows Redis to reclaim memory in its own time, rather than immediately. diff --git a/doc/development/code_review.md b/doc/development/code_review.md index 4617bea8ad4..3b33c94f956 100644 --- a/doc/development/code_review.md +++ b/doc/development/code_review.md @@ -135,7 +135,7 @@ with [domain expertise](#domain-experts). More information about license compatibility can be found in our [GitLab Licensing and Compatibility documentation](licensing.md). 1. If your merge request includes a new dependency or a file system change, it must be - **approved by a [Distribution team member](https://about.gitlab.com/company/team/)**. See how to work with the [Distribution team](https://about.gitlab.com/handbook/engineering/development/enablement/distribution/#how-to-work-with-distribution) for more details. + **approved by a [Distribution team member](https://about.gitlab.com/company/team/)**. See how to work with the [Distribution team](https://about.gitlab.com/handbook/engineering/development/enablement/systems/distribution/#how-to-work-with-distribution) for more details. 1. If your merge request includes documentation changes, it must be **approved by a [Technical writer](https://about.gitlab.com/handbook/engineering/ux/technical-writing/#assignments)**, based on assignments in the appropriate [DevOps stage group](https://about.gitlab.com/handbook/product/categories/#devops-stages). diff --git a/doc/development/contributing/design.md b/doc/development/contributing/design.md index ce013a9254b..04915985dc8 100644 --- a/doc/development/contributing/design.md +++ b/doc/development/contributing/design.md @@ -68,9 +68,9 @@ Check states using your browser's _styles inspector_ to toggle CSS pseudo-classe like `:hover` and others ([Chrome](https://developer.chrome.com/docs/devtools/css/reference/#pseudo-class), [Firefox](https://firefox-source-docs.mozilla.org/devtools-user/page_inspector/how_to/examine_and_edit_css/index.html#viewing-common-pseudo-classes)). -- Account for all applicable states ([error](https://design.gitlab.com/content/error-messages), +- Account for all applicable states ([error](https://design.gitlab.com/content/error-messages/), rest, loading, focus, hover, selected, disabled). -- Account for states dependent on data size ([empty](https://design.gitlab.com/regions/empty-states), +- Account for states dependent on data size ([empty](https://design.gitlab.com/regions/empty-states/), some data, and lots of data). - Account for states dependent on user role, user preferences, and subscription. - Consider animations and transitions, and follow their [guidelines](https://design.gitlab.com/product-foundations/motion/). @@ -113,7 +113,7 @@ When the design is ready, _before_ starting its implementation: At any moment, but usually _during_ or _after_ the design's implementation: -- Contribute [issues to Pajamas](https://design.gitlab.com/get-started/contribute#contribute-an-issue) +- Contribute [issues to Pajamas](https://design.gitlab.com/get-started/contribute/#contribute-an-issue) for additions or enhancements to the design system. - Create issues with the [`~UX debt`](issue_workflow.md#technical-and-ux-debt) label for intentional deviations from the agreed-upon UX requirements due to diff --git a/doc/development/contributing/issue_workflow.md b/doc/development/contributing/issue_workflow.md index c6d977cf5ad..48271263f97 100644 --- a/doc/development/contributing/issue_workflow.md +++ b/doc/development/contributing/issue_workflow.md @@ -161,7 +161,7 @@ For instance, the "DevOps Reports" category is represented by the `devops_reports.name` value is "DevOps Reports". If a category's label doesn't respect this naming convention, it should be specified -with [the `label` attribute](https://about.gitlab.com/handbook/marketing/inbound-marketing/digital-experience/website/#category-attributes) +with [the `label` attribute](https://about.gitlab.com/handbook/marketing/digital-experience/website/#category-attributes) in . ### Feature labels diff --git a/doc/development/database/database_reviewer_guidelines.md b/doc/development/database/database_reviewer_guidelines.md index b6bbfe690c1..a34ea52454f 100644 --- a/doc/development/database/database_reviewer_guidelines.md +++ b/doc/development/database/database_reviewer_guidelines.md @@ -36,7 +36,7 @@ projects: Create the merge request [using the "Database reviewer" template](https://gitlab.com/gitlab-com/www-gitlab-com/-/blob/master/.gitlab/merge_request_templates/Database%20reviewer.md), adding your expertise your profile YAML file. Assign to a database maintainer or the -[Database Team's Engineering Manager](https://about.gitlab.com/handbook/engineering/development/enablement/database/). +[Database Team's Engineering Manager](https://about.gitlab.com/handbook/engineering/development/enablement/data_stores/database/). After the `team.yml` update is merged, the [Reviewer roulette](../code_review.md#reviewer-roulette) may recommend you as a database reviewer. diff --git a/doc/development/database/transaction_guidelines.md b/doc/development/database/transaction_guidelines.md index 255de19a420..1583bbc02c2 100644 --- a/doc/development/database/transaction_guidelines.md +++ b/doc/development/database/transaction_guidelines.md @@ -12,7 +12,7 @@ For further reference, check PostgreSQL documentation about [transactions](https ## Database decomposition and sharding -The [sharding group](https://about.gitlab.com/handbook/engineering/development/enablement/sharding/) plans +The [Pods Group](https://about.gitlab.com/handbook/engineering/development/enablement/data_stores/pods/) plans to split the main GitLab database and move some of the database tables to other database servers. We start decomposing the `ci_*`-related database tables first. To maintain the current application diff --git a/doc/development/documentation/styleguide/word_list.md b/doc/development/documentation/styleguide/word_list.md index c753c39b727..8d66bc096b0 100644 --- a/doc/development/documentation/styleguide/word_list.md +++ b/doc/development/documentation/styleguide/word_list.md @@ -1127,7 +1127,7 @@ in present tense, active voice. ## you, your, yours Use **you**, **your**, and **yours** instead of [**the user** and **the user's**](#user-users). -Documentation should be from the [point of view](https://design.gitlab.com/content/voice-tone#point-of-view) of the reader. +Documentation should be from the [point of view](https://design.gitlab.com/content/voice-tone/#point-of-view) of the reader. Use: diff --git a/doc/development/documentation/testing.md b/doc/development/documentation/testing.md index 5dd7235917a..1a678873509 100644 --- a/doc/development/documentation/testing.md +++ b/doc/development/documentation/testing.md @@ -219,12 +219,12 @@ You can use markdownlint: ### Vale -[Vale](https://docs.errata.ai/vale/about/) is a grammar, style, and word usage linter for the +[Vale](https://vale.sh/) is a grammar, style, and word usage linter for the English language. Vale's configuration is stored in the [`.vale.ini`](https://gitlab.com/gitlab-org/gitlab/-/blob/master/.vale.ini) file located in the root directory of projects. -Vale supports creating [custom tests](https://docs.errata.ai/vale/styles) that extend any of +Vale supports creating [custom tests](https://vale.sh/docs/topics/styles/) that extend any of several types of checks, which we store in the `.linting/vale/styles/gitlab` directory in the documentation directory of projects. @@ -241,7 +241,7 @@ This configuration is also used in build pipelines, where You can use Vale: -- [On the command line](https://docs.errata.ai/vale/cli). +- [On the command line](https://vale.sh/docs/vale-cli/structure/). - [In a code editor](#configure-editors). - [In a Git hook](#configure-pre-push-hooks). Vale only reports errors in the Git hook (the same configuration as the CI/CD pipelines), and does not report suggestions or warnings. @@ -305,7 +305,7 @@ For example, a page that scores `12` before a set of changes, and `9` after, ind general complexity level of the page. The readability score is calculated based on the number of words per sentence, and the number -of syllables per word. For more information, see [the Vale documentation](https://docs.errata.ai/vale/styles#metric). +of syllables per word. For more information, see [the Vale documentation](https://vale.sh/docs/topics/styles/#metric). ### Install linters @@ -400,8 +400,6 @@ To configure Vale in your editor, install one of the following as appropriate: In this setup the `markdownlint` checker is set as a "next" checker from the defined `vale` checker. Enabling this custom Vale checker provides error linting from both Vale and markdownlint. -We don't use [Vale Server](https://docs.errata.ai/vale-server/install). - ### Configure pre-push hooks Git [pre-push hooks](https://git-scm.com/book/en/v2/Customizing-Git-Git-Hooks) allow Git users to: @@ -480,7 +478,7 @@ document: Whenever possible, exclude only the problematic rule and lines. For more information, see -[Vale's documentation](https://docs.errata.ai/vale/scoping#markup-based-configuration). +[Vale's documentation](https://vale.sh/docs/topics/scoping/). ### Disable markdownlint tests diff --git a/doc/development/documentation/versions.md b/doc/development/documentation/versions.md index 067c37d30aa..0be10a58da2 100644 --- a/doc/development/documentation/versions.md +++ b/doc/development/documentation/versions.md @@ -182,7 +182,7 @@ GitLab supports the current major version and two previous major versions. For example, if 15.0 is the current major version, all major and minor releases of GitLab 15.0, 14.0, and 13.0 are supported. -[View the list of supported versions](https://about.gitlab.com/support/statement-of-support.html#version-support). +[View the list of supported versions](https://about.gitlab.com/support/statement-of-support/#version-support). If you see version history items or inline text that refers to unsupported versions, you can remove it. diff --git a/doc/development/ee_features.md b/doc/development/ee_features.md index 28cf6d4e1e3..3127b03ad57 100644 --- a/doc/development/ee_features.md +++ b/doc/development/ee_features.md @@ -1041,7 +1041,7 @@ information on managing page-specific JavaScript within EE. #### Child Component only used in EE -To separate Vue template differences we should [import the components asynchronously](https://vuejs.org/v2/guide/components-dynamic-async.html#Async-Components). +To separate Vue template differences we should [import the components asynchronously](https://v2.vuejs.org/v2/guide/components-dynamic-async.html#Async-Components). Doing this allows for us to load the correct component in EE while in CE we can load a empty component that renders nothing. This code **should** diff --git a/doc/development/elasticsearch.md b/doc/development/elasticsearch.md index d32ceb43ce9..1d6d21a080b 100644 --- a/doc/development/elasticsearch.md +++ b/doc/development/elasticsearch.md @@ -38,7 +38,7 @@ Additionally, if you need large repositories or multiple forks for testing, plea The Elasticsearch integration depends on an external indexer. We ship an [indexer written in Go](https://gitlab.com/gitlab-org/gitlab-elasticsearch-indexer). The user must trigger the initial indexing via a Rake task but, after this is done, GitLab itself will trigger reindexing when required via `after_` callbacks on create, update, and destroy that are inherited from [`/ee/app/models/concerns/elastic/application_versioned_search.rb`](https://gitlab.com/gitlab-org/gitlab/-/blob/master/ee/app/models/concerns/elastic/application_versioned_search.rb). -After initial indexing is complete, create, update, and delete operations for all models except projects (see [#207494](https://gitlab.com/gitlab-org/gitlab/-/issues/207494)) are tracked in a Redis [`ZSET`](https://redis.io/topics/data-types#sorted-sets). A regular `sidekiq-cron` `ElasticIndexBulkCronWorker` processes this queue, updating many Elasticsearch documents at a time with the [Bulk Request API](https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-bulk.html). +After initial indexing is complete, create, update, and delete operations for all models except projects (see [#207494](https://gitlab.com/gitlab-org/gitlab/-/issues/207494)) are tracked in a Redis [`ZSET`](https://redis.io/docs/manual/data-types/#sorted-sets). A regular `sidekiq-cron` `ElasticIndexBulkCronWorker` processes this queue, updating many Elasticsearch documents at a time with the [Bulk Request API](https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-bulk.html). Search queries are generated by the concerns found in [`ee/app/models/concerns/elastic`](https://gitlab.com/gitlab-org/gitlab/-/tree/master/ee/app/models/concerns/elastic). These concerns are also in charge of access control, and have been a historic source of security bugs so please pay close attention to them! diff --git a/doc/development/fe_guide/accessibility.md b/doc/development/fe_guide/accessibility.md index 2a1083d031f..bdd6c5d6e84 100644 --- a/doc/development/fe_guide/accessibility.md +++ b/doc/development/fe_guide/accessibility.md @@ -13,7 +13,7 @@ This page contains guidelines we should follow. ## Quick summary -Since [no ARIA is better than bad ARIA](https://www.w3.org/TR/wai-aria-practices/#no_aria_better_bad_aria), +Since [no ARIA is better than bad ARIA](https://w3c.github.io/aria-practices/#no_aria_better_bad_aria), review the following recommendations before using `aria-*`, `role`, and `tabindex`. Use semantic HTML, which has accessibility semantics baked in, and ideally test with [relevant combinations of screen readers and browsers](https://www.accessibility-developer-guide.com/knowledge/screen-readers/relevant-combinations/). diff --git a/doc/development/fe_guide/architecture.md b/doc/development/fe_guide/architecture.md index afaf6df8f8a..da22ec385ea 100644 --- a/doc/development/fe_guide/architecture.md +++ b/doc/development/fe_guide/architecture.md @@ -19,7 +19,7 @@ You can find the Frontend Architecture experts on the [team page](https://about. ## Widget Architecture -The [Plan stage](https://about.gitlab.com/handbook/engineering/development/dev/fe-plan/) +The [Plan stage](https://about.gitlab.com/handbook/engineering/development/dev/plan-project-management/) is refactoring the right sidebar to consist of **widgets**. They have a specific architecture to be reusable and to expose an interface that can be used by external Vue applications on the page. Learn more about the [widget architecture](widgets.md). diff --git a/doc/development/fe_guide/graphql.md b/doc/development/fe_guide/graphql.md index 10db332d64c..db267a6d5b3 100644 --- a/doc/development/fe_guide/graphql.md +++ b/doc/development/fe_guide/graphql.md @@ -14,7 +14,7 @@ info: "See the Technical Writers assigned to Development Guidelines: https://abo **General resources**: - [📚 Official Introduction to GraphQL](https://graphql.org/learn/) -- [📚 Official Introduction to Apollo](https://www.apollographql.com/docs/tutorial/introduction/) +- [📚 Official Introduction to Apollo](https://www.apollographql.com/tutorials/fullstack-quickstart/introduction) **GraphQL at GitLab**: diff --git a/doc/development/fe_guide/performance.md b/doc/development/fe_guide/performance.md index bcdc49a1070..4b5fd6ffc07 100644 --- a/doc/development/fe_guide/performance.md +++ b/doc/development/fe_guide/performance.md @@ -434,7 +434,7 @@ Use `webpackChunkName` when generating dynamic imports as it provides a deterministic filename for the chunk which can then be cached in the browser across GitLab versions. -More information is available in [webpack's code splitting documentation](https://webpack.js.org/guides/code-splitting/#dynamic-imports) and [vue's dynamic component documentation](https://vuejs.org/v2/guide/components-dynamic-async.html). +More information is available in [webpack's code splitting documentation](https://webpack.js.org/guides/code-splitting/#dynamic-imports) and [vue's dynamic component documentation](https://v2.vuejs.org/v2/guide/components-dynamic-async.html). ### Minimizing page size diff --git a/doc/development/fe_guide/source_editor.md b/doc/development/fe_guide/source_editor.md index b06e341630f..88508e94380 100644 --- a/doc/development/fe_guide/source_editor.md +++ b/doc/development/fe_guide/source_editor.md @@ -129,7 +129,7 @@ with additional functions on the instance level: Source Editor provides a universal, extensible editing tool to the whole product, and doesn't depend on any particular group. Even though the Source Editor's core is owned by -[Create::Editor FE Team](https://about.gitlab.com/handbook/engineering/development/dev/create-editor/), +[Create::Editor FE Team](https://about.gitlab.com/handbook/engineering/development/dev/create/editor/), any group can own the extensions—the main functional elements. The goal of Source Editor extensions is to keep the editor's core slim and stable. Any needed features can be added as extensions to this core. Any group can diff --git a/doc/development/fe_guide/storybook.md b/doc/development/fe_guide/storybook.md index 4c0e7b2612b..45342eb6d72 100644 --- a/doc/development/fe_guide/storybook.md +++ b/doc/development/fe_guide/storybook.md @@ -6,7 +6,7 @@ info: To determine the technical writer assigned to the Stage/Group associated w # Storybook -The Storybook for the `gitlab-org/gitlab` project is available on our [GitLab Pages site](https://gitlab-org.gitlab.io/gitlab/storybook). +The Storybook for the `gitlab-org/gitlab` project is available on our [GitLab Pages site](https://gitlab-org.gitlab.io/gitlab/storybook/). ## Storybook in local development diff --git a/doc/integration/advanced_search/elasticsearch.md b/doc/integration/advanced_search/elasticsearch.md index 5eac6ab7c84..8d29e04eb05 100644 --- a/doc/integration/advanced_search/elasticsearch.md +++ b/doc/integration/advanced_search/elasticsearch.md @@ -212,7 +212,7 @@ The following Elasticsearch settings are available: | `Password` | The password of your Elasticsearch instance. | | `Number of Elasticsearch shards` | Elasticsearch indices are split into multiple shards for performance reasons. In general, you should use at least 5 shards, and indices with tens of millions of documents need to have more shards ([see below](#guidance-on-choosing-optimal-cluster-configuration)). Changes to this value do not take effect until the index is recreated. You can read more about tradeoffs in the [Elasticsearch documentation](https://www.elastic.co/guide/en/elasticsearch/reference/current/scalability.html). | | `Number of Elasticsearch replicas` | Each Elasticsearch shard can have a number of replicas. These are a complete copy of the shard, and can provide increased query performance or resilience against hardware failure. Increasing this value increases total disk space required by the index. | -| `Limit the number of namespaces and projects that can be indexed` | Enabling this allows you to select namespaces and projects to index. All other namespaces and projects use database search instead. If you enable this option but do not select any namespaces or projects, none are indexed. [Read more below](#limit-the-number-of-namespaces-and-projects-that-can-be-indexed). +| `Limit the number of namespaces and projects that can be indexed` | Enabling this allows you to select namespaces and projects to index. All other namespaces and projects use database search instead. If you enable this option but do not select any namespaces or projects, none are indexed. [Read more below](#limit-the-number-of-namespaces-and-projects-that-can-be-indexed).| | `Using AWS hosted Elasticsearch with IAM credentials` | Sign your Elasticsearch requests using [AWS IAM authorization](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_access-keys.html), [AWS EC2 Instance Profile Credentials](https://docs.aws.amazon.com/codedeploy/latest/userguide/getting-started-create-iam-instance-profile.html#getting-started-create-iam-instance-profile-cli), or [AWS ECS Tasks Credentials](https://docs.aws.amazon.com/AmazonECS/latest/userguide/task-iam-roles.html). Please refer to [Identity and Access Management in Amazon OpenSearch Service](https://docs.aws.amazon.com/opensearch-service/latest/developerguide/ac.html) for details of AWS hosted OpenSearch domain access policy configuration. | | `AWS Region` | The AWS region in which your OpenSearch Service is located. | | `AWS Access Key` | The AWS access key. | diff --git a/doc/update/index.md b/doc/update/index.md index e9fa2321450..dd53542e400 100644 --- a/doc/update/index.md +++ b/doc/update/index.md @@ -333,7 +333,14 @@ sudo -u git -H bundle exec rake gitlab:elastic:list_pending_migrations ### What do you do if your Advanced Search migrations are stuck? -See [how to retry a halted migration](../integration/advanced_search/elasticsearch.md#retry-a-halted-migration). +In GitLab 15.0, an Advanced Search migration named `DeleteOrphanedCommit` can be permanently stuck +in a pending state across upgrades. This issue [is corrected in +GitLab 15.1](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/89539). + +If you are a self-managed customer who uses GitLab 15.0 with Advanced Search, you will experience performance degradation. +To clean up the migration, upgrade to 15.1 or later. + +For other Advanced Search migrations stuck in pending, see [how to retry a halted migration](../integration/advanced_search/elasticsearch.md#retry-a-halted-migration). ### What do you do for the error `Elasticsearch version not compatible` diff --git a/lib/gitlab/graphql/deprecation.rb b/lib/gitlab/graphql/deprecation.rb index d30751fe46e..7ba339d4191 100644 --- a/lib/gitlab/graphql/deprecation.rb +++ b/lib/gitlab/graphql/deprecation.rb @@ -21,8 +21,18 @@ module Gitlab validate :milestone_is_string validate :reason_known_or_string - def self.parse(options) - new(**options) if options + def self.parse(alpha: nil, deprecated: nil) + options = alpha || deprecated + return unless options + + if alpha + raise ArgumentError, '`alpha` and `deprecated` arguments cannot be passed at the same time' \ + if deprecated + + options[:reason] = :alpha + end + + new(**options) end def initialize(reason: nil, milestone: nil, replacement: nil) diff --git a/qa/Rakefile b/qa/Rakefile index e4d38d8294f..b772a30ed67 100644 --- a/qa/Rakefile +++ b/qa/Rakefile @@ -86,4 +86,9 @@ namespace :test_resources do QA::Tools::TestResourcesHandler.new.download(args[:ci_project_name]) end end + +desc "Deletes user's projects" +task :delete_user_projects, [:delete_before, :dry_run] do |t, args| + QA::Tools::DeleteUserProjects.new(args).run +end # rubocop:enable Rails/RakeEnvironment diff --git a/qa/qa/service/docker_run/gitlab_runner.rb b/qa/qa/service/docker_run/gitlab_runner.rb index 1584b577af1..45ab4ceff99 100644 --- a/qa/qa/service/docker_run/gitlab_runner.rb +++ b/qa/qa/service/docker_run/gitlab_runner.rb @@ -36,13 +36,14 @@ module QA end def register! - shell <<~CMD.tr("\n", ' ') + cmd = <<~CMD.tr("\n", ' ') docker run -d --rm --network #{runner_network} --name #{@name} #{'-v /var/run/docker.sock:/var/run/docker.sock' if @executor == :docker} --privileged #{@image} #{add_gitlab_tls_cert if @address.include? 'https'} && docker exec --detach #{@name} sh -c "#{register_command}" CMD + shell(cmd, mask_secrets: [@token]) wait_until_running_and_configured diff --git a/qa/qa/tools/delete_projects.rb b/qa/qa/tools/delete_projects.rb index 96ea5f8de7e..da46606f286 100644 --- a/qa/qa/tools/delete_projects.rb +++ b/qa/qa/tools/delete_projects.rb @@ -9,6 +9,7 @@ module QA module Tools class DeleteProjects include Support::API + include Lib::Project def initialize raise ArgumentError, "Please provide GITLAB_ADDRESS environment variable" unless ENV['GITLAB_ADDRESS'] @@ -30,25 +31,12 @@ module QA project_ids = fetch_project_ids(group_id, total_project_pages) $stdout.puts "Number of projects to be deleted: #{project_ids.length}" - delete_projects(project_ids) unless project_ids.empty? + delete_projects(project_ids, @api_client) unless project_ids.empty? $stdout.puts "\nDone" end private - def delete_projects(project_ids) - $stdout.puts "Deleting #{project_ids.length} projects..." - project_ids.each do |project_id| - request_url = Runtime::API::Request.new(@api_client, "/projects/#{project_id}").url - path = parse_body(get(request_url))[:path_with_namespace] - $stdout.puts "\nDeleting project #{path}..." - - delete_response = delete(request_url) - dot_or_f = delete_response.code.between?(200, 300) ? "\e[32m.\e[0m" : "\e[31mF - #{delete_response}\e[0m" - print dot_or_f - end - end - def fetch_group_id group_name = ENV['TOP_LEVEL_GROUP_NAME'] || "gitlab-qa-sandbox-group-#{Time.now.wday + 1}" group_search_response = get Runtime::API::Request.new(@api_client, "/groups/#{group_name}").url diff --git a/qa/qa/tools/delete_user_projects.rb b/qa/qa/tools/delete_user_projects.rb new file mode 100644 index 00000000000..9c031e352b4 --- /dev/null +++ b/qa/qa/tools/delete_user_projects.rb @@ -0,0 +1,64 @@ +# frozen_string_literal: true + +# This script deletes all projects owned by a given USER_ID in their personal namespace +# Required environment variables: USER_ID, GITLAB_QA_ACCESS_TOKEN and GITLAB_ADDRESS +# Run `rake delete_user_projects` + +module QA + module Tools + class DeleteUserProjects + include Support::API + include Lib::Project + + def initialize(delete_before: (Date.today - 1).to_s, dry_run: false) + unless ENV['GITLAB_ADDRESS'] + raise ArgumentError, "Please provide GITLAB_ADDRESS environment variable" + end + + unless ENV['GITLAB_QA_ACCESS_TOKEN'] + raise ArgumentError, "Please provide GITLAB_QA_ACCESS_TOKEN environment variable" + end + + unless ENV['USER_ID'] + raise ArgumentError, "Please provide USER_ID environment variable" + end + + @delete_before = Date.parse(delete_before) + @dry_run = dry_run + @api_client = Runtime::API::Client.new(ENV['GITLAB_ADDRESS'], + personal_access_token: ENV['GITLAB_QA_ACCESS_TOKEN']) + end + + def run + $stdout.puts 'Running...' + + projects_head_response = head Runtime::API::Request.new(@api_client, "/users/#{ENV['USER_ID']}/projects", + per_page: "100").url + total_project_pages = projects_head_response.headers[:x_total_pages] + + $stdout.puts "Total project pages: #{total_project_pages}" + + project_ids = fetch_project_ids(total_project_pages) + + delete_projects(project_ids, @api_client, @dry_run) unless project_ids.empty? + $stdout.puts "\nDone" + end + + private + + def fetch_project_ids(total_project_pages) + projects_ids = [] + + total_project_pages.to_i.times do |page_no| + projects_response = get Runtime::API::Request.new(@api_client, "/users/#{ENV['USER_ID']}/projects", + page: (page_no + 1).to_s, per_page: "100").url + projects_ids.concat(JSON.parse(projects_response.body) + .select { |project| Date.parse(project["created_at"]) < @delete_before } + .map { |project| project["id"] }) + end + + projects_ids.uniq + end + end + end +end diff --git a/qa/qa/tools/lib/project.rb b/qa/qa/tools/lib/project.rb new file mode 100644 index 00000000000..52e5e5c63a4 --- /dev/null +++ b/qa/qa/tools/lib/project.rb @@ -0,0 +1,33 @@ +# frozen_string_literal: true + +module QA + module Tools + module Lib + module Project + def delete_projects(project_ids, api_client, dry_run = false) + if dry_run + $stdout.puts "Following #{project_ids.length} projects would be deleted:" + else + $stdout.puts "Deleting #{project_ids.length} projects..." + end + + project_ids.each do |project_id| + request_url = Runtime::API::Request.new(api_client, "/projects/#{project_id}").url + parsed_body = parse_body(get(request_url)) + path = parsed_body[:path_with_namespace] + created_at = parsed_body[:created_at] + + if dry_run + $stdout.puts "#{path} - created at: #{created_at}" + else + $stdout.puts "\nDeleting project #{path} - created at: #{created_at}" + delete_response = delete(request_url) + dot_or_f = delete_response.code.between?(200, 300) ? "\e[32m.\e[0m" : "\e[31mF - #{delete_response}\e[0m" + print dot_or_f + end + end + end + end + end + end +end diff --git a/qa/spec/service/docker_run/gitlab_runner_spec.rb b/qa/spec/service/docker_run/gitlab_runner_spec.rb index d9f201cf67e..df0cddd1b9a 100644 --- a/qa/spec/service/docker_run/gitlab_runner_spec.rb +++ b/qa/spec/service/docker_run/gitlab_runner_spec.rb @@ -33,17 +33,21 @@ module QA end it 'runs non-interactively' do - expect(subject).to have_received(:shell).with(/ --non-interactive /) + expect(subject).to have_received_masked_shell_command(/ --non-interactive /) end it 'sets pertinent information' do - expect(subject).to have_received(:shell).with(/--name #{runner_name} /) - expect(subject).to have_received(:shell).with(/--url #{subject.address} /) - expect(subject).to have_received(:shell).with(/--registration-token #{subject.token} /) + expect(subject).to have_received_masked_shell_command(/--name #{runner_name} /) + expect(subject).to have_received_masked_shell_command(/--url #{subject.address} /) + expect(subject).to have_received_masked_shell_command(/--registration-token **** /) + end + + it 'masks the registration token' do + expect(subject).to have_received(:shell).with(/#{subject.token}/, mask_secrets: [subject.token]) end it 'runs untagged' do - expect(subject).to have_received(:shell).with(/--run-untagged=true /) + expect(subject).to have_received_masked_shell_command(/--run-untagged=true /) end it 'has no tags' do @@ -51,11 +55,11 @@ module QA end it 'runs daemonized' do - expect(subject).to have_received(:shell).with(/ -d /) + expect(subject).to have_received_masked_shell_command(/ -d /) end it 'cleans itself up' do - expect(subject).to have_received(:shell).with(/ --rm /) + expect(subject).to have_received_masked_shell_command(/ --rm /) end end @@ -65,11 +69,11 @@ module QA end it 'passes --run-untagged=true' do - expect(subject).to have_received(:shell).with(/--run-untagged=true /) + expect(subject).to have_received_masked_shell_command(/--run-untagged=true /) end it 'does not pass tag list' do - expect(subject).not_to have_received(:shell).with(/--tag-list/) + expect(subject).not_to have_received_masked_shell_command(/--tag-list/) end end @@ -82,11 +86,11 @@ module QA end it 'does not pass --run-untagged' do - expect(subject).not_to have_received(:shell).with(/--run-untagged=true/) + expect(subject).not_to have_received_masked_shell_command(/--run-untagged=true/) end it 'passes the tags with comma-separation' do - expect(subject).to have_received(:shell).with(/--tag-list #{tags.join(',')} /) + expect(subject).to have_received_masked_shell_command(/--tag-list #{tags.join(',')} /) end end @@ -116,7 +120,7 @@ module QA it 'defaults to the shell executor' do register - expect(subject).to have_received(:shell).with(/--executor shell /) + expect(subject).to have_received_masked_shell_command(/--executor shell /) end context 'docker' do @@ -127,31 +131,31 @@ module QA end it 'specifies the docker executor' do - expect(subject).to have_received(:shell).with(/--executor docker /) + expect(subject).to have_received_masked_shell_command(/--executor docker /) end it 'mounts the docker socket to the host runner' do - expect(subject).to have_received(:shell).with(%r{-v /var/run/docker.sock:/var/run/docker.sock }) + expect(subject).to have_received_masked_shell_command(%r{-v /var/run/docker.sock:/var/run/docker.sock }) end it 'runs in privileged mode' do - expect(subject).to have_received(:shell).with(/--privileged /) + expect(subject).to have_received_masked_shell_command(/--privileged /) end it 'has a default image' do - expect(subject).to have_received(:shell).with(/--docker-image \b.+\b /) + expect(subject).to have_received_masked_shell_command(/--docker-image \b.+\b /) end it 'does not verify TLS' do - expect(subject).to have_received(:shell).with(/--docker-tlsverify=false /) + expect(subject).to have_received_masked_shell_command(/--docker-tlsverify=false /) end it 'passes privileged mode' do - expect(subject).to have_received(:shell).with(/--docker-privileged=true /) + expect(subject).to have_received_masked_shell_command(/--docker-privileged=true /) end it 'passes the host network' do - expect(subject).to have_received(:shell).with(/--docker-network-mode=#{subject.network}/) + expect(subject).to have_received_masked_shell_command(/--docker-network-mode=#{subject.network}/) end end end @@ -170,5 +174,15 @@ module QA expect(subject.run_untagged).to be(false) end end + + RSpec::Matchers.define "have_received_masked_shell_command" do |cmd| + match do |actual| + expect(actual).to have_received(:shell).with(cmd, mask_secrets: anything) + end + + match_when_negated do |actual| + expect(actual).not_to have_received(:shell).with(cmd, mask_secrets: anything) + end + end end end diff --git a/scripts/undercoverage b/scripts/undercoverage index b9266b015a7..86153671d6a 100755 --- a/scripts/undercoverage +++ b/scripts/undercoverage @@ -22,4 +22,5 @@ end compare_base = ARGV[0] compare_base ||= IO.popen(%w(git merge-base origin/master HEAD)) { |p| p.read.chomp } -Undercover::CLI.run(%W(-c #{compare_base})) +result = Undercover::CLI.run(%W(-c #{compare_base})) +exit result diff --git a/spec/lib/gitlab/graphql/deprecation_spec.rb b/spec/lib/gitlab/graphql/deprecation_spec.rb index 2931e28a6ee..0ff4c232c6f 100644 --- a/spec/lib/gitlab/graphql/deprecation_spec.rb +++ b/spec/lib/gitlab/graphql/deprecation_spec.rb @@ -6,30 +6,57 @@ require 'active_model' RSpec.describe ::Gitlab::Graphql::Deprecation do let(:options) { {} } - subject(:deprecation) { described_class.parse(options) } + subject(:deprecation) { described_class.new(**options) } describe '.parse' do - context 'with nil' do - let(:options) { nil } + subject(:parsed_deprecation) { described_class.parse(**options) } - it 'parses to nil' do - expect(deprecation).to be_nil + context 'with no arguments' do + it 'returns nil' do + expect(parsed_deprecation).to be_nil end end - context 'with empty options' do - let(:options) { {} } + context 'with an incomplete `deprecated` argument' do + let(:options) { { deprecated: {} } } - it 'parses to an empty deprecation' do - expect(deprecation).to eq(described_class.new) + it 'parses as an invalid deprecation' do + expect(parsed_deprecation).not_to be_valid + expect(parsed_deprecation).to eq(described_class.new) end end - context 'with defined options' do - let(:options) { { reason: :renamed, milestone: '10.10' } } + context 'with a `deprecated` argument' do + let(:options) { { deprecated: { reason: :renamed, milestone: '10.10' } } } - it 'assigns the properties' do - expect(deprecation).to eq(described_class.new(reason: 'This was renamed', milestone: '10.10')) + it 'parses as a deprecation' do + expect(parsed_deprecation).to be_valid + expect(parsed_deprecation).to eq( + described_class.new(reason: 'This was renamed', milestone: '10.10') + ) + end + end + + context 'with an `alpha` argument' do + let(:options) { { alpha: { milestone: '10.10' } } } + + it 'parses as an alpha' do + expect(parsed_deprecation).to be_valid + expect(parsed_deprecation).to eq( + described_class.new(reason: :alpha, milestone: '10.10') + ) + end + end + + context 'with both `deprecated` and `alpha` arguments' do + let(:options) do + { alpha: { milestone: '10.10' }, deprecated: { reason: :renamed, milestone: '10.10' } } + end + + it 'raises an error' do + expect { parsed_deprecation }.to raise_error(ArgumentError, + '`alpha` and `deprecated` arguments cannot be passed at the same time' + ) end end end diff --git a/spec/support/shared_examples/graphql/types/gitlab_style_deprecations_shared_examples.rb b/spec/support/shared_examples/graphql/types/gitlab_style_deprecations_shared_examples.rb index 7fd54408b11..2d7da9f9f00 100644 --- a/spec/support/shared_examples/graphql/types/gitlab_style_deprecations_shared_examples.rb +++ b/spec/support/shared_examples/graphql/types/gitlab_style_deprecations_shared_examples.rb @@ -69,4 +69,21 @@ RSpec.shared_examples 'Gitlab-style deprecations' do 'This feature is in Alpha. It can be changed or removed at any time. Introduced in 1.10.' ) end + + it 'supports :alpha' do + deprecable = subject(alpha: { milestone: '1.10' }) + + expect(deprecable.deprecation_reason).to eq( + 'This feature is in Alpha. It can be changed or removed at any time. Introduced in 1.10.' + ) + end + + it 'does not allow :alpha and :deprecated together' do + expect do + subject(alpha: { milestone: '1.10' }, deprecated: { milestone: '1.10', reason: 'my reason' } ) + end.to raise_error( + ArgumentError, + eq("`alpha` and `deprecated` arguments cannot be passed at the same time") + ) + end end