Cherry pick PRs from 6.4.4 and 6.4.3 (#7309)

* Add support for using release branch targetted PRs (#7291)

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* Fix namespaces not respecting accessible namespace config (#7279)

* Fix namespaces not respecting accessible namespace config

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* Fix warning hover text formatting

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* Log state after refresh accessibility

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* Fix tests

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* Fix NamespaceStore.allowedNamespaces

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* Remove unnecessary '?'

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* Add deprecation messages

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* Move selected_namespaces storage to injectable

- And its initialization

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* Implement contextNamespaces logic in forNamespacedResources

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* Update snapshot

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* Fix formatting

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* Fix formatting

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* Fix test

- This was a side effect of the previous bug fixes where
  the clusterContext.hasAllSelected was previously erroneously 'false'

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* Change log level

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* Fix another test suite

Signed-off-by: Sebastian Malton <sebastian@malton.name>

---------

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* Fix not showing some non-core kinds (#7303)

* Fix not showing some non-core kinds

- Specifically if a Kind is not present within the preferredVersion of
  a group then we don't know that resource exists

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* Add technical tests

Signed-off-by: Sebastian Malton <sebastian@malton.name>

---------

Signed-off-by: Sebastian Malton <sebastian@malton.name>

---------

Signed-off-by: Sebastian Malton <sebastian@malton.name>
This commit is contained in:
Sebastian Malton authored and GitHub committed 2023-03-07 09:46:00 -08:00
1 parent f69dd6fc8f
commit 0fe4daf8d3
22 files changed
+311 -77

No files matched your search

+19 -5
View File
@@ -57,6 +57,7 @@ interface GithubPrData {
interface ExtendedGithubPrData extends Omit<GithubPrData, "mergedAt"> {
mergedAt: Date;
shouldAttemptCherryPick: boolean;
}
async function getCurrentBranch(): Promise<string> {
@@ -190,7 +191,7 @@ function sortExtendedGithubPrData(left: ExtendedGithubPrData, right: ExtendedGit
return -1;
}
async function getRelevantPRs(previousReleasedVersion: string): Promise<ExtendedGithubPrData[]> {
async function getRelevantPRs(previousReleasedVersion: string, baseBranch: string): Promise<ExtendedGithubPrData[]> {
console.log("retrieving previous 200 PRs...");
const milestone = formatVersionForPickingPrs(await getCurrentVersionOfSubPackage("core"));
@@ -200,7 +201,7 @@ async function getRelevantPRs(previousReleasedVersion: string): Promise<Extended
"list",
"--limit=500", // Should be big enough, if not we need to release more often ;)
"--state=merged",
"--base=master",
`--base=${baseBranch}`,
"--json mergeCommit,title,author,labels,number,milestone,mergedAt",
];
@@ -217,7 +218,11 @@ async function getRelevantPRs(previousReleasedVersion: string): Promise<Extended
.filter(query => query.stdout)
.map(query => query.pr)
.filter(pr => pr.labels.every(label => label.name !== "skip-changelog"))
.map(pr => ({ ...pr, mergedAt: new Date(pr.mergedAt) } as ExtendedGithubPrData))
.map(pr => ({
...pr,
mergedAt: new Date(pr.mergedAt),
shouldAttemptCherryPick: baseBranch === "master",
}))
.sort(sortExtendedGithubPrData);
}
@@ -300,7 +305,11 @@ async function cherryPickCommits(prs: ExtendedGithubPrData[]): Promise<void> {
const cherryPickCommit = cherryPickCommitWith(rl);
for (const pr of prs) {
await cherryPickCommit(pr.mergeCommit.oid);
if (pr.shouldAttemptCherryPick) {
await cherryPickCommit(pr.mergeCommit.oid);
} else {
console.log(`Skipping cherry picking of #${pr.number} - ${pr.title}`);
}
}
rl.close();
@@ -335,7 +344,12 @@ async function createRelease(): Promise<void> {
await bumpPackageVersions();
}
const relevantPrs = await getRelevantPRs(previousReleasedVersion);
const relevantPrs = await getRelevantPRs(previousReleasedVersion, "master");
if (prBase !== "master") {
relevantPrs.push(...await getRelevantPRs(previousReleasedVersion, prBase));
}
const selectedPrs = await pickRelevantPrs(relevantPrs, isMasterBranch);
const prBody = formatChangelog(previousReleasedVersion, selectedPrs);