diff options
-rw-r--r-- | app/assets/javascripts/clusters/agents/index.js | 2 | ||||
-rw-r--r-- | app/assets/javascripts/clusters_list/clusters_util.js | 3 | ||||
-rw-r--r-- | app/assets/javascripts/clusters_list/components/agent_token.vue | 4 | ||||
-rw-r--r-- | app/helpers/projects/cluster_agents_helper.rb | 1 | ||||
-rw-r--r-- | app/models/pool_repository.rb | 4 | ||||
-rw-r--r-- | app/models/project.rb | 2 | ||||
-rw-r--r-- | doc/api/members.md | 2 | ||||
-rw-r--r-- | doc/install/next_steps.md | 2 | ||||
-rw-r--r-- | doc/integration/elasticsearch.md | 9 | ||||
-rw-r--r-- | doc/update/index.md | 4 | ||||
-rw-r--r-- | spec/frontend/clusters_list/components/agent_token_spec.js | 5 | ||||
-rw-r--r-- | spec/helpers/projects/cluster_agents_helper_spec.rb | 1 | ||||
-rw-r--r-- | spec/models/pool_repository_spec.rb | 20 |
13 files changed, 48 insertions, 11 deletions
diff --git a/app/assets/javascripts/clusters/agents/index.js b/app/assets/javascripts/clusters/agents/index.js index 8a447f57f00..2070a32426e 100644 --- a/app/assets/javascripts/clusters/agents/index.js +++ b/app/assets/javascripts/clusters/agents/index.js @@ -18,6 +18,7 @@ export default () => { emptyStateSvgPath, projectPath, kasAddress, + kasVersion, canAdminCluster, } = el.dataset; @@ -32,6 +33,7 @@ export default () => { emptyStateSvgPath, projectPath, kasAddress, + kasVersion, canAdminCluster: parseBoolean(canAdminCluster), }, render(createElement) { diff --git a/app/assets/javascripts/clusters_list/clusters_util.js b/app/assets/javascripts/clusters_list/clusters_util.js index e7ad2f45c75..9eb01f593f5 100644 --- a/app/assets/javascripts/clusters_list/clusters_util.js +++ b/app/assets/javascripts/clusters_list/clusters_util.js @@ -1,9 +1,10 @@ -export function generateAgentRegistrationCommand(agentToken, kasAddress) { +export function generateAgentRegistrationCommand(agentToken, kasAddress, kasVersion) { return `helm repo add gitlab https://charts.gitlab.io helm repo update helm upgrade --install gitlab-agent gitlab/gitlab-agent \\ --namespace gitlab-agent \\ --create-namespace \\ + --set image.tag=v${kasVersion} \\ --set config.token=${agentToken} \\ --set config.kasAddress=${kasAddress}`; } diff --git a/app/assets/javascripts/clusters_list/components/agent_token.vue b/app/assets/javascripts/clusters_list/components/agent_token.vue index 751ad9795dd..1597fcb9914 100644 --- a/app/assets/javascripts/clusters_list/components/agent_token.vue +++ b/app/assets/javascripts/clusters_list/components/agent_token.vue @@ -19,7 +19,7 @@ export default { GlSprintf, ModalCopyButton, }, - inject: ['kasAddress'], + inject: ['kasAddress', 'kasVersion'], props: { agentToken: { required: true, @@ -32,7 +32,7 @@ export default { }, computed: { agentRegistrationCommand() { - return generateAgentRegistrationCommand(this.agentToken, this.kasAddress); + return generateAgentRegistrationCommand(this.agentToken, this.kasAddress, this.kasVersion); }, }, }; diff --git a/app/helpers/projects/cluster_agents_helper.rb b/app/helpers/projects/cluster_agents_helper.rb index c17cb787c9f..f62f5eadfb4 100644 --- a/app/helpers/projects/cluster_agents_helper.rb +++ b/app/helpers/projects/cluster_agents_helper.rb @@ -9,6 +9,7 @@ module Projects::ClusterAgentsHelper empty_state_svg_path: image_path('illustrations/operations-dashboard_empty.svg'), project_path: project.full_path, kas_address: Gitlab::Kas.external_url, + kas_version: Gitlab::Kas.version_info, can_admin_cluster: can?(current_user, :admin_cluster, project).to_s } end diff --git a/app/models/pool_repository.rb b/app/models/pool_repository.rb index 78cddaa1302..3461104ae35 100644 --- a/app/models/pool_repository.rb +++ b/app/models/pool_repository.rb @@ -81,7 +81,9 @@ class PoolRepository < ApplicationRecord object_pool.link(repository.raw) end - def mark_obsolete_if_last(repository) + def unlink_repository(repository) + repository.disconnect_alternates + if member_projects.where.not(id: repository.project.id).exists? true else diff --git a/app/models/project.rb b/app/models/project.rb index f4e39524e47..b66ec28b659 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -2561,7 +2561,7 @@ class Project < ApplicationRecord end def leave_pool_repository - pool_repository&.mark_obsolete_if_last(repository) && update_column(:pool_repository_id, nil) + pool_repository&.unlink_repository(repository) && update_column(:pool_repository_id, nil) end def link_pool_repository diff --git a/doc/api/members.md b/doc/api/members.md index 1db9714bfd1..5002e1003e3 100644 --- a/doc/api/members.md +++ b/doc/api/members.md @@ -6,6 +6,8 @@ info: To determine the technical writer assigned to the Stage/Group associated w # Group and project members API **(FREE)** +> `created_by` field [introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/28789) in GitLab 14.10. + ## Valid access levels The access levels are defined in the `Gitlab::Access` module. Currently, these levels are recognized: diff --git a/doc/install/next_steps.md b/doc/install/next_steps.md index 2fc60c3af53..5d8c61cad44 100644 --- a/doc/install/next_steps.md +++ b/doc/install/next_steps.md @@ -56,7 +56,7 @@ installation. ## Cross-repository Code Search -- [Advanced Search](../integration/elasticsearch.md): Leverage Elasticsearch for +- [Advanced Search](../integration/elasticsearch.md): Leverage [Elasticsearch](https://www.elastic.co/) or [OpenSearch](https://opensearch.org/) for faster, more advanced code search across your entire GitLab instance. ## Scaling and replication diff --git a/doc/integration/elasticsearch.md b/doc/integration/elasticsearch.md index 214bd845944..ab9aaae63a2 100644 --- a/doc/integration/elasticsearch.md +++ b/doc/integration/elasticsearch.md @@ -38,6 +38,8 @@ GitLab does not support: For updates, see [issue #327560](https://gitlab.com/gitlab-org/gitlab/-/issues/327560). - Elasticsearch 8.0. For updates, see [issue #350600](https://gitlab.com/gitlab-org/gitlab/-/issues/350600). Use Elasticsearch 7.17 instead. +If you are using a compatible version and after connecting to OpenSearch, you get the message `Elasticsearch version not compatible`, [unpause indexing](#unpause-indexing). + ## System requirements Elasticsearch requires additional resources to those documented in the @@ -301,6 +303,13 @@ To disable the Elasticsearch integration: bundle exec rake gitlab:elastic:delete_index RAILS_ENV=production ``` +## Unpause Indexing + +1. On the top bar, select **Menu > Admin**. +1. On the left sidebar, select **Settings > Advanced Search**. +1. Expand **Advanced Search**. +1. Clear the **Pause Elasticsearch indexing** checkbox. + ## Zero downtime reindexing The idea behind this reindexing method is to leverage the [Elasticsearch reindex API](https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-reindex.html) diff --git a/doc/update/index.md b/doc/update/index.md index 24afb01396a..779b8ccbc6a 100644 --- a/doc/update/index.md +++ b/doc/update/index.md @@ -289,6 +289,10 @@ sudo -u git -H bundle exec rake gitlab:elastic:list_pending_migrations See [how to retry a halted migration](../integration/elasticsearch.md#retry-a-halted-migration). +### What do I do for the error `Elasticsearch version not compatible` + +Confirm that your version of Elasticsearch or OpenSearch is [compatible with your version of GitLab](../integration/elasticsearch.md#version-requirements). + ## Upgrading without downtime Read how to [upgrade without downtime](zero_downtime.md). diff --git a/spec/frontend/clusters_list/components/agent_token_spec.js b/spec/frontend/clusters_list/components/agent_token_spec.js index 7f6ec2eb3a2..cdd94d33545 100644 --- a/spec/frontend/clusters_list/components/agent_token_spec.js +++ b/spec/frontend/clusters_list/components/agent_token_spec.js @@ -8,6 +8,7 @@ import ModalCopyButton from '~/vue_shared/components/modal_copy_button.vue'; const kasAddress = 'kas.example.com'; const agentToken = 'agent-token'; +const kasVersion = '15.0.0'; const modalId = INSTALL_AGENT_MODAL_ID; describe('InstallAgentModal', () => { @@ -21,6 +22,7 @@ describe('InstallAgentModal', () => { const createWrapper = () => { const provide = { kasAddress, + kasVersion, }; const propsData = { @@ -59,7 +61,7 @@ describe('InstallAgentModal', () => { it('renders a copy button', () => { expect(findCopyButton().props()).toMatchObject({ title: 'Copy command', - text: generateAgentRegistrationCommand(agentToken, kasAddress), + text: generateAgentRegistrationCommand(agentToken, kasAddress, kasVersion), modalId, }); }); @@ -71,6 +73,7 @@ describe('InstallAgentModal', () => { it('shows code block with agent installation command', () => { expect(findCodeBlock().props('code')).toContain(`--set config.token=${agentToken}`); expect(findCodeBlock().props('code')).toContain(`--set config.kasAddress=${kasAddress}`); + expect(findCodeBlock().props('code')).toContain(`--set image.tag=v${kasVersion}`); }); }); }); diff --git a/spec/helpers/projects/cluster_agents_helper_spec.rb b/spec/helpers/projects/cluster_agents_helper_spec.rb index 6849ec8b5ea..4045a7f6bf7 100644 --- a/spec/helpers/projects/cluster_agents_helper_spec.rb +++ b/spec/helpers/projects/cluster_agents_helper_spec.rb @@ -33,6 +33,7 @@ RSpec.describe Projects::ClusterAgentsHelper do empty_state_svg_path: kind_of(String), can_admin_vulnerability: "true", kas_address: Gitlab::Kas.external_url, + kas_version: Gitlab::Kas.version_info, can_admin_cluster: "false" }) } diff --git a/spec/models/pool_repository_spec.rb b/spec/models/pool_repository_spec.rb index 92b3e41cd18..447b7b2e0a2 100644 --- a/spec/models/pool_repository_spec.rb +++ b/spec/models/pool_repository_spec.rb @@ -24,23 +24,35 @@ RSpec.describe PoolRepository do end end - describe '#mark_obsolete_if_last' do + describe '#unlink_repository' do let(:pool) { create(:pool_repository, :ready) } + let(:repository_path) { File.join(TestEnv.repos_path, pool.source_project.repository.relative_path) } + let(:alternates_file) { File.join(repository_path, 'objects', 'info', 'alternates') } + + before do + pool.link_repository(pool.source_project.repository) + end context 'when the last member leaves' do it 'schedules pool removal' do expect(::ObjectPool::DestroyWorker).to receive(:perform_async).with(pool.id).and_call_original - pool.mark_obsolete_if_last(pool.source_project.repository) + pool.unlink_repository(pool.source_project.repository) + + expect(File).not_to exist(alternates_file) end end context 'when the second member leaves' do it 'does not schedule pool removal' do - create(:project, :repository, pool_repository: pool) + other_project = create(:project, :repository, pool_repository: pool) + pool.link_repository(other_project.repository) + expect(::ObjectPool::DestroyWorker).not_to receive(:perform_async).with(pool.id) - pool.mark_obsolete_if_last(pool.source_project.repository) + pool.unlink_repository(pool.source_project.repository) + + expect(File).not_to exist(alternates_file) end end end |