Skip to content

Commit 272680a

Browse files
fix figlet and node selector (#519)
* fix figlet and node selector
1 parent 70a1a5c commit 272680a

File tree

4 files changed

+21
-7
lines changed

4 files changed

+21
-7
lines changed

lib/interface/cli/commands/hybrid/helper.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ const {
1616
CODEFRESH_PATH,
1717
} = require('./../../../../binary');
1818
const { pathExists } = require('../../helpers/general');
19+
const Promise = require('bluebird');
1920

2021
const INSTALLATION_DEFAULTS = {
2122
NAMESPACE: 'codefresh',
@@ -272,15 +273,15 @@ function createProgressBar() {
272273
}
273274

274275
function drawCodefreshFiglet() {
275-
return new Promise((resolve) => {
276+
return Promise.race(new Promise((resolve) => {
276277
figlet('CODEFRESH', (err, data) => {
277278
if (err) {
278279
return;
279280
}
280281
console.log(data);
281282
resolve();
282283
});
283-
});
284+
}), Promise.delay(5000));
284285
}
285286

286287
async function getDefaultRuntime(runtimes) {

lib/interface/cli/commands/hybrid/migration.js

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,18 @@ const {
1515
} = require('./helper');
1616
const { getNewAgentName } = require('../agent/helper');
1717

18+
1819
const TEST_PIPELINE_NAME = 'CF_Runner_Migration_test';
1920

21+
function serealizeNodeSelector(objNodeSelector) {
22+
return _.keys(objNodeSelector).reduce((acc, key) => {
23+
if (acc) {
24+
return `${acc},${key}=${objNodeSelector[key]}`;
25+
}
26+
return `${key}=${objNodeSelector[key]}`;
27+
}, '');
28+
}
29+
2030
async function createAndRunTestPipeline(runtimeName, errHandler) {
2131
let testPipeline;
2232
const [getPipelineErr, _testPipeline] = await to(getTestPipeline(TEST_PIPELINE_NAME));
@@ -63,7 +73,7 @@ async function migrate({
6373
const newAgentName = agentName || await getNewAgentName(kubeContextName, kubeNamespace, agents);
6474
const [getRuntimeErr, runtime] = await to(sdk.runtimeEnvs.get({ name: runtimeName }));
6575
handleError(getRuntimeErr, `Failed to get runtime with name "${runtimeName}"`);
66-
const oldNodeSelector = _.get(runtime, 'runtimeScheduler.cluster.nodeSelector');
76+
let oldNodeSelector = _.get(runtime, 'dockerDaemonScheduler.cluster.nodeSelector');
6777
const oldStorageClassName = _.get(runtime, 'dockerDaemonScheduler.pvcs.dind.storageClassName');
6878

6979
// prompt migration process confirmation
@@ -121,8 +131,11 @@ async function migrate({
121131
}
122132

123133
if (oldConfig.nodeSelector) {
124-
const key = _.keys(oldConfig.nodeSelector)[0];
125-
oldConfig.nodeSelector = `${key}=${oldConfig.nodeSelector[key]}`;
134+
oldConfig.nodeSelector = serealizeNodeSelector(oldConfig.nodeSelector);
135+
}
136+
137+
if (oldNodeSelector) {
138+
oldNodeSelector = serealizeNodeSelector(oldNodeSelector);
126139
}
127140

128141
// install new agent and runtime

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ const upgradeCmd = new Command({
175175
handleError(err, `Failed to ${shouldDoMigration ? 'migrate' : 'upgrade'} codefresh runner`);
176176

177177
console.log(colors.green(`\nSuccessfully ${shouldDoMigration ? 'migrated' : 'upgraded'} your Codefresh Runner to the latest version`));
178-
console.log(colors.green(`If you had any issues with the uninstallation process please report them at: ${colors.blue('https://github.com/codefresh-io/cli/issues/new')}`));
178+
console.log(colors.green(`If you had any issues with the migration process please report them at: ${colors.blue('https://github.com/codefresh-io/cli/issues/new')}`));
179179
await drawCodefreshFiglet();
180180
process.exit(); // TODO : This is not needed - needed to be fixed
181181
},

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.69.3",
3+
"version": "0.69.4",
44
"description": "Codefresh command line utility",
55
"main": "index.js",
66
"preferGlobal": true,

0 commit comments

Comments
 (0)