@@ -33,6 +33,7 @@ const kubectlUtils = require('./js/kubectlUtils');
33
33
const helmUtils = require ( './js/helmUtils' ) ;
34
34
const openSSLUtils = require ( './js/openSSLUtils' ) ;
35
35
const osUtils = require ( './js/osUtils' ) ;
36
+ const githubUtils = require ( './js/githubUtils' ) ;
36
37
const { initializeAutoUpdater, registerAutoUpdateListeners, installUpdates, getUpdateInformation } = require ( './js/appUpdater' ) ;
37
38
const { startWebLogicRemoteConsoleBackend, getDefaultDirectoryForOpenDialog, setWebLogicRemoteConsoleHomeAndStart,
38
39
getDefaultWebLogicRemoteConsoleHome, getWebLogicRemoteConsoleBackendPort } = require ( './js/wlRemoteConsoleUtils' ) ;
@@ -43,6 +44,7 @@ const { deployApplication, deployComponents, deployProject, getComponentNamesByN
43
44
44
45
const { getHttpsProxyUrl, getBypassProxyHosts } = require ( './js/userSettings' ) ;
45
46
const { sendToWindow } = require ( './js/windowUtils' ) ;
47
+ const { compareVersions} = require ( './js/versionUtils' ) ;
46
48
47
49
const WKT_CONSOLE_STDOUT_CHANNEL = 'show-console-out-line' ;
48
50
const WKT_CONSOLE_STDERR_CHANNEL = 'show-console-err-line' ;
@@ -348,6 +350,10 @@ class Main {
348
350
return this . _wktMode . isDevelopmentMode ( ) ;
349
351
} ) ;
350
352
353
+ ipcMain . handle ( 'get-latest-wko-version-number' , async ( ) => {
354
+ return wktTools . getLatestWkoVersion ( ) ;
355
+ } ) ;
356
+
351
357
ipcMain . handle ( 'get-latest-wko-image-name' , async ( ) => {
352
358
return wktTools . getLatestWkoImageName ( ) ;
353
359
} ) ;
@@ -815,12 +821,17 @@ class Main {
815
821
return helmUtils . addOrUpdateWkoHelmChart ( helmExe , helmOptions ) ;
816
822
} ) ;
817
823
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 ) ;
820
827
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
+ }
824
835
}
825
836
}
826
837
return Promise . resolve ( results ) ;
@@ -830,9 +841,9 @@ class Main {
830
841
return helmUtils . uninstallWko ( helmExe , helmReleaseName , operatorNamespace , helmOptions ) ;
831
842
} ) ;
832
843
833
- ipcMain . handle ( 'helm-update-wko' , async ( event , helmExe , operatorName ,
844
+ ipcMain . handle ( 'helm-update-wko' , async ( event , helmExe , operatorName , operatorVersion ,
834
845
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 ) ;
836
847
if ( kubectlExe && results . isSuccess ) {
837
848
const versionResults = await kubectlUtils . getOperatorVersion ( kubectlExe , operatorNamespace , kubectlOptions ) ;
838
849
if ( versionResults . isSuccess ) {
@@ -990,6 +1001,25 @@ class Main {
990
1001
return getDefaultWebLogicRemoteConsoleHome ( ) ;
991
1002
} ) ;
992
1003
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
+
993
1023
// eslint-disable-next-line no-unused-vars
994
1024
ipcMain . handle ( 'get-verrazzano-release-versions' , async ( event , minimumVersion = undefined ) => {
995
1025
return getVerrazzanoReleaseVersions ( minimumVersion ) ;
0 commit comments