This commit is contained in:
CrazyMax 2025-12-19 10:59:05 +01:00 committed by GitHub
commit ad499276a5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
9 changed files with 6 additions and 121 deletions

View File

@ -212,7 +212,7 @@ jobs:
env: env:
DOCKER_CONTEXT: mycontext DOCKER_CONTEXT: mycontext
config: buildkitd-config:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- -
@ -244,7 +244,7 @@ jobs:
with: with:
context: . context: .
config-inline: buildkitd-config-inline:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- -
@ -391,36 +391,6 @@ jobs:
with: with:
context: . context: .
standalone-install-error:
runs-on: ubuntu-latest
steps:
-
name: Checkout
uses: actions/checkout@v6
-
name: Uninstall docker cli
run: |
if dpkg -s "docker-ce" >/dev/null 2>&1; then
sudo dpkg -r --force-depends docker-ce-cli docker-buildx-plugin
else
sudo apt-get purge -y moby-cli moby-buildx
fi
-
name: Set up Docker Buildx
id: buildx
continue-on-error: true
uses: ./
with:
install: true
-
name: Check
run: |
echo "${{ toJson(steps.buildx) }}"
if [ "${{ steps.buildx.outcome }}" != "failure" ] || [ "${{ steps.buildx.conclusion }}" != "success" ]; then
echo "::error::Should have failed"
exit 1
fi
append: append:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:

View File

