Skip to content

Commit 37b7bee

Browse files
authored
Changing mode of kubeconfig file to remove helm warning (#13581)
* Changing mode of kubeconfig file to remove helm warning * Changing config mode to 600 * Adding assert to check mode change
1 parent 414c031 commit 37b7bee

File tree

5 files changed

+7
-2
lines changed

5 files changed

+7
-2
lines changed

Tasks/HelmDeployV0/Tests/L0.ts

+1
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ describe("HelmDeployV0 Suite", function () {
4747
process.env[shared.isHelmV3] = "true";
4848

4949
tr.run();
50+
assert(tr.stdout.indexOf("changed mode of file") != -1, "Mode of kubeconfig file should have been changed to 600");
5051
assert(tr.stdout.indexOf("v3") != -1, "Helm version 3 should have been installed");
5152
assert(tr.stdout.indexOf("STATUS: deployed") != -1, `Release should have been created with NAME: ${shared.testReleaseName}`);
5253
assert(tr.stdout.indexOf(`DeploymentDetailsApiResponse: {"mockKey":"mockValue"}`) != -1, "Web response should have been received for pushing metadata to evidence store");

Tasks/HelmDeployV0/Tests/TestSetup.ts

+3
Original file line numberDiff line numberDiff line change
@@ -325,6 +325,9 @@ const fsClone = Object.assign({}, fs);
325325
fsClone.writeFileSync = function (path, data) {
326326
console.log(`wrote to ${path}`);
327327
};
328+
fsClone.chmodSync = function (path, mode) {
329+
console.log(`changed mode of file at ${path} to ${mode}`);
330+
};
328331
tr.registerMock('fs', fsClone);
329332

330333
import * as util from '../src/utils';

Tasks/HelmDeployV0/src/helm.ts

+1
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ async function getKubeConfigFile(): Promise<string> {
5353
var configFilePath = getKubeConfigFilePath();
5454
tl.debug(tl.loc("KubeConfigFilePath", configFilePath));
5555
fs.writeFileSync(configFilePath, config);
56+
fs.chmodSync(configFilePath, '600');
5657
return configFilePath;
5758
});
5859
}

Tasks/HelmDeployV0/task.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
"version": {
1515
"Major": 0,
1616
"Minor": 176,
17-
"Patch": 0
17+
"Patch": 1
1818
},
1919
"demands": [],
2020
"groups": [

Tasks/HelmDeployV0/task.loc.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
"version": {
1515
"Major": 0,
1616
"Minor": 176,
17-
"Patch": 0
17+
"Patch": 1
1818
},
1919
"demands": [],
2020
"groups": [

0 commit comments

Comments
 (0)