From ca0ac99493605b1657f975b0a47103a38495097d Mon Sep 17 00:00:00 2001 From: cmoulliard Date: Wed, 3 Jan 2024 17:04:08 +0100 Subject: [PATCH] Add a sleep of 2s to let the step to register the newly catalog created from the gitea server Signed-off-by: cmoulliard --- plugins/scaffolder-backend-module-gitea/src/actions/gitea.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/plugins/scaffolder-backend-module-gitea/src/actions/gitea.ts b/plugins/scaffolder-backend-module-gitea/src/actions/gitea.ts index b11d5bf765..e8c7328245 100644 --- a/plugins/scaffolder-backend-module-gitea/src/actions/gitea.ts +++ b/plugins/scaffolder-backend-module-gitea/src/actions/gitea.ts @@ -216,6 +216,8 @@ export function createPublishGiteaAction(options: { sourcePath, } = ctx.input; + const sleep = (ms: number | undefined) => + new Promise(r => setTimeout(r, ms)); const { repo, host, owner } = parseRepoUrl(repoUrl, integrations); const integrationConfig = integrations.gitea.byHost(host); @@ -269,6 +271,9 @@ export function createPublishGiteaAction(options: { gitAuthorInfo, }); + // TODO: As mentioned by Ben lambert, we should poll an endpoint to see if it's ready yet instead of hard coding a sleep + await sleep(2000); + const repoContentsUrl = `${integrationConfig.config.baseUrl}/${owner}/${repo}/+/refs/${defaultBranch}`; ctx.output('remoteUrl', remoteUrl); ctx.output('commitHash', commitResult?.commitHash);