diff --git a/web/docs/installation.mdx b/web/docs/installation.mdx index 027d1e8..01ee3c7 100644 --- a/web/docs/installation.mdx +++ b/web/docs/installation.mdx @@ -54,10 +54,9 @@ Both checks are required before proceeding with the installation. ## Installing the Barman Cloud Plugin -import { InstallationSnippet } from '@site/src/components/Installation'; +import { InstallationSnippet, ManifestVersion } from '@site/src/components/Installation'; -Install the plugin using `kubectl` by applying the manifest for the latest -release: +Install the plugin using `kubectl` by applying the manifest for : @@ -98,12 +97,6 @@ deployment "barman-cloud" successfully rolled out This confirms that the plugin is deployed and ready to use. -## Testing the latest development snapshot +import { DevSnapshotSection } from '@site/src/components/Installation'; -You can also test the latest development snapshot of the plugin with the -following command: - -```sh -kubectl apply -f \ - https://raw.githubusercontent.com/cloudnative-pg/plugin-barman-cloud/refs/heads/main/manifest.yaml -``` + diff --git a/web/src/components/Installation/index.tsx b/web/src/components/Installation/index.tsx index b149709..255abdd 100644 --- a/web/src/components/Installation/index.tsx +++ b/web/src/components/Installation/index.tsx @@ -1,6 +1,7 @@ import {ReactElement} from 'react'; import CodeBlock from '@theme/CodeBlock'; import {useActiveVersion} from '@docusaurus/plugin-content-docs/client'; +import Heading from '@theme/Heading'; // InstallationSnippet is the kubectl incantation to install the Barman // Cloud Plugin: the manifest matching the doc version being viewed, or @@ -17,3 +18,32 @@ export function InstallationSnippet(): ReactElement { ); } + +// ManifestVersion names the manifest the snippet below installs: the +// release tag for a versioned docs page, or the main branch on Dev docs. +export function ManifestVersion(): ReactElement { + const activeVersion = useActiveVersion('default'); + return activeVersion && activeVersion.name !== 'current' + ? <>version v{activeVersion.name} + : <>the latest development snapshot from the main branch; +} + + +// DevSnapshotSection offers the main-branch manifest as an alternative; +// on the Dev docs the main install already is that manifest, so hide it. +export function DevSnapshotSection(): ReactElement | null { + const activeVersion = useActiveVersion('default'); + const url = 'https://raw.githubusercontent.com/cloudnative-pg/plugin-barman-cloud/refs/heads/main/manifest.yaml'; + if (!activeVersion || activeVersion.name === 'current') return null; + return ( + <> + + Testing the latest development snapshot + + + {`kubectl apply -f \\ + ${url}`} + + + ); +} diff --git a/web/versioned_docs/version-0.13.0/installation.mdx b/web/versioned_docs/version-0.13.0/installation.mdx index 027d1e8..01ee3c7 100644 --- a/web/versioned_docs/version-0.13.0/installation.mdx +++ b/web/versioned_docs/version-0.13.0/installation.mdx @@ -54,10 +54,9 @@ Both checks are required before proceeding with the installation. ## Installing the Barman Cloud Plugin -import { InstallationSnippet } from '@site/src/components/Installation'; +import { InstallationSnippet, ManifestVersion } from '@site/src/components/Installation'; -Install the plugin using `kubectl` by applying the manifest for the latest -release: +Install the plugin using `kubectl` by applying the manifest for : @@ -98,12 +97,6 @@ deployment "barman-cloud" successfully rolled out This confirms that the plugin is deployed and ready to use. -## Testing the latest development snapshot +import { DevSnapshotSection } from '@site/src/components/Installation'; -You can also test the latest development snapshot of the plugin with the -following command: - -```sh -kubectl apply -f \ - https://raw.githubusercontent.com/cloudnative-pg/plugin-barman-cloud/refs/heads/main/manifest.yaml -``` + diff --git a/web/versioned_docs/version-0.14.0/installation.mdx b/web/versioned_docs/version-0.14.0/installation.mdx index 027d1e8..01ee3c7 100644 --- a/web/versioned_docs/version-0.14.0/installation.mdx +++ b/web/versioned_docs/version-0.14.0/installation.mdx @@ -54,10 +54,9 @@ Both checks are required before proceeding with the installation. ## Installing the Barman Cloud Plugin -import { InstallationSnippet } from '@site/src/components/Installation'; +import { InstallationSnippet, ManifestVersion } from '@site/src/components/Installation'; -Install the plugin using `kubectl` by applying the manifest for the latest -release: +Install the plugin using `kubectl` by applying the manifest for : @@ -98,12 +97,6 @@ deployment "barman-cloud" successfully rolled out This confirms that the plugin is deployed and ready to use. -## Testing the latest development snapshot +import { DevSnapshotSection } from '@site/src/components/Installation'; -You can also test the latest development snapshot of the plugin with the -following command: - -```sh -kubectl apply -f \ - https://raw.githubusercontent.com/cloudnative-pg/plugin-barman-cloud/refs/heads/main/manifest.yaml -``` +