Made gitlab:group:ensureExists action idempotent.
Signed-off-by: Bogdan Nechyporenko <bnechyporenko@bol.com>
This commit is contained in:
committed by
blam
parent
275632c349
commit
a0419a6c6c
@@ -0,0 +1,6 @@
|
||||
---
|
||||
'@backstage/plugin-scaffolder-backend-module-gitlab': patch
|
||||
'@backstage/plugin-scaffolder-node-test-utils': patch
|
||||
---
|
||||
|
||||
Made gitlab:group:ensureExists action idempotent
|
||||
@@ -90,17 +90,24 @@ export const createGitlabGroupEnsureExistsAction = (options: {
|
||||
);
|
||||
if (!subGroup) {
|
||||
ctx.logger.info(`creating missing group ${fullPath}`);
|
||||
parentId = (
|
||||
await api.Groups.create(
|
||||
name,
|
||||
slug,
|
||||
parentId
|
||||
? {
|
||||
parentId: parentId,
|
||||
}
|
||||
: {},
|
||||
)
|
||||
)?.id;
|
||||
|
||||
parentId = await ctx.checkpoint({
|
||||
key: `ensure.${name}.${slug}.${parentId}`,
|
||||
// eslint-disable-next-line no-loop-func
|
||||
fn: async () => {
|
||||
return (
|
||||
await api.Groups.create(
|
||||
name,
|
||||
slug,
|
||||
parentId
|
||||
? {
|
||||
parentId: parentId,
|
||||
}
|
||||
: {},
|
||||
)
|
||||
)?.id;
|
||||
},
|
||||
});
|
||||
} else {
|
||||
parentId = subGroup.id;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user