From d170c7eeef81debb74afa518c256358ccb7e231c Mon Sep 17 00:00:00 2001 From: GitLab Bot Date: Wed, 1 Feb 2023 21:12:08 +0000 Subject: [PATCH] Add latest changes from gitlab-org/gitlab@master --- .gitlab-ci.yml | 5 + .gitlab/ci/notify.gitlab-ci.yml | 13 +- .gitlab/ci/rules.gitlab-ci.yml | 2 +- .rubocop_todo/performance/string_include.yml | 13 -- GITALY_SERVER_VERSION | 2 +- .../graphql_shared/issuable_client.js | 24 +++ app/assets/javascripts/issues/show/graphql.js | 9 -- app/assets/javascripts/issues/show/index.js | 2 +- .../javascripts/related_issues/index.js | 2 +- .../work_item_links/work_item_links.vue | 61 +++----- .../add_hierarchy_child.mutation.graphql | 3 + .../remove_hierarchy_child.mutation.graphql | 3 + app/assets/javascripts/work_items/utils.js | 4 + .../concerns/sensitive_serializable_hash.rb | 8 +- app/models/deploy_key.rb | 1 + app/models/grafana_integration.rb | 2 +- app/models/integration.rb | 4 +- .../protected_tag/create_access_level.rb | 34 +++++ app/models/snippet_repository.rb | 2 +- config/initializers/1_settings.rb | 2 +- config/initializers/macos.rb | 2 +- config/spring.rb | 2 +- doc/administration/auth/cognito.md | 2 +- .../auth/ldap/ldap-troubleshooting.md | 13 +- doc/administration/instance_review.md | 2 +- .../reference_architectures/index.md | 14 +- doc/api/users.md | 2 +- doc/ci/caching/index.md | 2 +- doc/ci/environments/index.md | 4 +- doc/ci/examples/semantic-release.md | 2 +- doc/ci/jobs/index.md | 2 +- doc/ci/lint.md | 4 +- doc/ci/pipeline_editor/index.md | 2 +- doc/ci/pipelines/cicd_minutes.md | 4 +- doc/ci/pipelines/job_artifacts.md | 2 +- doc/ci/runners/runners_scope.md | 2 +- .../database/batched_background_migrations.md | 63 ++++++-- doc/development/database/index.md | 1 + .../documentation/styleguide/word_list.md | 1 + .../documentation/topic_types/task.md | 2 +- doc/development/documentation/versions.md | 2 +- doc/development/documentation/workflow.md | 6 +- doc/development/fe_guide/graphql.md | 2 +- .../product_qualified_lead_guide/index.md | 2 +- doc/gitlab-basics/start-using-git.md | 2 +- doc/install/installation.md | 2 +- .../elasticsearch_troubleshooting.md | 4 +- doc/integration/github.md | 2 +- doc/integration/gitlab.md | 2 +- doc/integration/gitpod.md | 4 +- doc/integration/kerberos.md | 2 +- doc/integration/oauth_provider.md | 4 +- doc/integration/omniauth.md | 2 +- doc/integration/sourcegraph.md | 2 +- doc/integration/vault.md | 2 +- .../incident_management/manage_incidents.md | 2 +- doc/operations/metrics/dashboards/index.md | 2 +- doc/operations/metrics/dashboards/settings.md | 2 +- doc/subscriptions/self_managed/index.md | 2 +- doc/update/patch_versions.md | 2 +- doc/update/upgrading_from_source.md | 2 +- .../settings/continuous_integration.md | 2 +- .../vulnerability_report/index.md | 2 +- doc/user/award_emojis.md | 2 +- doc/user/discussions/index.md | 4 +- doc/user/group/manage.md | 2 +- doc/user/group/saml_sso/index.md | 2 +- doc/user/group/saml_sso/scim_setup.md | 2 +- doc/user/group/subgroups/index.md | 2 +- .../group/value_stream_analytics/index.md | 4 +- .../infrastructure/iac/terraform_state.md | 5 +- doc/user/okrs.md | 2 +- doc/user/profile/account/delete_account.md | 2 +- doc/user/profile/active_sessions.md | 4 +- doc/user/profile/contributions_calendar.md | 8 +- doc/user/profile/index.md | 34 ++--- doc/user/profile/notifications.md | 12 +- doc/user/profile/personal_access_tokens.md | 6 +- doc/user/profile/preferences.md | 2 +- doc/user/profile/user_passwords.md | 2 +- doc/user/project/file_lock.md | 2 +- .../project/integrations/hangouts_chat.md | 2 +- doc/user/project/issues/create_issues.md | 4 +- doc/user/project/issues/csv_import.md | 2 +- doc/user/project/issues/design_management.md | 8 +- doc/user/project/issues/managing_issues.md | 2 +- doc/user/project/merge_requests/changes.md | 2 +- .../merge_requests/cherry_pick_changes.md | 8 +- .../merge_requests/creating_merge_requests.md | 4 +- doc/user/project/merge_requests/drafts.md | 4 +- doc/user/project/merge_requests/index.md | 4 +- .../project/merge_requests/revert_changes.md | 2 +- .../project/merge_requests/reviews/index.md | 4 +- .../index.md | 4 +- .../pages_forked_sample_project.md | 2 +- doc/user/project/releases/index.md | 6 +- .../project/repository/forking_workflow.md | 2 +- .../repository/gpg_signed_commits/index.md | 8 +- .../repository/ssh_signed_commits/index.md | 2 +- doc/user/project/requirements/index.md | 4 +- doc/user/project/web_ide/index.md | 4 +- doc/user/project/web_ide_beta/index.md | 4 +- doc/user/project/wiki/index.md | 2 +- doc/user/report_abuse.md | 8 +- doc/user/search/index.md | 2 +- doc/user/shortcuts.md | 2 +- doc/user/snippets.md | 4 +- doc/user/ssh.md | 6 +- doc/user/todos.md | 4 +- .../encrypt_integration_properties.rb | 2 +- lib/gitlab/doctor/secrets.rb | 4 +- .../import_export/base/relation_factory.rb | 4 +- .../import_export/project/import_export.yml | 1 + lib/gitlab/otp_key_rotator.rb | 2 +- .../parser/atlassian_document_format.rb | 2 +- lib/prometheus/pid_provider.rb | 2 +- .../your_work/menus/merge_requests_menu.rb | 6 +- locale/gitlab.pot | 3 + scripts/api/commit_merge_requests.rb | 29 ++++ scripts/create-pipeline-failure-incident.rb | 90 ++++++++++- .../generate-failed-pipeline-slack-message.rb | 2 +- scripts/review_apps/review-apps.sh | 6 +- .../protected_tags/create_access_levels.rb | 9 ++ spec/features/projects/jobs_spec.rb | 2 +- .../work_item_links/work_item_links_spec.js | 21 ++- spec/lib/gitlab/import_export/all_models.yml | 1 + .../attribute_configuration_spec.rb | 2 +- .../references_configuration_spec.rb | 2 +- .../sensitive_serializable_hash_spec.rb | 4 +- spec/models/deploy_key_spec.rb | 1 + spec/models/hooks/web_hook_spec.rb | 2 +- spec/models/integration_spec.rb | 8 +- .../integrations/issue_tracker_data_spec.rb | 2 +- .../integrations/jira_tracker_data_spec.rb | 2 +- .../integrations/zentao_tracker_data_spec.rb | 2 +- .../protected_tag/create_access_level_spec.rb | 144 ++++++++++++++++++ .../scripts/api/commit_merge_requests_spec.rb | 30 ++++ .../create_pipeline_failure_incident_spec.rb | 120 +++++++++++++++ spec/spec_helper.rb | 4 +- .../generate_distribution_shared_examples.rb | 3 +- vendor/gems/attr_encrypted/README.md | 2 +- .../gems/attr_encrypted/lib/attr_encrypted.rb | 58 +++---- .../attr_encrypted/adapters/active_record.rb | 12 +- .../attr_encrypted/test/active_record_test.rb | 10 +- .../test/attr_encrypted_test.rb | 30 ++-- .../test/legacy_attr_encrypted_test.rb | 18 +-- 146 files changed, 879 insertions(+), 350 deletions(-) delete mode 100644 .rubocop_todo/performance/string_include.yml delete mode 100644 app/assets/javascripts/issues/show/graphql.js create mode 100644 app/assets/javascripts/work_items/graphql/add_hierarchy_child.mutation.graphql create mode 100644 app/assets/javascripts/work_items/graphql/remove_hierarchy_child.mutation.graphql create mode 100644 scripts/api/commit_merge_requests.rb create mode 100644 spec/factories/protected_tags/create_access_levels.rb create mode 100644 spec/models/protected_tag/create_access_level_spec.rb create mode 100644 spec/scripts/api/commit_merge_requests_spec.rb create mode 100644 spec/scripts/create_pipeline_failure_incident_spec.rb diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 0354a2b650b..591c83f0cff 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -35,6 +35,8 @@ default: .default-branch-incident-variables: &default-branch-incident-variables CREATE_INCIDENT_FOR_PIPELINE_FAILURE: "true" NOTIFY_PIPELINE_FAILURE_CHANNEL: "master-broken" + BROKEN_BRANCH_INCIDENTS_PROJECT: "gitlab-org/quality/engineering-productivity/master-broken-incidents" + BROKEN_BRANCH_INCIDENTS_PROJECT_TOKEN: "${BROKEN_MASTER_INCIDENTS_PROJECT_TOKEN}" workflow: name: '$PIPELINE_NAME' @@ -107,6 +109,9 @@ workflow: <<: *ruby2-variables NOTIFY_PIPELINE_FAILURE_CHANNEL: "releases" PIPELINE_NAME: 'Ruby 2 $CI_COMMIT_BRANCH branch pipeline' + CREATE_INCIDENT_FOR_PIPELINE_FAILURE: "true" + BROKEN_BRANCH_INCIDENTS_PROJECT: "gitlab-org/release/tasks" + BROKEN_BRANCH_INCIDENTS_PROJECT_TOKEN: "${BROKEN_STABLE_INCIDENTS_PROJECT_TOKEN}" - if: '$CI_COMMIT_BRANCH =~ /^\d+-\d+-auto-deploy-\d+$/' variables: <<: *ruby2-variables diff --git a/.gitlab/ci/notify.gitlab-ci.yml b/.gitlab/ci/notify.gitlab-ci.yml index 84fb5a55ed1..bdd7979126f 100644 --- a/.gitlab/ci/notify.gitlab-ci.yml +++ b/.gitlab/ci/notify.gitlab-ci.yml @@ -43,8 +43,9 @@ notify-pipeline-failure: - .notify:rules:notify-pipeline-failure image: ${GITLAB_DEPENDENCY_PROXY_ADDRESS}ruby:${RUBY_VERSION} variables: - BROKEN_MASTER_INCIDENTS_PROJECT: "gitlab-org/quality/engineering-productivity/master-broken-incidents" - BROKEN_MASTER_INCIDENT_JSON: "${CI_PROJECT_DIR}/incident.json" + INCIDENT_PROJECT: "#{BROKEN_BRANCH_INCIDENTS_PROJECT}" + BROKEN_BRANCH_PROJECT_TOKEN: "${BROKEN_BRANCH_INCIDENTS_PROJECT_TOKEN}" + INCIDENT_JSON: "${CI_PROJECT_DIR}/incident.json" SLACK_CHANNEL: "${NOTIFY_PIPELINE_FAILURE_CHANNEL}" FAILED_PIPELINE_SLACK_MESSAGE_FILE: "${CI_PROJECT_DIR}/failed_pipeline_slack_message.json" before_script: @@ -54,17 +55,17 @@ notify-pipeline-failure: script: - | if [[ "${CREATE_INCIDENT_FOR_PIPELINE_FAILURE}" == "true" ]]; then - scripts/create-pipeline-failure-incident.rb -p ${BROKEN_MASTER_INCIDENTS_PROJECT} -f ${BROKEN_MASTER_INCIDENT_JSON} -t ${BROKEN_MASTER_INCIDENTS_PROJECT_TOKEN}; - echosuccess "Created incident $(jq '.web_url' ${BROKEN_MASTER_INCIDENT_JSON})"; + scripts/create-pipeline-failure-incident.rb -p ${INCIDENT_PROJECT} -f ${INCIDENT_JSON} -t ${BROKEN_BRANCH_PROJECT_TOKEN}; + echosuccess "Created incident $(jq '.web_url' ${INCIDENT_JSON})"; fi - | - scripts/generate-failed-pipeline-slack-message.rb -i ${BROKEN_MASTER_INCIDENT_JSON} -f ${FAILED_PIPELINE_SLACK_MESSAGE_FILE}; + scripts/generate-failed-pipeline-slack-message.rb -i ${INCIDENT_JSON} -f ${FAILED_PIPELINE_SLACK_MESSAGE_FILE}; curl -X POST -H 'Content-Type: application/json' --data @${FAILED_PIPELINE_SLACK_MESSAGE_FILE} "$CI_SLACK_WEBHOOK_URL" || scripts/slack ${SLACK_CHANNEL} "☠️ Broken pipeline notification failed! ☠️ See ${CI_JOB_URL}" ci_failing "Failed pipeline reporter" artifacts: paths: - - ${BROKEN_MASTER_INCIDENT_JSON} + - ${INCIDENT_JSON} - ${FAILED_PIPELINE_SLACK_MESSAGE_FILE} when: always expire_in: 2 days diff --git a/.gitlab/ci/rules.gitlab-ci.yml b/.gitlab/ci/rules.gitlab-ci.yml index 718b4e67f4e..c26dd45ae93 100644 --- a/.gitlab/ci/rules.gitlab-ci.yml +++ b/.gitlab/ci/rules.gitlab-ci.yml @@ -2096,7 +2096,7 @@ changes: *code-patterns when: manual allow_failure: true - - <<: *if-dot-com-gitlab-org-schedule + - <<: *if-dot-com-ee-schedule-default-branch-maintenance allow_failure: true .review:rules:review-k8s-resources-count-checks: diff --git a/.rubocop_todo/performance/string_include.yml b/.rubocop_todo/performance/string_include.yml deleted file mode 100644 index 2a2d0559397..00000000000 --- a/.rubocop_todo/performance/string_include.yml +++ /dev/null @@ -1,13 +0,0 @@ ---- -# Cop supports --autocorrect. -Performance/StringInclude: - Exclude: - - 'app/models/snippet_repository.rb' - - 'config/initializers/macos.rb' - - 'config/spring.rb' - - 'ee/app/models/ee/container_registry/event.rb' - - 'ee/lib/gitlab/auth/smartcard/certificate.rb' - - 'lib/kramdown/parser/atlassian_document_format.rb' - - 'lib/prometheus/pid_provider.rb' - - 'spec/features/projects/jobs_spec.rb' - - 'spec/spec_helper.rb' diff --git a/GITALY_SERVER_VERSION b/GITALY_SERVER_VERSION index 2dd600c5f52..3a65378f961 100644 --- a/GITALY_SERVER_VERSION +++ b/GITALY_SERVER_VERSION @@ -1 +1 @@ -4e200026c03189abe2c60b071204340c4af5cf35 +6eb7389db0d54ef9ba3622eb7d1412f71e9deb2f diff --git a/app/assets/javascripts/graphql_shared/issuable_client.js b/app/assets/javascripts/graphql_shared/issuable_client.js index 745a03f411a..316bc746051 100644 --- a/app/assets/javascripts/graphql_shared/issuable_client.js +++ b/app/assets/javascripts/graphql_shared/issuable_client.js @@ -6,6 +6,8 @@ import getIssueStateQuery from '~/issues/show/queries/get_issue_state.query.grap import createDefaultClient from '~/lib/graphql'; import typeDefs from '~/work_items/graphql/typedefs.graphql'; import { WIDGET_TYPE_NOTES } from '~/work_items/constants'; +import getWorkItemLinksQuery from '~/work_items/graphql/work_item_links.query.graphql'; +import { findHierarchyWidgetChildren } from '~/work_items/utils'; export const config = { typeDefs, @@ -143,6 +145,28 @@ export const config = { export const resolvers = { Mutation: { + addHierarchyChild: (_, { id, workItem }, { cache }) => { + const queryArgs = { query: getWorkItemLinksQuery, variables: { id } }; + const sourceData = cache.readQuery(queryArgs); + + const data = produce(sourceData, (draftState) => { + findHierarchyWidgetChildren(draftState.workItem).push(workItem); + }); + + cache.writeQuery({ ...queryArgs, data }); + }, + removeHierarchyChild: (_, { id, workItem }, { cache }) => { + const queryArgs = { query: getWorkItemLinksQuery, variables: { id } }; + const sourceData = cache.readQuery(queryArgs); + + const data = produce(sourceData, (draftState) => { + const hierarchyChildren = findHierarchyWidgetChildren(draftState.workItem); + const index = hierarchyChildren.findIndex((child) => child.id === workItem.id); + hierarchyChildren.splice(index, 1); + }); + + cache.writeQuery({ ...queryArgs, data }); + }, updateIssueState: (_, { issueType = undefined, isDirty = false }, { cache }) => { const sourceData = cache.readQuery({ query: getIssueStateQuery }); const data = produce(sourceData, (draftData) => { diff --git a/app/assets/javascripts/issues/show/graphql.js b/app/assets/javascripts/issues/show/graphql.js deleted file mode 100644 index deee034f9d1..00000000000 --- a/app/assets/javascripts/issues/show/graphql.js +++ /dev/null @@ -1,9 +0,0 @@ -import Vue from 'vue'; -import VueApollo from 'vue-apollo'; -import { defaultClient } from '~/graphql_shared/issuable_client'; - -Vue.use(VueApollo); - -export default new VueApollo({ - defaultClient, -}); diff --git a/app/assets/javascripts/issues/show/index.js b/app/assets/javascripts/issues/show/index.js index 8b8c710c641..489b65b8704 100644 --- a/app/assets/javascripts/issues/show/index.js +++ b/app/assets/javascripts/issues/show/index.js @@ -1,6 +1,7 @@ import Vue from 'vue'; import { mapGetters } from 'vuex'; import errorTrackingStore from '~/error_tracking/store'; +import { apolloProvider } from '~/graphql_shared/issuable_client'; import { parseBoolean } from '~/lib/utils/common_utils'; import { scrollToTargetOnResize } from '~/lib/utils/resize_observer'; import IssueApp from './components/app.vue'; @@ -8,7 +9,6 @@ import HeaderActions from './components/header_actions.vue'; import IncidentTabs from './components/incidents/incident_tabs.vue'; import SentryErrorStackTrace from './components/sentry_error_stack_trace.vue'; import { INCIDENT_TYPE, issueState } from './constants'; -import apolloProvider from './graphql'; import getIssueStateQuery from './queries/get_issue_state.query.graphql'; const bootstrapApollo = (state = {}) => { diff --git a/app/assets/javascripts/related_issues/index.js b/app/assets/javascripts/related_issues/index.js index c77a67c4287..c42ee27fbdf 100644 --- a/app/assets/javascripts/related_issues/index.js +++ b/app/assets/javascripts/related_issues/index.js @@ -1,5 +1,5 @@ import Vue from 'vue'; -import apolloProvider from '~/issues/show/graphql'; +import { apolloProvider } from '~/graphql_shared/issuable_client'; import { parseBoolean } from '~/lib/utils/common_utils'; import RelatedIssuesRoot from './components/related_issues_root.vue'; diff --git a/app/assets/javascripts/work_items/components/work_item_links/work_item_links.vue b/app/assets/javascripts/work_items/components/work_item_links/work_item_links.vue index 62680195984..3c3d5f0b42f 100644 --- a/app/assets/javascripts/work_items/components/work_item_links/work_item_links.vue +++ b/app/assets/javascripts/work_items/components/work_item_links/work_item_links.vue @@ -1,6 +1,5 @@