mirror of
https://github.com/docker/build-push-action.git
synced 2024-12-24 07:42:14 -05:00
Fix args
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
This commit is contained in:
parent
8be103ff82
commit
8913dd9900
3 changed files with 17 additions and 14 deletions
11
dist/index.js
generated
vendored
11
dist/index.js
generated
vendored
|
@ -1018,12 +1018,13 @@ function run() {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const inputs = yield context_1.getInputs();
|
const inputs = yield context_1.getInputs();
|
||||||
|
const args = yield context_1.getArgs(inputs);
|
||||||
if (inputs.builder) {
|
if (inputs.builder) {
|
||||||
core.info(`📌 Using builder instance ${inputs.builder}`);
|
core.info(`📌 Using builder instance ${inputs.builder}`);
|
||||||
yield buildx.use(inputs.builder);
|
yield buildx.use(inputs.builder);
|
||||||
}
|
}
|
||||||
core.info(`🏃 Starting build...`);
|
core.info(`🏃 Starting build...`);
|
||||||
yield exec.exec('docker', yield context_1.getArgs(inputs));
|
yield exec.exec('docker', args);
|
||||||
}
|
}
|
||||||
catch (error) {
|
catch (error) {
|
||||||
core.setFailed(error.message);
|
core.setFailed(error.message);
|
||||||
|
@ -1436,17 +1437,17 @@ function getArgs(inputs) {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
let args = ['buildx'];
|
let args = ['buildx'];
|
||||||
if (inputs.bake) {
|
if (inputs.bake) {
|
||||||
args.concat(yield getBakeArgs(inputs));
|
args.push.apply(args, yield getBakeArgs(inputs));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
args.concat(yield getBuildArgs(inputs));
|
args.push.apply(args, yield getBuildArgs(inputs));
|
||||||
}
|
}
|
||||||
args.concat(yield getCommonArgs(inputs));
|
args.push.apply(args, yield getCommonArgs(inputs));
|
||||||
if (!inputs.bake) {
|
if (!inputs.bake) {
|
||||||
args.push(inputs.context);
|
args.push(inputs.context);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
args.concat(inputs.bakeTargets);
|
args.push.apply(args, inputs.bakeTargets);
|
||||||
}
|
}
|
||||||
return args;
|
return args;
|
||||||
});
|
});
|
||||||
|
|
|
@ -46,25 +46,26 @@ export async function getInputs(): Promise<Inputs> {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function getArgs(inputs: Inputs): Promise<string[]> {
|
export async function getArgs(inputs: Inputs): Promise<Array<string>> {
|
||||||
let args: Array<string> = ['buildx'];
|
let args: Array<string> = ['buildx'];
|
||||||
|
|
||||||
if (inputs.bake) {
|
if (inputs.bake) {
|
||||||
args.concat(await getBakeArgs(inputs));
|
args.push.apply(args, await getBakeArgs(inputs));
|
||||||
} else {
|
} else {
|
||||||
args.concat(await getBuildArgs(inputs));
|
args.push.apply(args, await getBuildArgs(inputs));
|
||||||
}
|
}
|
||||||
args.concat(await getCommonArgs(inputs));
|
args.push.apply(args, await getCommonArgs(inputs));
|
||||||
|
|
||||||
if (!inputs.bake) {
|
if (!inputs.bake) {
|
||||||
args.push(inputs.context);
|
args.push(inputs.context);
|
||||||
} else {
|
} else {
|
||||||
args.concat(inputs.bakeTargets);
|
args.push.apply(args, inputs.bakeTargets);
|
||||||
}
|
}
|
||||||
|
|
||||||
return args;
|
return args;
|
||||||
}
|
}
|
||||||
|
|
||||||
async function getCommonArgs(inputs: Inputs): Promise<string[]> {
|
async function getCommonArgs(inputs: Inputs): Promise<Array<string>> {
|
||||||
let args: Array<string> = [];
|
let args: Array<string> = [];
|
||||||
if (inputs.noCache) {
|
if (inputs.noCache) {
|
||||||
args.push('--no-cache');
|
args.push('--no-cache');
|
||||||
|
@ -81,7 +82,7 @@ async function getCommonArgs(inputs: Inputs): Promise<string[]> {
|
||||||
return args;
|
return args;
|
||||||
}
|
}
|
||||||
|
|
||||||
async function getBakeArgs(inputs: Inputs): Promise<string[]> {
|
async function getBakeArgs(inputs: Inputs): Promise<Array<string>> {
|
||||||
let args: Array<string> = ['bake'];
|
let args: Array<string> = ['bake'];
|
||||||
await asyncForEach(inputs.bakeFiles, async bakeFile => {
|
await asyncForEach(inputs.bakeFiles, async bakeFile => {
|
||||||
args.push('--file', bakeFile);
|
args.push('--file', bakeFile);
|
||||||
|
@ -89,7 +90,7 @@ async function getBakeArgs(inputs: Inputs): Promise<string[]> {
|
||||||
return args;
|
return args;
|
||||||
}
|
}
|
||||||
|
|
||||||
async function getBuildArgs(inputs: Inputs): Promise<string[]> {
|
async function getBuildArgs(inputs: Inputs): Promise<Array<string>> {
|
||||||
let args: Array<string> = ['build'];
|
let args: Array<string> = ['build'];
|
||||||
await asyncForEach(inputs.buildArgs, async buildArg => {
|
await asyncForEach(inputs.buildArgs, async buildArg => {
|
||||||
args.push('--build-arg', buildArg);
|
args.push('--build-arg', buildArg);
|
||||||
|
|
|
@ -17,6 +17,7 @@ async function run(): Promise<void> {
|
||||||
}
|
}
|
||||||
|
|
||||||
const inputs: Inputs = await getInputs();
|
const inputs: Inputs = await getInputs();
|
||||||
|
const args: string[] = await getArgs(inputs);
|
||||||
|
|
||||||
if (inputs.builder) {
|
if (inputs.builder) {
|
||||||
core.info(`📌 Using builder instance ${inputs.builder}`);
|
core.info(`📌 Using builder instance ${inputs.builder}`);
|
||||||
|
@ -24,7 +25,7 @@ async function run(): Promise<void> {
|
||||||
}
|
}
|
||||||
|
|
||||||
core.info(`🏃 Starting build...`);
|
core.info(`🏃 Starting build...`);
|
||||||
await exec.exec('docker', await getArgs(inputs));
|
await exec.exec('docker', args);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
core.setFailed(error.message);
|
core.setFailed(error.message);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue