@@ -59,6 +59,7 @@ function printInstallationOptionsSummary({
5959 noProxy,
6060 appProxy,
6161 appProxyHost,
62+ dryRun,
6263} ) {
6364 let summary = `\n${ colors . green ( 'Installation options summary:' ) }
6465 1. Kubernetes Context: ${ colors . cyan ( kubeContextName ) }
@@ -73,6 +74,9 @@ function printInstallationOptionsSummary({
7374 if ( appProxy ) {
7475 summary += `7. App-Proxy hostname: ${ colors . cyan ( appProxyHost ) } \n` ;
7576 }
77+ if ( dryRun ) {
78+ summary += '**** running in dry-run mode ****' ;
79+ }
7680 console . log ( summary ) ;
7781}
7882
@@ -194,6 +198,11 @@ const initCmd = new Command({
194198 default : true ,
195199 type : 'boolean' ,
196200 } )
201+ . option ( 'dry-run' , {
202+ describe : 'Will save all of the manifests to be deployed on the cluster to: ./manifests/' ,
203+ default : false ,
204+ type : 'boolean' ,
205+ } )
197206 . example ( 'codefresh runner init --values values.yaml (see values file example here: '
198207 + 'https://github.com/codefresh-io/venona/blob/release-1.0/venonactl/example/values-example.yaml)' ) ,
199208 handler : async ( argv ) => {
@@ -249,6 +258,7 @@ const initCmd = new Command({
249258 reResources,
250259 userVolumeMounts,
251260 userVolumes,
261+ 'dry-run' : dryRun ,
252262 } = _argv ;
253263 let {
254264 'kube-context-name' : kubeContextName ,
@@ -395,6 +405,7 @@ const initCmd = new Command({
395405 noProxy,
396406 appProxy,
397407 appProxyHost,
408+ dryRun,
398409 } ) ;
399410
400411 if ( token ) {
@@ -410,14 +421,14 @@ const initCmd = new Command({
410421 console . log ( `A Codefresh context named '${ INSTALLATION_DEFAULTS . CF_CONTEXT_NAME } ' was added to your "cfconfig" file.` ) ;
411422 }
412423
413- const [ , progress ] = await to ( async ( ) => installationProgress . create ( sdk [ 'runner-installation' ] , {
424+ const progress = dryRun ? { } : await installationProgress . create ( sdk [ 'runner-installation' ] , {
414425 options : {
415426 kubeContextName,
416427 kubeNamespace,
417428 shouldMakeDefaultRe,
418429 shouldExecutePipeline,
419430 } ,
420- } ) ) ;
431+ } ) ;
421432 const progressReporter = installationProgress . buildReporter ( sdk [ 'runner-installation' ] , progress ) ;
422433
423434 let installationPlan ;
@@ -506,9 +517,11 @@ const initCmd = new Command({
506517 valuesFile, // --values
507518 setValue, // --set-value
508519 setFile, // --set-file
520+ dryRun,
509521 } ) ;
510522 } ,
511523 installationEvent : installationProgress . events . AGENT_INSTALLED ,
524+ executeOnDryRun : true ,
512525 } ) ;
513526
514527 // generate new runtime name
@@ -667,9 +680,11 @@ const initCmd = new Command({
667680 setValue,
668681 setFile,
669682 storageClassName,
683+ dryRun,
670684 } ) ;
671685 } ,
672686 installationEvent : installationProgress . events . RUNTIME_INSTALLED ,
687+ executeOnDryRun : true ,
673688 } ) ;
674689
675690 installationPlan . addStep ( {
@@ -688,12 +703,14 @@ const initCmd = new Command({
688703 setFile,
689704 appProxyHost,
690705 appProxyIngressClass,
706+ dryRun,
691707 } ) ;
692708 const appProxyUrl = `https://${ appProxyHost } ${ appProxyPathPrefix || '' } ` ;
693709 installationPlan . addContext ( 'appProxyIP' , `${ appProxyUrl } ` ) ;
694710 } ,
695711 installationEvent : installationProgress . events . APP_PROXY_INSTALLED ,
696712 condition : ! ! appProxy ,
713+ executeOnDryRun : true ,
697714 } ) ;
698715
699716 // update runtime with ingress IP
@@ -752,9 +769,11 @@ const initCmd = new Command({
752769 restartAgent : true , // --restart-agent
753770 verbose, // --verbose
754771 runtimeName : installationPlan . getContext ( 'runtimeName' ) , // --runtimeName
772+ dryRun,
755773 } ) ;
756774 } ,
757775 installationEvent : installationProgress . events . RUNNER_INSTALLED ,
776+ executeOnDryRun : true ,
758777 } ) ;
759778
760779 // install monitoring
@@ -770,6 +789,7 @@ const initCmd = new Command({
770789 'env-vars' : envVars ,
771790 'set-value' : setValue ,
772791 'set-file' : setFile ,
792+ 'dry-run' : dryRun ,
773793 token : _ . get ( sdk , 'config.context.token' ) ,
774794 verbose,
775795 noExit : true , // to prevent if from calling inner: process.exit()
@@ -778,6 +798,7 @@ const initCmd = new Command({
778798 } ,
779799 successMessage : 'Successfully installed cluster monitoring' ,
780800 installationEvent : installationProgress . events . MONITOR_INSTALLED ,
801+ executeOnDryRun : true ,
781802 condition : async ( ) => {
782803 if ( ! installMonitor ) {
783804 return false ;
0 commit comments