@redpanda-data/docs-extensions-and-macros 5.13.2 → 5.13.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -13,8 +13,13 @@ module.exports = async (github, owner, repo, logger = null) => {
|
|
|
13
13
|
per_page: 50
|
|
14
14
|
});
|
|
15
15
|
|
|
16
|
-
// Filter valid semver tags and sort them to find the highest version
|
|
16
|
+
// Filter valid semver tags and sort them to find the highest version.
|
|
17
|
+
// Drafts are dropped first, before the map discards the flag: a draft has
|
|
18
|
+
// no published Docker image, so returning its tag hands the caller a
|
|
19
|
+
// CONSOLE_VERSION that cannot be pulled. Drafts are only visible to
|
|
20
|
+
// callers whose token has push access to the repository.
|
|
17
21
|
const sortedReleases = releases.data
|
|
22
|
+
.filter(release => !release.draft)
|
|
18
23
|
.map(release => release.tag_name)
|
|
19
24
|
.filter(tag => semver.valid(tag.replace(/^v/, '')))
|
|
20
25
|
.sort((a, b) => semver.rcompare(a.replace(/^v/, ''), b.replace(/^v/, '')));
|
|
@@ -26,9 +26,14 @@ module.exports = async (github, owner, repo, logger = null) => {
|
|
|
26
26
|
release => !release.tag_name.includes('-rc') && !release.draft
|
|
27
27
|
);
|
|
28
28
|
|
|
29
|
-
// Find latest RC release
|
|
29
|
+
// Find latest RC release that is NOT a draft. The primary risk is a draft
|
|
30
|
+
// outranking the real latest RC (a token with push access sees drafts;
|
|
31
|
+
// unauthenticated CI does not, which is why this stays invisible there).
|
|
32
|
+
// A draft's git tag usually already exists, but isn't guaranteed to --
|
|
33
|
+
// when it's missing, the getRef below 404s, which the caller now handles
|
|
34
|
+
// per-RC instead of letting it take down the whole lookup.
|
|
30
35
|
const latestRcRelease = sortedReleases.find(
|
|
31
|
-
release => release.tag_name.includes('-rc')
|
|
36
|
+
release => release.tag_name.includes('-rc') && !release.draft
|
|
32
37
|
);
|
|
33
38
|
|
|
34
39
|
let latestRedpandaReleaseCommitHash = null;
|
|
@@ -41,14 +46,30 @@ module.exports = async (github, owner, repo, logger = null) => {
|
|
|
41
46
|
latestRedpandaReleaseCommitHash = commitData.data.object.sha;
|
|
42
47
|
}
|
|
43
48
|
|
|
49
|
+
// Resolved separately from the stable release: an RC whose tag cannot be
|
|
50
|
+
// resolved should cost us the RC, not the stable version the caller
|
|
51
|
+
// probably asked for. Only a missing tag is tolerated; transient errors
|
|
52
|
+
// still propagate so retryWithBackoff can retry them.
|
|
44
53
|
let latestRcReleaseCommitHash = null;
|
|
54
|
+
let resolvedRcRelease = latestRcRelease;
|
|
45
55
|
if (latestRcRelease) {
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
56
|
+
try {
|
|
57
|
+
const rcCommitData = await github.rest.git.getRef({
|
|
58
|
+
owner,
|
|
59
|
+
repo,
|
|
60
|
+
ref: `tags/${latestRcRelease.tag_name}`
|
|
61
|
+
});
|
|
62
|
+
latestRcReleaseCommitHash = rcCommitData.data.object.sha;
|
|
63
|
+
} catch (error) {
|
|
64
|
+
if (error.status !== 404) throw error;
|
|
65
|
+
const message = `No git tag for RC release ${latestRcRelease.tag_name}; ignoring it.`;
|
|
66
|
+
if (logger) {
|
|
67
|
+
logger.warn(message);
|
|
68
|
+
} else {
|
|
69
|
+
console.error(`⚠️ ${message}`);
|
|
70
|
+
}
|
|
71
|
+
resolvedRcRelease = null;
|
|
72
|
+
}
|
|
52
73
|
}
|
|
53
74
|
|
|
54
75
|
return {
|
|
@@ -56,8 +77,8 @@ module.exports = async (github, owner, repo, logger = null) => {
|
|
|
56
77
|
version: latestRedpandaRelease.tag_name,
|
|
57
78
|
commitHash: latestRedpandaReleaseCommitHash.substring(0, 7)
|
|
58
79
|
} : null,
|
|
59
|
-
latestRcRelease:
|
|
60
|
-
version:
|
|
80
|
+
latestRcRelease: resolvedRcRelease ? {
|
|
81
|
+
version: resolvedRcRelease.tag_name,
|
|
61
82
|
commitHash: latestRcReleaseCommitHash.substring(0, 7)
|
|
62
83
|
} : null
|
|
63
84
|
};
|