mirror of
https://github.com/docker/setup-buildx-action.git
synced 2025-05-10 08:29:30 +02:00
auth support for tls endpoint
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
This commit is contained in:
parent
f5bc16b105
commit
1c2ad20e10
8 changed files with 239 additions and 16 deletions
15
src/main.ts
15
src/main.ts
|
@ -1,6 +1,8 @@
|
|||
import * as fs from 'fs';
|
||||
import * as os from 'os';
|
||||
import * as path from 'path';
|
||||
import * as uuid from 'uuid';
|
||||
import * as auth from './auth';
|
||||
import * as buildx from './buildx';
|
||||
import * as context from './context';
|
||||
import * as docker from './docker';
|
||||
|
@ -56,8 +58,16 @@ async function run(): Promise<void> {
|
|||
context.setOutput('name', builderName);
|
||||
stateHelper.setBuilderName(builderName);
|
||||
|
||||
const credsdir = path.join(dockerConfigHome, 'buildx', 'creds', builderName);
|
||||
fs.mkdirSync(credsdir, {recursive: true});
|
||||
stateHelper.setCredsDir(credsdir);
|
||||
|
||||
if (inputs.driver !== 'docker') {
|
||||
core.startGroup(`Creating a new builder instance`);
|
||||
const authOpts = auth.setCredentials(credsdir, 0, inputs.driver, inputs.endpoint);
|
||||
if (authOpts.length > 0) {
|
||||
inputs.driverOpts = [...inputs.driverOpts, ...authOpts];
|
||||
}
|
||||
const createArgs: Array<string> = ['create', '--name', builderName, '--driver', inputs.driver];
|
||||
if (buildx.satisfies(buildxVersion, '>=0.3.0')) {
|
||||
await context.asyncForEach(inputs.driverOpts, async driverOpt => {
|
||||
|
@ -156,6 +166,11 @@ async function cleanup(): Promise<void> {
|
|||
});
|
||||
core.endGroup();
|
||||
}
|
||||
|
||||
if (stateHelper.credsDir.length > 0 && fs.existsSync(stateHelper.credsDir)) {
|
||||
core.info(`Cleaning up credentials`);
|
||||
fs.rmdirSync(stateHelper.credsDir, {recursive: true});
|
||||
}
|
||||
}
|
||||
|
||||
if (!stateHelper.IsPost) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue