Skip to content

Commit

Permalink
fix: Improve openshift version detection (#2929)
Browse files Browse the repository at this point in the history
* fix: Improve openshift version detection

Signed-off-by: Anatolii Bazko <[email protected]>


---------

Signed-off-by: Anatolii Bazko <[email protected]>
  • Loading branch information
tolusha authored Sep 5, 2024
1 parent 0a6b042 commit 82dfd2c
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -290,9 +290,11 @@ 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'
Expand Down

0 comments on commit 82dfd2c

Please sign in to comment.