@@ -136,6 +136,7 @@ const initCmd = new Command({
136
136
if ( oldInstallationPlan ) {
137
137
console . log ( colors . cyan ( 'Previous installation state:' ) ) ;
138
138
oldInstallationPlan . printState ( ) ;
139
+ oldInstallationPlan . reset ( ) ; // needs to be called after printState()
139
140
const answer = await inquirer . prompt ( {
140
141
type : 'confirm' ,
141
142
name : 'resumeInstallation' ,
@@ -254,19 +255,6 @@ const initCmd = new Command({
254
255
shouldExecutePipeline,
255
256
} ) ;
256
257
257
- if ( token ) {
258
- // Create a new context and switch to that context
259
- const [ err ] = await to ( createContext . handler ( {
260
- apiKey : token ,
261
- name : INSTALLATION_DEFAULTS . CF_CONTEXT_NAME ,
262
- url,
263
- } ) ) ;
264
- await handleError ( err , 'Failed to use the provided token' ) ;
265
- const config = await getConfigForSdk ( ) ;
266
- await sdk . configure ( config ) ;
267
- console . log ( `A Codefresh context named '${ INSTALLATION_DEFAULTS . CF_CONTEXT_NAME } ' was added to your "cfconfig" file.` ) ;
268
- }
269
-
270
258
const [ , progress ] = await to ( async ( ) => installationProgress . create ( sdk [ 'runner-installation' ] , {
271
259
options : {
272
260
kubeContextName,
@@ -293,17 +281,31 @@ const initCmd = new Command({
293
281
_argv [ 'exec-demo-pipeline' ] = shouldExecutePipeline ;
294
282
installationPlan . addContext ( 'argv' , _argv ) ;
295
283
296
- if ( skipClusterTest ) {
297
- console . log ( 'Skipping cluster requirements tests...' ) ;
298
- } else {
299
- installationPlan . addStep ( {
300
- name : 'run cluster acceptance tests' ,
301
- func : runClusterAcceptanceTests ,
302
- arg : { kubeNamespace, kubeConfigPath } ,
303
- errMessage : 'Failed to run cluster test' ,
304
- installationEvent : installationProgress . events . ACCEPTANCE_TESTS_RAN ,
305
- } ) ;
306
- }
284
+ // create new codefresh auth context
285
+ installationPlan . addStep ( {
286
+ name : 'create new codefresh auth context' ,
287
+ func : async ( ) => {
288
+ await createContext . handler ( {
289
+ apiKey : token ,
290
+ name : INSTALLATION_DEFAULTS . CF_CONTEXT_NAME ,
291
+ url,
292
+ } ) ;
293
+ const config = await getConfigForSdk ( ) ;
294
+ await sdk . configure ( config ) ;
295
+ console . log ( `A Codefresh context named '${ INSTALLATION_DEFAULTS . CF_CONTEXT_NAME } ' was added to your "cfconfig" file.` ) ;
296
+ } ,
297
+ condition : token ,
298
+
299
+ } ) ;
300
+
301
+ // run cluster acceptance tests
302
+ installationPlan . addStep ( {
303
+ name : 'run cluster acceptance tests' ,
304
+ func : runClusterAcceptanceTests ,
305
+ arg : { kubeNamespace, kubeConfigPath } ,
306
+ installationEvent : installationProgress . events . ACCEPTANCE_TESTS_RAN ,
307
+ condition : ! skipClusterTest ,
308
+ } ) ;
307
309
308
310
// generate new agent name
309
311
installationPlan . addContext ( 'agentName' , name ) ;
0 commit comments