mirror of
https://github.com/docker/setup-buildx-action.git
synced 2025-06-26 12:41:09 +02:00
Compare commits
22 Commits
Author | SHA1 | Date | |
---|---|---|---|
07b1484797 | |||
2ec180e24a | |||
8c8d171420 | |||
7b1571268a | |||
f9814f80df | |||
6635284beb | |||
3e60c35816 | |||
f5f60fa737 | |||
43c79af50b | |||
0c969bab1f | |||
dc5191ec77 | |||
f9ddc94e27 | |||
55b445ecbc | |||
19625e207e | |||
ba442a71c2 | |||
bd58e36ac7 | |||
044aaa9258 | |||
d4577a64b2 | |||
c631d8cb6c | |||
10c3d69900 | |||
4d0df3997e | |||
84de361baa |
BIN
.github/setup-buildx-action.png
vendored
BIN
.github/setup-buildx-action.png
vendored
Binary file not shown.
Before Width: | Height: | Size: 13 KiB After Width: | Height: | Size: 4.5 KiB |
16
.github/workflows/ci.yml
vendored
16
.github/workflows/ci.yml
vendored
@ -27,7 +27,7 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
-
|
-
|
||||||
name: Checkout
|
name: Checkout
|
||||||
uses: actions/checkout@v2.3.3
|
uses: actions/checkout@v2
|
||||||
-
|
-
|
||||||
name: Set up Docker Buildx
|
name: Set up Docker Buildx
|
||||||
id: buildx
|
id: buildx
|
||||||
@ -49,7 +49,7 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
-
|
-
|
||||||
name: Checkout
|
name: Checkout
|
||||||
uses: actions/checkout@v2.3.3
|
uses: actions/checkout@v2
|
||||||
-
|
-
|
||||||
name: Set up Docker Buildx 1
|
name: Set up Docker Buildx 1
|
||||||
id: buildx1
|
id: buildx1
|
||||||
@ -70,7 +70,7 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
-
|
-
|
||||||
name: Checkout
|
name: Checkout
|
||||||
uses: actions/checkout@v2.3.3
|
uses: actions/checkout@v2
|
||||||
-
|
-
|
||||||
name: Set up Docker Buildx
|
name: Set up Docker Buildx
|
||||||
uses: ./
|
uses: ./
|
||||||
@ -92,7 +92,7 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
-
|
-
|
||||||
name: Checkout
|
name: Checkout
|
||||||
uses: actions/checkout@v2.3.3
|
uses: actions/checkout@v2
|
||||||
-
|
-
|
||||||
name: Set up Docker Buildx
|
name: Set up Docker Buildx
|
||||||
uses: ./
|
uses: ./
|
||||||
@ -115,7 +115,7 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
-
|
-
|
||||||
name: Checkout
|
name: Checkout
|
||||||
uses: actions/checkout@v2.3.3
|
uses: actions/checkout@v2
|
||||||
-
|
-
|
||||||
name: Set up Docker Buildx
|
name: Set up Docker Buildx
|
||||||
uses: ./
|
uses: ./
|
||||||
@ -128,7 +128,7 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
-
|
-
|
||||||
name: Checkout
|
name: Checkout
|
||||||
uses: actions/checkout@v2.3.3
|
uses: actions/checkout@v2
|
||||||
-
|
-
|
||||||
name: Set up Docker Buildx
|
name: Set up Docker Buildx
|
||||||
uses: ./
|
uses: ./
|
||||||
@ -161,7 +161,7 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
-
|
-
|
||||||
name: Checkout
|
name: Checkout
|
||||||
uses: actions/checkout@v2.3.3
|
uses: actions/checkout@v2
|
||||||
-
|
-
|
||||||
name: Create context
|
name: Create context
|
||||||
run: |
|
run: |
|
||||||
@ -191,7 +191,7 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
-
|
-
|
||||||
name: Checkout
|
name: Checkout
|
||||||
uses: actions/checkout@v2.3.3
|
uses: actions/checkout@v2
|
||||||
-
|
-
|
||||||
name: Set up QEMU
|
name: Set up QEMU
|
||||||
uses: docker/setup-qemu-action@v1
|
uses: docker/setup-qemu-action@v1
|
||||||
|
4
.github/workflows/labels.yml
vendored
4
.github/workflows/labels.yml
vendored
@ -14,7 +14,7 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
-
|
-
|
||||||
name: Checkout
|
name: Checkout
|
||||||
uses: actions/checkout@v2.3.3
|
uses: actions/checkout@v2
|
||||||
-
|
-
|
||||||
name: Run Labeler
|
name: Run Labeler
|
||||||
uses: crazy-max/ghaction-github-labeler@v3.0.0
|
uses: crazy-max/ghaction-github-labeler@v3
|
||||||
|
6
.github/workflows/test.yml
vendored
6
.github/workflows/test.yml
vendored
@ -17,7 +17,7 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
-
|
-
|
||||||
name: Checkout
|
name: Checkout
|
||||||
uses: actions/checkout@v2.3.3
|
uses: actions/checkout@v2
|
||||||
-
|
-
|
||||||
name: Validate
|
name: Validate
|
||||||
run: docker buildx bake validate
|
run: docker buildx bake validate
|
||||||
@ -30,7 +30,7 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
-
|
-
|
||||||
name: Checkout
|
name: Checkout
|
||||||
uses: actions/checkout@v2.3.3
|
uses: actions/checkout@v2
|
||||||
-
|
-
|
||||||
name: Install
|
name: Install
|
||||||
run: yarn install
|
run: yarn install
|
||||||
@ -39,7 +39,7 @@ jobs:
|
|||||||
run: yarn run test
|
run: yarn run test
|
||||||
-
|
-
|
||||||
name: Upload coverage
|
name: Upload coverage
|
||||||
uses: codecov/codecov-action@v1.0.13
|
uses: codecov/codecov-action@v1
|
||||||
if: success()
|
if: success()
|
||||||
with:
|
with:
|
||||||
token: ${{ secrets.CODECOV_TOKEN }}
|
token: ${{ secrets.CODECOV_TOKEN }}
|
||||||
|
@ -49,8 +49,6 @@ jobs:
|
|||||||
name: Set up Docker Buildx
|
name: Set up Docker Buildx
|
||||||
id: buildx
|
id: buildx
|
||||||
uses: docker/setup-buildx-action@v1
|
uses: docker/setup-buildx-action@v1
|
||||||
with:
|
|
||||||
version: latest
|
|
||||||
-
|
-
|
||||||
name: Builder instance name
|
name: Builder instance name
|
||||||
run: echo ${{ steps.buildx.outputs.name }}
|
run: echo ${{ steps.buildx.outputs.name }}
|
||||||
@ -79,14 +77,10 @@ jobs:
|
|||||||
-
|
-
|
||||||
name: Set up QEMU
|
name: Set up QEMU
|
||||||
uses: docker/setup-qemu-action@v1
|
uses: docker/setup-qemu-action@v1
|
||||||
with:
|
|
||||||
platforms: all
|
|
||||||
-
|
-
|
||||||
name: Set up Docker Buildx
|
name: Set up Docker Buildx
|
||||||
id: buildx
|
id: buildx
|
||||||
uses: docker/setup-buildx-action@v1
|
uses: docker/setup-buildx-action@v1
|
||||||
with:
|
|
||||||
version: latest
|
|
||||||
-
|
-
|
||||||
name: Available platforms
|
name: Available platforms
|
||||||
run: echo ${{ steps.buildx.outputs.platforms }}
|
run: echo ${{ steps.buildx.outputs.platforms }}
|
||||||
|
179
dist/index.js
generated
vendored
179
dist/index.js
generated
vendored
@ -515,7 +515,9 @@ function run() {
|
|||||||
const inputs = yield context.getInputs();
|
const inputs = yield context.getInputs();
|
||||||
const dockerConfigHome = process.env.DOCKER_CONFIG || path.join(os.homedir(), '.docker');
|
const dockerConfigHome = process.env.DOCKER_CONFIG || path.join(os.homedir(), '.docker');
|
||||||
if (!(yield buildx.isAvailable()) || inputs.version) {
|
if (!(yield buildx.isAvailable()) || inputs.version) {
|
||||||
|
core.startGroup(`👉 Installing Buildx`);
|
||||||
yield buildx.install(inputs.version || 'latest', dockerConfigHome);
|
yield buildx.install(inputs.version || 'latest', dockerConfigHome);
|
||||||
|
core.endGroup();
|
||||||
}
|
}
|
||||||
const buildxVersion = yield buildx.getVersion();
|
const buildxVersion = yield buildx.getVersion();
|
||||||
core.info(`📣 Buildx version: ${buildxVersion}`);
|
core.info(`📣 Buildx version: ${buildxVersion}`);
|
||||||
@ -523,13 +525,23 @@ function run() {
|
|||||||
core.setOutput('name', builderName);
|
core.setOutput('name', builderName);
|
||||||
stateHelper.setBuilderName(builderName);
|
stateHelper.setBuilderName(builderName);
|
||||||
if (inputs.driver !== 'docker') {
|
if (inputs.driver !== 'docker') {
|
||||||
core.info('🔨 Creating a new builder instance...');
|
core.startGroup(`🔨 Creating a new builder instance`);
|
||||||
let createArgs = ['buildx', 'create', '--name', builderName, '--driver', inputs.driver];
|
let createArgs = ['buildx', 'create', '--name', builderName, '--driver', inputs.driver];
|
||||||
yield context.asyncForEach(inputs.driverOpts, (driverOpt) => __awaiter(this, void 0, void 0, function* () {
|
if (semver.satisfies(buildxVersion, '>=0.3.0')) {
|
||||||
createArgs.push('--driver-opt', driverOpt);
|
let hasImageDriverOpt = false;
|
||||||
}));
|
yield context.asyncForEach(inputs.driverOpts, (driverOpt) => __awaiter(this, void 0, void 0, function* () {
|
||||||
if (inputs.buildkitdFlags && semver.satisfies(buildxVersion, '>=0.3.0')) {
|
if (driverOpt.startsWith('image=')) {
|
||||||
createArgs.push('--buildkitd-flags', inputs.buildkitdFlags);
|
hasImageDriverOpt = true;
|
||||||
|
}
|
||||||
|
createArgs.push('--driver-opt', driverOpt);
|
||||||
|
}));
|
||||||
|
if (!hasImageDriverOpt) {
|
||||||
|
//FIXME: Temporary fix (docker/build-push-action#154, docker/build-push-action#162)
|
||||||
|
createArgs.push('--driver-opt', 'image=moby/buildkit:v0.8-beta');
|
||||||
|
}
|
||||||
|
if (inputs.buildkitdFlags) {
|
||||||
|
createArgs.push('--buildkitd-flags', inputs.buildkitdFlags);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (inputs.use) {
|
if (inputs.use) {
|
||||||
createArgs.push('--use');
|
createArgs.push('--use');
|
||||||
@ -538,17 +550,21 @@ function run() {
|
|||||||
createArgs.push(inputs.endpoint);
|
createArgs.push(inputs.endpoint);
|
||||||
}
|
}
|
||||||
yield exec.exec('docker', createArgs);
|
yield exec.exec('docker', createArgs);
|
||||||
core.info('🏃 Booting builder...');
|
core.endGroup();
|
||||||
|
core.startGroup(`🏃 Booting builder`);
|
||||||
yield exec.exec('docker', ['buildx', 'inspect', '--bootstrap']);
|
yield exec.exec('docker', ['buildx', 'inspect', '--bootstrap']);
|
||||||
|
core.endGroup();
|
||||||
}
|
}
|
||||||
if (inputs.install) {
|
if (inputs.install) {
|
||||||
core.info('🤝 Setting buildx as default builder...');
|
core.startGroup(`🤝 Setting buildx as default builder`);
|
||||||
yield exec.exec('docker', ['buildx', 'install']);
|
yield exec.exec('docker', ['buildx', 'install']);
|
||||||
|
core.endGroup();
|
||||||
}
|
}
|
||||||
core.info('🛒 Extracting available platforms...');
|
core.startGroup(`🛒 Extracting available platforms`);
|
||||||
const platforms = yield buildx.platforms();
|
const platforms = yield buildx.platforms();
|
||||||
core.info(`${platforms}`);
|
core.info(`${platforms}`);
|
||||||
core.setOutput('platforms', platforms);
|
core.setOutput('platforms', platforms);
|
||||||
|
core.endGroup();
|
||||||
}
|
}
|
||||||
catch (error) {
|
catch (error) {
|
||||||
core.setFailed(error.message);
|
core.setFailed(error.message);
|
||||||
@ -1302,6 +1318,8 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|||||||
};
|
};
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
const command_1 = __webpack_require__(351);
|
const command_1 = __webpack_require__(351);
|
||||||
|
const file_command_1 = __webpack_require__(717);
|
||||||
|
const utils_1 = __webpack_require__(278);
|
||||||
const os = __importStar(__webpack_require__(87));
|
const os = __importStar(__webpack_require__(87));
|
||||||
const path = __importStar(__webpack_require__(622));
|
const path = __importStar(__webpack_require__(622));
|
||||||
/**
|
/**
|
||||||
@ -1328,9 +1346,17 @@ var ExitCode;
|
|||||||
*/
|
*/
|
||||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
function exportVariable(name, val) {
|
function exportVariable(name, val) {
|
||||||
const convertedVal = command_1.toCommandValue(val);
|
const convertedVal = utils_1.toCommandValue(val);
|
||||||
process.env[name] = convertedVal;
|
process.env[name] = convertedVal;
|
||||||
command_1.issueCommand('set-env', { name }, convertedVal);
|
const filePath = process.env['GITHUB_ENV'] || '';
|
||||||
|
if (filePath) {
|
||||||
|
const delimiter = '_GitHubActionsFileCommandDelimeter_';
|
||||||
|
const commandValue = `${name}<<${delimiter}${os.EOL}${convertedVal}${os.EOL}${delimiter}`;
|
||||||
|
file_command_1.issueCommand('ENV', commandValue);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
command_1.issueCommand('set-env', { name }, convertedVal);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
exports.exportVariable = exportVariable;
|
exports.exportVariable = exportVariable;
|
||||||
/**
|
/**
|
||||||
@ -1346,7 +1372,13 @@ exports.setSecret = setSecret;
|
|||||||
* @param inputPath
|
* @param inputPath
|
||||||
*/
|
*/
|
||||||
function addPath(inputPath) {
|
function addPath(inputPath) {
|
||||||
command_1.issueCommand('add-path', {}, inputPath);
|
const filePath = process.env['GITHUB_PATH'] || '';
|
||||||
|
if (filePath) {
|
||||||
|
file_command_1.issueCommand('PATH', inputPath);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
command_1.issueCommand('add-path', {}, inputPath);
|
||||||
|
}
|
||||||
process.env['PATH'] = `${inputPath}${path.delimiter}${process.env['PATH']}`;
|
process.env['PATH'] = `${inputPath}${path.delimiter}${process.env['PATH']}`;
|
||||||
}
|
}
|
||||||
exports.addPath = addPath;
|
exports.addPath = addPath;
|
||||||
@ -1795,6 +1827,32 @@ if (process.env.NODE_DEBUG && /\btunnel\b/.test(process.env.NODE_DEBUG)) {
|
|||||||
exports.debug = debug; // for test
|
exports.debug = debug; // for test
|
||||||
|
|
||||||
|
|
||||||
|
/***/ }),
|
||||||
|
|
||||||
|
/***/ 278:
|
||||||
|
/***/ (function(__unusedmodule, exports) {
|
||||||
|
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
// We use any as a valid input type
|
||||||
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||||
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
|
/**
|
||||||
|
* Sanitizes an input into a string so it can be passed into issueCommand safely
|
||||||
|
* @param input input to sanitize into a string
|
||||||
|
*/
|
||||||
|
function toCommandValue(input) {
|
||||||
|
if (input === null || input === undefined) {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
else if (typeof input === 'string' || input instanceof String) {
|
||||||
|
return input;
|
||||||
|
}
|
||||||
|
return JSON.stringify(input);
|
||||||
|
}
|
||||||
|
exports.toCommandValue = toCommandValue;
|
||||||
|
//# sourceMappingURL=utils.js.map
|
||||||
|
|
||||||
/***/ }),
|
/***/ }),
|
||||||
|
|
||||||
/***/ 279:
|
/***/ 279:
|
||||||
@ -2154,6 +2212,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|||||||
};
|
};
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
const os = __importStar(__webpack_require__(87));
|
const os = __importStar(__webpack_require__(87));
|
||||||
|
const utils_1 = __webpack_require__(278);
|
||||||
/**
|
/**
|
||||||
* Commands
|
* Commands
|
||||||
*
|
*
|
||||||
@ -2207,28 +2266,14 @@ class Command {
|
|||||||
return cmdStr;
|
return cmdStr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/**
|
|
||||||
* Sanitizes an input into a string so it can be passed into issueCommand safely
|
|
||||||
* @param input input to sanitize into a string
|
|
||||||
*/
|
|
||||||
function toCommandValue(input) {
|
|
||||||
if (input === null || input === undefined) {
|
|
||||||
return '';
|
|
||||||
}
|
|
||||||
else if (typeof input === 'string' || input instanceof String) {
|
|
||||||
return input;
|
|
||||||
}
|
|
||||||
return JSON.stringify(input);
|
|
||||||
}
|
|
||||||
exports.toCommandValue = toCommandValue;
|
|
||||||
function escapeData(s) {
|
function escapeData(s) {
|
||||||
return toCommandValue(s)
|
return utils_1.toCommandValue(s)
|
||||||
.replace(/%/g, '%25')
|
.replace(/%/g, '%25')
|
||||||
.replace(/\r/g, '%0D')
|
.replace(/\r/g, '%0D')
|
||||||
.replace(/\n/g, '%0A');
|
.replace(/\n/g, '%0A');
|
||||||
}
|
}
|
||||||
function escapeProperty(s) {
|
function escapeProperty(s) {
|
||||||
return toCommandValue(s)
|
return utils_1.toCommandValue(s)
|
||||||
.replace(/%/g, '%25')
|
.replace(/%/g, '%25')
|
||||||
.replace(/\r/g, '%0D')
|
.replace(/\r/g, '%0D')
|
||||||
.replace(/\n/g, '%0A')
|
.replace(/\n/g, '%0A')
|
||||||
@ -2747,12 +2792,11 @@ function copyFile(srcFile, destFile, force) {
|
|||||||
/***/ }),
|
/***/ }),
|
||||||
|
|
||||||
/***/ 443:
|
/***/ 443:
|
||||||
/***/ (function(__unusedmodule, exports, __webpack_require__) {
|
/***/ (function(__unusedmodule, exports) {
|
||||||
|
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
const url = __webpack_require__(835);
|
|
||||||
function getProxyUrl(reqUrl) {
|
function getProxyUrl(reqUrl) {
|
||||||
let usingSsl = reqUrl.protocol === 'https:';
|
let usingSsl = reqUrl.protocol === 'https:';
|
||||||
let proxyUrl;
|
let proxyUrl;
|
||||||
@ -2767,7 +2811,7 @@ function getProxyUrl(reqUrl) {
|
|||||||
proxyVar = process.env['http_proxy'] || process.env['HTTP_PROXY'];
|
proxyVar = process.env['http_proxy'] || process.env['HTTP_PROXY'];
|
||||||
}
|
}
|
||||||
if (proxyVar) {
|
if (proxyVar) {
|
||||||
proxyUrl = url.parse(proxyVar);
|
proxyUrl = new URL(proxyVar);
|
||||||
}
|
}
|
||||||
return proxyUrl;
|
return proxyUrl;
|
||||||
}
|
}
|
||||||
@ -5269,6 +5313,42 @@ function bytesToUuid(buf, offset) {
|
|||||||
module.exports = bytesToUuid;
|
module.exports = bytesToUuid;
|
||||||
|
|
||||||
|
|
||||||
|
/***/ }),
|
||||||
|
|
||||||
|
/***/ 717:
|
||||||
|
/***/ (function(__unusedmodule, exports, __webpack_require__) {
|
||||||
|
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
// For internal use, subject to change.
|
||||||
|
var __importStar = (this && this.__importStar) || function (mod) {
|
||||||
|
if (mod && mod.__esModule) return mod;
|
||||||
|
var result = {};
|
||||||
|
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
|
||||||
|
result["default"] = mod;
|
||||||
|
return result;
|
||||||
|
};
|
||||||
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
|
// We use any as a valid input type
|
||||||
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||||
|
const fs = __importStar(__webpack_require__(747));
|
||||||
|
const os = __importStar(__webpack_require__(87));
|
||||||
|
const utils_1 = __webpack_require__(278);
|
||||||
|
function issueCommand(command, message) {
|
||||||
|
const filePath = process.env[`GITHUB_${command}`];
|
||||||
|
if (!filePath) {
|
||||||
|
throw new Error(`Unable to find environment variable for file command ${command}`);
|
||||||
|
}
|
||||||
|
if (!fs.existsSync(filePath)) {
|
||||||
|
throw new Error(`Missing file at path: ${filePath}`);
|
||||||
|
}
|
||||||
|
fs.appendFileSync(filePath, `${utils_1.toCommandValue(message)}${os.EOL}`, {
|
||||||
|
encoding: 'utf8'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
exports.issueCommand = issueCommand;
|
||||||
|
//# sourceMappingURL=file-command.js.map
|
||||||
|
|
||||||
/***/ }),
|
/***/ }),
|
||||||
|
|
||||||
/***/ 741:
|
/***/ 741:
|
||||||
@ -6523,13 +6603,6 @@ const minSatisfying = (versions, range, options) => {
|
|||||||
module.exports = minSatisfying
|
module.exports = minSatisfying
|
||||||
|
|
||||||
|
|
||||||
/***/ }),
|
|
||||||
|
|
||||||
/***/ 835:
|
|
||||||
/***/ (function(module) {
|
|
||||||
|
|
||||||
module.exports = require("url");
|
|
||||||
|
|
||||||
/***/ }),
|
/***/ }),
|
||||||
|
|
||||||
/***/ 842:
|
/***/ 842:
|
||||||
@ -6935,7 +7008,6 @@ exports.getRelease = (version) => __awaiter(void 0, void 0, void 0, function* ()
|
|||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
const url = __webpack_require__(835);
|
|
||||||
const http = __webpack_require__(605);
|
const http = __webpack_require__(605);
|
||||||
const https = __webpack_require__(211);
|
const https = __webpack_require__(211);
|
||||||
const pm = __webpack_require__(443);
|
const pm = __webpack_require__(443);
|
||||||
@ -6984,7 +7056,7 @@ var MediaTypes;
|
|||||||
* @param serverUrl The server URL where the request will be sent. For example, https://api.github.com
|
* @param serverUrl The server URL where the request will be sent. For example, https://api.github.com
|
||||||
*/
|
*/
|
||||||
function getProxyUrl(serverUrl) {
|
function getProxyUrl(serverUrl) {
|
||||||
let proxyUrl = pm.getProxyUrl(url.parse(serverUrl));
|
let proxyUrl = pm.getProxyUrl(new URL(serverUrl));
|
||||||
return proxyUrl ? proxyUrl.href : '';
|
return proxyUrl ? proxyUrl.href : '';
|
||||||
}
|
}
|
||||||
exports.getProxyUrl = getProxyUrl;
|
exports.getProxyUrl = getProxyUrl;
|
||||||
@ -7003,6 +7075,15 @@ const HttpResponseRetryCodes = [
|
|||||||
const RetryableHttpVerbs = ['OPTIONS', 'GET', 'DELETE', 'HEAD'];
|
const RetryableHttpVerbs = ['OPTIONS', 'GET', 'DELETE', 'HEAD'];
|
||||||
const ExponentialBackoffCeiling = 10;
|
const ExponentialBackoffCeiling = 10;
|
||||||
const ExponentialBackoffTimeSlice = 5;
|
const ExponentialBackoffTimeSlice = 5;
|
||||||
|
class HttpClientError extends Error {
|
||||||
|
constructor(message, statusCode) {
|
||||||
|
super(message);
|
||||||
|
this.name = 'HttpClientError';
|
||||||
|
this.statusCode = statusCode;
|
||||||
|
Object.setPrototypeOf(this, HttpClientError.prototype);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
exports.HttpClientError = HttpClientError;
|
||||||
class HttpClientResponse {
|
class HttpClientResponse {
|
||||||
constructor(message) {
|
constructor(message) {
|
||||||
this.message = message;
|
this.message = message;
|
||||||
@ -7021,7 +7102,7 @@ class HttpClientResponse {
|
|||||||
}
|
}
|
||||||
exports.HttpClientResponse = HttpClientResponse;
|
exports.HttpClientResponse = HttpClientResponse;
|
||||||
function isHttps(requestUrl) {
|
function isHttps(requestUrl) {
|
||||||
let parsedUrl = url.parse(requestUrl);
|
let parsedUrl = new URL(requestUrl);
|
||||||
return parsedUrl.protocol === 'https:';
|
return parsedUrl.protocol === 'https:';
|
||||||
}
|
}
|
||||||
exports.isHttps = isHttps;
|
exports.isHttps = isHttps;
|
||||||
@ -7126,7 +7207,7 @@ class HttpClient {
|
|||||||
if (this._disposed) {
|
if (this._disposed) {
|
||||||
throw new Error('Client has already been disposed.');
|
throw new Error('Client has already been disposed.');
|
||||||
}
|
}
|
||||||
let parsedUrl = url.parse(requestUrl);
|
let parsedUrl = new URL(requestUrl);
|
||||||
let info = this._prepareRequest(verb, parsedUrl, headers);
|
let info = this._prepareRequest(verb, parsedUrl, headers);
|
||||||
// Only perform retries on reads since writes may not be idempotent.
|
// Only perform retries on reads since writes may not be idempotent.
|
||||||
let maxTries = this._allowRetries && RetryableHttpVerbs.indexOf(verb) != -1
|
let maxTries = this._allowRetries && RetryableHttpVerbs.indexOf(verb) != -1
|
||||||
@ -7165,7 +7246,7 @@ class HttpClient {
|
|||||||
// if there's no location to redirect to, we won't
|
// if there's no location to redirect to, we won't
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
let parsedRedirectUrl = url.parse(redirectUrl);
|
let parsedRedirectUrl = new URL(redirectUrl);
|
||||||
if (parsedUrl.protocol == 'https:' &&
|
if (parsedUrl.protocol == 'https:' &&
|
||||||
parsedUrl.protocol != parsedRedirectUrl.protocol &&
|
parsedUrl.protocol != parsedRedirectUrl.protocol &&
|
||||||
!this._allowRedirectDowngrade) {
|
!this._allowRedirectDowngrade) {
|
||||||
@ -7281,7 +7362,7 @@ class HttpClient {
|
|||||||
* @param serverUrl The server URL where the request will be sent. For example, https://api.github.com
|
* @param serverUrl The server URL where the request will be sent. For example, https://api.github.com
|
||||||
*/
|
*/
|
||||||
getAgent(serverUrl) {
|
getAgent(serverUrl) {
|
||||||
let parsedUrl = url.parse(serverUrl);
|
let parsedUrl = new URL(serverUrl);
|
||||||
return this._getAgent(parsedUrl);
|
return this._getAgent(parsedUrl);
|
||||||
}
|
}
|
||||||
_prepareRequest(method, requestUrl, headers) {
|
_prepareRequest(method, requestUrl, headers) {
|
||||||
@ -7354,7 +7435,7 @@ class HttpClient {
|
|||||||
maxSockets: maxSockets,
|
maxSockets: maxSockets,
|
||||||
keepAlive: this._keepAlive,
|
keepAlive: this._keepAlive,
|
||||||
proxy: {
|
proxy: {
|
||||||
proxyAuth: proxyUrl.auth,
|
proxyAuth: `${proxyUrl.username}:${proxyUrl.password}`,
|
||||||
host: proxyUrl.hostname,
|
host: proxyUrl.hostname,
|
||||||
port: proxyUrl.port
|
port: proxyUrl.port
|
||||||
}
|
}
|
||||||
@ -7449,12 +7530,8 @@ class HttpClient {
|
|||||||
else {
|
else {
|
||||||
msg = 'Failed request: (' + statusCode + ')';
|
msg = 'Failed request: (' + statusCode + ')';
|
||||||
}
|
}
|
||||||
let err = new Error(msg);
|
let err = new HttpClientError(msg, statusCode);
|
||||||
// attach statusCode and body obj (if available) to the error object
|
err.result = response.result;
|
||||||
err['statusCode'] = statusCode;
|
|
||||||
if (response.result) {
|
|
||||||
err['result'] = response.result;
|
|
||||||
}
|
|
||||||
reject(err);
|
reject(err);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -29,8 +29,8 @@
|
|||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@actions/core": "^1.2.6",
|
"@actions/core": "^1.2.6",
|
||||||
"@actions/exec": "^1.0.4",
|
"@actions/exec": "^1.0.4",
|
||||||
"@actions/http-client": "^1.0.8",
|
"@actions/http-client": "^1.0.9",
|
||||||
"@actions/tool-cache": "^1.5.5",
|
"@actions/tool-cache": "^1.6.1",
|
||||||
"semver": "^7.3.2"
|
"semver": "^7.3.2"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
34
src/main.ts
34
src/main.ts
@ -19,7 +19,9 @@ async function run(): Promise<void> {
|
|||||||
const dockerConfigHome: string = process.env.DOCKER_CONFIG || path.join(os.homedir(), '.docker');
|
const dockerConfigHome: string = process.env.DOCKER_CONFIG || path.join(os.homedir(), '.docker');
|
||||||
|
|
||||||
if (!(await buildx.isAvailable()) || inputs.version) {
|
if (!(await buildx.isAvailable()) || inputs.version) {
|
||||||
|
core.startGroup(`👉 Installing Buildx`);
|
||||||
await buildx.install(inputs.version || 'latest', dockerConfigHome);
|
await buildx.install(inputs.version || 'latest', dockerConfigHome);
|
||||||
|
core.endGroup();
|
||||||
}
|
}
|
||||||
|
|
||||||
const buildxVersion = await buildx.getVersion();
|
const buildxVersion = await buildx.getVersion();
|
||||||
@ -31,13 +33,23 @@ async function run(): Promise<void> {
|
|||||||
stateHelper.setBuilderName(builderName);
|
stateHelper.setBuilderName(builderName);
|
||||||
|
|
||||||
if (inputs.driver !== 'docker') {
|
if (inputs.driver !== 'docker') {
|
||||||
core.info('🔨 Creating a new builder instance...');
|
core.startGroup(`🔨 Creating a new builder instance`);
|
||||||
let createArgs: Array<string> = ['buildx', 'create', '--name', builderName, '--driver', inputs.driver];
|
let createArgs: Array<string> = ['buildx', 'create', '--name', builderName, '--driver', inputs.driver];
|
||||||
await context.asyncForEach(inputs.driverOpts, async driverOpt => {
|
if (semver.satisfies(buildxVersion, '>=0.3.0')) {
|
||||||
createArgs.push('--driver-opt', driverOpt);
|
let hasImageDriverOpt: boolean = false;
|
||||||
});
|
await context.asyncForEach(inputs.driverOpts, async driverOpt => {
|
||||||
if (inputs.buildkitdFlags && semver.satisfies(buildxVersion, '>=0.3.0')) {
|
if (driverOpt.startsWith('image=')) {
|
||||||
createArgs.push('--buildkitd-flags', inputs.buildkitdFlags);
|
hasImageDriverOpt = true;
|
||||||
|
}
|
||||||
|
createArgs.push('--driver-opt', driverOpt);
|
||||||
|
});
|
||||||
|
if (!hasImageDriverOpt) {
|
||||||
|
//FIXME: Temporary fix (docker/build-push-action#154, docker/build-push-action#162)
|
||||||
|
createArgs.push('--driver-opt', 'image=moby/buildkit:v0.8-beta');
|
||||||
|
}
|
||||||
|
if (inputs.buildkitdFlags) {
|
||||||
|
createArgs.push('--buildkitd-flags', inputs.buildkitdFlags);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (inputs.use) {
|
if (inputs.use) {
|
||||||
createArgs.push('--use');
|
createArgs.push('--use');
|
||||||
@ -46,20 +58,24 @@ async function run(): Promise<void> {
|
|||||||
createArgs.push(inputs.endpoint);
|
createArgs.push(inputs.endpoint);
|
||||||
}
|
}
|
||||||
await exec.exec('docker', createArgs);
|
await exec.exec('docker', createArgs);
|
||||||
|
core.endGroup();
|
||||||
|
|
||||||
core.info('🏃 Booting builder...');
|
core.startGroup(`🏃 Booting builder`);
|
||||||
await exec.exec('docker', ['buildx', 'inspect', '--bootstrap']);
|
await exec.exec('docker', ['buildx', 'inspect', '--bootstrap']);
|
||||||
|
core.endGroup();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (inputs.install) {
|
if (inputs.install) {
|
||||||
core.info('🤝 Setting buildx as default builder...');
|
core.startGroup(`🤝 Setting buildx as default builder`);
|
||||||
await exec.exec('docker', ['buildx', 'install']);
|
await exec.exec('docker', ['buildx', 'install']);
|
||||||
|
core.endGroup();
|
||||||
}
|
}
|
||||||
|
|
||||||
core.info('🛒 Extracting available platforms...');
|
core.startGroup(`🛒 Extracting available platforms`);
|
||||||
const platforms = await buildx.platforms();
|
const platforms = await buildx.platforms();
|
||||||
core.info(`${platforms}`);
|
core.info(`${platforms}`);
|
||||||
core.setOutput('platforms', platforms);
|
core.setOutput('platforms', platforms);
|
||||||
|
core.endGroup();
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
core.setFailed(error.message);
|
core.setFailed(error.message);
|
||||||
}
|
}
|
||||||
|
20
yarn.lock
20
yarn.lock
@ -2,7 +2,7 @@
|
|||||||
# yarn lockfile v1
|
# yarn lockfile v1
|
||||||
|
|
||||||
|
|
||||||
"@actions/core@^1.2.3", "@actions/core@^1.2.6":
|
"@actions/core@^1.2.6":
|
||||||
version "1.2.6"
|
version "1.2.6"
|
||||||
resolved "https://registry.yarnpkg.com/@actions/core/-/core-1.2.6.tgz#a78d49f41a4def18e88ce47c2cac615d5694bf09"
|
resolved "https://registry.yarnpkg.com/@actions/core/-/core-1.2.6.tgz#a78d49f41a4def18e88ce47c2cac615d5694bf09"
|
||||||
integrity sha512-ZQYitnqiyBc3D+k7LsgSBmMDVkOVidaagDG7j3fOym77jNunWRuYx7VSHa9GNfFZh+zh61xsCjRj4JxMZlDqTA==
|
integrity sha512-ZQYitnqiyBc3D+k7LsgSBmMDVkOVidaagDG7j3fOym77jNunWRuYx7VSHa9GNfFZh+zh61xsCjRj4JxMZlDqTA==
|
||||||
@ -14,10 +14,10 @@
|
|||||||
dependencies:
|
dependencies:
|
||||||
"@actions/io" "^1.0.1"
|
"@actions/io" "^1.0.1"
|
||||||
|
|
||||||
"@actions/http-client@^1.0.8":
|
"@actions/http-client@^1.0.8", "@actions/http-client@^1.0.9":
|
||||||
version "1.0.8"
|
version "1.0.9"
|
||||||
resolved "https://registry.yarnpkg.com/@actions/http-client/-/http-client-1.0.8.tgz#8bd76e8eca89dc8bcf619aa128eba85f7a39af45"
|
resolved "https://registry.yarnpkg.com/@actions/http-client/-/http-client-1.0.9.tgz#af1947d020043dbc6a3b4c5918892095c30ffb52"
|
||||||
integrity sha512-G4JjJ6f9Hb3Zvejj+ewLLKLf99ZC+9v+yCxoYf9vSyH+WkzPLB2LuUtRMGNkooMqdugGBFStIKXOuvH1W+EctA==
|
integrity sha512-0O4SsJ7q+MK0ycvXPl2e6bMXV7dxAXOGjrXS1eTF9s2S401Tp6c/P3c3Joz04QefC1J6Gt942Wl2jbm3f4mLcg==
|
||||||
dependencies:
|
dependencies:
|
||||||
tunnel "0.0.6"
|
tunnel "0.0.6"
|
||||||
|
|
||||||
@ -26,12 +26,12 @@
|
|||||||
resolved "https://registry.yarnpkg.com/@actions/io/-/io-1.0.2.tgz#2f614b6e69ce14d191180451eb38e6576a6e6b27"
|
resolved "https://registry.yarnpkg.com/@actions/io/-/io-1.0.2.tgz#2f614b6e69ce14d191180451eb38e6576a6e6b27"
|
||||||
integrity sha512-J8KuFqVPr3p6U8W93DOXlXW6zFvrQAJANdS+vw0YhusLIq+bszW8zmK2Fh1C2kDPX8FMvwIl1OUcFgvJoXLbAg==
|
integrity sha512-J8KuFqVPr3p6U8W93DOXlXW6zFvrQAJANdS+vw0YhusLIq+bszW8zmK2Fh1C2kDPX8FMvwIl1OUcFgvJoXLbAg==
|
||||||
|
|
||||||
"@actions/tool-cache@^1.5.5":
|
"@actions/tool-cache@^1.6.1":
|
||||||
version "1.6.0"
|
version "1.6.1"
|
||||||
resolved "https://registry.yarnpkg.com/@actions/tool-cache/-/tool-cache-1.6.0.tgz#5b425db2d642df65dd0d6bcec0d84dcdbca3f80d"
|
resolved "https://registry.yarnpkg.com/@actions/tool-cache/-/tool-cache-1.6.1.tgz#5e199f7bfd9863eb2b0d467cd70751ef8042ec40"
|
||||||
integrity sha512-+fyEBImPD3m5I0o6DflCO0NHY180LPoX8Lo6y4Iez+V17kO8kfkH0VHxb8mUdmD6hn9dWA9Ch1JA20fXoIYUeQ==
|
integrity sha512-F+vwEDwfqcHMKuSkj79pihOnsAMv23EkG76nMpc82UsnXwyQdyEsktGxrB0SNtm7pRqTXEIOoAPTgrSQclXYTg==
|
||||||
dependencies:
|
dependencies:
|
||||||
"@actions/core" "^1.2.3"
|
"@actions/core" "^1.2.6"
|
||||||
"@actions/exec" "^1.0.0"
|
"@actions/exec" "^1.0.0"
|
||||||
"@actions/http-client" "^1.0.8"
|
"@actions/http-client" "^1.0.8"
|
||||||
"@actions/io" "^1.0.1"
|
"@actions/io" "^1.0.1"
|
||||||
|
Reference in New Issue
Block a user