From 100b1a03e603487ff1966f513ba1a177a8adaefd Mon Sep 17 00:00:00 2001 From: GitLab Bot Date: Mon, 7 Dec 2020 12:10:00 +0000 Subject: [PATCH] Add latest changes from gitlab-org/gitlab@master --- .../javascripts/diffs/components/app.vue | 21 +-- app/assets/javascripts/diffs/store/actions.js | 3 +- .../stylesheets/framework/dropdowns.scss | 3 +- .../stylesheets/pages/notifications.scss | 2 - .../notifications/_group_settings.html.haml | 2 +- .../shared/notes/_comment_button.html.haml | 2 +- .../shared/notifications/_button.html.haml | 6 +- .../shared/web_hooks/_test_button.html.haml | 2 +- ...957-convert-to-svg-caret-down-comments.yml | 5 + ...e-disable-admin-mode-in-requests-views.yml | 5 + doc/administration/geo/setup/database.md | 5 - .../graphql/reference/gitlab_schema.graphql | 36 +++++ doc/api/graphql/reference/gitlab_schema.json | 125 ++++++++++++++++++ doc/api/graphql/reference/index.md | 9 ++ doc/ci/multi_project_pipelines.md | 7 +- doc/development/pipelines.md | 30 ++++- .../Security/API-Fuzzing.gitlab-ci.yml | 4 +- locale/gitlab.pot | 2 +- package.json | 2 +- spec/frontend/fixtures/abuse_reports.rb | 2 + spec/frontend/fixtures/admin_users.rb | 2 + .../frontend/fixtures/application_settings.rb | 2 + .../frontend/fixtures/autocomplete_sources.rb | 5 +- spec/frontend/fixtures/blob.rb | 4 +- spec/frontend/fixtures/branches.rb | 6 +- spec/frontend/fixtures/clusters.rb | 4 +- spec/frontend/fixtures/commit.rb | 4 +- spec/frontend/fixtures/deploy_keys.rb | 4 + spec/frontend/fixtures/freeze_period.rb | 4 +- spec/frontend/fixtures/groups.rb | 10 +- spec/frontend/fixtures/issues.rb | 5 +- spec/frontend/fixtures/jobs.rb | 4 +- spec/frontend/fixtures/labels.rb | 7 +- spec/frontend/fixtures/merge_requests.rb | 18 +-- .../frontend/fixtures/merge_requests_diffs.rb | 4 +- spec/frontend/fixtures/pipeline_schedules.rb | 8 +- spec/frontend/fixtures/pipelines.rb | 3 +- spec/frontend/fixtures/projects.rb | 6 +- spec/frontend/fixtures/prometheus_service.rb | 4 +- spec/frontend/fixtures/search.rb | 6 +- spec/frontend/fixtures/services.rb | 4 +- spec/frontend/fixtures/snippet.rb | 8 +- spec/frontend/fixtures/tags.rb | 4 +- spec/frontend/fixtures/todos.rb | 10 +- spec/helpers/nav_helper_spec.rb | 2 +- .../api_guard/admin_mode_middleware_spec.rb | 2 +- spec/requests/api/graphql/group_query_spec.rb | 2 +- .../mutations/snippets/mark_as_spam_spec.rb | 2 +- spec/requests/api/users_spec.rb | 2 +- spec/requests/git_http_spec.rb | 20 ++- spec/requests/lfs_http_spec.rb | 4 +- spec/requests/self_monitoring_project_spec.rb | 8 +- spec/spec_helper.rb | 6 - .../self_monitoring_shared_examples.rb | 12 ++ .../artifacts/_artifact.html.haml_spec.rb | 17 ++- spec/views/search/_results.html.haml_spec.rb | 38 ++++-- yarn.lock | 8 +- 57 files changed, 399 insertions(+), 133 deletions(-) create mode 100644 changelogs/unreleased/225957-convert-to-svg-caret-down-comments.yml create mode 100644 changelogs/unreleased/chore-disable-admin-mode-in-requests-views.yml diff --git a/app/assets/javascripts/diffs/components/app.vue b/app/assets/javascripts/diffs/components/app.vue index 731050f2e51..7827c78b658 100644 --- a/app/assets/javascripts/diffs/components/app.vue +++ b/app/assets/javascripts/diffs/components/app.vue @@ -283,10 +283,7 @@ export default { }, created() { this.adjustView(); - - notesEventHub.$once('fetchDiffData', this.fetchData); - notesEventHub.$on('refetchDiffData', this.refetchDiffData); - eventHub.$on(EVT_VIEW_FILE_BY_FILE, this.fileByFileListener); + this.subscribeToEvents(); this.CENTERED_LIMITED_CONTAINER_CLASSES = CENTERED_LIMITED_CONTAINER_CLASSES; @@ -307,11 +304,7 @@ export default { }, beforeDestroy() { diffsApp.deinstrument(); - - eventHub.$off(EVT_VIEW_FILE_BY_FILE, this.fileByFileListener); - notesEventHub.$off('refetchDiffData', this.refetchDiffData); - notesEventHub.$off('fetchDiffData', this.fetchData); - + this.unsubscribeFromEvents(); this.removeEventListeners(); }, methods: { @@ -331,6 +324,16 @@ export default { 'navigateToDiffFileIndex', 'setFileByFile', ]), + subscribeToEvents() { + notesEventHub.$once('fetchDiffData', this.fetchData); + notesEventHub.$on('refetchDiffData', this.refetchDiffData); + eventHub.$on(EVT_VIEW_FILE_BY_FILE, this.fileByFileListener); + }, + unsubscribeFromEvents() { + eventHub.$off(EVT_VIEW_FILE_BY_FILE, this.fileByFileListener); + notesEventHub.$off('refetchDiffData', this.refetchDiffData); + notesEventHub.$off('fetchDiffData', this.fetchData); + }, fileByFileListener({ setting } = {}) { this.setFileByFile({ fileByFile: setting }); }, diff --git a/app/assets/javascripts/diffs/store/actions.js b/app/assets/javascripts/diffs/store/actions.js index e7f950f15c1..ee319990290 100644 --- a/app/assets/javascripts/diffs/store/actions.js +++ b/app/assets/javascripts/diffs/store/actions.js @@ -114,7 +114,8 @@ export const fetchDiffFilesBatch = ({ commit, state, dispatch }) => { } if ( - (diffsGradualLoad && totalLoaded === pagination.total_pages) || + (diffsGradualLoad && + (totalLoaded === pagination.total_pages || pagination.total_pages === null)) || (!diffsGradualLoad && !pagination.next_page) ) { commit(types.SET_RETRIEVING_BATCHES, false); diff --git a/app/assets/stylesheets/framework/dropdowns.scss b/app/assets/stylesheets/framework/dropdowns.scss index 47e1ba21d6b..ad26766cdfa 100644 --- a/app/assets/stylesheets/framework/dropdowns.scss +++ b/app/assets/stylesheets/framework/dropdowns.scss @@ -341,7 +341,8 @@ } .droplab-dropdown { - .dropdown-toggle > i { + .dropdown-toggle > i, + .dropdown-toggle > svg { pointer-events: none; } diff --git a/app/assets/stylesheets/pages/notifications.scss b/app/assets/stylesheets/pages/notifications.scss index e1cbf0e6654..4c0dc6b59f4 100644 --- a/app/assets/stylesheets/pages/notifications.scss +++ b/app/assets/stylesheets/pages/notifications.scss @@ -1,6 +1,4 @@ .notification-list-item { - line-height: 34px; - .dropdown-menu { @extend .dropdown-menu-right; } diff --git a/app/views/profiles/notifications/_group_settings.html.haml b/app/views/profiles/notifications/_group_settings.html.haml index ea698a296fb..b1578886098 100644 --- a/app/views/profiles/notifications/_group_settings.html.haml +++ b/app/views/profiles/notifications/_group_settings.html.haml @@ -12,5 +12,5 @@ = render 'shared/notifications/button', notification_setting: setting, emails_disabled: emails_disabled .table-section.section-30 - = form_for setting, url: profile_notifications_group_path(group), method: :put, html: { class: 'update-notifications' } do |f| + = form_for setting, url: profile_notifications_group_path(group), method: :put, html: { class: 'update-notifications gl-display-flex' } do |f| = f.select :notification_email, @user.public_verified_emails, { include_blank: 'Global notification email' }, class: 'select2 js-group-notification-email' diff --git a/app/views/shared/notes/_comment_button.html.haml b/app/views/shared/notes/_comment_button.html.haml index 45af4b51b27..6c39f66bed5 100644 --- a/app/views/shared/notes/_comment_button.html.haml +++ b/app/views/shared/notes/_comment_button.html.haml @@ -5,7 +5,7 @@ - if @note.can_be_discussion_note? = button_tag type: 'button', class: 'btn btn-nr dropdown-toggle btn-success js-note-new-discussion js-disable-on-submit', data: { 'dropdown-trigger' => '#resolvable-comment-menu' }, 'aria-label' => _('Open comment type dropdown') do - = icon('caret-down', class: 'toggle-icon') + = sprite_icon('chevron-down') %ul#resolvable-comment-menu.dropdown-menu.dropdown-open-top{ data: { dropdown: true } } %li#comment.droplab-item-selected{ data: { value: '', 'submit-text' => _('Comment'), 'close-text' => _("Comment & close %{noteable_name}") % { noteable_name: noteable_name }, 'reopen-text' => _("Comment & reopen %{noteable_name}") % { noteable_name: noteable_name } } } diff --git a/app/views/shared/notifications/_button.html.haml b/app/views/shared/notifications/_button.html.haml index d7b53810f76..e12531b8a8d 100644 --- a/app/views/shared/notifications/_button.html.haml +++ b/app/views/shared/notifications/_button.html.haml @@ -20,8 +20,8 @@ %button.dropdown-new.btn.btn-default.btn-icon.gl-button.has-tooltip.notifications-btn.text-left#notifications-button{ type: "button", title: button_title, class: "#{btn_class}", "aria-label" => aria_label, data: { container: "body", toggle: "modal", target: "#" + notifications_menu_identifier("modal", notification_setting), display: 'static' } } = sprite_icon("notifications", css_class: "js-notification-loading") = notification_title(notification_setting.level) - %button.btn.dropdown-toggle.d-flex{ data: { toggle: "dropdown", target: notifications_menu_identifier("dropdown", notification_setting), flip: "false" } } - = icon('caret-down') + %button.btn.dropdown-toggle.gl-display-flex.gl-align-items-center{ data: { toggle: "dropdown", target: notifications_menu_identifier("dropdown", notification_setting), flip: "false" } } + = sprite_icon('chevron-down') .sr-only Toggle dropdown - else %button.dropdown-new.btn.btn-default.btn-icon.gl-button.has-tooltip.notifications-btn#notifications-button{ type: "button", title: button_title, class: "#{btn_class}", "aria-label" => aria_label, data: { container: "body", toggle: "dropdown", target: notifications_menu_identifier("dropdown", notification_setting), flip: "false" } } @@ -29,7 +29,7 @@ = sprite_icon("notifications", css_class: "js-notification-loading") = notification_title(notification_setting.level) .float-right - = icon("caret-down") + = sprite_icon("chevron-down") = render "shared/notifications/notification_dropdown", notification_setting: notification_setting diff --git a/app/views/shared/web_hooks/_test_button.html.haml b/app/views/shared/web_hooks/_test_button.html.haml index fc24e425ab6..c46b8a99886 100644 --- a/app/views/shared/web_hooks/_test_button.html.haml +++ b/app/views/shared/web_hooks/_test_button.html.haml @@ -5,7 +5,7 @@ .hook-test-button.dropdown.inline> %button.btn{ 'data-toggle' => 'dropdown', class: button_class } = _('Test') - = icon('caret-down') + = sprite_icon('chevron-down') %ul.dropdown-menu.dropdown-menu-right{ role: 'menu' } - triggers.each_value do |event| %li diff --git a/changelogs/unreleased/225957-convert-to-svg-caret-down-comments.yml b/changelogs/unreleased/225957-convert-to-svg-caret-down-comments.yml new file mode 100644 index 00000000000..5d33c6c91b9 --- /dev/null +++ b/changelogs/unreleased/225957-convert-to-svg-caret-down-comments.yml @@ -0,0 +1,5 @@ +--- +title: Convert bootstrap carets to svg chevrons +merge_request: 48492 +author: +type: other diff --git a/changelogs/unreleased/chore-disable-admin-mode-in-requests-views.yml b/changelogs/unreleased/chore-disable-admin-mode-in-requests-views.yml new file mode 100644 index 00000000000..b05240343eb --- /dev/null +++ b/changelogs/unreleased/chore-disable-admin-mode-in-requests-views.yml @@ -0,0 +1,5 @@ +--- +title: Disable auto admin mode on requests and views specs +merge_request: 48700 +author: Diego Louzán +type: other diff --git a/doc/administration/geo/setup/database.md b/doc/administration/geo/setup/database.md index 17830289005..adaf92a74b0 100644 --- a/doc/administration/geo/setup/database.md +++ b/doc/administration/geo/setup/database.md @@ -434,11 +434,6 @@ data before running `pg_basebackup`. NOTE: Replication slot names must only contain lowercase letters, numbers, and the underscore character. - NOTE: - In GitLab 13.4, a seed project is added when GitLab is first installed. This makes it necessary to pass `--force` even - on a new Geo secondary node. There is an [issue to account for seed projects](https://gitlab.com/gitlab-org/omnibus-gitlab/-/issues/5618) - when checking the database. - When prompted, enter the _plaintext_ password you set up for the `gitlab_replicator` user in the first step. diff --git a/doc/api/graphql/reference/gitlab_schema.graphql b/doc/api/graphql/reference/gitlab_schema.graphql index 6ab0e6c8903..14975346491 100644 --- a/doc/api/graphql/reference/gitlab_schema.graphql +++ b/doc/api/graphql/reference/gitlab_schema.graphql @@ -3290,6 +3290,11 @@ type ComplianceFrameworkEdge { node: ComplianceFramework } +""" +Identifier of ComplianceManagement::Framework +""" +scalar ComplianceManagementFrameworkID + """ Autogenerated input type of ConfigureSast """ @@ -6545,6 +6550,36 @@ type DestroyBoardPayload { errors: [String!]! } +""" +Autogenerated input type of DestroyComplianceFramework +""" +input DestroyComplianceFrameworkInput { + """ + A unique identifier for the client performing the mutation. + """ + clientMutationId: String + + """ + The global ID of the compliance framework to destroy + """ + id: ComplianceManagementFrameworkID! +} + +""" +Autogenerated return type of DestroyComplianceFramework +""" +type DestroyComplianceFrameworkPayload { + """ + A unique identifier for the client performing the mutation. + """ + clientMutationId: String + + """ + Errors encountered during execution of the mutation. + """ + errors: [String!]! +} + """ Autogenerated input type of DestroyContainerRepository """ @@ -14247,6 +14282,7 @@ type Mutation { designManagementUpload(input: DesignManagementUploadInput!): DesignManagementUploadPayload destroyBoard(input: DestroyBoardInput!): DestroyBoardPayload destroyBoardList(input: DestroyBoardListInput!): DestroyBoardListPayload + destroyComplianceFramework(input: DestroyComplianceFrameworkInput!): DestroyComplianceFrameworkPayload destroyContainerRepository(input: DestroyContainerRepositoryInput!): DestroyContainerRepositoryPayload destroyNote(input: DestroyNoteInput!): DestroyNotePayload destroySnippet(input: DestroySnippetInput!): DestroySnippetPayload diff --git a/doc/api/graphql/reference/gitlab_schema.json b/doc/api/graphql/reference/gitlab_schema.json index f8c6337e852..8c3a658f3bd 100644 --- a/doc/api/graphql/reference/gitlab_schema.json +++ b/doc/api/graphql/reference/gitlab_schema.json @@ -9045,6 +9045,16 @@ "enumValues": null, "possibleTypes": null }, + { + "kind": "SCALAR", + "name": "ComplianceManagementFrameworkID", + "description": "Identifier of ComplianceManagement::Framework", + "fields": null, + "inputFields": null, + "interfaces": null, + "enumValues": null, + "possibleTypes": null + }, { "kind": "INPUT_OBJECT", "name": "ConfigureSastInput", @@ -18130,6 +18140,94 @@ "enumValues": null, "possibleTypes": null }, + { + "kind": "INPUT_OBJECT", + "name": "DestroyComplianceFrameworkInput", + "description": "Autogenerated input type of DestroyComplianceFramework", + "fields": null, + "inputFields": [ + { + "name": "id", + "description": "The global ID of the compliance framework to destroy", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "ComplianceManagementFrameworkID", + "ofType": null + } + }, + "defaultValue": null + }, + { + "name": "clientMutationId", + "description": "A unique identifier for the client performing the mutation.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + } + ], + "interfaces": null, + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "DestroyComplianceFrameworkPayload", + "description": "Autogenerated return type of DestroyComplianceFramework", + "fields": [ + { + "name": "clientMutationId", + "description": "A unique identifier for the client performing the mutation.", + "args": [ + + ], + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "errors", + "description": "Errors encountered during execution of the mutation.", + "args": [ + + ], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + } + } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [ + + ], + "enumValues": null, + "possibleTypes": null + }, { "kind": "INPUT_OBJECT", "name": "DestroyContainerRepositoryInput", @@ -40589,6 +40687,33 @@ "isDeprecated": false, "deprecationReason": null }, + { + "name": "destroyComplianceFramework", + "description": null, + "args": [ + { + "name": "input", + "description": null, + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "INPUT_OBJECT", + "name": "DestroyComplianceFrameworkInput", + "ofType": null + } + }, + "defaultValue": null + } + ], + "type": { + "kind": "OBJECT", + "name": "DestroyComplianceFrameworkPayload", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, { "name": "destroyContainerRepository", "description": null, diff --git a/doc/api/graphql/reference/index.md b/doc/api/graphql/reference/index.md index 6081fddf974..2d53ecd3f02 100644 --- a/doc/api/graphql/reference/index.md +++ b/doc/api/graphql/reference/index.md @@ -1099,6 +1099,15 @@ Autogenerated return type of DestroyBoard. | `clientMutationId` | String | A unique identifier for the client performing the mutation. | | `errors` | String! => Array | Errors encountered during execution of the mutation. | +### DestroyComplianceFrameworkPayload + +Autogenerated return type of DestroyComplianceFramework. + +| Field | Type | Description | +| ----- | ---- | ----------- | +| `clientMutationId` | String | A unique identifier for the client performing the mutation. | +| `errors` | String! => Array | Errors encountered during execution of the mutation. | + ### DestroyContainerRepositoryPayload Autogenerated return type of DestroyContainerRepository. diff --git a/doc/ci/multi_project_pipelines.md b/doc/ci/multi_project_pipelines.md index fd64e620687..1df196182c0 100644 --- a/doc/ci/multi_project_pipelines.md +++ b/doc/ci/multi_project_pipelines.md @@ -19,9 +19,10 @@ but also across projects with multi-project pipelines. Multi-project pipelines are useful for larger products that require cross-project inter-dependencies, such as those adopting a [microservices architecture](https://about.gitlab.com/blog/2016/08/16/trends-in-version-control-land-microservices/). -For a demonstration of how cross-functional development teams can use cross-pipeline -triggering to trigger multiple pipelines for different microservices projects, see -[Cross-project Pipeline Triggering and Visualization](https://about.gitlab.com/handbook/marketing/product-marketing/demo/#cross-project-pipeline-triggering-and-visualization-may-2019---1110). +Cross-functional development teams can use cross-pipeline +triggering to trigger multiple pipelines for different microservices projects. Learn more +in the [Cross-project Pipeline Triggering and Visualization demo](https://about.gitlab.com/learn/) +at GitLab@learn, in the Continuous Integration (CI) section. Additionally, it's possible to visualize the entire pipeline, including all cross-project inter-dependencies. **(PREMIUM)** diff --git a/doc/development/pipelines.md b/doc/development/pipelines.md index ba9ccadb2c3..bdd3a46fcb7 100644 --- a/doc/development/pipelines.md +++ b/doc/development/pipelines.md @@ -629,17 +629,21 @@ that are scoped to a single [configuration keyword](../ci/yaml/README.md#job-key | Job definitions | Description | |------------------|-------------| -| `.default-tags` | Ensures a job has the `gitlab-org` tag to ensure it's using our dedicated runners. | | `.default-retry` | Allows a job to [retry](../ci/yaml/README.md#retry) upon `unknown_failure`, `api_failure`, `runner_system_failure`, `job_execution_timeout`, or `stuck_or_timeout_failure`. | | `.default-before_script` | Allows a job to use a default `before_script` definition suitable for Ruby/Rails tasks that may need a database running (e.g. tests). | | `.rails-cache` | Allows a job to use a default `cache` definition suitable for Ruby/Rails tasks. | | `.static-analysis-cache` | Allows a job to use a default `cache` definition suitable for static analysis tasks. | +| `.coverage-cache` | Allows a job to use a default `cache` definition suitable for coverage tasks. | +| `.qa-cache` | Allows a job to use a default `cache` definition suitable for QA tasks. | | `.yarn-cache` | Allows a job to use a default `cache` definition suitable for frontend jobs that do a `yarn install`. | | `.assets-compile-cache` | Allows a job to use a default `cache` definition suitable for frontend jobs that compile assets. | | `.use-pg11` | Allows a job to use the `postgres:11.6` and `redis:4.0-alpine` services. | -| `.use-pg11-ee` | Same as `.use-pg11` but also use the `docker.elastic.co/elasticsearch/elasticsearch:6.4.2` services. | +| `.use-pg11-ee` | Same as `.use-pg11` but also use the `docker.elastic.co/elasticsearch/elasticsearch:7.9.2` services. | +| `.use-pg12` | Allows a job to use the `postgres:12` and `redis:4.0-alpine` services. | +| `.use-pg12-ee` | Same as `.use-pg12` but also use the `docker.elastic.co/elasticsearch/elasticsearch:7.9.2` services. | | `.use-kaniko` | Allows a job to use the `kaniko` tool to build Docker images. | | `.as-if-foss` | Simulate the FOSS project by setting the `FOSS_ONLY='1'` environment variable. | +| `.use-docker-in-docker` | Allows a job to use Docker in Docker. | ### `rules`, `if:` conditions and `changes:` patterns @@ -656,6 +660,7 @@ and included in `rules` definitions via [YAML anchors](../ci/yaml/README.md#anch #### `if:` conditions + | `if:` conditions | Description | Notes | |------------------|-------------|-------| | `if-not-canonical-namespace` | Matches if the project isn't in the canonical (`gitlab-org/`) or security (`gitlab-org/security`) namespace. | Use to create a job for forks (by using `when: on_success\|manual`), or **not** create a job for forks (by using `when: never`). | @@ -663,26 +668,45 @@ and included in `rules` definitions via [YAML anchors](../ci/yaml/README.md#anch | `if-not-foss` | Matches if the project isn't FOSS (i.e. project name isn't `gitlab-foss`, `gitlab-ce`, or `gitlabhq`). | Use to create a job only in the EE project (by using `when: on_success|manual`), or **not** create a job if the project is FOSS (by using `when: never`). | | `if-default-refs` | Matches if the pipeline is for `master`, `/^[\d-]+-stable(-ee)?$/` (stable branches), `/^\d+-\d+-auto-deploy-\d+$/` (auto-deploy branches), `/^security\//` (security branches), merge requests, and tags. | Note that jobs aren't created for branches with this default configuration. | | `if-master-refs` | Matches if the current branch is `master`. | | +| `if-master-push` | Matches if the current branch is `master` and pipeline source is `push`. | | +| `if-master-schedule-2-hourly` | Matches if the current branch is `master` and pipeline runs on a 2-hourly schedule. | | +| `if-master-schedule-2-nightly` | Matches if the current branch is `master` and pipeline runs on a nightly schedule. | | +| `if-auto-deploy-branches` | Matches if the current branch is an auto-deploy one. | | | `if-master-or-tag` | Matches if the pipeline is for the `master` branch or for a tag. | | | `if-merge-request` | Matches if the pipeline is for a merge request. | | +| `if-merge-request-title-as-if-foss` | Matches if the pipeline is for a merge request and the MR title includes "RUN AS-IF-FOSS". | | +| `if-merge-request-title-update-caches` | Matches if the pipeline is for a merge request and the MR title includes "UPDATE CACHE". | | +| `if-merge-request-title-run-all-rspec` | Matches if the pipeline is for a merge request and the MR title includes "RUN ALL RSPEC". | | +| `if-security-merge-request` | Matches if the pipeline is for a security merge request. | | +| `if-security-schedule` | Matches if the pipeline is for a security scheduled pipeline. | | | `if-nightly-master-schedule` | Matches if the pipeline is for a `master` scheduled pipeline with `$NIGHTLY` set. | | | `if-dot-com-gitlab-org-schedule` | Limits jobs creation to scheduled pipelines for the `gitlab-org` group on GitLab.com. | | | `if-dot-com-gitlab-org-master` | Limits jobs creation to the `master` branch for the `gitlab-org` group on GitLab.com. | | | `if-dot-com-gitlab-org-merge-request` | Limits jobs creation to merge requests for the `gitlab-org` group on GitLab.com. | | | `if-dot-com-gitlab-org-and-security-tag` | Limits job creation to tags for the `gitlab-org` and `gitlab-org/security` groups on GitLab.com. | | | `if-dot-com-gitlab-org-and-security-merge-request` | Limit jobs creation to merge requests for the `gitlab-org` and `gitlab-org/security` groups on GitLab.com. | | +| `if-dot-com-gitlab-org-and-security-tag` | Limit jobs creation to tags for the `gitlab-org` and `gitlab-org/security` groups on GitLab.com. | | | `if-dot-com-ee-schedule` | Limits jobs to scheduled pipelines for the `gitlab-org/gitlab` project on GitLab.com. | | | `if-cache-credentials-schedule` | Limits jobs to scheduled pipelines with the `$CI_REPO_CACHE_CREDENTIALS` variable set. | | +| `if-rspec-fail-fast-disabled` | Limits jobs to pipelines with `$RSPEC_FAIL_FAST_ENABLED` variable not set to `"true"`. | | +| `if-rspec-fail-fast-skipped` | Matches if the pipeline is for a merge request and the MR title includes "SKIP RSPEC FAIL-FAST". | | +| `if-security-pipeline-merge-result` | Matches if the pipeline is for a security merge request triggerred by `@gitlab-release-tools-bot`. | | + #### `changes:` patterns | `changes:` patterns | Description | |------------------------------|--------------------------------------------------------------------------| | `ci-patterns` | Only create job for CI config-related changes. | -| `yaml-patterns` | Only create job for YAML-related changes. | +| `ci-build-images-patterns` | Only create job for CI config-related changes related to the `build-images` stage. | +| `ci-review-patterns` | Only create job for CI config-related changes related to the `review` stage. | +| `ci-qa-patterns` | Only create job for CI config-related changes related to the `qa` stage. | +| `yaml-lint-patterns` | Only create job for YAML-related changes. | | `docs-patterns` | Only create job for docs-related changes. | | `frontend-dependency-patterns` | Only create job when frontend dependencies are updated (i.e. `package.json`, and `yarn.lock`). changes. | | `frontend-patterns` | Only create job for frontend-related changes. | +| `backend-patterns` | Only create job for backend-related changes. | +| `db-patterns` | Only create job for DB-related changes. | | `backstage-patterns` | Only create job for backstage-related changes (i.e. Danger, fixtures, RuboCop, specs). | | `code-patterns` | Only create job for code-related changes. | | `qa-patterns` | Only create job for QA-related changes. | diff --git a/lib/gitlab/ci/templates/Security/API-Fuzzing.gitlab-ci.yml b/lib/gitlab/ci/templates/Security/API-Fuzzing.gitlab-ci.yml index 0ae8fd833c4..401a710182d 100644 --- a/lib/gitlab/ci/templates/Security/API-Fuzzing.gitlab-ci.yml +++ b/lib/gitlab/ci/templates/Security/API-Fuzzing.gitlab-ci.yml @@ -61,7 +61,7 @@ apifuzzer_fuzz: - if: $API_FUZZING_DISABLED_FOR_DEFAULT_BRANCH && $CI_DEFAULT_BRANCH == $CI_COMMIT_REF_NAME when: never - - if: $GITLAB_FEATURES =~ /\bapi_fuzzing\b/ + - if: $CI_COMMIT_BRANCH && $GITLAB_FEATURES =~ /\bapi_fuzzing\b/ script: # # Validate options @@ -102,7 +102,7 @@ apifuzzer_fuzz_dnd: - if: $API_FUZZING_DISABLED_FOR_DEFAULT_BRANCH && $CI_DEFAULT_BRANCH == $CI_COMMIT_REF_NAME when: never - - if: $GITLAB_FEATURES =~ /\bapi_fuzzing\b/ + - if: $CI_COMMIT_BRANCH && $GITLAB_FEATURES =~ /\bapi_fuzzing\b/ services: - docker:19.03.12-dind script: diff --git a/locale/gitlab.pot b/locale/gitlab.pot index e46dbc7bc97..989dc19a589 100644 --- a/locale/gitlab.pot +++ b/locale/gitlab.pot @@ -9634,7 +9634,7 @@ msgstr "" msgid "DevopsAdoption|DevOps adoption uses segments to track adoption across key features. Segments are a way to track multiple related projects and groups at once. For example, you could create a segment for the engineering department or a particular product team." msgstr "" -msgid "DevopsAdoption|Feature adoption is based on usage over the last 30 days. Last updated: %{timestamp}." +msgid "DevopsAdoption|Feature adoption is based on usage in the last calendar month. Last updated: %{timestamp}." msgstr "" msgid "DevopsAdoption|Issues" diff --git a/package.json b/package.json index 20b0cc8d958..0d2554e6158 100644 --- a/package.json +++ b/package.json @@ -43,7 +43,7 @@ "@babel/preset-env": "^7.10.1", "@gitlab/at.js": "1.5.5", "@gitlab/svgs": "1.176.0", - "@gitlab/ui": "24.4.0", + "@gitlab/ui": "24.5.0", "@gitlab/visual-review-tools": "1.6.1", "@rails/actioncable": "^6.0.3-3", "@rails/ujs": "^6.0.3-2", diff --git a/spec/frontend/fixtures/abuse_reports.rb b/spec/frontend/fixtures/abuse_reports.rb index 48b055fcda5..f5524a10033 100644 --- a/spec/frontend/fixtures/abuse_reports.rb +++ b/spec/frontend/fixtures/abuse_reports.rb @@ -4,6 +4,7 @@ require 'spec_helper' RSpec.describe Admin::AbuseReportsController, '(JavaScript fixtures)', type: :controller do include JavaScriptFixturesHelpers + include AdminModeHelper let(:admin) { create(:admin) } let!(:abuse_report) { create(:abuse_report) } @@ -18,6 +19,7 @@ RSpec.describe Admin::AbuseReportsController, '(JavaScript fixtures)', type: :co before do sign_in(admin) + enable_admin_mode!(admin) end it 'abuse_reports/abuse_reports_list.html' do diff --git a/spec/frontend/fixtures/admin_users.rb b/spec/frontend/fixtures/admin_users.rb index f068ada53e1..e0fecbdb1aa 100644 --- a/spec/frontend/fixtures/admin_users.rb +++ b/spec/frontend/fixtures/admin_users.rb @@ -5,12 +5,14 @@ require 'spec_helper' RSpec.describe Admin::UsersController, '(JavaScript fixtures)', type: :controller do include StubENV include JavaScriptFixturesHelpers + include AdminModeHelper let(:admin) { create(:admin) } before do stub_env('IN_MEMORY_APPLICATION_SETTINGS', 'false') sign_in(admin) + enable_admin_mode!(admin) end render_views diff --git a/spec/frontend/fixtures/application_settings.rb b/spec/frontend/fixtures/application_settings.rb index 6156e6a43bc..ebccecb32ba 100644 --- a/spec/frontend/fixtures/application_settings.rb +++ b/spec/frontend/fixtures/application_settings.rb @@ -5,6 +5,7 @@ require 'spec_helper' RSpec.describe Admin::ApplicationSettingsController, '(JavaScript fixtures)', type: :controller do include StubENV include JavaScriptFixturesHelpers + include AdminModeHelper let(:admin) { create(:admin) } let(:namespace) { create(:namespace, name: 'frontend-fixtures' )} @@ -13,6 +14,7 @@ RSpec.describe Admin::ApplicationSettingsController, '(JavaScript fixtures)', ty before do stub_env('IN_MEMORY_APPLICATION_SETTINGS', 'false') sign_in(admin) + enable_admin_mode!(admin) end render_views diff --git a/spec/frontend/fixtures/autocomplete_sources.rb b/spec/frontend/fixtures/autocomplete_sources.rb index 8858d69a939..9ff0f959c11 100644 --- a/spec/frontend/fixtures/autocomplete_sources.rb +++ b/spec/frontend/fixtures/autocomplete_sources.rb @@ -5,7 +5,7 @@ require 'spec_helper' RSpec.describe Projects::AutocompleteSourcesController, '(JavaScript fixtures)', type: :controller do include JavaScriptFixturesHelpers - let_it_be(:admin) { create(:admin) } + let_it_be(:user) { create(:user) } let_it_be(:group) { create(:group, name: 'frontend-fixtures') } let_it_be(:project) { create(:project, namespace: group, path: 'autocomplete-sources-project') } let_it_be(:issue) { create(:issue, project: project) } @@ -15,7 +15,8 @@ RSpec.describe Projects::AutocompleteSourcesController, '(JavaScript fixtures)', end before do - sign_in(admin) + group.add_owner(user) + sign_in(user) end it 'autocomplete_sources/labels.json' do diff --git a/spec/frontend/fixtures/blob.rb b/spec/frontend/fixtures/blob.rb index a365ee805af..b112886b2ca 100644 --- a/spec/frontend/fixtures/blob.rb +++ b/spec/frontend/fixtures/blob.rb @@ -5,9 +5,9 @@ require 'spec_helper' RSpec.describe Projects::BlobController, '(JavaScript fixtures)', type: :controller do include JavaScriptFixturesHelpers - let(:admin) { create(:admin) } let(:namespace) { create(:namespace, name: 'frontend-fixtures' )} let(:project) { create(:project, :repository, namespace: namespace, path: 'branches-project') } + let(:user) { project.owner } render_views @@ -16,7 +16,7 @@ RSpec.describe Projects::BlobController, '(JavaScript fixtures)', type: :control end before do - sign_in(admin) + sign_in(user) allow(SecureRandom).to receive(:hex).and_return('securerandomhex:thereisnospoon') end diff --git a/spec/frontend/fixtures/branches.rb b/spec/frontend/fixtures/branches.rb index df2d1af7ecf..f3b3633347d 100644 --- a/spec/frontend/fixtures/branches.rb +++ b/spec/frontend/fixtures/branches.rb @@ -5,9 +5,9 @@ require 'spec_helper' RSpec.describe 'Branches (JavaScript fixtures)' do include JavaScriptFixturesHelpers - let_it_be(:admin) { create(:admin) } let_it_be(:namespace) { create(:namespace, name: 'frontend-fixtures' )} let_it_be(:project) { create(:project, :repository, namespace: namespace, path: 'branches-project') } + let_it_be(:user) { project.owner } before(:all) do clean_frontend_fixtures('branches/') @@ -22,7 +22,7 @@ RSpec.describe 'Branches (JavaScript fixtures)' do render_views before do - sign_in(admin) + sign_in(user) end it 'branches/new_branch.html' do @@ -44,7 +44,7 @@ RSpec.describe 'Branches (JavaScript fixtures)' do # - "master": default, protected # - "markdown": non-default, protected # - "many_files": non-default, not protected - get api("/projects/#{project.id}/repository/branches?search=ma", admin) + get api("/projects/#{project.id}/repository/branches?search=ma", user) expect(response).to be_successful end diff --git a/spec/frontend/fixtures/clusters.rb b/spec/frontend/fixtures/clusters.rb index d0940c7dc7f..b37aa137504 100644 --- a/spec/frontend/fixtures/clusters.rb +++ b/spec/frontend/fixtures/clusters.rb @@ -5,10 +5,10 @@ require 'spec_helper' RSpec.describe Projects::ClustersController, '(JavaScript fixtures)', type: :controller do include JavaScriptFixturesHelpers - let(:admin) { create(:admin) } let(:namespace) { create(:namespace, name: 'frontend-fixtures' )} let(:project) { create(:project, :repository, namespace: namespace) } let(:cluster) { create(:cluster, :provided_by_gcp, projects: [project]) } + let(:user) { project.owner } render_views @@ -17,7 +17,7 @@ RSpec.describe Projects::ClustersController, '(JavaScript fixtures)', type: :con end before do - sign_in(admin) + sign_in(user) end after do diff --git a/spec/frontend/fixtures/commit.rb b/spec/frontend/fixtures/commit.rb index 9175a757b73..ff62a8286fc 100644 --- a/spec/frontend/fixtures/commit.rb +++ b/spec/frontend/fixtures/commit.rb @@ -6,14 +6,12 @@ RSpec.describe 'Commit (JavaScript fixtures)' do include JavaScriptFixturesHelpers let_it_be(:project) { create(:project, :repository) } - let_it_be(:user) { create(:user) } + let_it_be(:user) { project.owner } let_it_be(:commit) { project.commit("master") } before(:all) do clean_frontend_fixtures('commit/') clean_frontend_fixtures('api/commits/') - - project.add_maintainer(user) end before do diff --git a/spec/frontend/fixtures/deploy_keys.rb b/spec/frontend/fixtures/deploy_keys.rb index e87600e9d24..5c24c071792 100644 --- a/spec/frontend/fixtures/deploy_keys.rb +++ b/spec/frontend/fixtures/deploy_keys.rb @@ -4,6 +4,7 @@ require 'spec_helper' RSpec.describe Projects::DeployKeysController, '(JavaScript fixtures)', type: :controller do include JavaScriptFixturesHelpers + include AdminModeHelper let(:admin) { create(:admin) } let(:namespace) { create(:namespace, name: 'frontend-fixtures' )} @@ -17,7 +18,10 @@ RSpec.describe Projects::DeployKeysController, '(JavaScript fixtures)', type: :c end before do + # Using an admin for these fixtures because they are used for verifying a frontend + # component that would normally get its data from `Admin::DeployKeysController` sign_in(admin) + enable_admin_mode!(admin) end after do diff --git a/spec/frontend/fixtures/freeze_period.rb b/spec/frontend/fixtures/freeze_period.rb index b05045663f1..09e4f969e1d 100644 --- a/spec/frontend/fixtures/freeze_period.rb +++ b/spec/frontend/fixtures/freeze_period.rb @@ -6,8 +6,8 @@ RSpec.describe 'Freeze Periods (JavaScript fixtures)' do include JavaScriptFixturesHelpers include TimeZoneHelper - let_it_be(:admin) { create(:admin) } let_it_be(:project) { create(:project, :repository, path: 'freeze-periods-project') } + let_it_be(:user) { project.owner } before(:all) do clean_frontend_fixtures('api/freeze-periods/') @@ -34,7 +34,7 @@ RSpec.describe 'Freeze Periods (JavaScript fixtures)' do create(:ci_freeze_period, project: project, freeze_start: '0 12 * * 1-5', freeze_end: '0 1 5 * *', cron_timezone: 'Etc/UTC') create(:ci_freeze_period, project: project, freeze_start: '0 12 * * 1-5', freeze_end: '0 16 * * 6', cron_timezone: 'Europe/Berlin') - get api("/projects/#{project.id}/freeze_periods", admin) + get api("/projects/#{project.id}/freeze_periods", user) expect(response).to be_successful end diff --git a/spec/frontend/fixtures/groups.rb b/spec/frontend/fixtures/groups.rb index 9f0b2c73c93..42aad9f187e 100644 --- a/spec/frontend/fixtures/groups.rb +++ b/spec/frontend/fixtures/groups.rb @@ -5,20 +5,20 @@ require 'spec_helper' RSpec.describe 'Groups (JavaScript fixtures)', type: :controller do include JavaScriptFixturesHelpers - let(:admin) { create(:admin) } + let(:user) { create(:user) } let(:group) { create(:group, name: 'frontend-fixtures-group', runners_token: 'runnerstoken:intabulasreferre')} - render_views - before(:all) do clean_frontend_fixtures('groups/') end before do - group.add_maintainer(admin) - sign_in(admin) + group.add_owner(user) + sign_in(user) end + render_views + describe GroupsController, '(JavaScript fixtures)', type: :controller do it 'groups/edit.html' do get :edit, params: { id: group } diff --git a/spec/frontend/fixtures/issues.rb b/spec/frontend/fixtures/issues.rb index 2bea6abbbaf..a027247bd0d 100644 --- a/spec/frontend/fixtures/issues.rb +++ b/spec/frontend/fixtures/issues.rb @@ -5,7 +5,7 @@ require 'spec_helper' RSpec.describe Projects::IssuesController, '(JavaScript fixtures)', type: :controller do include JavaScriptFixturesHelpers - let(:admin) { create(:admin, feed_token: 'feedtoken:coldfeed') } + let(:user) { create(:user, feed_token: 'feedtoken:coldfeed') } let(:namespace) { create(:namespace, name: 'frontend-fixtures' )} let(:project) { create(:project_empty_repo, namespace: namespace, path: 'issues-project') } @@ -16,7 +16,8 @@ RSpec.describe Projects::IssuesController, '(JavaScript fixtures)', type: :contr end before do - sign_in(admin) + project.add_maintainer(user) + sign_in(user) end after do diff --git a/spec/frontend/fixtures/jobs.rb b/spec/frontend/fixtures/jobs.rb index afbde82f6e8..22179c790bd 100644 --- a/spec/frontend/fixtures/jobs.rb +++ b/spec/frontend/fixtures/jobs.rb @@ -5,9 +5,9 @@ require 'spec_helper' RSpec.describe Projects::JobsController, '(JavaScript fixtures)', type: :controller do include JavaScriptFixturesHelpers - let(:admin) { create(:admin) } let(:namespace) { create(:namespace, name: 'frontend-fixtures' )} let(:project) { create(:project, :repository, namespace: namespace, path: 'builds-project') } + let(:user) { project.owner } let(:pipeline) { create(:ci_empty_pipeline, project: project, sha: project.commit.id) } let!(:build_with_artifacts) { create(:ci_build, :success, :artifacts, :trace_artifact, pipeline: pipeline, stage: 'test', artifacts_expire_at: Time.now + 18.months) } let!(:failed_build) { create(:ci_build, :failed, pipeline: pipeline, stage: 'build') } @@ -26,7 +26,7 @@ RSpec.describe Projects::JobsController, '(JavaScript fixtures)', type: :control end before do - sign_in(admin) + sign_in(user) end after do diff --git a/spec/frontend/fixtures/labels.rb b/spec/frontend/fixtures/labels.rb index 5623fd16f7b..d7ca2aff18c 100644 --- a/spec/frontend/fixtures/labels.rb +++ b/spec/frontend/fixtures/labels.rb @@ -5,7 +5,7 @@ require 'spec_helper' RSpec.describe 'Labels (JavaScript fixtures)' do include JavaScriptFixturesHelpers - let(:admin) { create(:admin) } + let(:user) { create(:user) } let(:group) { create(:group, name: 'frontend-fixtures-group' )} let(:project) { create(:project_empty_repo, namespace: group, path: 'labels-project') } @@ -29,8 +29,6 @@ RSpec.describe 'Labels (JavaScript fixtures)' do include JavaScriptFixturesHelpers include ApiHelpers - let(:user) { create(:user) } - before do group.add_owner(user) end @@ -46,7 +44,8 @@ RSpec.describe 'Labels (JavaScript fixtures)' do render_views before do - sign_in(admin) + group.add_owner(user) + sign_in(user) end it 'labels/project_labels.json' do diff --git a/spec/frontend/fixtures/merge_requests.rb b/spec/frontend/fixtures/merge_requests.rb index d2daa66f033..acce3891ada 100644 --- a/spec/frontend/fixtures/merge_requests.rb +++ b/spec/frontend/fixtures/merge_requests.rb @@ -5,9 +5,9 @@ require 'spec_helper' RSpec.describe Projects::MergeRequestsController, '(JavaScript fixtures)', type: :controller do include JavaScriptFixturesHelpers - let(:admin) { create(:admin) } let(:namespace) { create(:namespace, name: 'frontend-fixtures' )} let(:project) { create(:project, :repository, namespace: namespace, path: 'merge-requests-project') } + let(:user) { project.owner } # rubocop: disable Layout/TrailingWhitespace let(:description) do @@ -55,7 +55,7 @@ RSpec.describe Projects::MergeRequestsController, '(JavaScript fixtures)', type: end before do - sign_in(admin) + sign_in(user) allow(Discussion).to receive(:build_discussion_id).and_return(['discussionid:ceterumcenseo']) end @@ -64,7 +64,7 @@ RSpec.describe Projects::MergeRequestsController, '(JavaScript fixtures)', type: end it 'merge_requests/merge_request_of_current_user.html' do - merge_request.update(author: admin) + merge_request.update(author: user) render_merge_request(merge_request) end @@ -76,19 +76,19 @@ RSpec.describe Projects::MergeRequestsController, '(JavaScript fixtures)', type: end it 'merge_requests/diff_comment.html' do - create(:diff_note_on_merge_request, project: project, author: admin, position: position, noteable: merge_request) - create(:note_on_merge_request, author: admin, project: project, noteable: merge_request) + create(:diff_note_on_merge_request, project: project, author: user, position: position, noteable: merge_request) + create(:note_on_merge_request, author: user, project: project, noteable: merge_request) render_merge_request(merge_request) end it 'merge_requests/diff_discussion.json' do - create(:diff_note_on_merge_request, project: project, author: admin, position: position, noteable: merge_request) + create(:diff_note_on_merge_request, project: project, author: user, position: position, noteable: merge_request) render_discussions_json(merge_request) end it 'merge_requests/resolved_diff_discussion.json' do - note = create(:discussion_note_on_merge_request, :resolved, project: project, author: admin, position: position, noteable: merge_request) - create(:system_note, project: project, author: admin, noteable: merge_request, discussion_id: note.discussion.id) + note = create(:discussion_note_on_merge_request, :resolved, project: project, author: user, position: position, noteable: merge_request) + create(:system_note, project: project, author: user, noteable: merge_request, discussion_id: note.discussion.id) render_discussions_json(merge_request) end @@ -111,7 +111,7 @@ RSpec.describe Projects::MergeRequestsController, '(JavaScript fixtures)', type: context 'with mentions' do let(:group) { create(:group) } - let(:description) { "@#{group.full_path} @all @#{admin.username}" } + let(:description) { "@#{group.full_path} @all @#{user.username}" } it 'merge_requests/merge_request_with_mentions.html' do render_merge_request(merge_request) diff --git a/spec/frontend/fixtures/merge_requests_diffs.rb b/spec/frontend/fixtures/merge_requests_diffs.rb index 217456a97fb..6e07ef679f5 100644 --- a/spec/frontend/fixtures/merge_requests_diffs.rb +++ b/spec/frontend/fixtures/merge_requests_diffs.rb @@ -5,9 +5,9 @@ require 'spec_helper' RSpec.describe Projects::MergeRequests::DiffsController, '(JavaScript fixtures)', type: :controller do include JavaScriptFixturesHelpers - let(:admin) { create(:admin) } let(:namespace) { create(:namespace, name: 'frontend-fixtures' )} let(:project) { create(:project, :repository, namespace: namespace, path: 'merge-requests-project') } + let(:user) { project.owner } let(:merge_request) { create(:merge_request, :with_diffs, source_project: project, target_project: project, description: '- [ ] Task List Item') } let(:path) { "files/ruby/popen.rb" } let(:position) do @@ -25,7 +25,7 @@ RSpec.describe Projects::MergeRequests::DiffsController, '(JavaScript fixtures)' end before do - sign_in(admin) + sign_in(user) end after do diff --git a/spec/frontend/fixtures/pipeline_schedules.rb b/spec/frontend/fixtures/pipeline_schedules.rb index e47bb25ec0a..a7d43fdbe62 100644 --- a/spec/frontend/fixtures/pipeline_schedules.rb +++ b/spec/frontend/fixtures/pipeline_schedules.rb @@ -5,11 +5,11 @@ require 'spec_helper' RSpec.describe Projects::PipelineSchedulesController, '(JavaScript fixtures)', type: :controller do include JavaScriptFixturesHelpers - let(:admin) { create(:admin) } let(:namespace) { create(:namespace, name: 'frontend-fixtures' )} let(:project) { create(:project, :public, :repository) } - let!(:pipeline_schedule) { create(:ci_pipeline_schedule, project: project, owner: admin) } - let!(:pipeline_schedule_populated) { create(:ci_pipeline_schedule, project: project, owner: admin) } + let(:user) { project.owner } + let!(:pipeline_schedule) { create(:ci_pipeline_schedule, project: project, owner: user) } + let!(:pipeline_schedule_populated) { create(:ci_pipeline_schedule, project: project, owner: user) } let!(:pipeline_schedule_variable1) { create(:ci_pipeline_schedule_variable, key: 'foo', value: 'foovalue', pipeline_schedule: pipeline_schedule_populated) } let!(:pipeline_schedule_variable2) { create(:ci_pipeline_schedule_variable, key: 'bar', value: 'barvalue', pipeline_schedule: pipeline_schedule_populated) } @@ -20,7 +20,7 @@ RSpec.describe Projects::PipelineSchedulesController, '(JavaScript fixtures)', t end before do - sign_in(admin) + sign_in(user) end it 'pipeline_schedules/edit.html' do diff --git a/spec/frontend/fixtures/pipelines.rb b/spec/frontend/fixtures/pipelines.rb index 93e2c19fc27..4270e38afcb 100644 --- a/spec/frontend/fixtures/pipelines.rb +++ b/spec/frontend/fixtures/pipelines.rb @@ -5,7 +5,6 @@ require 'spec_helper' RSpec.describe Projects::PipelinesController, '(JavaScript fixtures)', type: :controller do include JavaScriptFixturesHelpers - let(:admin) { create(:admin) } let(:namespace) { create(:namespace, name: 'frontend-fixtures' )} let(:project) { create(:project, :repository, namespace: namespace, path: 'pipelines-project') } let(:commit) { create(:commit, project: project) } @@ -22,7 +21,7 @@ RSpec.describe Projects::PipelinesController, '(JavaScript fixtures)', type: :co end before do - sign_in(admin) + sign_in(user) end it 'pipelines/pipelines.json' do diff --git a/spec/frontend/fixtures/projects.rb b/spec/frontend/fixtures/projects.rb index 0b7755d4021..aa2f7dbed36 100644 --- a/spec/frontend/fixtures/projects.rb +++ b/spec/frontend/fixtures/projects.rb @@ -7,11 +7,11 @@ RSpec.describe 'Projects (JavaScript fixtures)', type: :controller do runners_token = 'runnerstoken:intabulasreferre' - let(:admin) { create(:admin) } let(:namespace) { create(:namespace, name: 'frontend-fixtures' )} let(:project) { create(:project, namespace: namespace, path: 'builds-project', runners_token: runners_token) } let(:project_with_repo) { create(:project, :repository, description: 'Code and stuff') } let(:project_variable_populated) { create(:project, namespace: namespace, path: 'builds-project2', runners_token: runners_token) } + let(:user) { project.owner } render_views @@ -20,8 +20,8 @@ RSpec.describe 'Projects (JavaScript fixtures)', type: :controller do end before do - project.add_maintainer(admin) - sign_in(admin) + project_with_repo.add_maintainer(user) + sign_in(user) allow(SecureRandom).to receive(:hex).and_return('securerandomhex:thereisnospoon') end diff --git a/spec/frontend/fixtures/prometheus_service.rb b/spec/frontend/fixtures/prometheus_service.rb index 8c923d91d08..3a59ecf3868 100644 --- a/spec/frontend/fixtures/prometheus_service.rb +++ b/spec/frontend/fixtures/prometheus_service.rb @@ -5,10 +5,10 @@ require 'spec_helper' RSpec.describe Projects::ServicesController, '(JavaScript fixtures)', type: :controller do include JavaScriptFixturesHelpers - let(:admin) { create(:admin) } let(:namespace) { create(:namespace, name: 'frontend-fixtures' )} let(:project) { create(:project_empty_repo, namespace: namespace, path: 'services-project') } let!(:service) { create(:prometheus_service, project: project) } + let(:user) { project.owner } render_views @@ -17,7 +17,7 @@ RSpec.describe Projects::ServicesController, '(JavaScript fixtures)', type: :con end before do - sign_in(admin) + sign_in(user) end after do diff --git a/spec/frontend/fixtures/search.rb b/spec/frontend/fixtures/search.rb index f43ed2cfbd3..264ce7d010c 100644 --- a/spec/frontend/fixtures/search.rb +++ b/spec/frontend/fixtures/search.rb @@ -7,7 +7,7 @@ RSpec.describe SearchController, '(JavaScript fixtures)', type: :controller do render_views - let_it_be(:user) { create(:admin) } + let_it_be(:user) { create(:user) } before(:all) do clean_frontend_fixtures('search/') @@ -66,6 +66,10 @@ RSpec.describe SearchController, '(JavaScript fixtures)', type: :controller do offset: 0) end + before do + project.add_developer(user) + end + it 'search/blob_search_result.html' do allow_next_instance_of(SearchServicePresenter) do |search_service| allow(search_service).to receive(:search_objects).and_return(blobs) diff --git a/spec/frontend/fixtures/services.rb b/spec/frontend/fixtures/services.rb index 43230301296..7472af802f3 100644 --- a/spec/frontend/fixtures/services.rb +++ b/spec/frontend/fixtures/services.rb @@ -5,10 +5,10 @@ require 'spec_helper' RSpec.describe Projects::ServicesController, '(JavaScript fixtures)', type: :controller do include JavaScriptFixturesHelpers - let(:admin) { create(:admin) } let(:namespace) { create(:namespace, name: 'frontend-fixtures' )} let(:project) { create(:project_empty_repo, namespace: namespace, path: 'services-project') } let!(:service) { create(:custom_issue_tracker_service, project: project) } + let(:user) { project.owner } render_views @@ -17,7 +17,7 @@ RSpec.describe Projects::ServicesController, '(JavaScript fixtures)', type: :con end before do - sign_in(admin) + sign_in(user) end after do diff --git a/spec/frontend/fixtures/snippet.rb b/spec/frontend/fixtures/snippet.rb index 2e67a2ecfe3..5211d52f374 100644 --- a/spec/frontend/fixtures/snippet.rb +++ b/spec/frontend/fixtures/snippet.rb @@ -5,10 +5,10 @@ require 'spec_helper' RSpec.describe SnippetsController, '(JavaScript fixtures)', type: :controller do include JavaScriptFixturesHelpers - let(:admin) { create(:admin) } let(:namespace) { create(:namespace, name: 'frontend-fixtures' )} let(:project) { create(:project, :repository, namespace: namespace, path: 'branches-project') } - let(:snippet) { create(:personal_snippet, :public, title: 'snippet.md', content: '# snippet', file_name: 'snippet.md', author: admin) } + let(:user) { project.owner } + let(:snippet) { create(:personal_snippet, :public, title: 'snippet.md', content: '# snippet', file_name: 'snippet.md', author: user) } render_views @@ -17,7 +17,7 @@ RSpec.describe SnippetsController, '(JavaScript fixtures)', type: :controller do end before do - sign_in(admin) + sign_in(user) allow(Discussion).to receive(:build_discussion_id).and_return(['discussionid:ceterumcenseo']) end @@ -26,7 +26,7 @@ RSpec.describe SnippetsController, '(JavaScript fixtures)', type: :controller do end it 'snippets/show.html' do - create(:discussion_note_on_project_snippet, noteable: snippet, project: project, author: admin, note: '- [ ] Task List Item') + create(:discussion_note_on_project_snippet, noteable: snippet, project: project, author: user, note: '- [ ] Task List Item') get(:show, params: { id: snippet.to_param }) diff --git a/spec/frontend/fixtures/tags.rb b/spec/frontend/fixtures/tags.rb index b2a5429fac8..9483f0a4492 100644 --- a/spec/frontend/fixtures/tags.rb +++ b/spec/frontend/fixtures/tags.rb @@ -5,8 +5,8 @@ require 'spec_helper' RSpec.describe 'Tags (JavaScript fixtures)' do include JavaScriptFixturesHelpers - let_it_be(:admin) { create(:admin) } let_it_be(:project) { create(:project, :repository, path: 'tags-project') } + let_it_be(:user) { project.owner } before(:all) do clean_frontend_fixtures('api/tags/') @@ -20,7 +20,7 @@ RSpec.describe 'Tags (JavaScript fixtures)' do include ApiHelpers it 'api/tags/tags.json' do - get api("/projects/#{project.id}/repository/tags", admin) + get api("/projects/#{project.id}/repository/tags", user) expect(response).to be_successful end diff --git a/spec/frontend/fixtures/todos.rb b/spec/frontend/fixtures/todos.rb index 399be272e9b..985afafe50e 100644 --- a/spec/frontend/fixtures/todos.rb +++ b/spec/frontend/fixtures/todos.rb @@ -5,13 +5,13 @@ require 'spec_helper' RSpec.describe 'Todos (JavaScript fixtures)' do include JavaScriptFixturesHelpers - let(:admin) { create(:admin) } let(:namespace) { create(:namespace, name: 'frontend-fixtures' )} let(:project) { create(:project_empty_repo, namespace: namespace, path: 'todos-project') } + let(:user) { project.owner } let(:issue_1) { create(:issue, title: 'issue_1', project: project) } - let!(:todo_1) { create(:todo, user: admin, project: project, target: issue_1, created_at: 5.hours.ago) } + let!(:todo_1) { create(:todo, user: user, project: project, target: issue_1, created_at: 5.hours.ago) } let(:issue_2) { create(:issue, title: 'issue_2', project: project) } - let!(:todo_2) { create(:todo, :done, user: admin, project: project, target: issue_2, created_at: 50.hours.ago) } + let!(:todo_2) { create(:todo, :done, user: user, project: project, target: issue_2, created_at: 50.hours.ago) } before(:all) do clean_frontend_fixtures('todos/') @@ -25,7 +25,7 @@ RSpec.describe 'Todos (JavaScript fixtures)' do render_views before do - sign_in(admin) + sign_in(user) end it 'todos/todos.html' do @@ -39,7 +39,7 @@ RSpec.describe 'Todos (JavaScript fixtures)' do render_views before do - sign_in(admin) + sign_in(user) end it 'todos/todos.json' do diff --git a/spec/helpers/nav_helper_spec.rb b/spec/helpers/nav_helper_spec.rb index b1c9485e5a1..c4795a814ba 100644 --- a/spec/helpers/nav_helper_spec.rb +++ b/spec/helpers/nav_helper_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe NavHelper, :do_not_mock_admin_mode do +RSpec.describe NavHelper do describe '#header_links' do include_context 'custom session' diff --git a/spec/requests/api/api_guard/admin_mode_middleware_spec.rb b/spec/requests/api/api_guard/admin_mode_middleware_spec.rb index 4b477f829a7..63bcec4b52a 100644 --- a/spec/requests/api/api_guard/admin_mode_middleware_spec.rb +++ b/spec/requests/api/api_guard/admin_mode_middleware_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe API::APIGuard::AdminModeMiddleware, :do_not_mock_admin_mode, :request_store do +RSpec.describe API::APIGuard::AdminModeMiddleware, :request_store do let(:user) { create(:admin) } it 'is loaded' do diff --git a/spec/requests/api/graphql/group_query_spec.rb b/spec/requests/api/graphql/group_query_spec.rb index 83180c7d7a5..391bae4cfcf 100644 --- a/spec/requests/api/graphql/group_query_spec.rb +++ b/spec/requests/api/graphql/group_query_spec.rb @@ -4,7 +4,7 @@ require 'spec_helper' # Based on spec/requests/api/groups_spec.rb # Should follow closely in order to ensure all situations are covered -RSpec.describe 'getting group information', :do_not_mock_admin_mode do +RSpec.describe 'getting group information' do include GraphqlHelpers include UploadHelpers diff --git a/spec/requests/api/graphql/mutations/snippets/mark_as_spam_spec.rb b/spec/requests/api/graphql/mutations/snippets/mark_as_spam_spec.rb index 97e6ae8fda8..199a8ee09a2 100644 --- a/spec/requests/api/graphql/mutations/snippets/mark_as_spam_spec.rb +++ b/spec/requests/api/graphql/mutations/snippets/mark_as_spam_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe 'Mark snippet as spam', :do_not_mock_admin_mode do +RSpec.describe 'Mark snippet as spam' do include GraphqlHelpers let_it_be(:admin) { create(:admin) } diff --git a/spec/requests/api/users_spec.rb b/spec/requests/api/users_spec.rb index 381e0b03589..2cd1483f486 100644 --- a/spec/requests/api/users_spec.rb +++ b/spec/requests/api/users_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe API::Users, :do_not_mock_admin_mode do +RSpec.describe API::Users do let_it_be(:admin) { create(:admin) } let_it_be(:user, reload: true) { create(:user, username: 'user.with.dot') } let_it_be(:key) { create(:key, user: user) } diff --git a/spec/requests/git_http_spec.rb b/spec/requests/git_http_spec.rb index dc735e3714d..479edf5e873 100644 --- a/spec/requests/git_http_spec.rb +++ b/spec/requests/git_http_spec.rb @@ -795,12 +795,24 @@ RSpec.describe 'Git HTTP requests' do context 'administrator' do let(:user) { create(:admin) } - it_behaves_like 'can download code only' + context 'when admin mode is enabled', :enable_admin_mode do + it_behaves_like 'can download code only' - it 'downloads from other project get status 403' do - clone_get "#{other_project.full_path}.git", user: 'gitlab-ci-token', password: build.token + it 'downloads from other project get status 403' do + clone_get "#{other_project.full_path}.git", user: 'gitlab-ci-token', password: build.token - expect(response).to have_gitlab_http_status(:forbidden) + expect(response).to have_gitlab_http_status(:forbidden) + end + end + + context 'when admin mode is disabled' do + it_behaves_like 'can download code only' + + it 'downloads from other project get status 404' do + clone_get "#{other_project.full_path}.git", user: 'gitlab-ci-token', password: build.token + + expect(response).to have_gitlab_http_status(:not_found) + end end end diff --git a/spec/requests/lfs_http_spec.rb b/spec/requests/lfs_http_spec.rb index 36bad1a66cb..1867a3a7592 100644 --- a/spec/requests/lfs_http_spec.rb +++ b/spec/requests/lfs_http_spec.rb @@ -195,7 +195,7 @@ RSpec.describe 'Git LFS API and storage' do end end - context 'administrator' do + context 'administrator', :enable_admin_mode do let(:user) { create(:admin) } let(:build) { create(:ci_build, :running, pipeline: pipeline, user: user) } @@ -453,7 +453,7 @@ RSpec.describe 'Git LFS API and storage' do end end - context 'administrator' do + context 'administrator', :enable_admin_mode do let(:user) { create(:admin) } let(:build) { create(:ci_build, :running, pipeline: pipeline, user: user) } diff --git a/spec/requests/self_monitoring_project_spec.rb b/spec/requests/self_monitoring_project_spec.rb index 5844a27da17..f7227f71b05 100644 --- a/spec/requests/self_monitoring_project_spec.rb +++ b/spec/requests/self_monitoring_project_spec.rb @@ -12,7 +12,7 @@ RSpec.describe 'Self-Monitoring project requests' do it_behaves_like 'not accessible to non-admin users' - context 'with admin user' do + context 'with admin user', :enable_admin_mode do before do login_as(admin) end @@ -36,7 +36,7 @@ RSpec.describe 'Self-Monitoring project requests' do it_behaves_like 'not accessible to non-admin users' - context 'with admin user' do + context 'with admin user', :enable_admin_mode do before do login_as(admin) end @@ -116,7 +116,7 @@ RSpec.describe 'Self-Monitoring project requests' do it_behaves_like 'not accessible to non-admin users' - context 'with admin user' do + context 'with admin user', :enable_admin_mode do before do login_as(admin) end @@ -140,7 +140,7 @@ RSpec.describe 'Self-Monitoring project requests' do it_behaves_like 'not accessible to non-admin users' - context 'with admin user' do + context 'with admin user', :enable_admin_mode do before do login_as(admin) end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 688deb78020..698d1e06fc3 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -286,19 +286,13 @@ RSpec.configure do |config| ./ee/spec/elastic_integration ./ee/spec/finders ./ee/spec/lib - ./ee/spec/requests/admin ./ee/spec/serializers ./ee/spec/support/shared_examples/finders/geo ./ee/spec/support/shared_examples/graphql/geo ./spec/finders - ./spec/frontend - ./spec/helpers ./spec/lib - ./spec/requests ./spec/serializers - ./spec/support/shared_examples/requests ./spec/support/shared_examples/lib/gitlab - ./spec/views ./spec/workers ) diff --git a/spec/support/shared_examples/requests/self_monitoring_shared_examples.rb b/spec/support/shared_examples/requests/self_monitoring_shared_examples.rb index db11b1fe07d..ff87fc5d8df 100644 --- a/spec/support/shared_examples/requests/self_monitoring_shared_examples.rb +++ b/spec/support/shared_examples/requests/self_monitoring_shared_examples.rb @@ -20,6 +20,18 @@ RSpec.shared_examples 'not accessible to non-admin users' do expect(response).to have_gitlab_http_status(:not_found) end end + + context 'with authenticated admin user without admin mode' do + before do + login_as(create(:admin)) + end + + it 'redirects to enable admin mode' do + subject + + expect(response).to redirect_to(new_admin_session_path) + end + end end # Requires subject and worker_class and status_api to be defined diff --git a/spec/views/projects/artifacts/_artifact.html.haml_spec.rb b/spec/views/projects/artifacts/_artifact.html.haml_spec.rb index b3bf54e143a..5d930d6b0f2 100644 --- a/spec/views/projects/artifacts/_artifact.html.haml_spec.rb +++ b/spec/views/projects/artifacts/_artifact.html.haml_spec.rb @@ -16,10 +16,21 @@ RSpec.describe "projects/artifacts/_artifact.html.haml" do context 'with admin' do let(:user) { build(:admin) } - it 'has a delete button' do - render_partial + context 'when admin mode is enabled', :enable_admin_mode do + it 'has a delete button' do + render_partial - expect(rendered).to have_link('Delete artifacts', href: project_artifact_path(project, project.job_artifacts.first)) + expect(rendered).to have_link('Delete artifacts', href: project_artifact_path(project, project.job_artifacts.first)) + end + end + + context 'when admin mode is disabled' do + it 'has no delete button' do + project.add_reporter(user) + render_partial + + expect(rendered).not_to have_link('Delete artifacts') + end end end diff --git a/spec/views/search/_results.html.haml_spec.rb b/spec/views/search/_results.html.haml_spec.rb index c1c31084677..8960d096143 100644 --- a/spec/views/search/_results.html.haml_spec.rb +++ b/spec/views/search/_results.html.haml_spec.rb @@ -54,11 +54,22 @@ RSpec.describe 'search/_results' do let(:scope) { search_scope } let(:search_objects) { Gitlab::ProjectSearchResults.new(user, '*', project: project).objects(scope) } - it 'renders the click text event tracking attributes' do - render + context 'when admin mode is enabled', :enable_admin_mode do + it 'renders the click text event tracking attributes' do + render - expect(rendered).to have_selector('[data-track-event=click_text]') - expect(rendered).to have_selector('[data-track-property=search_result]') + expect(rendered).to have_selector('[data-track-event=click_text]') + expect(rendered).to have_selector('[data-track-property=search_result]') + end + end + + context 'when admin mode is disabled' do + it 'does not render the click text event tracking attributes' do + render + + expect(rendered).not_to have_selector('[data-track-event=click_text]') + expect(rendered).not_to have_selector('[data-track-property=search_result]') + end end it 'does render the sidebar' do @@ -74,11 +85,22 @@ RSpec.describe 'search/_results' do let(:scope) { search_scope } let(:search_objects) { Gitlab::ProjectSearchResults.new(user, '*', project: project).objects(scope) } - it 'renders the click text event tracking attributes' do - render + context 'when admin mode is enabled', :enable_admin_mode do + it 'renders the click text event tracking attributes' do + render - expect(rendered).to have_selector('[data-track-event=click_text]') - expect(rendered).to have_selector('[data-track-property=search_result]') + expect(rendered).to have_selector('[data-track-event=click_text]') + expect(rendered).to have_selector('[data-track-property=search_result]') + end + end + + context 'when admin mode is disabled' do + it 'does not render the click text event tracking attributes' do + render + + expect(rendered).not_to have_selector('[data-track-event=click_text]') + expect(rendered).not_to have_selector('[data-track-property=search_result]') + end end it 'does not render the sidebar' do diff --git a/yarn.lock b/yarn.lock index 5585e2d259a..3075f876a7f 100644 --- a/yarn.lock +++ b/yarn.lock @@ -866,10 +866,10 @@ resolved "https://registry.yarnpkg.com/@gitlab/svgs/-/svgs-1.176.0.tgz#3b6d415704ed36db87146cfa361f3f9e2c01f535" integrity sha512-cl3SlGmLF/bnPAxrg52eRQOxRSrU54AB3yfV9TLi2iNAg/Jws0nuvdVZ4LRKKyyzHmT6yfVusCIGCISzvON6ew== -"@gitlab/ui@24.4.0": - version "24.4.0" - resolved "https://registry.yarnpkg.com/@gitlab/ui/-/ui-24.4.0.tgz#5c66c0582a4818edf596757dd56f6606f32a3604" - integrity sha512-M96BZBEv7t+Q9V7B0obCJJsew3rDJ+2xGcJZUrVVyBpwz2PUqFsSk86+SxUFDxuTlcQ3ox0O2Y1aCKGG8vZlyA== +"@gitlab/ui@24.5.0": + version "24.5.0" + resolved "https://registry.yarnpkg.com/@gitlab/ui/-/ui-24.5.0.tgz#68620005e65e8e170720d8baff60322e24b73aef" + integrity sha512-TqK/Pxmh8ps7KiSSSe+KXncNw2I9US9+cVJNu3IsZCyrqiWqaAVPcxhjAZQt31nZdk+XJek7pXJgHfit9vunlg== dependencies: "@babel/standalone" "^7.0.0" "@gitlab/vue-toasted" "^1.3.0"