Skip to content

Commit 3985673

Browse files
NexucisCopilot
andcommitted
Add the documentation of metrics-usage
Publish the documentation of perses/metrics-usage from v0.8. The repository has no release branch, so releaseBranch is now optional: without it, every minor version is taken from its latest patch tag. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: Augustin Husson <husson.augustin@gmail.com>
1 parent 9821f5c commit 3985673

7 files changed

Lines changed: 35 additions & 12 deletions

File tree

‎AGENTS.md‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,10 @@ Before editing, read `README.md` for the local setup, the organization of the co
4545
`perses.yaml`, `prometheus.yml`, `scripts/generate_config.sh`, the other services of `docker-compose.yaml`.
4646

4747
The documentation is not written here. It is pulled at build time from perses/perses, perses/perses-operator,
48-
perses/helm-charts and perses/plugins (`docs/` of each repository). Versioned sources publish every minor version from
49-
its release branch `release/vX.Y`, or its latest patch tag. Fix the content of the documentation in its repository,
50-
and the navigation in the `docs/nav.yaml` of that repository; `content/nav/` is only a fallback for old versions.
48+
perses/helm-charts, perses/plugins and perses/metrics-usage (`docs/` of each repository). Versioned sources publish
49+
every minor version from its release branch `release/vX.Y`, or its latest patch tag. Fix the content of the
50+
documentation in its repository, and the navigation in the `docs/nav.yaml` of that repository; `content/nav/` is only a
51+
fallback for old versions.
5152

5253
## Engineering rules
5354

‎README.md‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,10 @@ It contains:
5353
- the home page, the adopters page and the blog, written in this repository (`content/`),
5454
- the documentation of [perses/perses](https://github.com/perses/perses),
5555
[perses/perses-operator](https://github.com/perses/perses-operator),
56-
[perses/helm-charts](https://github.com/perses/helm-charts) and [perses/plugins](https://github.com/perses/plugins),
57-
pulled from these repositories at build time. Perses and the operator are versioned: every minor version is
58-
published (from the release branch when it exists, the latest patch tag otherwise),
56+
[perses/helm-charts](https://github.com/perses/helm-charts), [perses/plugins](https://github.com/perses/plugins) and
57+
[perses/metrics-usage](https://github.com/perses/metrics-usage), pulled from these repositories at build time.
58+
Perses, the operator and metrics-usage are versioned: every minor version is published (from the release branch
59+
when it exists, the latest patch tag otherwise),
5960
- the download pages, built from the latest GitHub releases. In the browser, the pages also check GitHub for the
6061
releases published since the build and display them (cached 10 minutes; if GitHub is not reachable or rate limits
6162
the visitor, the releases of the build are displayed).

‎src/content/config.server.ts‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@ const linkSchema = z.object({
2323

2424
const versioningSchema = z.object({
2525
minVersion: z.string().regex(/^v\d+\.\d+$/, 'minVersion must look like vX.Y'),
26-
releaseBranch: z.string().default('release/v{major}.{minor}'),
26+
// Without release branch, each minor version is taken from its latest patch tag.
27+
releaseBranch: z.string().optional(),
2728
});
2829

2930
const sourceSchema = z

‎src/content/sync.server.ts‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,10 @@ export async function downloadDocs(source: SourceConfig, sha: string, destinatio
8181

8282
async function resolveSource(source: SourceConfig): Promise<Omit<ManifestVersion, 'dir'>[]> {
8383
if (source.versioning) {
84-
const output = await lsRemote(source.repository, ['--tags', '--heads']);
84+
const output = await lsRemote(
85+
source.repository,
86+
source.versioning.releaseBranch === undefined ? ['--tags'] : ['--tags', '--heads'],
87+
);
8588
return resolveVersions(parseLsRemote(output), source.versioning);
8689
}
8790
const branch = source.branch ?? 'main';

‎src/content/versions.server.test.ts‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,14 @@ describe('resolveVersions', () => {
6969
expect(versions).toEqual([{ id: 'v1.2', ref: 'release-1.2', sha: 'b', release: 'v1.2.0' }]);
7070
});
7171

72+
it('uses the latest patch tag of every version without release branch', () => {
73+
const versions = resolveVersions(refs, { minVersion: 'v0.54' });
74+
expect(versions).toEqual([
75+
{ id: 'v0.55', ref: 'v0.55.1', sha: 'fff1', release: 'v0.55.1' },
76+
{ id: 'v0.54', ref: 'v0.54.0', sha: 'ggg1', release: 'v0.54.0' },
77+
]);
78+
});
79+
7280
it('rejects an invalid minimum version', () => {
7381
expect(() => resolveVersions(refs, { minVersion: '0.53', releaseBranch: 'release/v{major}.{minor}' })).toThrow('invalid minor version');
7482
});

‎src/content/versions.server.ts‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,13 +84,14 @@ function compareSemver(a: Semver, b: Semver): number {
8484
* resolveVersions computes the list of published versions of a source, sorted from the most recent to the oldest.
8585
* Only minor versions having at least one final release (no pre-release) are published, so a release branch
8686
* created for a release candidate doesn't appear before the release is out.
87+
* Without releaseBranch, every version is taken from its latest patch tag.
8788
*/
8889
export function resolveVersions(
8990
refs: GitRef[],
90-
options: { minVersion: string; releaseBranch: string },
91+
options: { minVersion: string; releaseBranch?: string },
9192
): ResolvedVersion[] {
9293
const min = parseMinorVersion(options.minVersion);
93-
const branchMatcher = branchRegexp(options.releaseBranch);
94+
const branchMatcher = options.releaseBranch === undefined ? undefined : branchRegexp(options.releaseBranch);
9495
const latestTags = new Map<string, { semver: Semver; ref: GitRef }>();
9596
const branches = new Map<string, GitRef>();
9697

@@ -108,7 +109,7 @@ export function resolveVersions(
108109
}
109110
continue;
110111
}
111-
const branch = branchMatcher.exec(ref.name);
112+
const branch = branchMatcher?.exec(ref.name);
112113
if (branch?.groups) {
113114
branches.set(`v${Number(branch.groups.major)}.${Number(branch.groups.minor)}`, ref);
114115
}

‎website.yaml‎

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ docs:
4949
legacyPath: perses/docs
5050
versioning:
5151
# Each minor version is published. The docs are taken from the release branch when it exists,
52-
# otherwise from the latest patch tag.
52+
# otherwise from the latest patch tag. Without `releaseBranch`, only the tags are used.
5353
minVersion: v0.53
5454
releaseBranch: release/v{major}.{minor}
5555
- id: operator
@@ -75,6 +75,14 @@ docs:
7575
docsDir: docs
7676
legacyPath: plugins/docs
7777
branch: main
78+
- id: metrics-usage
79+
title: Metrics Usage
80+
description: Track the usage of metrics across dashboards, alerting rules and recording rules.
81+
repository: perses/metrics-usage
82+
docsDir: docs
83+
versioning:
84+
# No release branch: each minor version is taken from its latest patch tag.
85+
minVersion: v0.8
7886

7987
blog:
8088
title: Perses Blog

0 commit comments

Comments
 (0)