setup-kubectl/lib/helpers.js
Tommy Barnes a10d84bc2e
Refactoring Action for use with AKS Atlanta (#37)
* Did some reorganizing of code in run.ts, moved run.test.ts into /src, and put some helpers into helpers.ts in /src.

* Did some reorganizing of code in run.ts, moved run.test.ts into /src, and put some helpers into helpers.ts in /src.

* Grabbed the upstream integration tests and brought them here.  Removed bash script. Added validateKubectl.py to /test folder for integration tests.

* Ran npm run build

* Ran npm run build

* Updated on section for integration-tests.yml

* Removing ruby commands from integration tests yaml.

* Fixing discrepancies in integration test yaml.

* Fixing discrepancies in integration test yaml.

* Default to ubuntu-latest

* renamed python script according to workflow.

* renamed python script according to workflow.

* Fixing path parameters.

* Updated tsconfig.json

* Testing for int test failure.

* Validated that int tests work.

* Added new workflows.

* Testing release (#10)

* Did some reorganizing of code in run.ts, moved run.test.ts into /src, and put some helpers into helpers.ts in /src.

* Did some reorganizing of code in run.ts, moved run.test.ts into /src, and put some helpers into helpers.ts in /src.

* Grabbed the upstream integration tests and brought them here.  Removed bash script. Added validateKubectl.py to /test folder for integration tests.

* Ran npm run build

* Ran npm run build

* Updated on section for integration-tests.yml

* Removing ruby commands from integration tests yaml.

* Fixing discrepancies in integration test yaml.

* Fixing discrepancies in integration test yaml.

* Default to ubuntu-latest

* renamed python script according to workflow.

* renamed python script according to workflow.

* Fixing path parameters.

* Updated tsconfig.json

* Testing for int test failure.

* Validated that int tests work.

* Added new workflows.

Co-authored-by: Tommy Barnes <thbarnes@microsoft.com>

* made changes reflected in comments

Co-authored-by: Tommy Barnes <thbarnes@microsoft.com>
2022-01-05 11:19:30 -05:00

32 lines
1.2 KiB
JavaScript

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getExecutableExtension = exports.getkubectlDownloadURL = exports.getKubectlArch = void 0;
const os = require("os");
const util = require("util");
function getKubectlArch() {
const arch = os.arch();
if (arch === 'x64') {
return 'amd64';
}
return arch;
}
exports.getKubectlArch = getKubectlArch;
function getkubectlDownloadURL(version, arch) {
switch (os.type()) {
case 'Linux':
return util.format('https://storage.googleapis.com/kubernetes-release/release/%s/bin/linux/%s/kubectl', version, arch);
case 'Darwin':
return util.format('https://storage.googleapis.com/kubernetes-release/release/%s/bin/darwin/%s/kubectl', version, arch);
case 'Windows_NT':
default:
return util.format('https://storage.googleapis.com/kubernetes-release/release/%s/bin/windows/%s/kubectl.exe', version, arch);
}
}
exports.getkubectlDownloadURL = getkubectlDownloadURL;
function getExecutableExtension() {
if (os.type().match(/^Win/)) {
return '.exe';
}
return '';
}
exports.getExecutableExtension = getExecutableExtension;