@docker/actions-toolkit 0.1.0-beta.11 → 0.1.0-beta.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/buildkit/buildkit.d.ts +1 -4
- package/lib/buildkit/buildkit.js +11 -23
- package/lib/buildkit/buildkit.js.map +1 -1
- package/lib/buildkit/config.d.ts +0 -3
- package/lib/buildkit/config.js +2 -4
- package/lib/buildkit/config.js.map +1 -1
- package/lib/buildx/builder.d.ts +1 -4
- package/lib/buildx/builder.js +4 -34
- package/lib/buildx/builder.js.map +1 -1
- package/lib/buildx/buildx.d.ts +3 -5
- package/lib/buildx/buildx.js +29 -26
- package/lib/buildx/buildx.js.map +1 -1
- package/lib/buildx/inputs.d.ts +0 -3
- package/lib/buildx/inputs.js +8 -11
- package/lib/buildx/inputs.js.map +1 -1
- package/lib/buildx/install.d.ts +4 -7
- package/lib/buildx/install.js +50 -56
- package/lib/buildx/install.js.map +1 -1
- package/lib/context.d.ts +6 -7
- package/lib/context.js +18 -13
- package/lib/context.js.map +1 -1
- package/lib/docker.d.ts +3 -7
- package/lib/docker.js +23 -48
- package/lib/docker.js.map +1 -1
- package/lib/exec.d.ts +20 -0
- package/lib/exec.js +68 -0
- package/lib/exec.js.map +1 -0
- package/lib/git.js +3 -28
- package/lib/git.js.map +1 -1
- package/lib/github.js +3 -5
- package/lib/github.js.map +1 -1
- package/lib/toolkit.d.ts +0 -2
- package/lib/toolkit.js +4 -6
- package/lib/toolkit.js.map +1 -1
- package/package.json +1 -1
package/lib/buildx/install.js
CHANGED
|
@@ -55,21 +55,20 @@ const fs_1 = __importDefault(require("fs"));
|
|
|
55
55
|
const os_1 = __importDefault(require("os"));
|
|
56
56
|
const path_1 = __importDefault(require("path"));
|
|
57
57
|
const core = __importStar(require("@actions/core"));
|
|
58
|
-
const exec = __importStar(require("@actions/exec"));
|
|
59
58
|
const httpm = __importStar(require("@actions/http-client"));
|
|
60
59
|
const tc = __importStar(require("@actions/tool-cache"));
|
|
61
60
|
const semver = __importStar(require("semver"));
|
|
62
61
|
const util = __importStar(require("util"));
|
|
63
62
|
const buildx_1 = require("./buildx");
|
|
64
63
|
const context_1 = require("../context");
|
|
64
|
+
const exec_1 = require("../exec");
|
|
65
65
|
const docker_1 = require("../docker");
|
|
66
66
|
const git_1 = require("../git");
|
|
67
67
|
class Install {
|
|
68
68
|
constructor(opts) {
|
|
69
|
-
this.context = (opts === null || opts === void 0 ? void 0 : opts.context) || new context_1.Context();
|
|
70
69
|
this._standalone = opts === null || opts === void 0 ? void 0 : opts.standalone;
|
|
71
70
|
}
|
|
72
|
-
download(version
|
|
71
|
+
download(version) {
|
|
73
72
|
return __awaiter(this, void 0, void 0, function* () {
|
|
74
73
|
const release = yield Install.getRelease(version);
|
|
75
74
|
const fversion = release.tag_name.replace(/^v+|v+$/g, '');
|
|
@@ -84,15 +83,10 @@ class Install {
|
|
|
84
83
|
toolPath = yield this.fetchBinary(fversion);
|
|
85
84
|
}
|
|
86
85
|
core.debug(`Install.download toolPath: ${toolPath}`);
|
|
87
|
-
|
|
88
|
-
core.debug(`Install.download dest: ${dest}`);
|
|
89
|
-
if (yield this.isStandalone()) {
|
|
90
|
-
return this.setStandalone(toolPath, dest);
|
|
91
|
-
}
|
|
92
|
-
return this.setPlugin(toolPath, dest);
|
|
86
|
+
return toolPath;
|
|
93
87
|
});
|
|
94
88
|
}
|
|
95
|
-
build(gitContext
|
|
89
|
+
build(gitContext) {
|
|
96
90
|
return __awaiter(this, void 0, void 0, function* () {
|
|
97
91
|
// eslint-disable-next-line prefer-const
|
|
98
92
|
let [repo, ref] = gitContext.split('#');
|
|
@@ -111,31 +105,62 @@ class Install {
|
|
|
111
105
|
let toolPath;
|
|
112
106
|
toolPath = tc.find('buildx', vspec);
|
|
113
107
|
if (!toolPath) {
|
|
114
|
-
const outputDir = path_1.default.join(
|
|
108
|
+
const outputDir = path_1.default.join(context_1.Context.tmpDir(), 'build-cache');
|
|
115
109
|
const buildCmd = yield this.buildCommand(gitContext, outputDir);
|
|
116
|
-
toolPath = yield
|
|
117
|
-
.getExecOutput(buildCmd.command, buildCmd.args, {
|
|
110
|
+
toolPath = yield exec_1.Exec.getExecOutput(buildCmd.command, buildCmd.args, {
|
|
118
111
|
ignoreReturnCode: true
|
|
119
|
-
})
|
|
120
|
-
.then(res => {
|
|
112
|
+
}).then(res => {
|
|
121
113
|
if (res.stderr.length > 0 && res.exitCode != 0) {
|
|
122
114
|
core.warning(res.stderr.trim());
|
|
123
115
|
}
|
|
124
116
|
return tc.cacheFile(`${outputDir}/buildx`, os_1.default.platform() == 'win32' ? 'docker-buildx.exe' : 'docker-buildx', 'buildx', vspec);
|
|
125
117
|
});
|
|
126
118
|
}
|
|
119
|
+
return toolPath;
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
installStandalone(toolPath, dest) {
|
|
123
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
124
|
+
core.info('Standalone mode');
|
|
125
|
+
dest = dest || context_1.Context.tmpDir();
|
|
126
|
+
const toolBinPath = path_1.default.join(toolPath, os_1.default.platform() == 'win32' ? 'docker-buildx.exe' : 'docker-buildx');
|
|
127
|
+
const binDir = path_1.default.join(dest, 'bin');
|
|
128
|
+
if (!fs_1.default.existsSync(binDir)) {
|
|
129
|
+
fs_1.default.mkdirSync(binDir, { recursive: true });
|
|
130
|
+
}
|
|
131
|
+
const filename = os_1.default.platform() == 'win32' ? 'buildx.exe' : 'buildx';
|
|
132
|
+
const buildxPath = path_1.default.join(binDir, filename);
|
|
133
|
+
fs_1.default.copyFileSync(toolBinPath, buildxPath);
|
|
134
|
+
core.info('Fixing perms');
|
|
135
|
+
fs_1.default.chmodSync(buildxPath, '0755');
|
|
136
|
+
core.addPath(binDir);
|
|
137
|
+
core.info('Added Buildx to PATH');
|
|
138
|
+
core.info(`Binary path: ${buildxPath}`);
|
|
139
|
+
return buildxPath;
|
|
140
|
+
});
|
|
141
|
+
}
|
|
142
|
+
installPlugin(toolPath, dest) {
|
|
143
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
144
|
+
core.info('Docker plugin mode');
|
|
127
145
|
dest = dest || docker_1.Docker.configDir;
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
146
|
+
const toolBinPath = path_1.default.join(toolPath, os_1.default.platform() == 'win32' ? 'docker-buildx.exe' : 'docker-buildx');
|
|
147
|
+
const pluginsDir = path_1.default.join(dest, 'cli-plugins');
|
|
148
|
+
if (!fs_1.default.existsSync(pluginsDir)) {
|
|
149
|
+
fs_1.default.mkdirSync(pluginsDir, { recursive: true });
|
|
131
150
|
}
|
|
132
|
-
|
|
151
|
+
const filename = os_1.default.platform() == 'win32' ? 'docker-buildx.exe' : 'docker-buildx';
|
|
152
|
+
const pluginPath = path_1.default.join(pluginsDir, filename);
|
|
153
|
+
fs_1.default.copyFileSync(toolBinPath, pluginPath);
|
|
154
|
+
core.info('Fixing perms');
|
|
155
|
+
fs_1.default.chmodSync(pluginPath, '0755');
|
|
156
|
+
core.info(`Plugin path: ${pluginPath}`);
|
|
157
|
+
return pluginPath;
|
|
133
158
|
});
|
|
134
159
|
}
|
|
135
160
|
buildCommand(gitContext, outputDir) {
|
|
136
161
|
return __awaiter(this, void 0, void 0, function* () {
|
|
137
|
-
const buildxStandaloneFound = yield new buildx_1.Buildx({
|
|
138
|
-
const buildxPluginFound = yield new buildx_1.Buildx({
|
|
162
|
+
const buildxStandaloneFound = yield new buildx_1.Buildx({ standalone: true }).isAvailable();
|
|
163
|
+
const buildxPluginFound = yield new buildx_1.Buildx({ standalone: false }).isAvailable();
|
|
139
164
|
let buildStandalone = false;
|
|
140
165
|
if ((yield this.isStandalone()) && buildxStandaloneFound) {
|
|
141
166
|
core.debug(`Install.buildCommand: Buildx standalone found, build with it`);
|
|
@@ -157,7 +182,7 @@ class Install {
|
|
|
157
182
|
throw new Error(`Neither buildx standalone or plugin have been found to build from ref ${gitContext}`);
|
|
158
183
|
}
|
|
159
184
|
//prettier-ignore
|
|
160
|
-
return yield new buildx_1.Buildx({
|
|
185
|
+
return yield new buildx_1.Buildx({ standalone: buildStandalone }).getCommand([
|
|
161
186
|
'build',
|
|
162
187
|
'--target', 'binaries',
|
|
163
188
|
'--build-arg', 'BUILDKIT_CONTEXT_KEEP_GIT_DIR=1',
|
|
@@ -169,49 +194,18 @@ class Install {
|
|
|
169
194
|
isStandalone() {
|
|
170
195
|
var _a;
|
|
171
196
|
return __awaiter(this, void 0, void 0, function* () {
|
|
172
|
-
const standalone = (_a = this._standalone) !== null && _a !== void 0 ? _a : !(yield docker_1.Docker.
|
|
197
|
+
const standalone = (_a = this._standalone) !== null && _a !== void 0 ? _a : !(yield docker_1.Docker.isAvailable());
|
|
173
198
|
core.debug(`Install.isStandalone: ${standalone}`);
|
|
174
199
|
return standalone;
|
|
175
200
|
});
|
|
176
201
|
}
|
|
177
|
-
setStandalone(toolPath, dest) {
|
|
178
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
179
|
-
const toolBinPath = path_1.default.join(toolPath, os_1.default.platform() == 'win32' ? 'docker-buildx.exe' : 'docker-buildx');
|
|
180
|
-
const binDir = path_1.default.join(dest, 'bin');
|
|
181
|
-
if (!fs_1.default.existsSync(binDir)) {
|
|
182
|
-
fs_1.default.mkdirSync(binDir, { recursive: true });
|
|
183
|
-
}
|
|
184
|
-
const filename = os_1.default.platform() == 'win32' ? 'buildx.exe' : 'buildx';
|
|
185
|
-
const buildxPath = path_1.default.join(binDir, filename);
|
|
186
|
-
fs_1.default.copyFileSync(toolBinPath, buildxPath);
|
|
187
|
-
fs_1.default.chmodSync(buildxPath, '0755');
|
|
188
|
-
core.addPath(binDir);
|
|
189
|
-
core.debug(`Install.setStandalone buildxPath: ${buildxPath}`);
|
|
190
|
-
return buildxPath;
|
|
191
|
-
});
|
|
192
|
-
}
|
|
193
|
-
setPlugin(toolPath, dest) {
|
|
194
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
195
|
-
const toolBinPath = path_1.default.join(toolPath, os_1.default.platform() == 'win32' ? 'docker-buildx.exe' : 'docker-buildx');
|
|
196
|
-
const pluginsDir = path_1.default.join(dest, 'cli-plugins');
|
|
197
|
-
if (!fs_1.default.existsSync(pluginsDir)) {
|
|
198
|
-
fs_1.default.mkdirSync(pluginsDir, { recursive: true });
|
|
199
|
-
}
|
|
200
|
-
const filename = os_1.default.platform() == 'win32' ? 'docker-buildx.exe' : 'docker-buildx';
|
|
201
|
-
const pluginPath = path_1.default.join(pluginsDir, filename);
|
|
202
|
-
fs_1.default.copyFileSync(toolBinPath, pluginPath);
|
|
203
|
-
fs_1.default.chmodSync(pluginPath, '0755');
|
|
204
|
-
core.debug(`Install.setPlugin pluginPath: ${pluginPath}`);
|
|
205
|
-
return pluginPath;
|
|
206
|
-
});
|
|
207
|
-
}
|
|
208
202
|
fetchBinary(version) {
|
|
209
203
|
return __awaiter(this, void 0, void 0, function* () {
|
|
210
204
|
const targetFile = os_1.default.platform() == 'win32' ? 'docker-buildx.exe' : 'docker-buildx';
|
|
211
205
|
const downloadURL = util.format('https://github.com/docker/buildx/releases/download/v%s/%s', version, this.filename(version));
|
|
206
|
+
core.info(`Downloading ${downloadURL}`);
|
|
212
207
|
const downloadPath = yield tc.downloadTool(downloadURL);
|
|
213
|
-
core.debug(`
|
|
214
|
-
core.debug(`downloadPath: ${downloadPath}`);
|
|
208
|
+
core.debug(`Install.fetchBinary downloadPath: ${downloadPath}`);
|
|
215
209
|
return yield tc.cacheFile(downloadPath, targetFile, 'buildx', version);
|
|
216
210
|
});
|
|
217
211
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"install.js","sourceRoot":"","sources":["../../src/buildx/install.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,4CAAoB;AACpB,4CAAoB;AACpB,gDAAwB;AACxB,oDAAsC;AACtC,
|
|
1
|
+
{"version":3,"file":"install.js","s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C,CAAC;YACjE,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE;gBACtB,MAAM,IAAI,KAAK,CAAC,8BAA8B,OAAO,OAAO,GAAG,EAAE,CAAC,CAAC;aACpE;YACD,OAAO,QAAQ,CAAC,OAAO,CAAC,CAAC;QAC3B,CAAC;KAAA;CACF;AAnMD,0BAmMC"}
|
package/lib/context.d.ts
CHANGED
|
@@ -15,11 +15,10 @@
|
|
|
15
15
|
*/
|
|
16
16
|
import * as tmp from 'tmp';
|
|
17
17
|
export declare class Context {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
tmpName(options?: tmp.TmpNameOptions): string;
|
|
18
|
+
private static readonly _tmpDir;
|
|
19
|
+
static tmpDir(): string;
|
|
20
|
+
static tmpName(options?: tmp.TmpNameOptions): string;
|
|
21
|
+
static gitRef(): string;
|
|
22
|
+
static gitContext(): string;
|
|
23
|
+
static provenanceBuilderID(): string;
|
|
25
24
|
}
|
package/lib/context.js
CHANGED
|
@@ -49,24 +49,29 @@ const tmp = __importStar(require("tmp"));
|
|
|
49
49
|
const github = __importStar(require("@actions/github"));
|
|
50
50
|
const github_1 = require("./github");
|
|
51
51
|
class Context {
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
52
|
+
static tmpDir() {
|
|
53
|
+
return Context._tmpDir;
|
|
54
|
+
}
|
|
55
|
+
static tmpName(options) {
|
|
56
|
+
return tmp.tmpNameSync(options);
|
|
57
|
+
}
|
|
58
|
+
static gitRef() {
|
|
59
|
+
let gitRef = github.context.ref;
|
|
60
|
+
if (github.context.sha && gitRef && !gitRef.startsWith('refs/')) {
|
|
61
|
+
gitRef = `refs/heads/${github.context.ref}`;
|
|
57
62
|
}
|
|
58
|
-
if (github.context.sha && !
|
|
59
|
-
|
|
63
|
+
if (github.context.sha && !gitRef.startsWith(`refs/pull/`)) {
|
|
64
|
+
gitRef = github.context.sha;
|
|
60
65
|
}
|
|
61
|
-
|
|
62
|
-
this.provenanceBuilderID = `${github_1.GitHub.serverURL}/${github.context.repo.owner}/${github.context.repo.repo}/actions/runs/${github.context.runId}`;
|
|
66
|
+
return gitRef;
|
|
63
67
|
}
|
|
64
|
-
|
|
65
|
-
return
|
|
68
|
+
static gitContext() {
|
|
69
|
+
return `${github_1.GitHub.serverURL}/${github.context.repo.owner}/${github.context.repo.repo}.git#${Context.gitRef()}`;
|
|
66
70
|
}
|
|
67
|
-
|
|
68
|
-
return
|
|
71
|
+
static provenanceBuilderID() {
|
|
72
|
+
return `${github_1.GitHub.serverURL}/${github.context.repo.owner}/${github.context.repo.repo}/actions/runs/${github.context.runId}`;
|
|
69
73
|
}
|
|
70
74
|
}
|
|
71
75
|
exports.Context = Context;
|
|
76
|
+
Context._tmpDir = fs_1.default.mkdtempSync(path_1.default.join(os_1.default.tmpdir(), 'docker-actions-toolkit-'));
|
|
72
77
|
//# sourceMappingURL=context.js.map
|
package/lib/context.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context.js","sourceRoot":"","sources":["../src/context.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,4CAAoB;AACpB,4CAAoB;AACpB,gDAAwB;AACxB,yCAA2B;AAC3B,wDAA0C;AAE1C,qCAAgC;AAEhC,MAAa,OAAO;
|
|
1
|
+
{"version":3,"file":"context.js","sourceRoot":"","sources":["../src/context.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,4CAAoB;AACpB,4CAAoB;AACpB,gDAAwB;AACxB,yCAA2B;AAC3B,wDAA0C;AAE1C,qCAAgC;AAEhC,MAAa,OAAO;IAGX,MAAM,CAAC,MAAM;QAClB,OAAO,OAAO,CAAC,OAAO,CAAC;IACzB,CAAC;IAEM,MAAM,CAAC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docker {
|
|
17
|
-
private static instance?;
|
|
18
|
-
static getInstance: () => Docker;
|
|
19
|
-
private _available;
|
|
20
|
-
private constructor();
|
|
21
17
|
static get configDir(): string;
|
|
22
|
-
isAvailable(): Promise<boolean>;
|
|
23
|
-
static printVersion(
|
|
24
|
-
static printInfo(
|
|
18
|
+
static isAvailable(): Promise<boolean>;
|
|
19
|
+
static printVersion(): Promise<void>;
|
|
20
|
+
static printInfo(): Promise<void>;
|
|
25
21
|
}
|
package/lib/docker.js
CHANGED
|
@@ -54,67 +54,42 @@ exports.Docker = void 0;
|
|
|
54
54
|
const os_1 = __importDefault(require("os"));
|
|
55
55
|
const path_1 = __importDefault(require("path"));
|
|
56
56
|
const core = __importStar(require("@actions/core"));
|
|
57
|
-
const
|
|
57
|
+
const exec_1 = require("./exec");
|
|
58
58
|
class Docker {
|
|
59
|
-
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
60
|
-
constructor() { }
|
|
61
59
|
static get configDir() {
|
|
62
60
|
return process.env.DOCKER_CONFIG || path_1.default.join(os_1.default.homedir(), '.docker');
|
|
63
61
|
}
|
|
64
|
-
isAvailable() {
|
|
65
|
-
var _a;
|
|
62
|
+
static isAvailable() {
|
|
66
63
|
return __awaiter(this, void 0, void 0, function* () {
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
.
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
.catch(error => {
|
|
85
|
-
core.debug(`Docker.available failed: ${error}`);
|
|
86
|
-
this._available = false;
|
|
87
|
-
});
|
|
88
|
-
}
|
|
89
|
-
core.debug(`Docker.available: ${this._available}`);
|
|
90
|
-
return (_a = this._available) !== null && _a !== void 0 ? _a : false;
|
|
64
|
+
const ok = yield exec_1.Exec.getExecOutput('docker', [], {
|
|
65
|
+
ignoreReturnCode: true,
|
|
66
|
+
silent: true
|
|
67
|
+
})
|
|
68
|
+
.then(res => {
|
|
69
|
+
if (res.stderr.length > 0 && res.exitCode != 0) {
|
|
70
|
+
core.debug(`Docker.isAvailable cmd err: ${res.stderr}`);
|
|
71
|
+
return false;
|
|
72
|
+
}
|
|
73
|
+
return res.exitCode == 0;
|
|
74
|
+
})
|
|
75
|
+
.catch(error => {
|
|
76
|
+
core.debug(`Docker.isAvailable error: ${error}`);
|
|
77
|
+
return false;
|
|
78
|
+
});
|
|
79
|
+
core.debug(`Docker.isAvailable: ${ok}`);
|
|
80
|
+
return ok;
|
|
91
81
|
});
|
|
92
82
|
}
|
|
93
|
-
static printVersion(
|
|
83
|
+
static printVersion() {
|
|
94
84
|
return __awaiter(this, void 0, void 0, function* () {
|
|
95
|
-
|
|
96
|
-
if (noDocker) {
|
|
97
|
-
core.debug('Docker.printVersion: Docker is not available, skipping.');
|
|
98
|
-
return;
|
|
99
|
-
}
|
|
100
|
-
yield exec.exec('docker', ['version'], {
|
|
101
|
-
failOnStdErr: false
|
|
102
|
-
});
|
|
85
|
+
yield exec_1.Exec.exec('docker', ['version']);
|
|
103
86
|
});
|
|
104
87
|
}
|
|
105
|
-
static printInfo(
|
|
88
|
+
static printInfo() {
|
|
106
89
|
return __awaiter(this, void 0, void 0, function* () {
|
|
107
|
-
|
|
108
|
-
if (noDocker) {
|
|
109
|
-
core.debug('Docker.printInfo: Docker is not available, skipping.');
|
|
110
|
-
return;
|
|
111
|
-
}
|
|
112
|
-
yield exec.exec('docker', ['info'], {
|
|
113
|
-
failOnStdErr: false
|
|
114
|
-
});
|
|
90
|
+
yield exec_1.Exec.exec('docker', ['info']);
|
|
115
91
|
});
|
|
116
92
|
}
|
|
117
93
|
}
|
|
118
94
|
exports.Docker = Docker;
|
|
119
|
-
Docker.getInstance = () => { var _a; return (Docker.instance = (_a = Docker.instance) !== null && _a !== void 0 ? _a : new Docker()); };
|
|
120
95
|
//# sourceMappingURL=docker.js.map
|
package/lib/docker.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"docker.js","sourceRoot":"","sources":["../src/docker.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,4CAAoB;AACpB,gDAAwB;AACxB,oDAAsC;AACtC,
|
|
1
|
+
{"version":3,"file":"docker.js","sourceRoot":"","sources":["../src/docker.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,4CAAoB;AACpB,gDAAwB;AACxB,oDAAsC;AACtC,iCAA4B;AAE5B,MAAa,MAAM;IACjB,MAAM,KAAK,SAAS;QAClB,OAAO,OAAO,CAAC,GAAG,CAAC,aAAa,IAAI,cAAI,CAAC,IAAI,CAAC,YAAE,CAAC,OAAO,EAAE,EAAE,SAAS,CAAC,CAAC;IACzE,CAAC;IAEM,MAAM,CAAO,WAAW;;YAC7B,MAAM,EAAE,GAAY,MAAM,WAAI,CAAC,aAAa,CAAC,QAAQ,EAAE,EAAE,EAAE;gBACzD,gBAAgB,EAAE,IAAI;gBACtB,MAAM,EAAE,IAAI;aACb,CAAC;iBACC,IAAI,CAAC,GAAG,CAAC,EAAE;gBACV,IAAI,GAAG,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,IAAI,GAAG,CAAC,QAAQ,IAAI,CAAC,EAAE;oBAC9C,IAAI,CAAC,KAAK,CAAC,+BAA+B,GAAG,CAAC,MAAM,EAAE,CAAC,CAAC;oBACxD,OAAO,KAAK,CAAC;iBACd;gBACD,OAAO,GAAG,CAAC,QAAQ,IAAI,CAAC,CAAC;YAC3B,CAAC,CAAC;iBACD,KAAK,CAAC,KAAK,CAAC,EAAE;gBACb,IAAI,CAAC,KAAK,CAAC,6BAA6B,KAAK,EAAE,CAAC,CAAC;gBACjD,OAAO,KAAK,CAAC;YACf,CAAC,CAAC,CAAC;YAEL,IAAI,CAAC,KAAK,CAAC,uBAAuB,EAAE,EAAE,CAAC,CAAC;YACxC,OAAO,EAAE,CAAC;QACZ,CAAC;KAAA;IAEM,MAAM,CAAO,YAAY;;YAC9B,MAAM,WAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC,SAAS,CAAC,CAAC,CAAC;QACzC,CAAC;KAAA;IAEM,MAAM,CAAO,SAAS;;YAC3B,MAAM,WAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC;QACtC,CAAC;KAAA;CACF;AAjCD,wBAiCC"}
|
package/lib/exec.d.ts
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2023 actions-toolkit authors
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
import { ExecOptions, ExecOutput } from '@actions/exec';
|
|
17
|
+
export declare class Exec {
|
|
18
|
+
static exec(commandLine: string, args?: string[], options?: ExecOptions): Promise<number>;
|
|
19
|
+
static getExecOutput(commandLine: string, args?: string[], options?: ExecOptions): Promise<ExecOutput>;
|
|
20
|
+
}
|
package/lib/exec.js
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Copyright 2023 actions-toolkit authors
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
18
|
+
if (k2 === undefined) k2 = k;
|
|
19
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
20
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
21
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
22
|
+
}
|
|
23
|
+
Object.defineProperty(o, k2, desc);
|
|
24
|
+
}) : (function(o, m, k, k2) {
|
|
25
|
+
if (k2 === undefined) k2 = k;
|
|
26
|
+
o[k2] = m[k];
|
|
27
|
+
}));
|
|
28
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
29
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
30
|
+
}) : function(o, v) {
|
|
31
|
+
o["default"] = v;
|
|
32
|
+
});
|
|
33
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
34
|
+
if (mod && mod.__esModule) return mod;
|
|
35
|
+
var result = {};
|
|
36
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
37
|
+
__setModuleDefault(result, mod);
|
|
38
|
+
return result;
|
|
39
|
+
};
|
|
40
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
41
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
42
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
43
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
44
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
45
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
46
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
47
|
+
});
|
|
48
|
+
};
|
|
49
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
50
|
+
exports.Exec = void 0;
|
|
51
|
+
const core = __importStar(require("@actions/core"));
|
|
52
|
+
const exec = __importStar(require("@actions/exec"));
|
|
53
|
+
class Exec {
|
|
54
|
+
static exec(commandLine, args, options) {
|
|
55
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
56
|
+
core.debug(`Exec.exec: ${commandLine} ${args === null || args === void 0 ? void 0 : args.join(' ')}`);
|
|
57
|
+
return exec.exec(commandLine, args, options);
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
static getExecOutput(commandLine, args, options) {
|
|
61
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
62
|
+
core.debug(`Exec.getExecOutput: ${commandLine} ${args === null || args === void 0 ? void 0 : args.join(' ')}`);
|
|
63
|
+
return exec.getExecOutput(commandLine, args, options);
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
exports.Exec = Exec;
|
|
68
|
+
//# sourceMappingURL=exec.js.map
|
package/lib/exec.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"exec.js","sourceRoot":"","sources":["../src/exec.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,oDAAsC;AACtC,oDAAsC;AAGtC,MAAa,IAAI;IACR,MAAM,CAAO,IAAI,CAAC,WAAmB,EAAE,IAAe,EAAE,OAAqB;;YAClF,IAAI,CAAC,KAAK,CAAC,cAAc,WAAW,IAAI,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;YAC3D,OAAO,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,IAAI,EAAE,OAAO,CAAC,CAAC;QAC/C,CAAC;KAAA;IAEM,MAAM,CAAO,aAAa,CAAC,WAAmB,EAAE,IAAe,EAAE,OAAqB;;YAC3F,IAAI,CAAC,KAAK,CAAC,uBAAuB,WAAW,IAAI,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;YACpE,OAAO,IAAI,CAAC,aAAa,CAAC,WAAW,EAAE,IAAI,EAAE,OAAO,CAAC,CAAC;QACxD,CAAC;KAAA;CACF;AAVD,oBAUC"}
|
package/lib/git.js
CHANGED
|
@@ -14,29 +14,6 @@
|
|
|
14
14
|
* See the License for the specific language governing permissions and
|
|
15
15
|
* limitations under the License.
|
|
16
16
|
*/
|
|
17
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
18
|
-
if (k2 === undefined) k2 = k;
|
|
19
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
20
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
21
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
22
|
-
}
|
|
23
|
-
Object.defineProperty(o, k2, desc);
|
|
24
|
-
}) : (function(o, m, k, k2) {
|
|
25
|
-
if (k2 === undefined) k2 = k;
|
|
26
|
-
o[k2] = m[k];
|
|
27
|
-
}));
|
|
28
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
29
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
30
|
-
}) : function(o, v) {
|
|
31
|
-
o["default"] = v;
|
|
32
|
-
});
|
|
33
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
34
|
-
if (mod && mod.__esModule) return mod;
|
|
35
|
-
var result = {};
|
|
36
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
37
|
-
__setModuleDefault(result, mod);
|
|
38
|
-
return result;
|
|
39
|
-
};
|
|
40
17
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
41
18
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
42
19
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -48,16 +25,14 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
48
25
|
};
|
|
49
26
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
50
27
|
exports.Git = void 0;
|
|
51
|
-
const
|
|
28
|
+
const exec_1 = require("./exec");
|
|
52
29
|
class Git {
|
|
53
30
|
static getRemoteSha(repo, ref) {
|
|
54
31
|
return __awaiter(this, void 0, void 0, function* () {
|
|
55
|
-
return yield
|
|
56
|
-
.getExecOutput(`git`, ['ls-remote', repo, ref], {
|
|
32
|
+
return yield exec_1.Exec.getExecOutput(`git`, ['ls-remote', repo, ref], {
|
|
57
33
|
ignoreReturnCode: true,
|
|
58
34
|
silent: true
|
|
59
|
-
})
|
|
60
|
-
.then(res => {
|
|
35
|
+
}).then(res => {
|
|
61
36
|
if (res.stderr.length > 0 && res.exitCode != 0) {
|
|
62
37
|
throw new Error(res.stderr);
|
|
63
38
|
}
|
package/lib/git.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"git.js","sourceRoot":"","sources":["../src/git.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG
|
|
1
|
+
{"version":3,"file":"git.js","sourceRoot":"","sources":["../src/git.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;;;;;;;;;;AAEH,iCAA4B;AAE5B,MAAa,GAAG;IACP,MAAM,CAAO,YAAY,CAAC,IAAY,EAAE,GAAW;;YACxD,OAAO,MAAM,WAAI,CAAC,aAAa,CAAC,KAAK,EAAE,CAAC,WAAW,EAAE,IAAI,EAAE,GAAG,CAAC,EAAE;gBAC/D,gBAAgB,EAAE,IAAI;gBACtB,MAAM,EAAE,IAAI;aACb,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE;gBACZ,IAAI,GAAG,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,IAAI,GAAG,CAAC,QAAQ,IAAI,CAAC,EAAE;oBAC9C,MAAM,IAAI,KAAK,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;iBAC7B;gBACD,MAAM,CAAC,IAAI,CAAC,GAAG,GAAG,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;gBACjD,IAAI,IAAI,CAAC,MAAM,IAAI,CAAC,EAAE;oBACpB,MAAM,IAAI,KAAK,CAAC,8BAA8B,IAAI,IAAI,GAAG,EAAE,CAAC,CAAC;iBAC9D;gBACD,OAAO,IAAI,CAAC;YACd,CAAC,CAAC,CAAC;QACL,CAAC;KAAA;CACF;AAhBD,kBAgBC"}
|
package/lib/github.js
CHANGED
|
@@ -81,12 +81,10 @@ class GitHub {
|
|
|
81
81
|
jwt = GitHub.actionsRuntimeToken;
|
|
82
82
|
}
|
|
83
83
|
catch (e) {
|
|
84
|
-
|
|
85
|
-
return;
|
|
84
|
+
throw new Error(`Cannot parse GitHub Actions Runtime Token: ${e.message}`);
|
|
86
85
|
}
|
|
87
86
|
if (!jwt) {
|
|
88
|
-
|
|
89
|
-
return;
|
|
87
|
+
throw new Error(`ACTIONS_RUNTIME_TOKEN not set`);
|
|
90
88
|
}
|
|
91
89
|
try {
|
|
92
90
|
JSON.parse(`${jwt.ac}`).forEach(ac => {
|
|
@@ -108,7 +106,7 @@ class GitHub {
|
|
|
108
106
|
});
|
|
109
107
|
}
|
|
110
108
|
catch (e) {
|
|
111
|
-
|
|
109
|
+
throw new Error(`Cannot parse GitHub Actions Runtime Token ACs: ${e.message}`);
|
|
112
110
|
}
|
|
113
111
|
});
|
|
114
112
|
}
|
package/lib/github.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"github.js","sourceRoot":"","sources":["../src/github.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGH,oDAAsC;AACtC,wDAA0C;AAE1C,4DAAoC;AAQpC,MAAa,MAAM;IAGjB,YAAY,IAAiB;QAC3B,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC,UAAU,CAAC,GAAG,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,KAAK,EAAE,CAAC,CAAC;IACrD,CAAC;IAEM,QAAQ;QACb,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,mBAAK,MAAM,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC,QAAQ,CAAC,IAAkB,CAAC,CAAC;IAC7G,CAAC;IAED,MAAM,KAAK,OAAO;QAChB,OAAO,MAAM,CAAC,OAAO,CAAC;IACxB,CAAC;IAED,MAAM,KAAK,SAAS;QAClB,OAAO,OAAO,CAAC,GAAG,CAAC,iBAAiB,IAAI,oBAAoB,CAAC;IAC/D,CAAC;IAED,MAAM,KAAK,MAAM;QACf,OAAO,OAAO,CAAC,GAAG,CAAC,cAAc,IAAI,wBAAwB,CAAC;IAChE,CAAC;IAED,MAAM,KAAK,mBAAmB;QAC5B,MAAM,KAAK,GAAG,OAAO,CAAC,GAAG,CAAC,uBAAuB,CAAC,IAAI,EAAE,CAAC;QACzD,OAAO,KAAK,CAAC,CAAC,CAAC,IAAA,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AK,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;IAC1E,CAAC;IAEM,MAAM,CAAO,2BAA2B;;YAC7C,IAAI,GAA0C,CAAC;YAC/C,IAAI;gBACF,GAAG,GAAG,MAAM,CAAC,mBAAmB,CAAC;aAClC;YAAC,OAAO,CAAC,EAAE;gBACV,MAAM,IAAI,KAAK,CAAC,8CAA8C,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC;aAC5E;YACD,IAAI,CAAC,GAAG,EAAE;gBACR,MAAM,IAAI,KAAK,CAAC,+BAA+B,CAAC,CAAC;aAClD;YACD,IAAI;gBACkC,IAAI,CAAC,KAAK,CAAC,GAAG,GAAG,CAAC,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,EAAE,CAAC,EAAE;oBACvE,IAAI,UAAkB,CAAC;oBACvB,QAAQ,EAAE,CAAC,UAAU,EAAE;wBACrB,KAAK,CAAC;4BACJ,UAAU,GAAG,MAAM,CAAC;4BACpB,MAAM;wBACR,KAAK,CAAC;4BACJ,UAAU,GAAG,OAAO,CAAC;4BACrB,MAAM;wBACR,KAAK,CAAC;4BACJ,UAAU,GAAG,YAAY,CAAC;4BAC1B,MAAM;wBACR;4BACE,UAAU,GAAG,kBAAkB,EAAE,CAAC,UAAU,GAAG,CAAC;qBACnD;oBACD,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,KAAK,KAAK,UAAU,EAAE,CAAC,CAAC;gBAC1C,CAAC,CAAC,CAAC;aACJ;YAAC,OAAO,CAAC,EAAE;gBACV,MAAM,IAAI,KAAK,CAAC,kDAAkD,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC;aAChF;QACH,CAAC;KAAA;CACF;AA5DD,wBA4DC"}
|
package/lib/toolkit.d.ts
CHANGED
|
@@ -13,7 +13,6 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
import { Context } from './context';
|
|
17
16
|
import { Buildx } from './buildx/buildx';
|
|
18
17
|
import { Install } from './buildx/install';
|
|
19
18
|
import { Builder } from './buildx/builder';
|
|
@@ -27,7 +26,6 @@ export interface ToolkitOpts {
|
|
|
27
26
|
githubToken?: string;
|
|
28
27
|
}
|
|
29
28
|
export declare class Toolkit {
|
|
30
|
-
context: Context;
|
|
31
29
|
github: GitHub;
|
|
32
30
|
buildx: Buildx;
|
|
33
31
|
buildxInstall: Install;
|