Skip to content

Commit

Permalink
Fix gitlab scaffoler publisher
Browse files Browse the repository at this point in the history
  • Loading branch information
titilambert committed Jan 8, 2021
1 parent 730a54c commit 5eb8c9b
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/metal-mangos-jog.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@backstage/plugin-scaffolder-backend': minor
---

Fix gitlab scaffoler publisher
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import { JsonValue } from '@backstage/config';
import { initRepoAndPush } from './helpers';
import { RequiredTemplateValues } from '../templater';


export class GitlabPublisher implements PublisherBase {
private readonly client: Gitlab;
private readonly token: string;
Expand Down Expand Up @@ -52,7 +53,10 @@ export class GitlabPublisher implements PublisherBase {
private async createRemote(
values: RequiredTemplateValues & Record<string, JsonValue>,
) {
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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@ export async function initRepoAndPush({
dot: true,
});

await git.init({
dir,
});

for (const filepath of paths) {
await git.add({ dir, filepath });
}
Expand Down

0 comments on commit 5eb8c9b

Please sign in to comment.