Merge pull request #23051 from ch007m/issue-23049

Add the missing break within the while statement of the gitea action
This commit is contained in:
Ben Lambert
2024-02-19 18:29:03 +01:00
committed by GitHub
3 changed files with 15 additions and 14 deletions
+6
View File
@@ -0,0 +1,6 @@
---
'@backstage/plugin-scaffolder-backend-module-gitea': patch
---
- Fix issue for infinite loop when repository already exists
- Log the root cause of error reported by `checkGiteaOrg`
@@ -28,8 +28,8 @@ integrations:
password: '<GITEA_LOCALHOST_PASSWORD>'
```
**NOTE**: As backstage will issue HTTPS/TLS requests to the gitea instance, it is needed to configure `gitea` with a valid certificate or at least with a
self-signed certificate `gitea cert --host localhost -ca`. Don't forget to set the env var `NODE_EXTRA_CA_CERTS` to point to the CA file before launching backstage !
**Important**: As backstage will issue HTTPS/TLS requests to the gitea instance, it is needed to configure `gitea` with a valid certificate or at least with a
self-signed certificate `gitea cert --host localhost -ca` trusted by a CA authority. Don't forget to set the env var `NODE_EXTRA_CA_CERTS` to point to the CA file before launching backstage !
When done, you can create a template which:
@@ -69,18 +69,8 @@ spec:
action: fetch:template
input:
url: ./skeleton
copyWithoutTemplating:
- .github/workflows/*
values:
component_id: ${{ parameters.component_id }}
namespace: ${{ parameters.component_id }}-dev
description: ${{ parameters.description }}
group_id: ${{ parameters.group_id }}
artifact_id: ${{ parameters.artifact_id }}
java_package_name: ${{ parameters.java_package_name }}
owner: ${{ parameters.owner }}
destination: ${{ (parameters.repoUrl | parseRepoUrl).owner }}/${{ (parameters.repoUrl | parseRepoUrl).repo }
port: 8080
name: ${{ parameters.name }}
- id: publish
name: Publishing to a gitea git repository
@@ -80,7 +80,9 @@ const checkGiteaOrg = async (
getOptions,
);
} catch (e) {
throw new Error(`Unable to get the Organization: ${owner}, ${e}`);
throw new Error(
`Unable to get the Organization: ${owner}; Error cause: ${e.cause.message}`,
);
}
if (response.status !== 200) {
throw new Error(
@@ -178,6 +180,9 @@ async function checkAvailabilityGiteaRepository(
if (response.status !== 200) {
// Repository is not yet available/accessible ...
await sleep(1000);
} else {
// Gitea repository exists !
break;
}
}
}