import {ReactElement} from 'react'; import CodeBlock from '@theme/CodeBlock'; import {useActiveVersion} from '@docusaurus/plugin-content-docs/client'; // DEV_MANIFEST_URL is the URL of the manifest.yaml on the main branch of the plugin repo. const DEV_MANIFEST_URL = 'https://raw.githubusercontent.com/cloudnative-pg/plugin-barman-cloud/refs/heads/main/manifest.yaml'; // InstallationSnippet is the kubectl incantation to install the Barman // Cloud Plugin: the manifest matching the doc version being viewed, or // (on the unreleased "current" docs) the latest manifest on main. export function InstallationSnippet(): ReactElement { const activeVersion = useActiveVersion('default'); const url = activeVersion && activeVersion.name !== 'current' ? `https://github.com/cloudnative-pg/plugin-barman-cloud/releases/download/v${activeVersion.name}/manifest.yaml` : DEV_MANIFEST_URL; return ( {`kubectl apply -f \\ ${url}`} ); } // 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' ? 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 { const activeVersion = useActiveVersion('default'); if (!activeVersion || activeVersion.name === 'current') { return (

The install command above already applies the latest development snapshot from the main branch.

); } return ( <>

You can also test the latest development snapshot of the plugin with the following command:

{`kubectl apply -f \\ ${DEV_MANIFEST_URL}`} ); }