assembled docker args
This commit is contained in:
parent
ae28309b42
commit
eeebfeb67a
43
dist/index.js
vendored
43
dist/index.js
vendored
@ -62235,6 +62235,38 @@ function prepareDestinations(registries, tags) {
|
|||||||
return destinations;
|
return destinations;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function prepareDockerArgs(destinations) {
|
||||||
|
let dockerArgs = (core.getInput('docker_args') ?? '').trim();
|
||||||
|
if (dockerArgs.length > 0) {
|
||||||
|
dockerArgs = [dockerArgs];
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
dockerArgs = [];
|
||||||
|
}
|
||||||
|
|
||||||
|
if(isNonEmptyStr(core.getInput("dockerfile"))) {
|
||||||
|
dockerArgs.unshift("--file " + core.getInput("dockerfile"))
|
||||||
|
}
|
||||||
|
|
||||||
|
if(isNonEmptyStr(core.getInput("docker_context_dir"))) {
|
||||||
|
dockerArgs.unshift(core.getInput("docker_context_dir"))
|
||||||
|
} // TODO use runner workdir instead
|
||||||
|
|
||||||
|
if(core.getBooleanInput("squash_layers")) {
|
||||||
|
dockerArgs.push("--squash")
|
||||||
|
}
|
||||||
|
|
||||||
|
destinations.forEach(dest => {
|
||||||
|
dockerArgs.push("--tag " + dest)
|
||||||
|
})
|
||||||
|
|
||||||
|
if(isNonEmptyStr(core.getInput("additional_registry_destinations"))) {
|
||||||
|
dockerArgs.push(core.getInput("additional_registry_destinations"))
|
||||||
|
}
|
||||||
|
|
||||||
|
return dockerArgs
|
||||||
|
}
|
||||||
|
|
||||||
;// CONCATENATED MODULE: ./src/action.js
|
;// CONCATENATED MODULE: ./src/action.js
|
||||||
|
|
||||||
|
|
||||||
@ -62244,9 +62276,9 @@ function prepareDestinations(registries, tags) {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
const information = collect_all(true, false);
|
const information = collect_all(true, false);
|
||||||
let debug = core.getInput('debug') != null ? (!!core.getInput('debug')) : true;
|
let debug = core.getInput('debug') != null ? (!!core.getInput('debug')) : true;
|
||||||
console.log("debug=", debug)
|
console.log('debug=', debug);
|
||||||
debug=true
|
debug = true;
|
||||||
|
|
||||||
let targetRegistries = [];
|
let targetRegistries = [];
|
||||||
const repoStr = github.context.repo.owner + '/' + github.context.repo.repo;
|
const repoStr = github.context.repo.owner + '/' + github.context.repo.repo;
|
||||||
@ -62272,6 +62304,11 @@ try {
|
|||||||
if (debug) {
|
if (debug) {
|
||||||
console.log('destinations:', JSON.stringify(destinations, null, 2));
|
console.log('destinations:', JSON.stringify(destinations, null, 2));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const dockerArgs = prepareDockerArgs(destinations);
|
||||||
|
if (debug) {
|
||||||
|
console.log('dockerArgs:', JSON.stringify(destinations, null, 2));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch (error) {
|
catch (error) {
|
||||||
console.log('Failed to build docker image', error);
|
console.log('Failed to build docker image', error);
|
||||||
|
|||||||
@ -5,7 +5,7 @@ import {
|
|||||||
addCiRegistryAuth,
|
addCiRegistryAuth,
|
||||||
collectTags,
|
collectTags,
|
||||||
mergeArgRegistryAuthJson,
|
mergeArgRegistryAuthJson,
|
||||||
prepareDestinations,
|
prepareDestinations, prepareDockerArgs,
|
||||||
processAdditionalRegistries,
|
processAdditionalRegistries,
|
||||||
writeRegistryAuthJson
|
writeRegistryAuthJson
|
||||||
} from './lib';
|
} from './lib';
|
||||||
@ -13,9 +13,9 @@ import {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
const information = action_information.collect_all(true, false);
|
const information = action_information.collect_all(true, false);
|
||||||
let debug = core.getInput('debug') != null ? (!!core.getInput('debug')) : true;
|
let debug = core.getInput('debug') != null ? (!!core.getInput('debug')) : true;
|
||||||
console.log("debug=", debug)
|
console.log('debug=', debug);
|
||||||
debug=true
|
debug = true;
|
||||||
|
|
||||||
let targetRegistries = [];
|
let targetRegistries = [];
|
||||||
const repoStr = github.context.repo.owner + '/' + github.context.repo.repo;
|
const repoStr = github.context.repo.owner + '/' + github.context.repo.repo;
|
||||||
@ -41,6 +41,11 @@ try {
|
|||||||
if (debug) {
|
if (debug) {
|
||||||
console.log('destinations:', JSON.stringify(destinations, null, 2));
|
console.log('destinations:', JSON.stringify(destinations, null, 2));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const dockerArgs = prepareDockerArgs(destinations);
|
||||||
|
if (debug) {
|
||||||
|
console.log('dockerArgs:', JSON.stringify(destinations, null, 2));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch (error) {
|
catch (error) {
|
||||||
console.log('Failed to build docker image', error);
|
console.log('Failed to build docker image', error);
|
||||||
|
|||||||
32
src/lib.js
32
src/lib.js
@ -134,3 +134,35 @@ export function prepareDestinations(registries, tags) {
|
|||||||
|
|
||||||
return destinations;
|
return destinations;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function prepareDockerArgs(destinations) {
|
||||||
|
let dockerArgs = (core.getInput('docker_args') ?? '').trim();
|
||||||
|
if (dockerArgs.length > 0) {
|
||||||
|
dockerArgs = [dockerArgs];
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
dockerArgs = [];
|
||||||
|
}
|
||||||
|
|
||||||
|
if(isNonEmptyStr(core.getInput("dockerfile"))) {
|
||||||
|
dockerArgs.unshift("--file " + core.getInput("dockerfile"))
|
||||||
|
}
|
||||||
|
|
||||||
|
if(isNonEmptyStr(core.getInput("docker_context_dir"))) {
|
||||||
|
dockerArgs.unshift(core.getInput("docker_context_dir"))
|
||||||
|
} // TODO use runner workdir instead
|
||||||
|
|
||||||
|
if(core.getBooleanInput("squash_layers")) {
|
||||||
|
dockerArgs.push("--squash")
|
||||||
|
}
|
||||||
|
|
||||||
|
destinations.forEach(dest => {
|
||||||
|
dockerArgs.push("--tag " + dest)
|
||||||
|
})
|
||||||
|
|
||||||
|
if(isNonEmptyStr(core.getInput("additional_registry_destinations"))) {
|
||||||
|
dockerArgs.push(core.getInput("additional_registry_destinations"))
|
||||||
|
}
|
||||||
|
|
||||||
|
return dockerArgs
|
||||||
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user