Fix gitlab prepare fails with a 404.
A GitLab URL not ending in .git requires a redirect which isomorphic-git doesn't follow, resulting in a 404. This incorporates @ruloweb's fix in #4134.
This commit is contained in:
@@ -16,3 +16,5 @@ catalog:
|
||||
- type: url
|
||||
target: https://github.com/backstage/backstage/blob/other/plugins/scaffolder-backend/sample-templates/docs-template/template.yaml
|
||||
```
|
||||
|
||||
This also fixes a 404 in the prepare stage for GitLab URLs.
|
||||
|
||||
@@ -87,7 +87,7 @@ describe('GitLabPreparer', () => {
|
||||
await preparer.prepare(mockEntity, { logger: getVoidLogger() });
|
||||
|
||||
expect(mockGitClient.clone).toHaveBeenCalledWith({
|
||||
url: 'https://gitlab.com/benjdlambert/backstage-graphql-template',
|
||||
url: 'https://gitlab.com/benjdlambert/backstage-graphql-template.git',
|
||||
dir: expect.any(String),
|
||||
ref: expect.any(String),
|
||||
});
|
||||
@@ -112,7 +112,7 @@ describe('GitLabPreparer', () => {
|
||||
await preparer.prepare(mockEntity, { logger: getVoidLogger() });
|
||||
|
||||
expect(mockGitClient.clone).toHaveBeenCalledWith({
|
||||
url: 'https://gitlab.com/benjdlambert/backstage-graphql-template',
|
||||
url: 'https://gitlab.com/benjdlambert/backstage-graphql-template.git',
|
||||
dir: expect.any(String),
|
||||
ref: expect.any(String),
|
||||
});
|
||||
|
||||
@@ -41,6 +41,7 @@ export class GitlabPreparer implements PreparerBase {
|
||||
const templateId = template.metadata.name;
|
||||
|
||||
const parsedGitLocation = parseGitUrl(location);
|
||||
parsedGitLocation.git_suffix = true;
|
||||
const repositoryCheckoutUrl = parsedGitLocation.toString('https');
|
||||
const ref = parsedGitLocation.ref;
|
||||
const tempDir = await fs.promises.mkdtemp(
|
||||
|
||||
Reference in New Issue
Block a user