From 10b9592fb8508c85105185db2680a7360c6dfd3d Mon Sep 17 00:00:00 2001 From: Leonardo Cecchi Date: Wed, 14 May 2025 11:36:52 +0200 Subject: [PATCH] chore: review Signed-off-by: Leonardo Cecchi --- web/docs/installation.mdx | 18 ++---------------- web/src/components/Installation/index.tsx | 16 ++++++++++++++++ web/src/hooks/versions.ts | 1 + 3 files changed, 19 insertions(+), 16 deletions(-) create mode 100644 web/src/components/Installation/index.tsx diff --git a/web/docs/installation.mdx b/web/docs/installation.mdx index bb003c0..85bd41b 100644 --- a/web/docs/installation.mdx +++ b/web/docs/installation.mdx @@ -4,22 +4,6 @@ sidebar_position: 20 # Installation - - -import { react } from 'react'; -import CodeBlock from '@theme/CodeBlock'; -import { useCurrentVersion } from '@site/src/hooks/versions'; - -export function InstallationSnippet() { - const latest = useCurrentVersion('latestReleased'); - return( - - {`kubectl apply -f \\ - https://github.com/cloudnative-pg/plugin-barman-cloud/releases/download/v${latest}/manifest.yaml`} - - ); -} - :::important 1. The plugin **must** be installed in the same namespace as the CloudNativePG operator (typically `cnpg-system`). @@ -70,6 +54,8 @@ Both checks are required before proceeding with the installation. ## Installing the Barman Cloud Plugin +import { InstallationSnippet } from '@site/src/components/Installation'; + Install the plugin using `kubectl` by applying the manifest for the latest release: diff --git a/web/src/components/Installation/index.tsx b/web/src/components/Installation/index.tsx new file mode 100644 index 0000000..1ffd030 --- /dev/null +++ b/web/src/components/Installation/index.tsx @@ -0,0 +1,16 @@ +import { react } from 'react'; +import CodeBlock from '@theme/CodeBlock'; +import { useCurrentVersion } from '@site/src/hooks/versions'; + +// InstallationSnippet is the kubectl incantation to install the lastest +// available version of the Barman Cloud Plugin. +export function InstallationSnippet() { + const latest = useCurrentVersion('latestReleased'); + return( + + {`kubectl apply -f \\ + https://github.com/cloudnative-pg/plugin-barman-cloud/releases/download/v${latest}/manifest.yaml`} + + ); +} + diff --git a/web/src/hooks/versions.ts b/web/src/hooks/versions.ts index 6306227..706800c 100644 --- a/web/src/hooks/versions.ts +++ b/web/src/hooks/versions.ts @@ -19,6 +19,7 @@ export function useLatestReleasedVersion() { const versioned = versions.filter(v => v.name !== 'current'); // Assuming the latest is the first in the list after sorting by semantic version + // in descending order const latestVersion = versioned.length > 0 ? versioned.sort((a, b) => (b.name.localeCompare(a.name, undefined, {numeric: true, sensitivity: 'base'})))[0] : null;