@@ -28,6 +28,7 @@ import { IPipeline, IKubectlPipeline, IKubectlPipelineList, IKubectlAppList, IKu
2828import { App , KubectlApp } from './application' ;
2929import { KubectlPipeline } from './pipeline' ;
3030import { IAddon , IAddonMinimal } from './addons' ;
31+ import { version } from 'os' ;
3132
3233
3334export class Kubectl {
@@ -909,4 +910,49 @@ export class Kubectl {
909910 }
910911 }
911912
913+ public async deployAppDisabled ( namespace : string , app : string , tag : string ) : Promise < any > {
914+
915+ console . log ( "deploy app: " + app , ",namespace: " + namespace , ",tag: " + tag ) ;
916+ }
917+
918+ public async deployApp ( namespace : string , appName : string , tag : string ) {
919+
920+ let deploymentName = appName + '-kuberoapp-web' ;
921+ console . log ( "deploy app: " + appName , ",namespace: " + namespace , ",tag: " + tag , ",deploymentName: " + deploymentName ) ;
922+
923+ // format : https://jsonpatch.com/
924+ const patch = [
925+ {
926+ op : 'replace' ,
927+ path : '/spec/image/tag' ,
928+ value : tag ,
929+ } ,
930+ ] ;
931+
932+ const apiVersion = "v1alpha1"
933+ const group = "application.kubero.dev"
934+ const plural = "kuberoapps"
935+
936+ const options = { "headers" : { "Content-type" : 'application/json-patch+json' } } ;
937+ this . customObjectsApi . patchNamespacedCustomObject (
938+ group ,
939+ apiVersion ,
940+ namespace ,
941+ plural ,
942+ appName ,
943+ patch ,
944+ undefined ,
945+ undefined ,
946+ undefined ,
947+ options
948+ ) . then ( ( ) => {
949+ debug . log ( `Deployment ${ deploymentName } in Pipeline ${ namespace } updated` ) ;
950+ } ) . catch ( error => {
951+ if ( error . body . message ) {
952+ debug . log ( 'ERROR: ' + error . body . message ) ;
953+ }
954+ debug . log ( 'ERROR: ' + error ) ;
955+ } ) ;
956+ } ;
957+
912958}
0 commit comments