Skip to content

Commit 9777d23

Browse files
roi-codefreshRoi Kramer
andauthored
fixed runner init not using token (#497)
Co-authored-by: Roi Kramer <roikramer@Rois-MacBook-Pro.local>
1 parent f8a9a61 commit 9777d23

File tree

2 files changed

+14
-18
lines changed

2 files changed

+14
-18
lines changed

lib/interface/cli/commands/hybrid/init.cmd.js

Lines changed: 13 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -255,6 +255,19 @@ const initCmd = new Command({
255255
shouldExecutePipeline,
256256
});
257257

258+
if (token) {
259+
// Create a new context and switch to that context
260+
const [err] = await to(createContext.handler({
261+
apiKey: token,
262+
name: INSTALLATION_DEFAULTS.CF_CONTEXT_NAME,
263+
url,
264+
}));
265+
await handleError(err, 'Failed to use the provided token');
266+
const config = await getConfigForSdk();
267+
await sdk.configure(config);
268+
console.log(`A Codefresh context named '${INSTALLATION_DEFAULTS.CF_CONTEXT_NAME}' was added to your "cfconfig" file.`);
269+
}
270+
258271
const [, progress] = await to(async () => installationProgress.create(sdk['runner-installation'], {
259272
options: {
260273
kubeContextName,
@@ -281,23 +294,6 @@ const initCmd = new Command({
281294
_argv['exec-demo-pipeline'] = shouldExecutePipeline;
282295
installationPlan.addContext('argv', _argv);
283296

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-
301297
// run cluster acceptance tests
302298
installationPlan.addStep({
303299
name: 'run cluster acceptance tests',

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "codefresh",
3-
"version": "0.68.5",
3+
"version": "0.68.6",
44
"description": "Codefresh command line utility",
55
"main": "index.js",
66
"preferGlobal": true,

0 commit comments

Comments
 (0)