mirror of
https://github.com/cloudnative-pg/plugin-barman-cloud.git
synced 2026-09-04 22:22:21 +02:00
fix: pin the Helm chart's image tag to the plugin version
Before, each doc page hardcoded its own chart version. That is fragile: the chart is published after the plugin, so we can't know the right chart version yet when we write the docs. Now we set the image tag straight to the plugin version instead. The latest release skips this, since the chart already defaults to itself there. Signed-off-by: Marco Nenciarini <marco.nenciarini@enterprisedb.com>
This commit is contained in:
parent
8aeec18e26
commit
4961bec18d
@ -1,22 +1,36 @@
|
|||||||
import { ReactElement } from "react";
|
import {ReactElement} from 'react';
|
||||||
import CodeBlock from "@theme/CodeBlock";
|
import CodeBlock from '@theme/CodeBlock';
|
||||||
|
import {useActiveVersion, useLatestVersion} from '@docusaurus/plugin-content-docs/client';
|
||||||
|
|
||||||
type HelmInstallationProps = {
|
// HelmInstallationSnippet is the Helm command to install the plugin.
|
||||||
chartVersion?: string;
|
//
|
||||||
};
|
// - Latest release: no override. The chart already defaults to
|
||||||
|
// itself.
|
||||||
// HelmInstallationSnippet is the Helm incantation to install a specific
|
// - Older release: pin image.tag and sidecarImage.tag to that
|
||||||
// or latest available version of the Barman Cloud Plugin.
|
// version. We check this again on every build using
|
||||||
export function HelmInstallationSnippet({
|
// useLatestVersion, so an old page updates itself once a newer
|
||||||
chartVersion,
|
// version ships.
|
||||||
}: HelmInstallationProps): ReactElement<null> {
|
// - Dev docs: also no override, but this does NOT install a dev
|
||||||
const versionArg = chartVersion ? `\n --version ${chartVersion} \\` : "";
|
// build. Setting the tag alone would not be enough, since the
|
||||||
return (
|
// chart's own templates (CRDs, RBAC...) can be older than what
|
||||||
<CodeBlock language="sh">
|
// main needs. Use the kubectl method to test a dev build.
|
||||||
{`helm repo add cnpg https://cloudnative-pg.github.io/charts --force-update
|
export function HelmInstallationSnippet(): ReactElement<null> {
|
||||||
|
const activeVersion = useActiveVersion('default');
|
||||||
|
const latestVersion = useLatestVersion('default');
|
||||||
|
const isOlderRelease = activeVersion
|
||||||
|
&& activeVersion.name !== 'current'
|
||||||
|
&& activeVersion.name !== latestVersion.name;
|
||||||
|
const setArgs = isOlderRelease
|
||||||
|
? ` \\
|
||||||
|
--set image.tag=v${activeVersion.name} \\
|
||||||
|
--set sidecarImage.tag=v${activeVersion.name}`
|
||||||
|
: '';
|
||||||
|
return (
|
||||||
|
<CodeBlock language="sh">
|
||||||
|
{`helm repo add cnpg https://cloudnative-pg.github.io/charts --force-update
|
||||||
helm upgrade --install plugin-barman-cloud \\
|
helm upgrade --install plugin-barman-cloud \\
|
||||||
--namespace cnpg-system \\${versionArg}
|
--namespace cnpg-system${setArgs} \\
|
||||||
cnpg/plugin-barman-cloud`}
|
cnpg/plugin-barman-cloud`}
|
||||||
</CodeBlock>
|
</CodeBlock>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -64,7 +64,7 @@ import { HelmInstallationSnippet } from '@site/src/components/HelmInstallation';
|
|||||||
|
|
||||||
The plugin can be installed using the provided [Helm chart](https://github.com/cloudnative-pg/charts/tree/main/charts/plugin-barman-cloud):
|
The plugin can be installed using the provided [Helm chart](https://github.com/cloudnative-pg/charts/tree/main/charts/plugin-barman-cloud):
|
||||||
|
|
||||||
<HelmInstallationSnippet chartVersion="0.7.0" />
|
<HelmInstallationSnippet />
|
||||||
|
|
||||||
Example output:
|
Example output:
|
||||||
|
|
||||||
|
|||||||
@ -64,7 +64,7 @@ import { HelmInstallationSnippet } from '@site/src/components/HelmInstallation';
|
|||||||
|
|
||||||
The plugin can be installed using the provided [Helm chart](https://github.com/cloudnative-pg/charts/tree/main/charts/plugin-barman-cloud):
|
The plugin can be installed using the provided [Helm chart](https://github.com/cloudnative-pg/charts/tree/main/charts/plugin-barman-cloud):
|
||||||
|
|
||||||
<HelmInstallationSnippet chartVersion="0.7.1" />
|
<HelmInstallationSnippet />
|
||||||
|
|
||||||
Example output:
|
Example output:
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user