Skip to content

Commit

Permalink
uberf-8149: reset workspace attempts counter tool (#6604)
Browse files Browse the repository at this point in the history
Signed-off-by: Alexey Zinoviev <[email protected]>
  • Loading branch information
lexiv0re authored Sep 17, 2024
1 parent 434773d commit 9459fde
Showing 1 changed file with 23 additions and 2 deletions.
25 changes: 23 additions & 2 deletions dev/tool/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -524,7 +524,8 @@ export function devTool (
await updateWorkspace(db, info, {
mode: 'active',
progress: 100,
version
version,
attempts: 0
})

console.log(metricsToString(measureCtx.metrics, 'upgrade', 60))
Expand Down Expand Up @@ -572,7 +573,8 @@ export function devTool (
await updateWorkspace(db, ws, {
mode: 'active',
progress: 100,
version
version,
attempts: 0
})
} catch (err: any) {
console.error(err)
Expand Down Expand Up @@ -1589,6 +1591,25 @@ export function devTool (
})
})

program
.command('reset-ws-attempts <name>')
.description('Reset workspace creation/upgrade attempts counter')
.action(async (workspace) => {
const { mongodbUri } = prepareTools()
await withDatabase(mongodbUri, async (db) => {
const info = await getWorkspaceById(db, workspace)
if (info === null) {
throw new Error(`workspace ${workspace} not found`)
}

await updateWorkspace(db, info, {
attempts: 0
})

console.log('Attempts counter for workspace', workspace, 'has been reset')
})
})

extendProgram?.(program)

program.parse(process.argv)
Expand Down

0 comments on commit 9459fde

Please sign in to comment.