Skip to content

Commit 30996b7

Browse files
j-zimnowodaAni1357
authored andcommitted
fix: ensure correct working directory and increase retry timeout (#1882)
(cherry picked from commit 4ab74e0)
1 parent 184daa5 commit 30996b7

File tree

2 files changed

+6
-7
lines changed

2 files changed

+6
-7
lines changed

src/cmd/apply.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import { getCurrentVersion, getImageTag, writeValuesToFile } from 'src/common/va
1212
import { HelmArguments, getParsedArgs, helmOptions, setParsedArgs } from 'src/common/yargs'
1313
import { ProcessOutputTrimmed } from 'src/common/zx-enhance'
1414
import { Argv, CommandModule } from 'yargs'
15-
import { $, nothrow } from 'zx'
15+
import { $, cd } from 'zx'
1616
import { applyAsApps } from './apply-as-apps'
1717
import {
1818
cloneOtomiChartsInGitea,
@@ -146,12 +146,11 @@ const apply = async (): Promise<void> => {
146146
if (!argv.label && !argv.file) {
147147
await retry(async (bail) => {
148148
try {
149+
cd(rootDir)
149150
await applyAll()
150151
} catch (e) {
151152
d.error(e)
152-
await nothrow($`helm uninstall wait-for-otomi-realm -n maintenance`)
153-
await nothrow($`kubectl delete job wait-for-otomi-realm -n maintenance`)
154-
d.info(`Retrying in ${retryOptions.maxRetryTime} ms`)
153+
d.info(`Retrying in ${retryOptions.maxTimeout} ms`)
155154
throw e
156155
}
157156
}, retryOptions)

src/common/k8s.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
/* eslint-disable no-loop-func */
22
/* eslint-disable no-await-in-loop */
3+
import { CoreV1Api, V1Secret } from '@kubernetes/client-node'
34
import retry, { Options } from 'async-retry'
45
import { AnyAaaaRecord, AnyARecord } from 'dns'
56
import { resolveAny } from 'dns/promises'
@@ -16,7 +17,6 @@ import { env } from './envalid'
1617
import { hfValues } from './hf'
1718
import { parser } from './yargs'
1819
import { askYesNo } from './zx-enhance'
19-
import { CoreV1Api, V1Secret } from '@kubernetes/client-node'
2020

2121
export const secretId = `secret/otomi/${DEPLOYMENT_PASSWORDS_SECRET}`
2222

@@ -212,7 +212,7 @@ type WaitTillAvailableOptions = Options & {
212212

213213
export const waitTillGitRepoAvailable = async (repoUrl): Promise<void> => {
214214
const retryOptions: Options = {
215-
retries: 10,
215+
retries: 20,
216216
maxTimeout: 30000,
217217
}
218218
const d = terminal('common:k8s:waitTillGitRepoAvailable')
@@ -222,7 +222,7 @@ export const waitTillGitRepoAvailable = async (repoUrl): Promise<void> => {
222222
// the ls-remote exist with zero even if repo is empty
223223
await $`git ls-remote ${repoUrl}`
224224
} catch (e) {
225-
d.warn(e.message)
225+
d.warn(`The ${repoUrl} is not yet reachable. Retrying in ${retryOptions.maxTimeout} ms`)
226226
throw e
227227
}
228228
}, retryOptions)

0 commit comments

Comments
 (0)