Skip to content

Commit

Permalink
fix path issue (#3)
Browse files Browse the repository at this point in the history
  • Loading branch information
Eik Emil Bengtsson committed May 5, 2022
1 parent 98170ae commit fcc966e
Show file tree
Hide file tree
Showing 6 changed files with 145 additions and 3 deletions.
2 changes: 1 addition & 1 deletion action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ inputs:
kubectl:
description: 'The version of kustomize to use'
required: true
default: '1.20.9'
default: '1.23.6'
namesuffix:
description: 'Add suffix to all resources'
required: false
Expand Down
9 changes: 9 additions & 0 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8208,6 +8208,8 @@ exports.setupKustomize = void 0;
const os = __importStar(__webpack_require__(87));
const toolCache = __importStar(__webpack_require__(533));
const core = __importStar(__webpack_require__(470));
const path = __importStar(__webpack_require__(622));
const fs = __importStar(__webpack_require__(747));
const getKustomizeLink = (version) => {
switch (os.type()) {
case 'Linux':
Expand All @@ -8220,6 +8222,7 @@ const getKustomizeLink = (version) => {
throw Error("Could not find correct OS");
}
};
const getToolWithExtension = (toolName) => os.type() == 'Windows_NT' ? `${toolName}.exe` : toolName;
exports.setupKustomize = (version) => __awaiter(void 0, void 0, void 0, function* () {
const toolName = 'kustomize';
let cachedToolpath = toolCache.find(toolName, version);
Expand All @@ -8228,6 +8231,8 @@ exports.setupKustomize = (version) => __awaiter(void 0, void 0, void 0, function
const unzipped = yield toolCache.extractTar(location);
cachedToolpath = yield toolCache.cacheDir(unzipped, toolName, version);
}
const kustomizePath = path.join(cachedToolpath, getToolWithExtension(toolName));
fs.chmodSync(kustomizePath, '777');
core.addPath(cachedToolpath);
});

Expand Down Expand Up @@ -11645,6 +11650,8 @@ exports.setupKubectl = void 0;
const os = __importStar(__webpack_require__(87));
const toolCache = __importStar(__webpack_require__(533));
const core = __importStar(__webpack_require__(470));
const path = __importStar(__webpack_require__(622));
const fs = __importStar(__webpack_require__(747));
const getkubectlDownloadURL = (version) => {
switch (os.type()) {
case 'Linux':
Expand All @@ -11665,6 +11672,8 @@ exports.setupKubectl = (version) => __awaiter(void 0, void 0, void 0, function*
const location = yield toolCache.downloadTool(getkubectlDownloadURL(version));
cachedToolpath = yield toolCache.cacheFile(location, getToolWithExtension(toolName), toolName, version);
}
const kubectlPath = path.join(cachedToolpath, getToolWithExtension(toolName));
fs.chmodSync(kubectlPath, '777');
core.addPath(cachedToolpath);
});

Expand Down
122 changes: 121 additions & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions src/kubectl.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
import * as os from 'os';
import * as toolCache from '@actions/tool-cache'
import * as core from '@actions/core'
import * as path from 'path';
import * as fs from 'fs';


const getkubectlDownloadURL = (version: string): string => {
switch (os.type()) {
Expand All @@ -27,5 +30,8 @@ export const setupKubectl = async (version) => {
cachedToolpath = await toolCache.cacheFile(location, getToolWithExtension(toolName), toolName, version)
}

const kubectlPath = path.join(cachedToolpath, getToolWithExtension(toolName));
fs.chmodSync(kubectlPath, '777');

core.addPath(cachedToolpath)
}
7 changes: 7 additions & 0 deletions src/kustomize.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import * as os from 'os';
import * as toolCache from '@actions/tool-cache'
import * as core from '@actions/core'
import * as path from 'path';
import * as fs from 'fs';

const getKustomizeLink = (version: string): string => {
switch (os.type()) {
Expand All @@ -16,6 +18,8 @@ const getKustomizeLink = (version: string): string => {
}
}

const getToolWithExtension = (toolName) => os.type() == 'Windows_NT' ? `${toolName}.exe` : toolName;

export const setupKustomize = async (version) => {
const toolName = 'kustomize';

Expand All @@ -26,5 +30,8 @@ export const setupKustomize = async (version) => {
cachedToolpath = await toolCache.cacheDir(unzipped, toolName, version)
}

const kustomizePath = path.join(cachedToolpath, getToolWithExtension(toolName));
fs.chmodSync(kustomizePath, '777');

core.addPath(cachedToolpath)
}
2 changes: 1 addition & 1 deletion src/run.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,4 +104,4 @@ const execHelper = async (tool, args: string[], options: exec.ExecOptions = {})
return exitCode
}

run().catch(core.setFailed)
run().catch(core.setFailed)

0 comments on commit fcc966e

Please sign in to comment.