From 8b2a413032f009c3cdb2414144b136717db9331b Mon Sep 17 00:00:00 2001 From: GitLab Bot Date: Wed, 26 Feb 2025 15:12:07 +0000 Subject: [PATCH] Add latest changes from gitlab-org/gitlab@master --- .../lint/non_atomic_file_operation.yml | 12 - .../components/csv_upload_modal.vue | 2 +- .../autopopulate_allowlist_modal.vue | 11 +- .../components/inbound_token_access.vue | 308 +++++++++++------- .../remove_autopopulated_entries_modal.vue | 72 ++++ .../components/token_access_table.vue | 12 + .../javascripts/token_access/constants.js | 2 + ...ove_autopopulated_entries.mutation.graphql | 6 + .../graphql/list/get_work_items.query.graphql | 2 + .../stylesheets/page_bundles/search.scss | 4 + app/views/search/results/_milestone.html.haml | 4 +- ...egistry_maven_cleanup_new_worker_class.yml | 2 +- .../use_typhoeus_elasticsearch_adapter.yml | 8 - .../troubleshooting/postgresql.md | 2 +- doc/ci/docker/using_docker_build.md | 57 ++++ doc/development/data_retention_policies.md | 71 ++++ .../database/large_tables_limitations.md | 1 + doc/development/feature_development.md | 6 +- doc/integration/exact_code_search/zoekt.md | 22 ++ .../import/direct_transfer_migrations.md | 4 +- doc/user/group/manage.md | 2 +- doc/user/group/saml_sso/_index.md | 2 +- doc/user/project/import/_index.md | 61 +++- doc/user/project/settings/_index.md | 2 +- doc/user/workspace/configuration.md | 67 ++-- .../databases/elasticsearch/client.rb | 2 +- .../databases/opensearch/client.rb | 2 +- .../databases/elasticsearch/client_spec.rb | 2 +- .../databases/opensearch/client_spec.rb | 15 + lib/gitlab/ci/trace.rb | 4 +- .../test_batched_background_runner.rb | 2 +- lib/gitlab/gpg.rb | 2 +- .../base_after_export_strategy.rb | 2 +- .../import_export/recursive_merge_folders.rb | 2 +- .../memory/upload_and_cleanup_reports.rb | 2 +- lib/tasks/gitlab/update_templates.rake | 2 +- lib/tasks/tanuki_emoji.rake | 2 +- locale/gitlab.pot | 24 ++ package.json | 2 +- .../cells/application-settings-analysis.rb | 1 + .../autopopulate_allowlist_modal_spec.js | 21 +- .../token_access/inbound_token_access_spec.js | 182 ++++++++++- spec/frontend/token_access/mock_data.js | 10 + ...remove_autopopulated_entries_modal_spec.js | 63 ++++ .../token_access/token_access_table_spec.js | 12 + spec/frontend/work_items/mock_data.js | 1 + spec/lib/gitlab/gpg_spec.rb | 12 +- .../gitlab/update_templates_rake_spec.rb | 80 +++-- yarn.lock | 8 +- 49 files changed, 950 insertions(+), 247 deletions(-) delete mode 100644 .rubocop_todo/lint/non_atomic_file_operation.yml create mode 100644 app/assets/javascripts/token_access/components/remove_autopopulated_entries_modal.vue create mode 100644 app/assets/javascripts/token_access/graphql/mutations/remove_autopopulated_entries.mutation.graphql delete mode 100644 config/feature_flags/development/use_typhoeus_elasticsearch_adapter.yml create mode 100644 doc/development/data_retention_policies.md create mode 100644 spec/frontend/token_access/remove_autopopulated_entries_modal_spec.js diff --git a/.rubocop_todo/lint/non_atomic_file_operation.yml b/.rubocop_todo/lint/non_atomic_file_operation.yml deleted file mode 100644 index c00fb856d64..00000000000 --- a/.rubocop_todo/lint/non_atomic_file_operation.yml +++ /dev/null @@ -1,12 +0,0 @@ ---- -# Cop supports --autocorrect. -Lint/NonAtomicFileOperation: - Exclude: - - 'lib/gitlab/ci/trace.rb' - - 'lib/gitlab/database/migrations/test_batched_background_runner.rb' - - 'lib/gitlab/gpg.rb' - - 'lib/gitlab/import_export/after_export_strategies/base_after_export_strategy.rb' - - 'lib/gitlab/import_export/recursive_merge_folders.rb' - - 'lib/gitlab/memory/upload_and_cleanup_reports.rb' - - 'lib/tasks/gitlab/update_templates.rake' - - 'lib/tasks/tanuki_emoji.rake' diff --git a/app/assets/javascripts/members/placeholders/components/csv_upload_modal.vue b/app/assets/javascripts/members/placeholders/components/csv_upload_modal.vue index 86ee9adf65a..17bdd01991b 100644 --- a/app/assets/javascripts/members/placeholders/components/csv_upload_modal.vue +++ b/app/assets/javascripts/members/placeholders/components/csv_upload_modal.vue @@ -87,7 +87,7 @@ export default { }, dropzoneAllowList: ['.csv'], docsLink: helpPagePath('user/project/import/_index', { - anchor: 'reassign-contributions-and-memberships', + anchor: 'request-reassignment-by-using-a-csv-file', }), i18n: { description: s__( diff --git a/app/assets/javascripts/token_access/components/autopopulate_allowlist_modal.vue b/app/assets/javascripts/token_access/components/autopopulate_allowlist_modal.vue index 31f86d1eea9..3b6df8c2e5e 100644 --- a/app/assets/javascripts/token_access/components/autopopulate_allowlist_modal.vue +++ b/app/assets/javascripts/token_access/components/autopopulate_allowlist_modal.vue @@ -1,5 +1,6 @@ @@ -129,6 +133,7 @@ export default { @primary.prevent="autopopulateAllowlist" @secondary="hideModal" @canceled="hideModal" + @hidden="hideModal" > {{ errorMessage }} @@ -138,8 +143,6 @@ export default { {{ authLogExceedsLimitMessage }}

