1
0
Fork 0
mirror of https://github.com/docker/build-push-action.git synced 2025-05-12 08:29:30 +02:00

*: hit sentry on failures to get remote docker builders

This commit is contained in:
Aditya Maru 2024-11-12 19:23:57 -07:00
parent 5ce6222a10
commit 31a478457f
4 changed files with 63 additions and 20 deletions

View file

@ -85,18 +85,23 @@ export async function getInputs(): Promise<Inputs> {
// getDockerfilePath resolves the path to the build entity. This is basically
// {context}/{file} or {context}/{dockerfile} depending on the inputs.
export function getDockerfilePath(inputs: Inputs): string {
const context = inputs.context || Context.gitContext();
const normalizedContext = path.normalize(context);
export function getDockerfilePath(inputs: Inputs): string | null {
try {
const context = inputs.context || Context.gitContext();
const normalizedContext = path.normalize(context);
if (inputs.file) {
const normalizedFile = path.normalize(inputs.file);
return normalizedFile.startsWith(normalizedContext) ? normalizedFile : path.join(normalizedContext, normalizedFile);
} else if (inputs['dockerfile']) {
const normalizedDockerfile = path.normalize(inputs['dockerfile']);
return normalizedDockerfile.startsWith(normalizedContext) ? normalizedDockerfile : path.join(normalizedContext, normalizedDockerfile);
} else {
return normalizedContext;
if (inputs.file) {
const normalizedFile = path.normalize(inputs.file);
return normalizedFile.startsWith(normalizedContext) ? normalizedFile : path.join(normalizedContext, normalizedFile);
} else if (inputs['dockerfile']) {
const normalizedDockerfile = path.normalize(inputs['dockerfile']);
return normalizedDockerfile.startsWith(normalizedContext) ? normalizedDockerfile : path.join(normalizedContext, normalizedDockerfile);
} else {
return normalizedContext;
}
} catch (error) {
core.warning(`Error getting dockerfile path: ${(error as Error).message}`);
return null;
}
}