Skip to content

Commit aa272fe

Browse files
author
Radu M
committed
Update @actions packages
Signed-off-by: Radu M <[email protected]>
1 parent 675502a commit aa272fe

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

103 files changed

+9604
-2
lines changed

.gitignore

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
node_modules/
1+
# node_modules/
22
__tests__/runner/*
3-
lib/
3+
# lib/

lib/kind.js

Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
"use strict";
2+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3+
return new (P || (P = Promise))(function (resolve, reject) {
4+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6+
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
7+
step((generator = generator.apply(thisArg, _arguments || [])).next());
8+
});
9+
};
10+
var __importStar = (this && this.__importStar) || function (mod) {
11+
if (mod && mod.__esModule) return mod;
12+
var result = {};
13+
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
14+
result["default"] = mod;
15+
return result;
16+
};
17+
Object.defineProperty(exports, "__esModule", { value: true });
18+
const core = __importStar(require("@actions/core"));
19+
const tc = __importStar(require("@actions/tool-cache"));
20+
const exec = __importStar(require("@actions/exec"));
21+
const path = __importStar(require("path"));
22+
const VersionInput = "version";
23+
const ConfigInput = "config";
24+
const ImageInput = "image";
25+
const NameInput = "name";
26+
const WaitInput = "wait";
27+
const SkipClusterCreationInput = "skipClusterCreation";
28+
const toolName = "kind";
29+
class KindConfig {
30+
constructor(version, configFile, image, name, waitDuration, skipClusterCreation) {
31+
this.version = version;
32+
this.configFile = configFile;
33+
this.image = image;
34+
this.name = name;
35+
this.waitDuration = waitDuration;
36+
this.skipClusterCreation = (skipClusterCreation == 'true');
37+
}
38+
// returns the arguments to pass to `kind create cluster`
39+
getCommand() {
40+
let args = ["create", "cluster"];
41+
if (this.configFile != "") {
42+
const wd = process.env[`GITHUB_WORKSPACE`] || "";
43+
const absPath = path.join(wd, this.configFile);
44+
args.push("--config", absPath);
45+
}
46+
if (this.image != "") {
47+
args.push("--image", this.image);
48+
}
49+
if (this.name != "") {
50+
args.push("--name", this.name);
51+
}
52+
if (this.waitDuration != "") {
53+
args.push("--wait", this.waitDuration);
54+
}
55+
return args;
56+
}
57+
createCluster() {
58+
return __awaiter(this, void 0, void 0, function* () {
59+
if (this.skipClusterCreation)
60+
return;
61+
console.log("Executing kind with args " + this.getCommand());
62+
yield exec.exec("kind", this.getCommand());
63+
});
64+
}
65+
}
66+
exports.KindConfig = KindConfig;
67+
function getKindConfig() {
68+
const v = core.getInput(VersionInput);
69+
const c = core.getInput(ConfigInput);
70+
const i = core.getInput(ImageInput);
71+
const n = core.getInput(NameInput);
72+
const w = core.getInput(WaitInput);
73+
const s = core.getInput(SkipClusterCreationInput);
74+
return new KindConfig(v, c, i, n, w, s);
75+
}
76+
exports.getKindConfig = getKindConfig;
77+
// this action should always be run from a Linux worker
78+
function downloadKind(version) {
79+
return __awaiter(this, void 0, void 0, function* () {
80+
let url = `https://github.com/kubernetes-sigs/kind/releases/download/${version}/kind-linux-amd64`;
81+
console.log("downloading kind from " + url);
82+
let downloadPath = null;
83+
downloadPath = yield tc.downloadTool(url);
84+
yield exec.exec("chmod", ["+x", downloadPath]);
85+
let toolPath = yield tc.cacheFile(downloadPath, "kind", toolName, version);
86+
core.debug(`kind is cached under ${toolPath}`);
87+
return toolPath;
88+
});
89+
}
90+
exports.downloadKind = downloadKind;
91+
function getKind(version) {
92+
return __awaiter(this, void 0, void 0, function* () {
93+
let toolPath = tc.find(toolName, version);
94+
if (toolPath === "") {
95+
toolPath = yield downloadKind(version);
96+
}
97+
return toolPath;
98+
});
99+
}
100+
exports.getKind = getKind;

lib/main.js

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
"use strict";
2+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3+
return new (P || (P = Promise))(function (resolve, reject) {
4+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6+
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
7+
step((generator = generator.apply(thisArg, _arguments || [])).next());
8+
});
9+
};
10+
var __importStar = (this && this.__importStar) || function (mod) {
11+
if (mod && mod.__esModule) return mod;
12+
var result = {};
13+
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
14+
result["default"] = mod;
15+
return result;
16+
};
17+
Object.defineProperty(exports, "__esModule", { value: true });
18+
const core = __importStar(require("@actions/core"));
19+
const kind_1 = require("./kind");
20+
function run() {
21+
return __awaiter(this, void 0, void 0, function* () {
22+
try {
23+
let cfg = kind_1.getKindConfig();
24+
let toolPath = yield kind_1.getKind(cfg.version);
25+
core.addPath(toolPath);
26+
yield cfg.createCluster();
27+
}
28+
catch (error) {
29+
core.setFailed(error.message);
30+
}
31+
});
32+
}
33+
run();

node_modules/.bin/semver

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

node_modules/.bin/uuid

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

node_modules/@actions/core/LICENSE.md

Lines changed: 9 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

node_modules/@actions/core/README.md

Lines changed: 147 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

node_modules/@actions/core/lib/command.d.ts

Lines changed: 16 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)