- -

diff --git a/app/assets/javascripts/token_access/components/inbound_token_access.vue b/app/assets/javascripts/token_access/components/inbound_token_access.vue index efc465e56af..3f81fbc7a7b 100644 --- a/app/assets/javascripts/token_access/components/inbound_token_access.vue +++ b/app/assets/javascripts/token_access/components/inbound_token_access.vue @@ -3,6 +3,7 @@ import { GlAlert, GlButton, GlCollapsibleListbox, + GlDisclosureDropdown, GlIcon, GlLink, GlLoadingIcon, @@ -24,13 +25,16 @@ import inboundGetCIJobTokenScopeQuery from '../graphql/queries/inbound_get_ci_jo import inboundGetGroupsAndProjectsWithCIJobTokenScopeQuery from '../graphql/queries/inbound_get_groups_and_projects_with_ci_job_token_scope.query.graphql'; import getCiJobTokenScopeAllowlistQuery from '../graphql/queries/get_ci_job_token_scope_allowlist.query.graphql'; import getAuthLogCountQuery from '../graphql/queries/get_auth_log_count.query.graphql'; +import removeAutopopulatedEntriesMutation from '../graphql/mutations/remove_autopopulated_entries.mutation.graphql'; import { JOB_TOKEN_FORM_ADD_GROUP_OR_PROJECT, JOB_TOKEN_FORM_AUTOPOPULATE_AUTH_LOG, + JOB_TOKEN_REMOVE_AUTOPOPULATED_ENTRIES_MODAL, } from '../constants'; import TokenAccessTable from './token_access_table.vue'; import NamespaceForm from './namespace_form.vue'; import AutopopulateAllowlistModal from './autopopulate_allowlist_modal.vue'; +import RemoveAutopopulatedEntriesModal from './remove_autopopulated_entries_modal.vue'; export default { i18n: { @@ -55,6 +59,7 @@ export default { 'CICD|Are you sure you want to remove %{namespace} from the job token allowlist?', ), removeNamespaceModalActionText: s__('CICD|Remove group or project'), + removeAutopopulatedEntries: s__('CICD|Remove all auto-added allowlist entries'), }, inboundJobTokenScopeOptions: [ { @@ -81,11 +86,13 @@ export default { GlAlert, GlButton, GlCollapsibleListbox, + GlDisclosureDropdown, GlIcon, GlLink, GlLoadingIcon, GlSprintf, CrudComponent, + RemoveAutopopulatedEntriesModal, TokenAccessTable, GlFormRadioGroup, NamespaceForm, @@ -170,9 +177,11 @@ export default { data() { return { authLogCount: 0, + allowlistLoadingMessage: '', inboundJobTokenScopeEnabled: null, - isUpdating: false, + isUpdatingJobTokenScope: false, groupsAndProjectsWithAccess: { groups: [], projects: [] }, + autopopulationErrorMessage: null, projectName: '', namespaceToEdit: null, namespaceToRemove: null, @@ -183,6 +192,12 @@ export default { authLogExceedsLimit() { return this.projectCount + this.groupCount + this.authLogCount > this.projectAllowlistLimit; }, + isAllowlistLoading() { + return ( + this.$apollo.queries.groupsAndProjectsWithAccess.loading || + this.allowlistLoadingMessage.length > 0 + ); + }, isJobTokenPoliciesEnabled() { return this.glFeatures.addPoliciesToCiJobToken; }, @@ -198,6 +213,17 @@ export default { canAutopopulateAuthLog() { return this.glFeatures.authenticationLogsMigrationForAllowlist; }, + disclosureDropdownOptions() { + return [ + { + text: this.$options.i18n.removeAutopopulatedEntries, + variant: 'danger', + action: () => { + this.selectedAction = JOB_TOKEN_REMOVE_AUTOPOPULATED_ENTRIES_MODAL; + }, + }, + ]; + }, groupCount() { return this.groupsAndProjectsWithAccess.groups.length; }, @@ -210,14 +236,14 @@ export default { projectCountTooltip() { return n__('%d project has access', '%d projects have access', this.projectCount); }, - isAllowlistLoading() { - return this.$apollo.queries.groupsAndProjectsWithAccess.loading; - }, removeNamespaceModalTitle() { return sprintf(this.$options.i18n.removeNamespaceModalTitle, { namespace: this.namespaceToRemove?.fullPath, }); }, + showRemoveAutopopulatedEntriesModal() { + return this.selectedAction === JOB_TOKEN_REMOVE_AUTOPOPULATED_ENTRIES_MODAL; + }, showAutopopulateModal() { return this.selectedAction === JOB_TOKEN_FORM_AUTOPOPULATE_AUTH_LOG; }, @@ -238,7 +264,7 @@ export default { })); }, async updateCIJobTokenScope() { - this.isUpdating = true; + this.isUpdatingJobTokenScope = true; try { const { @@ -268,7 +294,7 @@ export default { this.inboundJobTokenScopeEnabled = !this.inboundJobTokenScopeEnabled; createAlert({ message: error.message }); } finally { - this.isUpdating = false; + this.isUpdatingJobTokenScope = false; } }, async removeItem() { @@ -291,6 +317,42 @@ export default { this.refetchGroupsAndProjects(); return Promise.resolve(); }, + async removeAutopopulatedEntries() { + this.hideSelectedAction(); + this.autopopulationErrorMessage = null; + this.allowlistLoadingMessage = s__( + 'CICD|Removing auto-added allowlist entries. Please wait while the action completes.', + ); + + try { + const { + data: { + ciJobTokenScopeClearAllowlistAutopopulations: { errors }, + }, + } = await this.$apollo.mutate({ + mutation: removeAutopopulatedEntriesMutation, + variables: { + projectPath: this.fullPath, + }, + }); + + if (errors.length) { + this.autopopulationErrorMessage = errors[0].message; + return; + } + + this.refetchAllowlist(); + this.$toast.show( + s__('CICD|Authentication log entries were successfully removed from the allowlist.'), + ); + } catch (error) { + this.autopopulationErrorMessage = s__( + 'CICD|An error occurred while removing the auto-added log entries. Please try again.', + ); + } finally { + this.allowlistLoadingMessage = ''; + } + }, refetchAllowlist() { this.$apollo.queries.groupsAndProjectsWithAccess.refetch(); this.hideSelectedAction(); @@ -328,117 +390,133 @@ export default { @hide="hideSelectedAction" @refetch-allowlist="refetchAllowlist" /> - -