@@ -59,6 +59,7 @@ function printInstallationOptionsSummary({
59
59
noProxy,
60
60
appProxy,
61
61
appProxyHost,
62
+ dryRun,
62
63
} ) {
63
64
let summary = `\n${ colors . green ( 'Installation options summary:' ) }
64
65
1. Kubernetes Context: ${ colors . cyan ( kubeContextName ) }
@@ -73,6 +74,9 @@ function printInstallationOptionsSummary({
73
74
if ( appProxy ) {
74
75
summary += `7. App-Proxy hostname: ${ colors . cyan ( appProxyHost ) } \n` ;
75
76
}
77
+ if ( dryRun ) {
78
+ summary += '**** running in dry-run mode ****' ;
79
+ }
76
80
console . log ( summary ) ;
77
81
}
78
82
@@ -194,6 +198,11 @@ const initCmd = new Command({
194
198
default : true ,
195
199
type : 'boolean' ,
196
200
} )
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
+ } )
197
206
. example ( 'codefresh runner init --values values.yaml (see values file example here: '
198
207
+ 'https://github.com/codefresh-io/venona/blob/release-1.0/venonactl/example/values-example.yaml)' ) ,
199
208
handler : async ( argv ) => {
@@ -249,6 +258,7 @@ const initCmd = new Command({
249
258
reResources,
250
259
userVolumeMounts,
251
260
userVolumes,
261
+ 'dry-run' : dryRun ,
252
262
} = _argv ;
253
263
let {
254
264
'kube-context-name' : kubeContextName ,
@@ -395,6 +405,7 @@ const initCmd = new Command({
395
405
noProxy,
396
406
appProxy,
397
407
appProxyHost,
408
+ dryRun,
398
409
} ) ;
399
410
400
411
if ( token ) {
@@ -410,14 +421,14 @@ const initCmd = new Command({
410
421
console . log ( `A Codefresh context named '${ INSTALLATION_DEFAULTS . CF_CONTEXT_NAME } ' was added to your "cfconfig" file.` ) ;
411
422
}
412
423
413
- const [ , progress ] = await to ( async ( ) => installationProgress . create ( sdk [ 'runner-installation' ] , {
424
+ const progress = dryRun ? { } : await installationProgress . create ( sdk [ 'runner-installation' ] , {
414
425
options : {
415
426
kubeContextName,
416
427
kubeNamespace,
417
428
shouldMakeDefaultRe,
418
429
shouldExecutePipeline,
419
430
} ,
420
- } ) ) ;
431
+ } ) ;
421
432
const progressReporter = installationProgress . buildReporter ( sdk [ 'runner-installation' ] , progress ) ;
422
433
423
434
let installationPlan ;
@@ -506,9 +517,11 @@ const initCmd = new Command({
506
517
valuesFile, // --values
507
518
setValue, // --set-value
508
519
setFile, // --set-file
520
+ dryRun,
509
521
} ) ;
510
522
} ,
511
523
installationEvent : installationProgress . events . AGENT_INSTALLED ,
524
+ executeOnDryRun : true ,
512
525
} ) ;
513
526
514
527
// generate new runtime name
@@ -667,9 +680,11 @@ const initCmd = new Command({
667
680
setValue,
668
681
setFile,
669
682
storageClassName,
683
+ dryRun,
670
684
} ) ;
671
685
} ,
672
686
installationEvent : installationProgress . events . RUNTIME_INSTALLED ,
687
+ executeOnDryRun : true ,
673
688
} ) ;
674
689
675
690
installationPlan . addStep ( {
@@ -688,12 +703,14 @@ const initCmd = new Command({
688
703
setFile,
689
704
appProxyHost,
690
705
appProxyIngressClass,
706
+ dryRun,
691
707
} ) ;
692
708
const appProxyUrl = `https://${ appProxyHost } ${ appProxyPathPrefix || '' } ` ;
693
709
installationPlan . addContext ( 'appProxyIP' , `${ appProxyUrl } ` ) ;
694
710
} ,
695
711
installationEvent : installationProgress . events . APP_PROXY_INSTALLED ,
696
712
condition : ! ! appProxy ,
713
+ executeOnDryRun : true ,
697
714
} ) ;
698
715
699
716
// update runtime with ingress IP
@@ -752,9 +769,11 @@ const initCmd = new Command({
752
769
restartAgent : true , // --restart-agent
753
770
verbose, // --verbose
754
771
runtimeName : installationPlan . getContext ( 'runtimeName' ) , // --runtimeName
772
+ dryRun,
755
773
} ) ;
756
774
} ,
757
775
installationEvent : installationProgress . events . RUNNER_INSTALLED ,
776
+ executeOnDryRun : true ,
758
777
} ) ;
759
778
760
779
// install monitoring
@@ -770,6 +789,7 @@ const initCmd = new Command({
770
789
'env-vars' : envVars ,
771
790
'set-value' : setValue ,
772
791
'set-file' : setFile ,
792
+ 'dry-run' : dryRun ,
773
793
token : _ . get ( sdk , 'config.context.token' ) ,
774
794
verbose,
775
795
noExit : true , // to prevent if from calling inner: process.exit()
@@ -778,6 +798,7 @@ const initCmd = new Command({
778
798
} ,
779
799
successMessage : 'Successfully installed cluster monitoring' ,
780
800
installationEvent : installationProgress . events . MONITOR_INSTALLED ,
801
+ executeOnDryRun : true ,
781
802
condition : async ( ) => {
782
803
if ( ! installMonitor ) {
783
804
return false ;
0 commit comments