mirror of
https://github.com/docker/setup-buildx-action.git
synced 2026-03-06 16:03:08 +08:00
Compare commits
10 Commits
28a438e9ed
...
2ae358d897
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2ae358d897 | ||
|
|
d586dba768 | ||
|
|
4d04d5d948 | ||
|
|
cd74e05d9b | ||
|
|
eee38ec7b3 | ||
|
|
7a83f65b5a | ||
|
|
a5aa96747d | ||
|
|
e73d53fa4e | ||
|
|
034e9d37dd | ||
|
|
b4664d8fd0 |
40
.github/workflows/ci.yml
vendored
40
.github/workflows/ci.yml
vendored
@ -102,7 +102,7 @@ jobs:
|
|||||||
EOL
|
EOL
|
||||||
-
|
-
|
||||||
name: Set up QEMU
|
name: Set up QEMU
|
||||||
uses: docker/setup-qemu-action@v3
|
uses: docker/setup-qemu-action@v4
|
||||||
-
|
-
|
||||||
name: Set up Docker Buildx
|
name: Set up Docker Buildx
|
||||||
uses: ./
|
uses: ./
|
||||||
@ -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:
|
||||||
-
|
-
|
||||||
@ -288,7 +288,7 @@ jobs:
|
|||||||
uses: actions/checkout@v6
|
uses: actions/checkout@v6
|
||||||
-
|
-
|
||||||
name: Set up QEMU
|
name: Set up QEMU
|
||||||
uses: docker/setup-qemu-action@v3
|
uses: docker/setup-qemu-action@v4
|
||||||
with:
|
with:
|
||||||
platforms: ${{ matrix.qemu-platforms }}
|
platforms: ${{ matrix.qemu-platforms }}
|
||||||
-
|
-
|
||||||
@ -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:
|
||||||
@ -458,7 +428,7 @@ jobs:
|
|||||||
uses: actions/checkout@v6
|
uses: actions/checkout@v6
|
||||||
-
|
-
|
||||||
name: Set up QEMU
|
name: Set up QEMU
|
||||||
uses: docker/setup-qemu-action@v3
|
uses: docker/setup-qemu-action@v4
|
||||||
-
|
-
|
||||||
name: Set up Docker Buildx
|
name: Set up Docker Buildx
|
||||||
uses: ./
|
uses: ./
|
||||||
|
|||||||
48
README.md
48
README.md
@ -40,17 +40,14 @@ jobs:
|
|||||||
buildx:
|
buildx:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
-
|
|
||||||
name: Checkout
|
|
||||||
uses: actions/checkout@v5
|
|
||||||
-
|
-
|
||||||
# Add support for more platforms with QEMU (optional)
|
# Add support for more platforms with QEMU (optional)
|
||||||
# https://github.com/docker/setup-qemu-action
|
# https://github.com/docker/setup-qemu-action
|
||||||
name: Set up QEMU
|
name: Set up QEMU
|
||||||
uses: docker/setup-qemu-action@v3
|
uses: docker/setup-qemu-action@v4
|
||||||
-
|
-
|
||||||
name: Set up Docker Buildx
|
name: Set up Docker Buildx
|
||||||
uses: docker/setup-buildx-action@v3
|
uses: docker/setup-buildx-action@v4
|
||||||
```
|
```
|
||||||
|
|
||||||
## Configuring your builder
|
## Configuring your builder
|
||||||
@ -94,7 +91,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 +107,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:
|
||||||
@ -142,23 +130,6 @@ The following [official docker environment variables](https://docs.docker.com/en
|
|||||||
|
|
||||||
### `nodes` output
|
### `nodes` output
|
||||||
|
|
||||||
```json
|
|
||||||
[
|
|
||||||
{
|
|
||||||
"name": "builder-3820d274-502c-4498-ae24-d4c32b3023d90",
|
|
||||||
"endpoint": "unix:///var/run/docker.sock",
|
|
||||||
"driver-opts": [
|
|
||||||
"network=host",
|
|
||||||
"image=moby/buildkit:master"
|
|
||||||
],
|
|
||||||
"status": "running",
|
|
||||||
"buildkitd-flags": "--allow-insecure-entitlement security.insecure --allow-insecure-entitlement network.host",
|
|
||||||
"buildkit": "3fab389",
|
|
||||||
"platforms": "linux/amd64,linux/amd64/v2,linux/amd64/v3,linux/amd64/v4,linux/386"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
```
|
|
||||||
|
|
||||||
| Name | Type | Description |
|
| Name | Type | Description |
|
||||||
|-------------------|--------|----------------------------|
|
|-------------------|--------|----------------------------|
|
||||||
| `name` | String | Node name |
|
| `name` | String | Node name |
|
||||||
@ -169,6 +140,21 @@ The following [official docker environment variables](https://docs.docker.com/en
|
|||||||
| `buildkit` | String | BuildKit version |
|
| `buildkit` | String | BuildKit version |
|
||||||
| `platforms` | String | Platforms available |
|
| `platforms` | String | Platforms available |
|
||||||
|
|
||||||
|
Example:
|
||||||
|
|
||||||
|
```json
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"name": "builder-8fa135e1-9bce-4a29-9368-46a09a1d750d0",
|
||||||
|
"endpoint": "unix:///var/run/docker.sock",
|
||||||
|
"status": "running",
|
||||||
|
"buildkitd-flags": "--allow-insecure-entitlement security.insecure --allow-insecure-entitlement network.host",
|
||||||
|
"buildkit": "v0.27.1",
|
||||||
|
"platforms": "linux/amd64,linux/amd64/v2,linux/amd64/v3,linux/386"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
```
|
||||||
|
|
||||||
## Contributing
|
## Contributing
|
||||||
|
|
||||||
Want to contribute? Awesome! You can find information about contributing to
|
Want to contribute? Awesome! You can find information about contributing to
|
||||||
|
|||||||
@ -54,7 +54,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'],
|
||||||
@ -73,7 +72,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'],
|
||||||
@ -91,7 +89,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'],
|
||||||
@ -113,7 +110,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'],
|
||||||
@ -134,7 +130,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'],
|
||||||
@ -153,7 +148,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'],
|
||||||
@ -172,7 +166,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'],
|
||||||
@ -191,7 +184,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'],
|
||||||
@ -208,7 +200,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'],
|
||||||
@ -227,7 +218,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'],
|
||||||
@ -246,7 +236,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'],
|
||||||
@ -265,7 +254,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'],
|
||||||
@ -284,7 +272,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'],
|
||||||
@ -332,7 +319,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'],
|
||||||
@ -391,7 +377,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'],
|
||||||
@ -404,7 +389,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'],
|
||||||
@ -417,7 +401,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'],
|
||||||
@ -430,7 +413,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'],
|
||||||
@ -444,7 +426,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'],
|
||||||
@ -458,7 +439,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'],
|
||||||
@ -471,7 +451,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'],
|
||||||
@ -485,7 +464,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'],
|
||||||
@ -498,7 +476,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'],
|
||||||
|
|||||||
14
action.yml
14
action.yml
@ -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
2
dist/index.js
generated
vendored
File diff suppressed because one or more lines are too long
2
dist/index.js.map
generated
vendored
2
dist/index.js.map
generated
vendored
File diff suppressed because one or more lines are too long
@ -23,7 +23,7 @@
|
|||||||
"packageManager": "yarn@4.9.2",
|
"packageManager": "yarn@4.9.2",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@actions/core": "^3.0.0",
|
"@actions/core": "^3.0.0",
|
||||||
"@docker/actions-toolkit": "^0.77.0",
|
"@docker/actions-toolkit": "^0.79.0",
|
||||||
"js-yaml": "^4.1.1"
|
"js-yaml": "^4.1.1"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
|||||||
@ -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'),
|
||||||
|
|||||||
32
src/main.ts
32
src/main.ts
@ -187,23 +187,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];
|
||||||
|
|
||||||
@ -221,9 +204,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') {
|
||||||
@ -293,17 +273,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'}`);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|||||||
@ -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);
|
||||||
}
|
}
|
||||||
|
|||||||
10
yarn.lock
10
yarn.lock
@ -367,9 +367,9 @@ __metadata:
|
|||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
"@docker/actions-toolkit@npm:^0.77.0":
|
"@docker/actions-toolkit@npm:^0.79.0":
|
||||||
version: 0.77.0
|
version: 0.79.0
|
||||||
resolution: "@docker/actions-toolkit@npm:0.77.0"
|
resolution: "@docker/actions-toolkit@npm:0.79.0"
|
||||||
dependencies:
|
dependencies:
|
||||||
"@actions/artifact": "npm:^6.2.0"
|
"@actions/artifact": "npm:^6.2.0"
|
||||||
"@actions/cache": "npm:^6.0.0"
|
"@actions/cache": "npm:^6.0.0"
|
||||||
@ -393,7 +393,7 @@ __metadata:
|
|||||||
semver: "npm:^7.7.4"
|
semver: "npm:^7.7.4"
|
||||||
tar-stream: "npm:^3.1.7"
|
tar-stream: "npm:^3.1.7"
|
||||||
tmp: "npm:^0.2.5"
|
tmp: "npm:^0.2.5"
|
||||||
checksum: 10/f3ae817a5a6827efc63d1a1730e918801a8fa33867cda72bd7a1f78309631c45d91de60bc57985c7520fae168e96daed0fcab0003b5fab9b50bdd7aa355d651b
|
checksum: 10/d64849ba49b2b59e2e93237a70be03fd7c43b1f7f01bac3f7557616ba5f59be785cb12a273bbb6a71c1e0d959f1bc6c673111b587c57bd2d6da105dcc500921a
|
||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
@ -2089,7 +2089,7 @@ __metadata:
|
|||||||
resolution: "docker-setup-buildx@workspace:."
|
resolution: "docker-setup-buildx@workspace:."
|
||||||
dependencies:
|
dependencies:
|
||||||
"@actions/core": "npm:^3.0.0"
|
"@actions/core": "npm:^3.0.0"
|
||||||
"@docker/actions-toolkit": "npm:^0.77.0"
|
"@docker/actions-toolkit": "npm:^0.79.0"
|
||||||
"@eslint/js": "npm:^9.39.3"
|
"@eslint/js": "npm:^9.39.3"
|
||||||
"@types/js-yaml": "npm:^4.0.9"
|
"@types/js-yaml": "npm:^4.0.9"
|
||||||
"@types/node": "npm:^24.11.0"
|
"@types/node": "npm:^24.11.0"
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user