Skip to content

Commit

Permalink
fix: Improve openshift version detection
Browse files Browse the repository at this point in the history
Signed-off-by: Anatolii Bazko <[email protected]>
  • Loading branch information
tolusha committed Sep 5, 2024
1 parent 0a6b042 commit 400152c
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -290,11 +290,12 @@ export namespace CheCtlContext {
async function getOpenShiftVersion(): Promise<string | undefined> {
const { stdout } = await execa('oc', ['version', '-o', 'json'], { timeout: 60_000 })
const versionOutput = JSON.parse(stdout)
const version = (versionOutput.openshiftVersion as string).match(/^\d.\d+/)
if (version) {
return version[0]
if (versionOutput?.openshiftVersion) {
const version = (versionOutput.openshiftVersion as string).match(/^\d.\d+/)
if (version) {
return version[0]
}
}

return '4.x'

Check failure on line 299 in src/context.ts

View workflow job for this annotation

GitHub Actions / release-test

Expected blank line before this statement

Check failure on line 299 in src/context.ts

View workflow job for this annotation

GitHub Actions / unit-tests

Expected blank line before this statement
}

Expand Down

0 comments on commit 400152c

Please sign in to comment.