diff --git a/.changeset/metal-mangos-jog.md b/.changeset/metal-mangos-jog.md new file mode 100644 index 0000000000..07bbfa4e98 --- /dev/null +++ b/.changeset/metal-mangos-jog.md @@ -0,0 +1,5 @@ +--- +'@backstage/plugin-scaffolder-backend': minor +--- + +Fix gitlab scaffolder publisher diff --git a/plugins/scaffolder-backend/src/scaffolder/stages/publish/gitlab.test.ts b/plugins/scaffolder-backend/src/scaffolder/stages/publish/gitlab.test.ts index 2f33358829..4894d99291 100644 --- a/plugins/scaffolder-backend/src/scaffolder/stages/publish/gitlab.test.ts +++ b/plugins/scaffolder-backend/src/scaffolder/stages/publish/gitlab.test.ts @@ -51,7 +51,7 @@ describe('GitLab Publisher', () => { const result = await publisher.publish({ values: { isOrg: true, - storePath: 'blam/test', + storePath: 'bloum/blam/test', owner: 'bob', }, directory: '/tmp/test', @@ -82,7 +82,7 @@ describe('GitLab Publisher', () => { const result = await publisher.publish({ values: { - storePath: 'blam/test', + storePath: 'bloum/blam/test', owner: 'bob', }, directory: '/tmp/test', diff --git a/plugins/scaffolder-backend/src/scaffolder/stages/publish/gitlab.ts b/plugins/scaffolder-backend/src/scaffolder/stages/publish/gitlab.ts index 156a4a249c..c933ffb48a 100644 --- a/plugins/scaffolder-backend/src/scaffolder/stages/publish/gitlab.ts +++ b/plugins/scaffolder-backend/src/scaffolder/stages/publish/gitlab.ts @@ -52,7 +52,10 @@ export class GitlabPublisher implements PublisherBase { private async createRemote( values: RequiredTemplateValues & Record, ) { - const [owner, name] = values.storePath.split('/'); + const pathElements = values.storePath.split('/'); + const name = pathElements[pathElements.length - 1]; + pathElements.pop(); + const owner = pathElements.join('/'); let targetNamespace = ((await this.client.Namespaces.show(owner)) as { id: number;