Skip to content

Commit 93933e7

Browse files
up (#237)
1 parent 458f8af commit 93933e7

File tree

7 files changed

+27
-21
lines changed

7 files changed

+27
-21
lines changed

lib/interface/cli/commands/runtimeEnvironments/create.cmd.js

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ const authManager = require('../../../../logic/auth').manager; // eslint-disable
1010
const scriptUrl = 'https://raw.githubusercontent.com/codefresh-io/k8s-dind-config/master/codefresh-k8s-configure.sh';
1111
let filePath = `${homedir()}/.Codefresh/runtime/codefresh-k8s-configure.sh`;
1212
const dirPath = `${homedir()}/.Codefresh/runtime`;
13+
const codefreshPath = `${homedir()}/.Codefresh`;
1314

1415

1516
const callToScript = (k8sScript) =>{
@@ -47,22 +48,23 @@ const command = new Command({
4748
.option('namespace', {
4849
describe: 'namespace',
4950
})
50-
.option('local', {
51-
describe: 'set if run the script from local file system',
52-
type: 'boolean',
53-
default: false,
54-
})
5551
.option('context', {
5652
describe: 'set your kubectl context',
57-
default: '',
5853
})
5954
.example('codefresh create re [cluster] --namespace codefresh --context kubeCodefresh', 'Creating a runtime environment');
6055
},
6156
handler: async (argv) => {
6257
const currentContext = authManager.getCurrentContext();
63-
const { local, namespace, cluster, context } = argv;
64-
if (!local) {
65-
if (!fs.existsSync(dirPath)) {
58+
const { namespace, cluster } = argv;
59+
let { context } = argv;
60+
if (!context) {
61+
context = '';
62+
}
63+
if (!process.env.LOCAL) {
64+
if (!fs.existsSync(codefreshPath)) {
65+
fs.mkdirSync(codefreshPath);
66+
fs.mkdirSync(dirPath);
67+
} else if (!fs.existsSync(dirPath)) {
6668
fs.mkdirSync(dirPath);
6769
}
6870
const options = {
@@ -75,12 +77,12 @@ const command = new Command({
7577
throw err;
7678
}
7779
fs.chmodSync(filePath, '644');
78-
const k8sScript = spawn('bash', [filePath, '--api-token', currentContext.token, '--api-host', currentContext.url, '--namespace', namespace, '--context', context, cluster]);
80+
const k8sScript = spawn('bash', [filePath, '--api-token', currentContext.token, '--api-host', currentContext.url, '--namespace', namespace, '--image-tag', 'master', '--remote', '--context', context, cluster]);
7981
callToScript(k8sScript);
8082
});
8183
} else {
8284
filePath = './codefresh-k8s-configure.sh';
83-
const k8sScript = spawn('bash', [filePath, '--api-token', currentContext.token, '--api-host', currentContext.url, '--namespace', namespace, '--local','--context', context, cluster]);
85+
const k8sScript = spawn('bash', [filePath, '--api-token', currentContext.token, '--api-host', currentContext.url, '--namespace', namespace,'--context', context, '--image-tag', 'master', cluster]);
8486
callToScript(k8sScript);
8587
}
8688
},

lib/interface/cli/commands/systemRuntimeEnvironments/apply.cmd.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ const command = new Command({
1414
onPremCommand: true,
1515
usage: 'Use apply to patch an existing context',
1616
webDocs: {
17-
category: 'Runtime-Environments (On Prem)',
18-
title: 'Apply Runtime-Environments',
17+
category: 'System Runtime-Environments (On Prem)',
18+
title: 'Apply System Runtime-Environments',
1919
weight: 90,
2020
},
2121
builder: (yargs) => {

lib/interface/cli/commands/systemRuntimeEnvironments/delete.cmd.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ const command = new Command({
1313
description: 'Delete a runtime-environment',
1414
onPremCommand: true,
1515
webDocs: {
16-
category: 'Runtime-Environments',
17-
title: 'Delete Runtime-Environments',
16+
category: 'System Runtime-Environments',
17+
title: 'Delete System Runtime-Environments',
1818
},
1919
builder: (yargs) => {
2020
return yargs

lib/interface/cli/commands/systemRuntimeEnvironments/diff.cmd.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ const command = new Command({
1414
description: 'Show diff between two runtime environments configuration',
1515
onPremCommand: true,
1616
webDocs: {
17-
category: 'Runtime-Environments (On Prem)',
18-
title: 'Diff Runtime-Environments',
17+
category: 'System Runtime-Environments (On Prem)',
18+
title: 'Diff System Runtime-Environments',
1919
},
2020
builder: (yargs) => {
2121
return yargs

lib/interface/cli/commands/systemRuntimeEnvironments/get.cmd.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ const command = new Command({
1717
description: 'Get a runtime environments configuration',
1818
onPremCommand: true,
1919
webDocs: {
20-
category: 'Runtime-Environments',
21-
title: 'Get Runtime-Environments',
20+
category: 'System Runtime-Environments',
21+
title: 'Get System Runtime-Environments',
2222
},
2323
builder: (yargs) => {
2424
return yargs

lib/logic/api/cluster.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ const createCluster = async (info) => {
5050
const filePath = `${homedir()}/.Codefresh/cluster/stevedore`;
5151
const versionPath = `${homedir()}/.Codefresh/cluster/version.txt`;
5252
const versionUrl = 'https://raw.githubusercontent.com/codefresh-io/Stevedore/master/VERSION';
53+
const codefreshPath = `${homedir()}/.Codefresh`;
5354
let zipPath = `${homedir()}/.Codefresh/cluster/data`;
5455
let shouldUpdate = true;
5556
const options = {
@@ -60,7 +61,10 @@ const createCluster = async (info) => {
6061
},
6162
};
6263
const version = await rp(options);
63-
if (!fs.existsSync(dirPath)) {
64+
if (!fs.existsSync(codefreshPath)) {
65+
fs.mkdirSync(codefreshPath);
66+
fs.mkdirSync(dirPath);
67+
} else if (!fs.existsSync(dirPath)) {
6468
fs.mkdirSync(dirPath);
6569
} else if (fs.existsSync(versionPath)) {
6670
const currVersion = fs.readFileSync(versionPath, { encoding: 'UTF8' }).trim();

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

0 commit comments

Comments
 (0)