@@ -33,6 +33,7 @@ const kubectlUtils = require('./js/kubectlUtils');
3333const helmUtils = require ( './js/helmUtils' ) ;
3434const openSSLUtils = require ( './js/openSSLUtils' ) ;
3535const osUtils = require ( './js/osUtils' ) ;
36+ const githubUtils = require ( './js/githubUtils' ) ;
3637const { initializeAutoUpdater, registerAutoUpdateListeners, installUpdates, getUpdateInformation } = require ( './js/appUpdater' ) ;
3738const { startWebLogicRemoteConsoleBackend, getDefaultDirectoryForOpenDialog, setWebLogicRemoteConsoleHomeAndStart,
3839 getDefaultWebLogicRemoteConsoleHome, getWebLogicRemoteConsoleBackendPort } = require ( './js/wlRemoteConsoleUtils' ) ;
@@ -43,6 +44,7 @@ const { deployApplication, deployComponents, deployProject, getComponentNamesByN
4344
4445const { getHttpsProxyUrl, getBypassProxyHosts } = require ( './js/userSettings' ) ;
4546const { sendToWindow } = require ( './js/windowUtils' ) ;
47+ const { compareVersions} = require ( './js/versionUtils' ) ;
4648
4749const WKT_CONSOLE_STDOUT_CHANNEL = 'show-console-out-line' ;
4850const WKT_CONSOLE_STDERR_CHANNEL = 'show-console-err-line' ;
@@ -348,6 +350,10 @@ class Main {
348350 return this . _wktMode . isDevelopmentMode ( ) ;
349351 } ) ;
350352
353+ ipcMain . handle ( 'get-latest-wko-version-number' , async ( ) => {
354+ return wktTools . getLatestWkoVersion ( ) ;
355+ } ) ;
356+
351357 ipcMain . handle ( 'get-latest-wko-image-name' , async ( ) => {
352358 return wktTools . getLatestWkoImageName ( ) ;
353359 } ) ;
@@ -815,12 +821,17 @@ class Main {
815821 return helmUtils . addOrUpdateWkoHelmChart ( helmExe , helmOptions ) ;
816822 } ) ;
817823
818- ipcMain . handle ( 'helm-install-wko' , async ( event , helmExe , helmReleaseName , operatorNamespace , helmChartValues , helmOptions , kubectlExe , kubectlOptions ) => {
819- const results = await helmUtils . installWko ( helmExe , helmReleaseName , operatorNamespace , helmChartValues , helmOptions ) ;
824+ ipcMain . handle ( 'helm-install-wko' , async ( event , helmExe , helmReleaseName , operatorVersion ,
825+ operatorNamespace , helmChartValues , helmOptions , kubectlExe , kubectlOptions ) => {
826+ const results = await helmUtils . installWko ( helmExe , helmReleaseName , operatorVersion , operatorNamespace , helmChartValues , helmOptions ) ;
820827 if ( results . isSuccess ) {
821- const versionResults = await kubectlUtils . getOperatorVersion ( kubectlExe , operatorNamespace , kubectlOptions ) ;
822- if ( versionResults . isSuccess ) {
823- results . version = versionResults . version ;
828+ if ( operatorVersion ) {
829+ results . version = operatorVersion ;
830+ } else {
831+ const versionResults = await kubectlUtils . getOperatorVersion ( kubectlExe , operatorNamespace , kubectlOptions ) ;
832+ if ( versionResults . isSuccess ) {
833+ results . version = versionResults . version ;
834+ }
824835 }
825836 }
826837 return Promise . resolve ( results ) ;
@@ -830,9 +841,9 @@ class Main {
830841 return helmUtils . uninstallWko ( helmExe , helmReleaseName , operatorNamespace , helmOptions ) ;
831842 } ) ;
832843
833- ipcMain . handle ( 'helm-update-wko' , async ( event , helmExe , operatorName ,
844+ ipcMain . handle ( 'helm-update-wko' , async ( event , helmExe , operatorName , operatorVersion ,
834845 operatorNamespace , helmChartValues , helmOptions , kubectlExe = undefined , kubectlOptions = undefined ) => {
835- const results = await helmUtils . updateWko ( helmExe , operatorName , operatorNamespace , helmChartValues , helmOptions ) ;
846+ const results = await helmUtils . updateWko ( helmExe , operatorName , operatorVersion , operatorNamespace , helmChartValues , helmOptions ) ;
836847 if ( kubectlExe && results . isSuccess ) {
837848 const versionResults = await kubectlUtils . getOperatorVersion ( kubectlExe , operatorNamespace , kubectlOptions ) ;
838849 if ( versionResults . isSuccess ) {
@@ -990,6 +1001,25 @@ class Main {
9901001 return getDefaultWebLogicRemoteConsoleHome ( ) ;
9911002 } ) ;
9921003
1004+ // eslint-disable-next-line no-unused-vars
1005+ ipcMain . handle ( 'get-wko-release-versions' , async ( event , minimumVersion = '3.3.0' ) => {
1006+ const ghApiWkoBaseUrl = 'https://api.github.com/repos/oracle/weblogic-kubernetes-operator' ;
1007+
1008+ return new Promise ( resolve => {
1009+ githubUtils . getReleaseVersions ( 'WebLogic Kubernetes Operator' , ghApiWkoBaseUrl ) . then ( results => {
1010+ const mappedResults = [ ] ;
1011+ results . forEach ( result => {
1012+ const version = result . tag . slice ( 1 ) ;
1013+ // Filter out versions less than the minimum we want to support...
1014+ if ( compareVersions ( version , minimumVersion ) >= 0 ) {
1015+ mappedResults . push ( { ...result , version } ) ;
1016+ }
1017+ } ) ;
1018+ resolve ( mappedResults ) ;
1019+ } ) ;
1020+ } ) ;
1021+ } ) ;
1022+
9931023 // eslint-disable-next-line no-unused-vars
9941024 ipcMain . handle ( 'get-verrazzano-release-versions' , async ( event , minimumVersion = undefined ) => {
9951025 return getVerrazzanoReleaseVersions ( minimumVersion ) ;
0 commit comments