@ -94,7 +94,6 @@ The following inputs can be used as `step.with` keys:
| `buildkitd-flags` | String | | [BuildKit daemon flags](https://docs.docker.com/engine/reference/commandline/buildx_create/#buildkitd-flags) | | `buildkitd-flags` | String | | [BuildKit daemon flags](https://docs.docker.com/engine/reference/commandline/buildx_create/#buildkitd-flags) |
| `buildkitd-config` \* | String | | [BuildKit daemon config file](https://docs.docker.com/engine/reference/commandline/buildx_create/#config) | | `buildkitd-config` \* | String | | [BuildKit daemon config file](https://docs.docker.com/engine/reference/commandline/buildx_create/#config) |
| `buildkitd-config-inline` \* | String | | Same as `buildkitd-config` but inline | | `buildkitd-config-inline` \* | String | | Same as `buildkitd-config` but inline |
| `install` \* | Bool | `false` | Sets up `docker build` command as an alias to `docker buildx` |
| `use` | Bool | `true` | Switch to this builder instance | | `use` | Bool | `true` | Switch to this builder instance |
| `endpoint` | String | | [Optional address for docker socket](https://docs.docker.com/engine/reference/commandline/buildx_create/#description) or context from `docker context ls` | | `endpoint` | String | | [Optional address for docker socket](https://docs.docker.com/engine/reference/commandline/buildx_create/#description) or context from `docker context ls` |
| `platforms` | List/CSV | | Fixed [platforms](https://docs.docker.com/engine/reference/commandline/buildx_create/#platform) for current node. If not empty, values take priority over the detected ones | | `platforms` | List/CSV | | Fixed [platforms](https://docs.docker.com/engine/reference/commandline/buildx_create/#platform) for current node. If not empty, values take priority over the detected ones |
@ -111,14 +110,6 @@ The following inputs can be used as `step.with` keys:
> [!NOTE] > [!NOTE]
> `buildkitd-config` and `buildkitd-config-inline` are mutually exclusive. > `buildkitd-config` and `buildkitd-config-inline` are mutually exclusive.
> [!NOTE]
> `install` input is deprecated and will be removed in a future release. This
> input is not necessary when building with our actions like
> `docker/build-push-action` or `docker/bake-action`. If you are still building
> with the `docker build` command then you can set the `BUILDX_BUILDER`
> environment variable, or you can just directly invoke the
> `docker buildx build` command: https://github.com/docker/setup-buildx-action/pull/455
### outputs ### outputs
The following outputs are available: The following outputs are available:

View File

@ -52,7 +52,6 @@ describe('getCreateArgs', () => {
0, 0,
'v0.10.3', 'v0.10.3',
new Map<string, string>([ new Map<string, string>([
['install', 'false'],
['use', 'true'], ['use', 'true'],
['cache-binary', 'true'], ['cache-binary', 'true'],
['cleanup', 'true'], ['cleanup', 'true'],
@ -71,7 +70,6 @@ describe('getCreateArgs', () => {
'v0.10.3', 'v0.10.3',
new Map<string, string>([ new Map<string, string>([
['driver', 'docker'], ['driver', 'docker'],
['install', 'false'],
['use', 'true'], ['use', 'true'],
['cache-binary', 'true'], ['cache-binary', 'true'],
['cleanup', 'true'], ['cleanup', 'true'],
@ -89,7 +87,6 @@ describe('getCreateArgs', () => {
2, 2,
'v0.10.3', 'v0.10.3',
new Map<string, string>([ new Map<string, string>([
['install', 'false'],
['use', 'false'], ['use', 'false'],
['driver-opts', 'image=moby/buildkit:master\nnetwork=host'], ['driver-opts', 'image=moby/buildkit:master\nnetwork=host'],
['cache-binary', 'true'], ['cache-binary', 'true'],
@ -111,7 +108,6 @@ describe('getCreateArgs', () => {
new Map<string, string>([ new Map<string, string>([
['driver', 'remote'], ['driver', 'remote'],
['endpoint', 'tls://foo:1234'], ['endpoint', 'tls://foo:1234'],
['install', 'false'],
['use', 'true'], ['use', 'true'],
['cache-binary', 'true'], ['cache-binary', 'true'],
['cleanup', 'true'], ['cleanup', 'true'],
@ -132,7 +128,6 @@ describe('getCreateArgs', () => {
['driver', 'remote'], ['driver', 'remote'],
['platforms', 'linux/arm64,linux/arm/v7'], ['platforms', 'linux/arm64,linux/arm/v7'],
['endpoint', 'tls://foo:1234'], ['endpoint', 'tls://foo:1234'],
['install', 'false'],
['use', 'true'], ['use', 'true'],
['cache-binary', 'true'], ['cache-binary', 'true'],
['cleanup', 'true'], ['cleanup', 'true'],
@ -151,7 +146,6 @@ describe('getCreateArgs', () => {
5, 5,
'v0.10.3', 'v0.10.3',
new Map<string, string>([ new Map<string, string>([
['install', 'false'],
['use', 'false'], ['use', 'false'],
['driver-opts', `"env.no_proxy=localhost,127.0.0.1,.mydomain"`], ['driver-opts', `"env.no_proxy=localhost,127.0.0.1,.mydomain"`],
['cache-binary', 'true'], ['cache-binary', 'true'],
@ -170,7 +164,6 @@ describe('getCreateArgs', () => {
6, 6,
'v0.10.3', 'v0.10.3',
new Map<string, string>([ new Map<string, string>([
['install', 'false'],
['use', 'false'], ['use', 'false'],
['platforms', 'linux/amd64\n"linux/arm64,linux/arm/v7"'], ['platforms', 'linux/amd64\n"linux/arm64,linux/arm/v7"'],
['cache-binary', 'true'], ['cache-binary', 'true'],
@ -189,7 +182,6 @@ describe('getCreateArgs', () => {
7, 7,
'v0.10.3', 'v0.10.3',
new Map<string, string>([ new Map<string, string>([
['install', 'false'],
['use', 'false'], ['use', 'false'],
['driver', 'unknown'], ['driver', 'unknown'],
['cache-binary', 'true'], ['cache-binary', 'true'],
@ -206,7 +198,6 @@ describe('getCreateArgs', () => {
8, 8,
'v0.10.3', 'v0.10.3',
new Map<string, string>([ new Map<string, string>([
['install', 'false'],
['use', 'false'], ['use', 'false'],
['buildkitd-config', path.join(fixturesDir, 'buildkitd.toml')], ['buildkitd-config', path.join(fixturesDir, 'buildkitd.toml')],
['cache-binary', 'true'], ['cache-binary', 'true'],
@ -225,7 +216,6 @@ describe('getCreateArgs', () => {
9, 9,
'v0.10.3', 'v0.10.3',
new Map<string, string>([ new Map<string, string>([
['install', 'false'],
['use', 'false'], ['use', 'false'],
['buildkitd-config-inline', 'debug = true'], ['buildkitd-config-inline', 'debug = true'],
['cache-binary', 'true'], ['cache-binary', 'true'],
@ -244,7 +234,6 @@ describe('getCreateArgs', () => {
10, 10,
'v0.10.3', 'v0.10.3',
new Map<string, string>([ new Map<string, string>([
['install', 'false'],
['use', 'false'], ['use', 'false'],
['driver', 'cloud'], ['driver', 'cloud'],
['buildkitd-flags', '--allow-insecure-entitlement network.host'], ['buildkitd-flags', '--allow-insecure-entitlement network.host'],
@ -263,7 +252,6 @@ describe('getCreateArgs', () => {
11, 11,
'v0.10.3', 'v0.10.3',
new Map<string, string>([ new Map<string, string>([
['install', 'false'],
['use', 'true'], ['use', 'true'],
['cleanup', 'true'], ['cleanup', 'true'],
['cache-binary', 'true'], ['cache-binary', 'true'],
@ -282,7 +270,6 @@ describe('getCreateArgs', () => {
12, 12,
'v0.10.3', 'v0.10.3',
new Map<string, string>([ new Map<string, string>([
['install', 'false'],
['use', 'true'], ['use', 'true'],
['cleanup', 'true'], ['cleanup', 'true'],
['cache-binary', 'true'], ['cache-binary', 'true'],
@ -330,7 +317,6 @@ describe('getAppendArgs', () => {
0, 0,
'v0.10.3', 'v0.10.3',
new Map<string, string>([ new Map<string, string>([
['install', 'false'],
['use', 'true'], ['use', 'true'],
['cache-binary', 'true'], ['cache-binary', 'true'],
['cleanup', 'true'], ['cleanup', 'true'],
@ -389,7 +375,6 @@ describe('getVersion', () => {
0, 0,
new Map<string, string>([ new Map<string, string>([
// defaults // defaults
['install', 'false'],
['use', 'true'], ['use', 'true'],
['cache-binary', 'true'], ['cache-binary', 'true'],
['cleanup', 'true'], ['cleanup', 'true'],
@ -402,7 +387,6 @@ describe('getVersion', () => {
new Map<string, string>([ new Map<string, string>([
['version', 'latest'], ['version', 'latest'],
// defaults // defaults
['install', 'false'],
['use', 'true'], ['use', 'true'],
['cache-binary', 'true'], ['cache-binary', 'true'],
['cleanup', 'true'], ['cleanup', 'true'],
@ -415,7 +399,6 @@ describe('getVersion', () => {
new Map<string, string>([ new Map<string, string>([
['version', 'edge'], ['version', 'edge'],
// defaults // defaults
['install', 'false'],
['use', 'true'], ['use', 'true'],
['cache-binary', 'true'], ['cache-binary', 'true'],
['cleanup', 'true'], ['cleanup', 'true'],
@ -428,7 +411,6 @@ describe('getVersion', () => {
new Map<string, string>([ new Map<string, string>([
['version', 'v0.19.2'], ['version', 'v0.19.2'],
// defaults // defaults
['install', 'false'],
['use', 'true'], ['use', 'true'],
['cache-binary', 'true'], ['cache-binary', 'true'],
['cleanup', 'true'], ['cleanup', 'true'],
@ -442,7 +424,6 @@ describe('getVersion', () => {
['version', 'latest'], ['version', 'latest'],
['driver', 'cloud'], ['driver', 'cloud'],
// defaults // defaults
['install', 'false'],
['use', 'true'], ['use', 'true'],
['cache-binary', 'true'], ['cache-binary', 'true'],
['cleanup', 'true'], ['cleanup', 'true'],
@ -456,7 +437,6 @@ describe('getVersion', () => {
['version', 'edge'], ['version', 'edge'],
['driver', 'cloud'], ['driver', 'cloud'],
// defaults // defaults
['install', 'false'],
['use', 'true'], ['use', 'true'],
['cache-binary', 'true'], ['cache-binary', 'true'],
['cleanup', 'true'], ['cleanup', 'true'],
@ -469,7 +449,6 @@ describe('getVersion', () => {
new Map<string, string>([ new Map<string, string>([
['driver', 'cloud'], ['driver', 'cloud'],
// defaults // defaults
['install', 'false'],
['use', 'true'], ['use', 'true'],
['cache-binary', 'true'], ['cache-binary', 'true'],
['cleanup', 'true'], ['cleanup', 'true'],
@ -483,7 +462,6 @@ describe('getVersion', () => {
['version', 'cloud:v0.11.2-desktop.2'], ['version', 'cloud:v0.11.2-desktop.2'],
['driver', 'cloud'], ['driver', 'cloud'],
// defaults // defaults
['install', 'false'],
['use', 'true'], ['use', 'true'],
['cache-binary', 'true'], ['cache-binary', 'true'],
['cleanup', 'true'], ['cleanup', 'true'],
@ -496,7 +474,6 @@ describe('getVersion', () => {
new Map<string, string>([ new Map<string, string>([
['version', 'cloud:v0.11.2-desktop.2'], ['version', 'cloud:v0.11.2-desktop.2'],
// defaults // defaults
['install', 'false'],
['use', 'true'], ['use', 'true'],
['cache-binary', 'true'], ['cache-binary', 'true'],
['cleanup', 'true'], ['cleanup', 'true'],

View File

@ -54,20 +54,6 @@ inputs:
description: 'Cleanup temp files and remove builder at the end of a job' description: 'Cleanup temp files and remove builder at the end of a job'
default: 'true' default: 'true'
required: false required: false
# TODO: remove deprecated config, config-inline and install inputs
config:
description: 'BuildKit daemon config file'
deprecationMessage: 'Use buildkitd-config instead'
required: false
config-inline:
description: 'Inline BuildKit daemon config'
deprecationMessage: 'Use buildkitd-config-inline instead'
required: false
install:
description: 'Sets up docker build command as an alias to docker buildx build'
deprecationMessage: '"docker buildx install" command is deprecated and will be removed in a future release, use BUILDX_BUILDER environment variable instead'
default: 'false'
required: false
outputs: outputs:
name: name:

2
dist/index.js generated vendored

File diff suppressed because one or more lines are too long

2
dist/index.js.map generated vendored

File diff suppressed because one or more lines are too long

View File

@ -19,7 +19,6 @@ export interface Inputs {
buildkitdConfig: string; buildkitdConfig: string;
buildkitdConfigInline: string; buildkitdConfigInline: string;
platforms: string[]; platforms: string[];
install: boolean;
use: boolean; use: boolean;
endpoint: string; endpoint: string;
append: string; append: string;
@ -36,11 +35,10 @@ export async function getInputs(): Promise<Inputs> {
driverOpts: Util.getInputList('driver-opts', {ignoreComma: true, quote: false}), driverOpts: Util.getInputList('driver-opts', {ignoreComma: true, quote: false}),
buildkitdFlags: core.getInput('buildkitd-flags'), buildkitdFlags: core.getInput('buildkitd-flags'),
platforms: Util.getInputList('platforms'), platforms: Util.getInputList('platforms'),
install: core.getBooleanInput('install'),
use: core.getBooleanInput('use'), use: core.getBooleanInput('use'),
endpoint: core.getInput('endpoint'), endpoint: core.getInput('endpoint'),
buildkitdConfig: core.getInput('buildkitd-config') || core.getInput('config'), buildkitdConfig: core.getInput('buildkitd-config'),
buildkitdConfigInline: core.getInput('buildkitd-config-inline') || core.getInput('config-inline'), buildkitdConfigInline: core.getInput('buildkitd-config-inline'),
append: core.getInput('append'), append: core.getInput('append'),
keepState: core.getBooleanInput('keep-state'), keepState: core.getBooleanInput('keep-state'),
cacheBinary: core.getBooleanInput('cache-binary'), cacheBinary: core.getBooleanInput('cache-binary'),

View File

@ -184,23 +184,6 @@ actionsToolkit.run(
}); });
}); });
if (inputs.install) {
if (standalone) {
throw new Error(`Cannot set buildx as default builder without the Docker CLI`);
}
await core.group(`Setting buildx as default builder`, async () => {
stateHelper.setBuildxIsDefaultBuilder(true);
const installCmd = await toolkit.buildx.getCommand(['install']);
await Exec.getExecOutput(installCmd.command, installCmd.args, {
ignoreReturnCode: true
}).then(res => {
if (res.stderr.length > 0 && res.exitCode != 0) {
throw new Error(res.stderr.match(/(.*)\s*$/)?.[0]?.trim() ?? 'unknown error');
}
});
});
}
const builderInspect = await toolkit.builder.inspect(inputs.name); const builderInspect = await toolkit.builder.inspect(inputs.name);
const firstNode = builderInspect.nodes[0]; const firstNode = builderInspect.nodes[0];
@ -218,9 +201,6 @@ actionsToolkit.run(
core.setOutput('driver', builderInspect.driver); core.setOutput('driver', builderInspect.driver);
core.setOutput('platforms', reducedPlatforms.join(',')); core.setOutput('platforms', reducedPlatforms.join(','));
core.setOutput('nodes', JSON.stringify(builderInspect.nodes, undefined, 2)); core.setOutput('nodes', JSON.stringify(builderInspect.nodes, undefined, 2));
core.setOutput('endpoint', firstNode.endpoint); // TODO: deprecated, to be removed in a later version
core.setOutput('status', firstNode.status); // TODO: deprecated, to be removed in a later version
core.setOutput('flags', firstNode['buildkitd-flags']); // TODO: deprecated, to be removed in a later version
}); });
if (!standalone && builderInspect.driver == 'docker-container') { if (!standalone && builderInspect.driver == 'docker-container') {
@ -290,17 +270,5 @@ actionsToolkit.run(
fs.rmSync(stateHelper.certsDir, {recursive: true}); fs.rmSync(stateHelper.certsDir, {recursive: true});
}); });
} }
if (stateHelper.buildxIsDefaultBuilder) {
await core.group(`Restoring default builder`, async () => {
await Exec.getExecOutput('docker', ['buildx', 'uninstall'], {
ignoreReturnCode: true
}).then(res => {
if (res.stderr.length > 0 && res.exitCode != 0) {
core.warning(`${res.stderr.match(/(.*)\s*$/)?.[0]?.trim() ?? 'unknown error'}`);
}
});
});
}
} }
); );

View File

@ -8,7 +8,6 @@ export const containerName = process.env['STATE_containerName'] || '';
export const certsDir = process.env['STATE_certsDir'] || ''; export const certsDir = process.env['STATE_certsDir'] || '';
export const tmpDockerContext = process.env['STATE_tmpDockerContext'] || ''; export const tmpDockerContext = process.env['STATE_tmpDockerContext'] || '';
export const cleanup = /true/i.test(process.env['STATE_cleanup'] || ''); export const cleanup = /true/i.test(process.env['STATE_cleanup'] || '');
export const buildxIsDefaultBuilder = /true/i.test(process.env['STATE_buildxIsDefaultBuilder'] || '');
export const keepState = /true/i.test(process.env['STATE_keepState'] || ''); export const keepState = /true/i.test(process.env['STATE_keepState'] || '');
export function setDebug(debug: string) { export function setDebug(debug: string) {
@ -43,10 +42,6 @@ export function setCleanup(cleanup: boolean) {
core.saveState('cleanup', cleanup); core.saveState('cleanup', cleanup);
} }
export function setBuildxIsDefaultBuilder(buildxIsDefaultBuilder: boolean) {
core.saveState('buildxIsDefaultBuilder', buildxIsDefaultBuilder);
}
export function setKeepState(keepState: boolean) { export function setKeepState(keepState: boolean) {
core.saveState('keepState', keepState); core.saveState('keepState', keepState);
} }