mirror of
https://github.com/renovatebot/renovate.git
synced 2026-11-01 10:09:50 +00:00
aae889a285
* fix(datasource/go): cache the publication time of each version The Go proxy defines that the `.info` API call is for a specific release version of a module, this file should never be modified after it's been created. However, because we previously had a 30m TTL on these entries, a repository that runs infrequently can lead to re-fetching data that doesn't ever update. We can fix this by introducing a separate cache namespace for the module's creation timestamp (`Time` in the `.info` API call). We can make sure that: - we always merge, not replace, the entries, as the `major < 2` filter in `_getReleases` means a run may only see a subset of a module's versions, and writing back only what we saw would evict the rest - we re-read immediately before writing, as `foo` and `foo/v2` are separate lookups which both walk the `v2` module, so one can overwrite the other's timestamps - the key is the proxy which served the data, minus any credentials, since a private Artifactory `GOPROXY` is a different universe of timestamps to `proxy.golang.org` - only the timestamps we successfully fetched are stored, so a proxy which serves no `Time` doesn't have that recorded for 100 days - it uses its own namespace, so that a `cacheTtlOverride` on the release cache doesn't drag the immutable data down with it Co-authored-by: Claude Opus 5 <jamie.tanna+claude-code@mend.io> * fixup! fix(datasource/go): cache the publication time of each version Co-authored-by: Claude Sonnet 5 <jamie.tanna+claude-code@mend.io> * fixup! fixup! fix(datasource/go): cache the publication time of each version Co-Authored-By: Claude Sonnet 5 <jamie.tanna+claude-code@mend.io> --------- Co-authored-by: Claude Opus 5 <jamie.tanna+claude-code@mend.io>
25 lines
778 B
TypeScript
25 lines
778 B
TypeScript
import { z } from 'zod/v4';
|
|
import { MaybeTimestamp, Timestamp } from '../../../util/timestamp.ts';
|
|
|
|
// https://go.dev/ref/mod#goproxy-protocol
|
|
export const VersionInfo = z.object({
|
|
Version: z.string(),
|
|
Time: MaybeTimestamp,
|
|
// https://github.com/golang/go/blob/dd612356d8bfe352ec7812ce6c93c9fd2bc10c81/src/cmd/go/internal/modfetch/codehost/codehost.go#L93
|
|
Origin: z
|
|
.object({
|
|
VCS: z.string().optional(),
|
|
URL: z.string().optional(),
|
|
})
|
|
.optional(),
|
|
});
|
|
|
|
export type VersionInfo = z.infer<typeof VersionInfo>;
|
|
|
|
/**
|
|
* The publication time of each version of a module, as served by a given Go proxy.
|
|
*/
|
|
export const VersionTimestamps = z.record(z.string(), Timestamp).catch({});
|
|
|
|
export type VersionTimestamps = z.infer<typeof VersionTimestamps>;
|