[PR workflow][PR Summary] should not fail on `CI-NewRPNamespaceWithoutRPaaS`
- Dominant language
- C#
- Stars
- 135
- Forks
- 260
- Avg merge
- 3d 1h
- Merged PRs (30d)
- 143
Description
PR Summary should not fail, but we might want to block the scenario in a different way.
For more context, see https://github.com/Azure/azure-rest-api-specs/pull/24974#issuecomment-1664657867
- https://dev.azure.com/azure-sdk/internal/_build/results?buildId=2974796&view=logs&j=d6a48a56-e996-55ca-2302-c3a9a7be685b&t=f4162ac4-a5be-580e-39db-db0d6209bd6a&l=183
- https://dev.azure.com/azure-sdk/internal/_build/results?buildId=2974796&view=logs&j=d6a48a56-e996-55ca-2302-c3a9a7be685b&t=f4162ac4-a5be-580e-39db-db0d6209bd6a&l=196
For a workaround, see:
- https://github.com/Azure/azure-rest-api-specs/pull/27502#issuecomment-1915427553
Relevant code adding the label that causes the PR summary task failure:
``` typescript
if (
labelsToAdd.has("new-rp-namespace") &&
!labelsToAdd.has("RPaaS")
) {
console.log(
"Adding new RP namespace, but not RPaaS, block PR. New RP namespace should be onboarded in RPaaS first."
);
labelsToAdd.add("CI-NewRPNamespaceWithoutRPaaS");
process.exitCode = 1;
}
```
This is how `RPaaS` is being added:
``` typescript
function isRPSaaS(readmeFilePath: string) {
const readmeParser = new ReadmeParser(readmeFilePath);
const openapiSubtype = readmeParser.getGlobalConfigByName("openapi-subtype");
console.log(
`readmeFilePath: ${readmeFilePath} openapi-subtype: ${openapiSubtype}`
);
return openapiSubtype === "rpaas" || openapiSubtype === "providerHub";
}
```
This is how `new-rp-namespace` is being added:
``` typescript
async function processNewRPNamespace(context: IValidatorContext) {
console.log("ENTER definition processNewRPNamespace")
const pr = await createPullRequestProperties(
context,
"pr-summary-new-rp-namespace"
);
// ...
const createSwaggerFileHandler = () => {
return (e: PRChange) => {
if (e.changeType === "Addition") {
const rpFolder = getRPFolderFromSwaggerFile(dirname(e.filePath));
console.log(`Processing newRPNameSpace rpFolder: ${rpFolder}`);
if (rpFolder !== undefined) {
const rpFolderFullPath = resolve(pr?.workingDir!, rpFolder);
if (!existsSync(rpFolderFullPath)) {
console.log(`Adding new RP namespace: ${rpFolder}`);
labelsToAdd.add("new-rp-namespace");
}
}
}
};
};
```
Contributor guide
Assessment
This issue has not been assessed yet.