diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-04-27 09:09:45 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-04-27 09:09:45 +0300 |
commit | f3197dab7ff4b138d756290e9edcc4d829a6eb6e (patch) | |
tree | b8a3134b9d2536381796fa26f4ab02fdb1ed9b91 | |
parent | 427879bb37f843a577b07eb9fb2c83537f8c3c4b (diff) |
Add latest changes from gitlab-org/gitlab@master
35 files changed, 129 insertions, 83 deletions
diff --git a/GITALY_SERVER_VERSION b/GITALY_SERVER_VERSION index f3537e0d902..db3af7c4d19 100644 --- a/GITALY_SERVER_VERSION +++ b/GITALY_SERVER_VERSION @@ -1 +1 @@ -08494e5d342f06281463abd6c2f688499ff77b7a +6e72a649c1b92f962ba8c82bec29ffe4f91ff957 diff --git a/app/assets/javascripts/boards/components/board_content.vue b/app/assets/javascripts/boards/components/board_content.vue index a4b1e6adacf..b8a38d833ad 100644 --- a/app/assets/javascripts/boards/components/board_content.vue +++ b/app/assets/javascripts/boards/components/board_content.vue @@ -4,7 +4,6 @@ import { sortBy } from 'lodash'; import Draggable from 'vuedraggable'; import { mapState, mapGetters, mapActions } from 'vuex'; import BoardAddNewColumn from 'ee_else_ce/boards/components/board_add_new_column.vue'; -import { sortableEnd, sortableStart } from '~/boards/mixins/sortable_default_options'; import defaultSortableConfig from '~/sortable/sortable_config'; import glFeatureFlagMixin from '~/vue_shared/mixins/gl_feature_flags_mixin'; import BoardColumn from './board_column.vue'; @@ -48,7 +47,7 @@ export default { : this.lists; }, canDragColumns() { - return !this.isEpicBoard && this.glFeatures.graphqlBoardLists && this.canAdminList; + return (this.isEpicBoard || this.glFeatures.graphqlBoardLists) && this.canAdminList; }, boardColumnWrapper() { return this.canDragColumns ? Draggable : 'div'; @@ -73,14 +72,7 @@ export default { const el = this.canDragColumns ? this.$refs.list.$el : this.$refs.list; el.scrollTo({ left: el.scrollWidth, behavior: 'smooth' }); }, - handleDragOnStart() { - sortableStart(); - }, - handleDragOnEnd(params) { - sortableEnd(); - if (this.isEpicBoard) return; - const { item, newIndex, oldIndex, to } = params; const listId = item.dataset.id; @@ -108,7 +100,6 @@ export default { ref="list" v-bind="draggableOptions" class="boards-list gl-w-full gl-py-5 gl-px-3 gl-white-space-nowrap" - @start="handleDragOnStart" @end="handleDragOnEnd" > <board-column diff --git a/app/assets/javascripts/boards/components/board_list_header.vue b/app/assets/javascripts/boards/components/board_list_header.vue index ca66ad6934a..aa574222fef 100644 --- a/app/assets/javascripts/boards/components/board_list_header.vue +++ b/app/assets/javascripts/boards/components/board_list_header.vue @@ -84,7 +84,7 @@ export default { return this.list?.label?.description || this.list?.assignee?.name || this.list.title || ''; }, showListHeaderButton() { - return !this.disabled && this.listType !== ListType.closed; + return !this.disabled && this.listType !== ListType.closed && !this.isEpicBoard; }, showMilestoneListDetails() { return this.listType === ListType.milestone && this.list.milestone && this.showListDetails; @@ -161,7 +161,7 @@ export default { const collapsed = !this.list.collapsed; this.toggleListCollapsed({ listId: this.list.id, collapsed }); - if (!this.isLoggedIn || this.isEpicBoard) { + if (!this.isLoggedIn) { this.addToLocalStorage(); } else { this.updateListFunction(); diff --git a/app/assets/javascripts/boards/constants.js b/app/assets/javascripts/boards/constants.js index df5376cb2be..f6703376a9a 100644 --- a/app/assets/javascripts/boards/constants.js +++ b/app/assets/javascripts/boards/constants.js @@ -2,6 +2,7 @@ import { __ } from '~/locale'; import updateEpicSubscriptionMutation from '~/sidebar/queries/update_epic_subscription.mutation.graphql'; import updateEpicTitleMutation from '~/sidebar/queries/update_epic_title.mutation.graphql'; import boardBlockingIssuesQuery from './graphql/board_blocking_issues.query.graphql'; +import updateBoardListMutation from './graphql/board_list_update.mutation.graphql'; import issueSetSubscriptionMutation from './graphql/issue_set_subscription.mutation.graphql'; import issueSetTitleMutation from './graphql/issue_set_title.mutation.graphql'; @@ -71,6 +72,12 @@ export const blockingIssuablesQueries = { }, }; +export const updateListQueries = { + [issuableTypes.issue]: { + mutation: updateBoardListMutation, + }, +}; + export const titleQueries = { [issuableTypes.issue]: { mutation: issueSetTitleMutation, diff --git a/app/assets/javascripts/boards/stores/actions.js b/app/assets/javascripts/boards/stores/actions.js index 4c9dee41e01..fa4e121001d 100644 --- a/app/assets/javascripts/boards/stores/actions.js +++ b/app/assets/javascripts/boards/stores/actions.js @@ -1,4 +1,5 @@ import * as Sentry from '@sentry/browser'; +import { updateListQueries } from 'ee_else_ce/boards/constants'; import createBoardListMutation from 'ee_else_ce/boards/graphql/board_list_create.mutation.graphql'; import boardListsQuery from 'ee_else_ce/boards/graphql/board_lists.query.graphql'; import issueMoveListMutation from 'ee_else_ce/boards/graphql/issue_move_list.mutation.graphql'; @@ -31,7 +32,6 @@ import { } from '../boards_util'; import boardLabelsQuery from '../graphql/board_labels.query.graphql'; import destroyBoardListMutation from '../graphql/board_list_destroy.mutation.graphql'; -import updateBoardListMutation from '../graphql/board_list_update.mutation.graphql'; import groupProjectsQuery from '../graphql/group_projects.query.graphql'; import issueCreateMutation from '../graphql/issue_create.mutation.graphql'; import issueSetDueDateMutation from '../graphql/issue_set_due_date.mutation.graphql'; @@ -238,10 +238,13 @@ export default { dispatch('updateList', { listId, position: newPosition, backupList }); }, - updateList: ({ commit }, { listId, position, collapsed, backupList }) => { + updateList: ( + { commit, state: { issuableType } }, + { listId, position, collapsed, backupList }, + ) => { gqlClient .mutate({ - mutation: updateBoardListMutation, + mutation: updateListQueries[issuableType].mutation, variables: { listId, position, diff --git a/app/assets/javascripts/notes/stores/actions.js b/app/assets/javascripts/notes/stores/actions.js index 3d918a8150b..bdb85360be8 100644 --- a/app/assets/javascripts/notes/stores/actions.js +++ b/app/assets/javascripts/notes/stores/actions.js @@ -345,7 +345,7 @@ export const saveNote = ({ commit, dispatch }, noteData) => { // this is a temporary solution until we have confidentiality real-time updates if ( confidentialWidget.setConfidentiality && - message.some((m) => m.includes('confidential')) + message.some((m) => m.includes('Made this issue confidential')) ) { confidentialWidget.setConfidentiality(); } diff --git a/app/graphql/mutations/commits/create.rb b/app/graphql/mutations/commits/create.rb index 84933fee5d2..2e06e1ea0c4 100644 --- a/app/graphql/mutations/commits/create.rb +++ b/app/graphql/mutations/commits/create.rb @@ -5,6 +5,11 @@ module Mutations class Create < BaseMutation include FindsProject + class UrlHelpers + include GitlabRoutingHelper + include Gitlab::Routing + end + graphql_name 'CommitCreate' argument :project_path, GraphQL::ID_TYPE, @@ -29,6 +34,11 @@ module Mutations required: true, description: 'Array of action hashes to commit as a batch.' + field :commit_pipeline_path, + GraphQL::STRING_TYPE, + null: true, + description: "ETag path for the commit's pipeline." + field :commit, Types::CommitType, null: true, @@ -50,6 +60,7 @@ module Mutations { commit: (project.repository.commit(result[:result]) if result[:status] == :success), + commit_pipeline_path: UrlHelpers.new.graphql_etag_pipeline_sha_path(result[:result]), errors: Array.wrap(result[:message]) } end diff --git a/app/graphql/types/alert_management/status_enum.rb b/app/graphql/types/alert_management/status_enum.rb index 9d2c7316254..417ed434685 100644 --- a/app/graphql/types/alert_management/status_enum.rb +++ b/app/graphql/types/alert_management/status_enum.rb @@ -7,7 +7,7 @@ module Types description 'Alert status values' ::AlertManagement::Alert.status_names.each do |status| - value status.to_s.upcase, value: status, description: "#{status.to_s.titleize} status" + value status.to_s.upcase, value: status, description: ::AlertManagement::Alert::STATUS_DESCRIPTIONS[status] end end end diff --git a/app/helpers/boards_helper.rb b/app/helpers/boards_helper.rb index 49963d14934..8815385546a 100644 --- a/app/helpers/boards_helper.rb +++ b/app/helpers/boards_helper.rb @@ -10,7 +10,7 @@ module BoardsHelper boards_endpoint: @boards_endpoint, lists_endpoint: board_lists_path(board), board_id: board.id, - disabled: (!can?(current_user, :create_non_backlog_issues, board)).to_s, + disabled: disabled?.to_s, root_path: root_path, full_path: full_path, bulk_update_path: @bulk_issues_path, @@ -101,6 +101,10 @@ module BoardsHelper can?(current_user, :admin_issue, current_board_parent) end + def disabled? + !can?(current_user, :create_non_backlog_issues, board) + end + def board_list_data include_descendant_groups = @group&.present? diff --git a/app/helpers/gitlab_routing_helper.rb b/app/helpers/gitlab_routing_helper.rb index 5f15686560d..36a565c221d 100644 --- a/app/helpers/gitlab_routing_helper.rb +++ b/app/helpers/gitlab_routing_helper.rb @@ -364,6 +364,10 @@ module GitlabRoutingHelper [api_graphql_path, "pipelines/id/#{pipeline.id}"].join(':') end + def graphql_etag_pipeline_sha_path(sha) + [api_graphql_path, "pipelines/sha/#{sha}"].join(':') + end + private def snippet_query_params(snippet, *args) diff --git a/app/helpers/search_helper.rb b/app/helpers/search_helper.rb index 2568917bafc..8a869bd7323 100644 --- a/app/helpers/search_helper.rb +++ b/app/helpers/search_helper.rb @@ -310,7 +310,7 @@ module SearchHelper link_to search_path(search_params) do concat label concat ' ' - concat content_tag(:span, count, class: ['badge badge-pill', badge_class], data: badge_data) + concat content_tag(:span, count, class: ['badge badge-pill gl-badge badge-muted sm', badge_class], data: badge_data) end end end diff --git a/app/models/alert_management/alert.rb b/app/models/alert_management/alert.rb index 7090d9f4ea1..6f090cefa23 100644 --- a/app/models/alert_management/alert.rb +++ b/app/models/alert_management/alert.rb @@ -22,6 +22,13 @@ module AlertManagement }.freeze private_constant :STATUSES + STATUS_DESCRIPTIONS = { + triggered: 'Investigation has not started', + acknowledged: 'Someone is actively investigating the problem', + resolved: 'No further work is required', + ignored: 'No action will be taken on the alert' + }.freeze + belongs_to :project belongs_to :issue, optional: true belongs_to :prometheus_alert, optional: true diff --git a/app/services/ci/expire_pipeline_cache_service.rb b/app/services/ci/expire_pipeline_cache_service.rb index 2ae60907dab..80c83818d0b 100644 --- a/app/services/ci/expire_pipeline_cache_service.rb +++ b/app/services/ci/expire_pipeline_cache_service.rb @@ -56,6 +56,10 @@ module Ci url_helpers.graphql_etag_pipeline_path(pipeline) end + def graphql_pipeline_sha_path(sha) + url_helpers.graphql_etag_pipeline_sha_path(sha) + end + # Updates ETag caches of a pipeline. # # This logic resides in a separate method so that EE can more easily extend @@ -76,6 +80,7 @@ module Ci pipeline.self_with_ancestors_and_descendants.each do |relative_pipeline| store.touch(project_pipeline_path(relative_pipeline.project, relative_pipeline)) store.touch(graphql_pipeline_path(relative_pipeline)) + store.touch(graphql_pipeline_sha_path(relative_pipeline.sha)) end end diff --git a/changelogs/unreleased/326008-add-codeowners-to-devops-adoption.yml b/changelogs/unreleased/326008-add-codeowners-to-devops-adoption.yml new file mode 100644 index 00000000000..145d9bd8412 --- /dev/null +++ b/changelogs/unreleased/326008-add-codeowners-to-devops-adoption.yml @@ -0,0 +1,5 @@ +--- +title: Add code owners metric to DevOps adoption page +merge_request: 59874 +author: +type: added diff --git a/changelogs/unreleased/dz-remove-ff-api_always_use_application_json.yml b/changelogs/unreleased/dz-remove-ff-api_always_use_application_json.yml new file mode 100644 index 00000000000..05edfbcee71 --- /dev/null +++ b/changelogs/unreleased/dz-remove-ff-api_always_use_application_json.yml @@ -0,0 +1,5 @@ +--- +title: Remove feature flag api_always_use_application_json +merge_request: 56777 +author: +type: removed diff --git a/changelogs/unreleased/gl-badge-deleted-projects.yml b/changelogs/unreleased/gl-badge-deleted-projects.yml new file mode 100644 index 00000000000..ab8a2b8a57f --- /dev/null +++ b/changelogs/unreleased/gl-badge-deleted-projects.yml @@ -0,0 +1,5 @@ +--- +title: Add gl-badge utility class for deleted projects tab +merge_request: 59590 +author: Yogi (@yo) +type: changed diff --git a/changelogs/unreleased/gl-badge-project-search.yml b/changelogs/unreleased/gl-badge-project-search.yml new file mode 100644 index 00000000000..433b925102f --- /dev/null +++ b/changelogs/unreleased/gl-badge-project-search.yml @@ -0,0 +1,5 @@ +--- +title: Add gl-badge for badges in project search page nav +merge_request: 57971 +author: Yogi (@yo) +type: changed diff --git a/changelogs/unreleased/lm-add-pl-sha-etag-cache.yml b/changelogs/unreleased/lm-add-pl-sha-etag-cache.yml new file mode 100644 index 00000000000..d54be2d6ccf --- /dev/null +++ b/changelogs/unreleased/lm-add-pl-sha-etag-cache.yml @@ -0,0 +1,5 @@ +--- +title: Add commmit_pipeline_path to CreateCommit mutation +merge_request: 58931 +author: +type: added diff --git a/config/feature_flags/development/api_always_use_application_json.yml b/config/feature_flags/development/api_always_use_application_json.yml deleted file mode 100644 index daa8b15c25f..00000000000 --- a/config/feature_flags/development/api_always_use_application_json.yml +++ /dev/null @@ -1,8 +0,0 @@ ---- -name: api_always_use_application_json -introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/42229 -rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/270067 -milestone: '13.6' -type: development -group: group::ecosystem -default_enabled: true diff --git a/db/migrate/20210421081724_add_codeowners_devops_adoption_snapshot.rb b/db/migrate/20210421081724_add_codeowners_devops_adoption_snapshot.rb new file mode 100644 index 00000000000..3d65abc5608 --- /dev/null +++ b/db/migrate/20210421081724_add_codeowners_devops_adoption_snapshot.rb @@ -0,0 +1,8 @@ +# frozen_string_literal: true + +class AddCodeownersDevopsAdoptionSnapshot < ActiveRecord::Migration[6.0] + def change + add_column :analytics_devops_adoption_snapshots, :total_projects_count, :integer + add_column :analytics_devops_adoption_snapshots, :code_owners_used_count, :integer + end +end diff --git a/db/schema_migrations/20210421081724 b/db/schema_migrations/20210421081724 new file mode 100644 index 00000000000..a246cfdd428 --- /dev/null +++ b/db/schema_migrations/20210421081724 @@ -0,0 +1 @@ +9049dc22e97261115ba935a059beb5b4f2eb810f1fdcc0881f96d4b6a501ab09
\ No newline at end of file diff --git a/db/structure.sql b/db/structure.sql index 877b1cbbf38..11f13865ebc 100644 --- a/db/structure.sql +++ b/db/structure.sql @@ -9084,7 +9084,9 @@ CREATE TABLE analytics_devops_adoption_snapshots ( pipeline_succeeded boolean NOT NULL, deploy_succeeded boolean NOT NULL, security_scan_succeeded boolean NOT NULL, - end_time timestamp with time zone NOT NULL + end_time timestamp with time zone NOT NULL, + total_projects_count integer, + code_owners_used_count integer ); CREATE SEQUENCE analytics_devops_adoption_snapshots_id_seq diff --git a/doc/api/README.md b/doc/api/README.md index db0256b096c..bb20bdb5155 100644 --- a/doc/api/README.md +++ b/doc/api/README.md @@ -777,7 +777,3 @@ some API endpoints also support `text/plain`. In [GitLab 13.10 and later](https://gitlab.com/gitlab-org/gitlab/-/issues/250342), API endpoints do not support `text/plain` by default, unless it's explicitly documented. - -This change is deployed behind the `:api_always_use_application_json` [feature flag](../user/feature_flags.md), -enabled by default. On GitLab self-managed instances, GitLab administrators can choose -to [disable it](../administration/feature_flags.md). **(FREE SELF)** diff --git a/doc/api/graphql/reference/index.md b/doc/api/graphql/reference/index.md index e4d6bc826e0..406a8a571fc 100644 --- a/doc/api/graphql/reference/index.md +++ b/doc/api/graphql/reference/index.md @@ -846,6 +846,7 @@ Input type: `CommitCreateInput` | ---- | ---- | ----------- | | <a id="mutationcommitcreateclientmutationid"></a>`clientMutationId` | [`String`](#string) | A unique identifier for the client performing the mutation. | | <a id="mutationcommitcreatecommit"></a>`commit` | [`Commit`](#commit) | The commit after mutation. | +| <a id="mutationcommitcreatecommitpipelinepath"></a>`commitPipelinePath` | [`String`](#string) | ETag path for the commit's pipeline. | | <a id="mutationcommitcreateerrors"></a>`errors` | [`[String!]!`](#string) | Errors encountered during execution of the mutation. | ### `Mutation.configureSast` @@ -7869,6 +7870,7 @@ Snapshot. | Name | Type | Description | | ---- | ---- | ----------- | +| <a id="devopsadoptionsnapshotcodeownersusedcount"></a>`codeOwnersUsedCount` | [`Int`](#int) | Total number of projects with existing CODEOWNERS file. | | <a id="devopsadoptionsnapshotdeploysucceeded"></a>`deploySucceeded` | [`Boolean!`](#boolean) | At least one deployment succeeded. | | <a id="devopsadoptionsnapshotendtime"></a>`endTime` | [`Time!`](#time) | The end time for the snapshot where the data points were collected. | | <a id="devopsadoptionsnapshotissueopened"></a>`issueOpened` | [`Boolean!`](#boolean) | At least one issue was opened. | @@ -7879,6 +7881,7 @@ Snapshot. | <a id="devopsadoptionsnapshotrunnerconfigured"></a>`runnerConfigured` | [`Boolean!`](#boolean) | At least one runner was used. | | <a id="devopsadoptionsnapshotsecurityscansucceeded"></a>`securityScanSucceeded` | [`Boolean!`](#boolean) | At least one security scan succeeded. | | <a id="devopsadoptionsnapshotstarttime"></a>`startTime` | [`Time!`](#time) | The start time for the snapshot where the data points were collected. | +| <a id="devopsadoptionsnapshottotalprojectscount"></a>`totalProjectsCount` | [`Int`](#int) | Total number of projects. | ### `DiffPosition` @@ -13182,10 +13185,10 @@ Alert status values. | Value | Description | | ----- | ----------- | -| <a id="alertmanagementstatusacknowledged"></a>`ACKNOWLEDGED` | Acknowledged status. | -| <a id="alertmanagementstatusignored"></a>`IGNORED` | Ignored status. | -| <a id="alertmanagementstatusresolved"></a>`RESOLVED` | Resolved status. | -| <a id="alertmanagementstatustriggered"></a>`TRIGGERED` | Triggered status. | +| <a id="alertmanagementstatusacknowledged"></a>`ACKNOWLEDGED` | Someone is actively investigating the problem. | +| <a id="alertmanagementstatusignored"></a>`IGNORED` | No action will be taken on the alert. | +| <a id="alertmanagementstatusresolved"></a>`RESOLVED` | No further work is required. | +| <a id="alertmanagementstatustriggered"></a>`TRIGGERED` | Investigation has not started. | ### `ApiFuzzingScanMode` diff --git a/doc/development/fe_guide/graphql.md b/doc/development/fe_guide/graphql.md index 8ce6db8b88a..ce51ce65104 100644 --- a/doc/development/fe_guide/graphql.md +++ b/doc/development/fe_guide/graphql.md @@ -817,7 +817,7 @@ apollo: { }, ``` -Then, because Etags depend on the request being a `GET` instead of GraphQL's usual `POST`, but our default link library does not support `GET` we need to let our defaut Apollo client know to use a different library. +Then, because Etags depend on the request being a `GET` instead of GraphQL's usual `POST`, but our default link library does not support `GET` we need to let our default Apollo client know to use a different library. ```javascript /* componentMountIndex.js */ diff --git a/lib/api/api.rb b/lib/api/api.rb index a287ffbfcd8..fed429aea2e 100644 --- a/lib/api/api.rb +++ b/lib/api/api.rb @@ -130,32 +130,6 @@ module API formatter :json, Gitlab::Json::GrapeFormatter content_type :json, 'application/json' - # Remove the `text/plain+deprecated` with `api_always_use_application_json` feature flag - # There is a small chance some users depend on the old behavior. - # We this change under a feature flag to see if affects GitLab.com users. - # The `+deprecated` is added to distinguish content type - # as defined by `API::API` vs ex. `API::Repositories` - content_type :txt, 'text/plain+deprecated' - - before do - # the feature flag workaround is only for `.txt` - api_format = env[Grape::Env::API_FORMAT] - next unless api_format == :txt - - # get all defined content-types for the endpoint - api_endpoint = env[Grape::Env::API_ENDPOINT] - content_types = api_endpoint&.namespace_stackable_with_hash(:content_types).to_h - - # Only overwrite `text/plain+deprecated` - if content_types[api_format] == 'text/plain+deprecated' - if Feature.enabled?(:api_always_use_application_json, default_enabled: :yaml) - content_type 'application/json' - else - content_type 'text/plain' - end - end - end - # Ensure the namespace is right, otherwise we might load Grape::API::Helpers helpers ::API::Helpers helpers ::API::Helpers::CommonHelpers diff --git a/lib/gitlab/etag_caching/router/graphql.rb b/lib/gitlab/etag_caching/router/graphql.rb index f1737f0ce5a..2b8639b9411 100644 --- a/lib/gitlab/etag_caching/router/graphql.rb +++ b/lib/gitlab/etag_caching/router/graphql.rb @@ -12,6 +12,11 @@ module Gitlab %r(\Apipelines/id/\d+\z), 'pipelines_graph', 'continuous_integration' + ], + [ + %r(\Apipelines/sha/\w{7,40}\z), + 'ci_editor', + 'pipeline_authoring' ] ].map(&method(:build_route)).freeze diff --git a/spec/factories/ci/pipelines.rb b/spec/factories/ci/pipelines.rb index 87b9a6c0e23..ce75d80e822 100644 --- a/spec/factories/ci/pipelines.rb +++ b/spec/factories/ci/pipelines.rb @@ -237,7 +237,7 @@ FactoryBot.define do trait :merged_result_pipeline do detached_merge_request_pipeline - sha { 'test-merge-sha'} + sha { 'mergeSha' } ref { merge_request.merge_ref_path } source_sha { merge_request.source_branch_sha } target_sha { merge_request.target_branch_sha } diff --git a/spec/factories/merge_requests.rb b/spec/factories/merge_requests.rb index fce44c2cee0..0aab41df90b 100644 --- a/spec/factories/merge_requests.rb +++ b/spec/factories/merge_requests.rb @@ -279,7 +279,7 @@ FactoryBot.define do trait :with_merge_request_pipeline do transient do - merge_sha { 'test-merge-sha' } + merge_sha { 'mergesha' } source_sha { source_branch_sha } target_sha { target_branch_sha } end diff --git a/spec/frontend/boards/stores/actions_spec.js b/spec/frontend/boards/stores/actions_spec.js index e0224dac736..8417ac9a41a 100644 --- a/spec/frontend/boards/stores/actions_spec.js +++ b/spec/frontend/boards/stores/actions_spec.js @@ -459,6 +459,7 @@ describe('updateList', () => { boardType: 'group', disabled: false, boardLists: [{ type: 'closed' }], + issuableType: 'issue', }; testAction( diff --git a/spec/graphql/mutations/commits/create_spec.rb b/spec/graphql/mutations/commits/create_spec.rb index 82a5e3a62f5..152b5d87da0 100644 --- a/spec/graphql/mutations/commits/create_spec.rb +++ b/spec/graphql/mutations/commits/create_spec.rb @@ -24,11 +24,12 @@ RSpec.describe Mutations::Commits::Create do let(:branch) { 'master' } let(:start_branch) { nil } let(:message) { 'Commit message' } + let(:file_path) { "#{SecureRandom.uuid}.md" } let(:actions) do [ { action: 'create', - file_path: 'NEW_FILE.md', + file_path: file_path, content: 'Hello' } ] @@ -68,12 +69,17 @@ RSpec.describe Mutations::Commits::Create do end context 'when service successfully creates a new commit' do + it "returns the ETag path for the commit's pipeline" do + commit_pipeline_path = subject[:commit_pipeline_path] + expect(commit_pipeline_path).to match(%r(pipelines/sha/\w+)) + end + it 'returns a new commit' do expect(mutated_commit).to have_attributes(message: message, project: project) expect(subject[:errors]).to be_empty expect_to_contain_deltas([ - a_hash_including(a_mode: '0', b_mode: '100644', new_file: true, new_path: 'NEW_FILE.md') + a_hash_including(a_mode: '0', b_mode: '100644', new_file: true, new_path: file_path) ]) end end diff --git a/spec/helpers/gitlab_routing_helper_spec.rb b/spec/helpers/gitlab_routing_helper_spec.rb index c3f8ac76ef5..40faf994ad2 100644 --- a/spec/helpers/gitlab_routing_helper_spec.rb +++ b/spec/helpers/gitlab_routing_helper_spec.rb @@ -353,7 +353,12 @@ RSpec.describe GitlabRoutingHelper do context 'GraphQL ETag paths' do context 'with pipelines' do - let(:pipeline) { double(id: 5) } + let(:sha) { 'b08774cb1a11ecdc27a82c5f444a69ea7e038ede' } + let(:pipeline) { double(id: 5 ) } + + it 'returns an ETag path for a pipeline sha' do + expect(graphql_etag_pipeline_sha_path(sha)).to eq('/api/graphql:pipelines/sha/b08774cb1a11ecdc27a82c5f444a69ea7e038ede') + end it 'returns an ETag path for pipelines' do expect(graphql_etag_pipeline_path(pipeline)).to eq('/api/graphql:pipelines/id/5') diff --git a/spec/lib/gitlab/etag_caching/router_spec.rb b/spec/lib/gitlab/etag_caching/router_spec.rb index c748ee00721..ce728c41f48 100644 --- a/spec/lib/gitlab/etag_caching/router_spec.rb +++ b/spec/lib/gitlab/etag_caching/router_spec.rb @@ -22,6 +22,14 @@ RSpec.describe Gitlab::EtagCaching::Router do expect(result.name).to eq 'pipelines_graph' expect(result.router).to eq Gitlab::EtagCaching::Router::Graphql end + + it 'matches pipeline sha endpoint' do + result = match_route('/api/graphql', 'pipelines/sha/4asd12lla2jiwjdqw9as32glm8is8hiu8s2c5jsw') + + expect(result).to be_present + expect(result.name).to eq 'ci_editor' + expect(result.router).to eq Gitlab::EtagCaching::Router::Graphql + end end end diff --git a/spec/requests/api/api_spec.rb b/spec/requests/api/api_spec.rb index b3e425630e5..46430e55ff2 100644 --- a/spec/requests/api/api_spec.rb +++ b/spec/requests/api/api_spec.rb @@ -170,20 +170,6 @@ RSpec.describe API::API do expect(response.media_type).to eq('application/json') expect(response.body).to include('{"id":') end - - context 'when api_always_use_application_json is disabled' do - before do - stub_feature_flags(api_always_use_application_json: false) - end - - it 'returns text/plain' do - subject - - expect(response).to have_gitlab_http_status(:ok) - expect(response.media_type).to eq('text/plain') - expect(response.body).to include('#<API::Entities::User:') - end - end end end end diff --git a/spec/services/ci/expire_pipeline_cache_service_spec.rb b/spec/services/ci/expire_pipeline_cache_service_spec.rb index ca37496657a..613bbe45e68 100644 --- a/spec/services/ci/expire_pipeline_cache_service_spec.rb +++ b/spec/services/ci/expire_pipeline_cache_service_spec.rb @@ -15,12 +15,14 @@ RSpec.describe Ci::ExpirePipelineCacheService do new_mr_pipelines_path = "/#{project.full_path}/-/merge_requests/new.json" pipeline_path = "/#{project.full_path}/-/pipelines/#{pipeline.id}.json" graphql_pipeline_path = "/api/graphql:pipelines/id/#{pipeline.id}" + graphql_pipeline_sha_path = "/api/graphql:pipelines/sha/#{pipeline.sha}" expect_next_instance_of(Gitlab::EtagCaching::Store) do |store| expect(store).to receive(:touch).with(pipelines_path) expect(store).to receive(:touch).with(new_mr_pipelines_path) expect(store).to receive(:touch).with(pipeline_path) expect(store).to receive(:touch).with(graphql_pipeline_path) + expect(store).to receive(:touch).with(graphql_pipeline_sha_path) end subject.execute(pipeline) |