diff --git a/action.yml b/action.yml index 2fa9806..afbf3fb 100644 --- a/action.yml +++ b/action.yml @@ -7,6 +7,9 @@ branding: color: 'blue' inputs: + nofallback: + description: "Fail the build if the remote builder is not available; defaults to false" + required: false add-hosts: description: "List of a customs host-to-IP mapping (e.g., docker:10.180.0.1)" required: false diff --git a/src/context.ts b/src/context.ts index d1e79cf..07c4f16 100644 --- a/src/context.ts +++ b/src/context.ts @@ -40,6 +40,7 @@ export interface Inputs { target: string; ulimit: string[]; 'github-token': string; + nofallback: boolean; } export async function getInputs(): Promise { @@ -75,7 +76,8 @@ export async function getInputs(): Promise { tags: Util.getInputList('tags'), target: core.getInput('target'), ulimit: Util.getInputList('ulimit', {ignoreComma: true}), - 'github-token': core.getInput('github-token') + 'github-token': core.getInput('github-token'), + nofallback: core.getBooleanInput('nofallback') }; } diff --git a/src/main.ts b/src/main.ts index 08c0a74..104b1cb 100644 --- a/src/main.ts +++ b/src/main.ts @@ -97,7 +97,9 @@ async function getRemoteBuilderAddr(inputs: context.Inputs): Promise { remoteBuilderAddr = await getRemoteBuilderAddr(inputs); if (!remoteBuilderAddr) { - core.warning('Failed to obtain Blacksmith remote builder address. Falling back to a local build.'); + if (inputs.nofallback) { + core.setFailed('Failed to obtain Blacksmith builder. Failing the build'); + } else { + core.warning('Failed to obtain Blacksmith remote builder address. Falling back to a local build.'); + } } });