Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6a58db7e0d | ||
|
|
d56292e348 | ||
|
|
790eb2db47 | ||
|
|
2a81c53912 | ||
|
|
00b2400aad | ||
|
|
484614d7a1 | ||
|
|
d95759405f | ||
|
|
5bb6d36be0 | ||
|
|
a99c5e53ef | ||
|
|
fc1a41d2e5 | ||
|
|
95cefc3c57 | ||
|
|
8ec3610541 | ||
|
|
a946f06b5d | ||
|
|
ce223e774e | ||
|
|
d267e74486 | ||
|
|
d350de3bba | ||
|
|
45a8690f10 | ||
|
|
b167a89702 | ||
|
|
81d4866861 | ||
|
|
07aea5fc9c | ||
|
|
1d91983c26 | ||
|
|
496312bcb8 | ||
|
|
4b4e9c3e2d | ||
|
|
eb27bcbef3 | ||
|
|
b7471d4240 | ||
|
|
e2df91e851 | ||
|
|
85ce96bcbc | ||
|
|
f549413411 | ||
|
|
99988698a5 | ||
|
|
e30725c029 | ||
|
|
f1dc97ee10 | ||
|
|
51ecd0a47f | ||
|
|
830f01a409 | ||
|
|
8b13d483f2 | ||
|
|
03a7a3d9fb | ||
|
|
30389db034 | ||
|
|
05ca2e6f5e | ||
|
|
774ea5c2f1 | ||
|
|
534bd3c5e6 | ||
|
|
0f5a2d6712 | ||
|
|
987520896f | ||
|
|
a19c171088 | ||
|
|
347dac9901 | ||
|
|
2dd22fa31c | ||
|
|
dd904132a2 | ||
|
|
f03ac48505 | ||
|
|
c8c479bb5b | ||
|
|
379311a773 | ||
|
|
6842354d08 | ||
|
|
7ce9a1f69d | ||
|
|
11e8a2e291 | ||
|
|
9407e67a52 | ||
|
|
15c905b16b | ||
|
|
a25d6a0130 | ||
|
|
39322d9057 | ||
|
|
0648fd6fd6 | ||
|
|
30d8a59ee0 | ||
|
|
71320d2e17 | ||
|
|
272f8b84cf | ||
|
|
5e716dcfd6 | ||
|
|
a83788eef0 | ||
|
|
d0d9a72195 | ||
|
|
a8165e7b70 | ||
|
|
a024221c60 | ||
|
|
4c3fce4ab2 | ||
|
|
7c965aebec | ||
|
|
7932f6210d | ||
|
|
70deadb37a | ||
|
|
165fe681b8 | ||
|
|
2d305372c4 | ||
|
|
c252a3bb80 | ||
|
|
4661366cb8 | ||
|
|
03d7e8ebf0 | ||
|
|
22f6533f7c | ||
|
|
b30c61b0de | ||
|
|
51cc8966ea | ||
|
|
db8b80b0d3 | ||
|
|
39a1a82492 | ||
|
|
c77919d12e | ||
|
|
341de1b1a5 | ||
|
|
8c0edbc76e | ||
|
|
1fb9cbdb32 | ||
|
|
693fdd6ca6 | ||
|
|
fe4c1ac86d |
+1
-1
@@ -2,7 +2,7 @@
|
|||||||
"env": {
|
"env": {
|
||||||
"node": true,
|
"node": true,
|
||||||
"es2021": true,
|
"es2021": true,
|
||||||
"jest/globals": true
|
"jest": true
|
||||||
},
|
},
|
||||||
"extends": [
|
"extends": [
|
||||||
"eslint:recommended",
|
"eslint:recommended",
|
||||||
|
|||||||
Binary file not shown.
|
Before Width: | Height: | Size: 13 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 15 KiB |
@@ -2,7 +2,7 @@ name: ci
|
|||||||
|
|
||||||
on:
|
on:
|
||||||
schedule:
|
schedule:
|
||||||
- cron: '0 10 * * *' # everyday at 10am
|
- cron: '0 10 * * *'
|
||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- 'master'
|
- 'master'
|
||||||
@@ -10,9 +10,6 @@ on:
|
|||||||
tags:
|
tags:
|
||||||
- 'v*'
|
- 'v*'
|
||||||
pull_request:
|
pull_request:
|
||||||
branches:
|
|
||||||
- 'master'
|
|
||||||
- 'releases/v*'
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
main:
|
main:
|
||||||
@@ -80,7 +77,7 @@ jobs:
|
|||||||
-
|
-
|
||||||
name: Dump context
|
name: Dump context
|
||||||
if: always()
|
if: always()
|
||||||
uses: crazy-max/ghaction-dump-context@v1
|
uses: crazy-max/ghaction-dump-context@v2
|
||||||
|
|
||||||
debug:
|
debug:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
@@ -105,7 +102,7 @@ jobs:
|
|||||||
buildkitd-flags: --debug
|
buildkitd-flags: --debug
|
||||||
-
|
-
|
||||||
name: Build
|
name: Build
|
||||||
uses: docker/build-push-action@v3
|
uses: docker/build-push-action@v4
|
||||||
with:
|
with:
|
||||||
context: .
|
context: .
|
||||||
platforms: linux/amd64,linux/arm64,linux/ppc64le
|
platforms: linux/amd64,linux/arm64,linux/ppc64le
|
||||||
@@ -251,7 +248,7 @@ jobs:
|
|||||||
config: /tmp/buildkitd.toml
|
config: /tmp/buildkitd.toml
|
||||||
-
|
-
|
||||||
name: Build
|
name: Build
|
||||||
uses: docker/build-push-action@v3
|
uses: docker/build-push-action@v4
|
||||||
with:
|
with:
|
||||||
context: .
|
context: .
|
||||||
|
|
||||||
@@ -278,7 +275,7 @@ jobs:
|
|||||||
mirrors = ["mirror.gcr.io"]
|
mirrors = ["mirror.gcr.io"]
|
||||||
-
|
-
|
||||||
name: Build
|
name: Build
|
||||||
uses: docker/build-push-action@v3
|
uses: docker/build-push-action@v4
|
||||||
with:
|
with:
|
||||||
context: .
|
context: .
|
||||||
|
|
||||||
@@ -464,3 +461,88 @@ jobs:
|
|||||||
uses: ./
|
uses: ./
|
||||||
with:
|
with:
|
||||||
platforms: linux/amd64
|
platforms: linux/amd64
|
||||||
|
|
||||||
|
docker-context:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
-
|
||||||
|
name: Checkout
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
-
|
||||||
|
name: Create Docker context
|
||||||
|
run: |
|
||||||
|
docker context create foo
|
||||||
|
docker context use foo
|
||||||
|
-
|
||||||
|
name: Set up Docker Buildx
|
||||||
|
uses: ./
|
||||||
|
with:
|
||||||
|
driver: docker
|
||||||
|
|
||||||
|
cleanup:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
cleanup:
|
||||||
|
- true
|
||||||
|
- false
|
||||||
|
steps:
|
||||||
|
-
|
||||||
|
name: Checkout
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
-
|
||||||
|
name: Set up Docker Buildx
|
||||||
|
uses: ./
|
||||||
|
with:
|
||||||
|
cleanup: ${{ matrix.cleanup }}
|
||||||
|
|
||||||
|
k3s:
|
||||||
|
runs-on: ubuntu-20.04
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
version:
|
||||||
|
- v0.11.0-rc1
|
||||||
|
- v0.10.5
|
||||||
|
steps:
|
||||||
|
-
|
||||||
|
name: Checkout
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
-
|
||||||
|
name: Install k3s
|
||||||
|
uses: crazy-max/.github/.github/actions/install-k3s@605d30d5ae97f6680578ace4b56645af79343e60
|
||||||
|
with:
|
||||||
|
version: "v1.21.2-k3s1"
|
||||||
|
-
|
||||||
|
name: Set up Docker Buildx
|
||||||
|
id: buildx
|
||||||
|
uses: ./
|
||||||
|
with:
|
||||||
|
version: ${{ matrix.version }}
|
||||||
|
driver: kubernetes
|
||||||
|
platforms: linux/amd64
|
||||||
|
driver-opts: |
|
||||||
|
image=moby/buildkit:buildx-stable-1
|
||||||
|
qemu.install=true
|
||||||
|
append: |
|
||||||
|
- platforms: linux/arm64
|
||||||
|
driver-opts:
|
||||||
|
- image=moby/buildkit:buildx-stable-1
|
||||||
|
- qemu.install=true
|
||||||
|
- platforms: linux/s390x
|
||||||
|
driver-opts:
|
||||||
|
- image=moby/buildkit:buildx-stable-1
|
||||||
|
- qemu.install=true
|
||||||
|
-
|
||||||
|
name: Create Dockerfile
|
||||||
|
run: |
|
||||||
|
cat > ./Dockerfile <<EOL
|
||||||
|
FROM alpine
|
||||||
|
RUN uname -a
|
||||||
|
EOL
|
||||||
|
-
|
||||||
|
name: Build
|
||||||
|
uses: docker/build-push-action@master
|
||||||
|
with:
|
||||||
|
context: .
|
||||||
|
|||||||
@@ -6,9 +6,6 @@ on:
|
|||||||
- 'master'
|
- 'master'
|
||||||
- 'releases/v*'
|
- 'releases/v*'
|
||||||
pull_request:
|
pull_request:
|
||||||
branches:
|
|
||||||
- 'master'
|
|
||||||
- 'releases/v*'
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
test:
|
test:
|
||||||
@@ -17,17 +14,12 @@ jobs:
|
|||||||
-
|
-
|
||||||
name: Checkout
|
name: Checkout
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
-
|
|
||||||
name: Validate
|
|
||||||
uses: docker/bake-action@v2
|
|
||||||
with:
|
|
||||||
targets: validate
|
|
||||||
-
|
-
|
||||||
name: Set up Docker Buildx
|
name: Set up Docker Buildx
|
||||||
uses: ./
|
uses: ./
|
||||||
-
|
-
|
||||||
name: Test
|
name: Test
|
||||||
uses: docker/bake-action@v2
|
uses: docker/bake-action@v3
|
||||||
with:
|
with:
|
||||||
targets: test
|
targets: test
|
||||||
-
|
-
|
||||||
|
|||||||
@@ -0,0 +1,41 @@
|
|||||||
|
name: validate
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- 'master'
|
||||||
|
- 'releases/v*'
|
||||||
|
pull_request:
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
prepare:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
outputs:
|
||||||
|
targets: ${{ steps.targets.outputs.matrix }}
|
||||||
|
steps:
|
||||||
|
-
|
||||||
|
name: Checkout
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
-
|
||||||
|
name: Targets matrix
|
||||||
|
id: targets
|
||||||
|
run: |
|
||||||
|
echo "matrix=$(docker buildx bake validate --print | jq -cr '.group.validate.targets')" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
|
validate:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
needs:
|
||||||
|
- prepare
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
target: ${{ fromJson(needs.prepare.outputs.targets) }}
|
||||||
|
steps:
|
||||||
|
-
|
||||||
|
name: Checkout
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
-
|
||||||
|
name: Validate
|
||||||
|
uses: docker/bake-action@v3
|
||||||
|
with:
|
||||||
|
targets: ${{ matrix.target }}
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
[](https://github.com/docker/setup-buildx-action/releases/latest)
|
[](https://github.com/docker/setup-buildx-action/releases/latest)
|
||||||
[](https://github.com/marketplace/actions/docker-setup-buildx)
|
[](https://github.com/marketplace/actions/docker-setup-buildx)
|
||||||
[](https://github.com/docker/setup-buildx-action/actions?workflow=ci)
|
[](https://github.com/docker/setup-buildx-action/actions?workflow=ci)
|
||||||
[](https://github.com/docker/setup-buildx-action/actions?workflow=test)
|
[](https://github.com/docker/setup-buildx-action/actions?workflow=test)
|
||||||
[](https://codecov.io/gh/docker/setup-buildx-action)
|
[](https://codecov.io/gh/docker/setup-buildx-action)
|
||||||
|
|
||||||
## About
|
## About
|
||||||
@@ -19,20 +19,14 @@ a [BuildKit](https://github.com/moby/buildkit) container.
|
|||||||
___
|
___
|
||||||
|
|
||||||
* [Usage](#usage)
|
* [Usage](#usage)
|
||||||
* [Advanced usage](#advanced-usage)
|
* [Configuring your builder](#configuring-your-builder)
|
||||||
* [Authentication support](docs/advanced/auth.md)
|
|
||||||
* [Append additional nodes to the builder](docs/advanced/append-nodes.md)
|
|
||||||
* [Install by default](docs/advanced/install-default.md)
|
|
||||||
* [BuildKit daemon configuration](docs/advanced/buildkit-config.md)
|
|
||||||
* [Standalone mode](docs/advanced/standalone.md)
|
|
||||||
* [Customizing](#customizing)
|
* [Customizing](#customizing)
|
||||||
* [inputs](#inputs)
|
* [inputs](#inputs)
|
||||||
* [outputs](#outputs)
|
* [outputs](#outputs)
|
||||||
* [environment variables](#environment-variables)
|
* [environment variables](#environment-variables)
|
||||||
* [Notes](#notes)
|
* [Notes](#notes)
|
||||||
* [`nodes` output](#nodes-output)
|
* [`nodes` output](#nodes-output)
|
||||||
* [BuildKit container logs](#buildkit-container-logs)
|
* [Contributing](#contributing)
|
||||||
* [Keep up-to-date with GitHub Dependabot](#keep-up-to-date-with-github-dependabot)
|
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
@@ -59,13 +53,19 @@ jobs:
|
|||||||
uses: docker/setup-buildx-action@v2
|
uses: docker/setup-buildx-action@v2
|
||||||
```
|
```
|
||||||
|
|
||||||
## Advanced usage
|
## Configuring your builder
|
||||||
|
|
||||||
* [Authentication support](docs/advanced/auth.md)
|
* [Version pinning](https://docs.docker.com/build/ci/github-actions/configure-builder/#version-pinning): Pin to a specific Buildx or BuildKit version
|
||||||
* [Append additional nodes to the builder](docs/advanced/append-nodes.md)
|
* [BuildKit container logs](https://docs.docker.com/build/ci/github-actions/configure-builder/#buildkit-container-logs): Enable BuildKit container logs for debugging purposes
|
||||||
* [Install by default](docs/advanced/install-default.md)
|
* [BuildKit Daemon configuration](https://docs.docker.com/build/ci/github-actions/configure-builder/#buildkit-daemon-configuration)
|
||||||
* [BuildKit daemon configuration](docs/advanced/buildkit-config.md)
|
* [Registry mirror](https://docs.docker.com/build/ci/github-actions/configure-builder/#registry-mirror): Configure a registry mirror for your builds
|
||||||
* [Standalone mode](docs/advanced/standalone.md)
|
* [Max parallelism](https://docs.docker.com/build/ci/github-actions/configure-builder/#max-parallelism): Configure the maximum parallelism for your builds
|
||||||
|
* [Append additional nodes to the builder](https://docs.docker.com/build/ci/github-actions/configure-builder/#append-additional-nodes-to-the-builder): Create additional nodes for your builder
|
||||||
|
* [Authentication for remote builders](https://docs.docker.com/build/ci/github-actions/configure-builder/#authentication-for-remote-builders)
|
||||||
|
* [SSH authentication](https://docs.docker.com/build/ci/github-actions/configure-builder/#ssh-authentication): Authenticate to a remote builder using SSH
|
||||||
|
* [TLS authentication](https://docs.docker.com/build/ci/github-actions/configure-builder/#tls-authentication): Authenticate to a remote builder using TLS
|
||||||
|
* [Standalone mode](https://docs.docker.com/build/ci/github-actions/configure-builder/#standalone-mode): Use Buildx as a standalone binary (without the Docker CLI)
|
||||||
|
* [Isolated builders](https://docs.docker.com/build/ci/github-actions/configure-builder/#isolated-builders): Create isolated builders for your builds
|
||||||
|
|
||||||
## Customizing
|
## Customizing
|
||||||
|
|
||||||
@@ -80,24 +80,25 @@ Following inputs can be used as `step.with` keys:
|
|||||||
> network=host
|
> network=host
|
||||||
> ```
|
> ```
|
||||||
|
|
||||||
> `CSV` type must be a newline-delimited string
|
> `CSV` type must be a comma-delimited string
|
||||||
> ```yaml
|
> ```yaml
|
||||||
> platforms: linux/amd64,linux/arm64
|
> platforms: linux/amd64,linux/arm64
|
||||||
> ```
|
> ```
|
||||||
|
|
||||||
| Name | Type | Description |
|
| Name | Type | Default | Description |
|
||||||
|-------------------|----------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
|-------------------|----------|--------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
||||||
| `version` | String | [Buildx](https://github.com/docker/buildx) version. (eg. `v0.3.0`, `latest`, `https://github.com/docker/buildx.git#master`) |
|
| `version` | String | | [Buildx](https://github.com/docker/buildx) version. (eg. `v0.3.0`, `latest`, `https://github.com/docker/buildx.git#master`) |
|
||||||
| `driver` | String | Sets the [builder driver](https://docs.docker.com/engine/reference/commandline/buildx_create/#driver) to be used (default `docker-container`) |
|
| `driver` | String | `docker-container` | Sets the [builder driver](https://docs.docker.com/engine/reference/commandline/buildx_create/#driver) to be used |
|
||||||
| `driver-opts` | List | List of additional [driver-specific options](https://docs.docker.com/engine/reference/commandline/buildx_create/#driver-opt) (eg. `image=moby/buildkit:master`) |
|
| `driver-opts` | List | | List of additional [driver-specific options](https://docs.docker.com/engine/reference/commandline/buildx_create/#driver-opt) (eg. `image=moby/buildkit:master`) |
|
||||||
| `buildkitd-flags` | String | [Flags for buildkitd](https://docs.docker.com/engine/reference/commandline/buildx_create/#buildkitd-flags) daemon (since [buildx v0.3.0](https://github.com/docker/buildx/releases/tag/v0.3.0)) |
|
| `buildkitd-flags` | String | | [Flags for buildkitd](https://docs.docker.com/engine/reference/commandline/buildx_create/#buildkitd-flags) daemon |
|
||||||
| `install` | Bool | Sets up `docker build` command as an alias to `docker buildx` (default `false`) |
|
| `install` | Bool | `false` | Sets up `docker build` command as an alias to `docker buildx` |
|
||||||
| `use` | Bool | Switch to this builder instance (default `true`) |
|
| `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. |
|
||||||
| `config`¹ | String | [BuildKit config file](https://docs.docker.com/engine/reference/commandline/buildx_create/#config) |
|
| `config`¹ | String | | [BuildKit config file](https://docs.docker.com/engine/reference/commandline/buildx_create/#config) |
|
||||||
| `config-inline`¹ | String | Same as `config` but inline |
|
| `config-inline`¹ | String | | Same as `config` but inline |
|
||||||
| `append` | YAML | [Append additional nodes](docs/advanced/append-nodes.md) to the builder |
|
| `append` | YAML | | [Append additional nodes](docs/advanced/append-nodes.md) to the builder |
|
||||||
|
| `cleanup` | Bool | `true` | Cleanup temp files and remove builder at the end of a job |
|
||||||
|
|
||||||
> * ¹ `config` and `config-inline` are mutually exclusive
|
> * ¹ `config` and `config-inline` are mutually exclusive
|
||||||
|
|
||||||
@@ -151,35 +152,7 @@ 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 |
|
||||||
|
|
||||||
### BuildKit container logs
|
## Contributing
|
||||||
|
|
||||||
To display BuildKit container logs (when `docker-container` driver is used) you have to [enable step debug logging](https://docs.github.com/en/actions/managing-workflow-runs/enabling-debug-logging#enabling-step-debug-logging),
|
Want to contribute? Awesome! You can find information about contributing to
|
||||||
or you can also enable debugging in the [setup-buildx action step](https://github.com/docker/setup-buildx-action):
|
this project in the [CONTRIBUTING.md](/.github/CONTRIBUTING.md)
|
||||||
|
|
||||||
```yaml
|
|
||||||
-
|
|
||||||
name: Set up Docker Buildx
|
|
||||||
uses: docker/setup-buildx-action@v2
|
|
||||||
with:
|
|
||||||
buildkitd-flags: --debug
|
|
||||||
```
|
|
||||||
|
|
||||||
Logs will be available at the end of a job:
|
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
## Keep up-to-date with GitHub Dependabot
|
|
||||||
|
|
||||||
Since [Dependabot](https://docs.github.com/en/github/administering-a-repository/keeping-your-actions-up-to-date-with-github-dependabot)
|
|
||||||
has [native GitHub Actions support](https://docs.github.com/en/github/administering-a-repository/configuration-options-for-dependency-updates#package-ecosystem),
|
|
||||||
to enable it on your GitHub repo all you need to do is add the `.github/dependabot.yml` file:
|
|
||||||
|
|
||||||
```yaml
|
|
||||||
version: 2
|
|
||||||
updates:
|
|
||||||
# Maintain dependencies for GitHub Actions
|
|
||||||
- package-ecosystem: "github-actions"
|
|
||||||
directory: "/"
|
|
||||||
schedule:
|
|
||||||
interval: "daily"
|
|
||||||
```
|
|
||||||
|
|||||||
@@ -1,88 +0,0 @@
|
|||||||
import {describe, expect, test, beforeEach} from '@jest/globals';
|
|
||||||
import * as fs from 'fs';
|
|
||||||
import * as os from 'os';
|
|
||||||
import * as path from 'path';
|
|
||||||
import * as auth from '../src/auth';
|
|
||||||
|
|
||||||
const tmpdir = fs.mkdtempSync(path.join(os.tmpdir(), 'docker-setup-buildx-jest')).split(path.sep).join(path.posix.sep);
|
|
||||||
const dockerConfigHome = path.join(tmpdir, '.docker');
|
|
||||||
const credsdir = path.join(dockerConfigHome, 'buildx', 'creds');
|
|
||||||
|
|
||||||
describe('setCredentials', () => {
|
|
||||||
beforeEach(() => {
|
|
||||||
process.env = Object.keys(process.env).reduce((object, key) => {
|
|
||||||
if (!key.startsWith(auth.envPrefix)) {
|
|
||||||
object[key] = process.env[key];
|
|
||||||
}
|
|
||||||
return object;
|
|
||||||
}, {});
|
|
||||||
});
|
|
||||||
|
|
||||||
// prettier-ignore
|
|
||||||
test.each([
|
|
||||||
[
|
|
||||||
'mycontext',
|
|
||||||
'docker-container',
|
|
||||||
{},
|
|
||||||
[],
|
|
||||||
[]
|
|
||||||
],
|
|
||||||
[
|
|
||||||
'docker-container://mycontainer',
|
|
||||||
'docker-container',
|
|
||||||
{},
|
|
||||||
[],
|
|
||||||
[]
|
|
||||||
],
|
|
||||||
[
|
|
||||||
'tcp://graviton2:1234',
|
|
||||||
'remote',
|
|
||||||
{},
|
|
||||||
[],
|
|
||||||
[]
|
|
||||||
],
|
|
||||||
[
|
|
||||||
'tcp://graviton2:1234',
|
|
||||||
'remote',
|
|
||||||
{
|
|
||||||
'BUILDER_NODE_0_AUTH_TLS_CACERT': 'foo',
|
|
||||||
'BUILDER_NODE_0_AUTH_TLS_CERT': 'foo',
|
|
||||||
'BUILDER_NODE_0_AUTH_TLS_KEY': 'foo'
|
|
||||||
},
|
|
||||||
[
|
|
||||||
path.join(credsdir, 'cacert_graviton2-1234.pem'),
|
|
||||||
path.join(credsdir, 'cert_graviton2-1234.pem'),
|
|
||||||
path.join(credsdir, 'key_graviton2-1234.pem')
|
|
||||||
],
|
|
||||||
[
|
|
||||||
`cacert=${path.join(credsdir, 'cacert_graviton2-1234.pem')}`,
|
|
||||||
`cert=${path.join(credsdir, 'cert_graviton2-1234.pem')}`,
|
|
||||||
`key=${path.join(credsdir, 'key_graviton2-1234.pem')}`
|
|
||||||
]
|
|
||||||
],
|
|
||||||
[
|
|
||||||
'tcp://graviton2:1234',
|
|
||||||
'docker-container',
|
|
||||||
{
|
|
||||||
'BUILDER_NODE_0_AUTH_TLS_CACERT': 'foo',
|
|
||||||
'BUILDER_NODE_0_AUTH_TLS_CERT': 'foo',
|
|
||||||
'BUILDER_NODE_0_AUTH_TLS_KEY': 'foo'
|
|
||||||
},
|
|
||||||
[
|
|
||||||
path.join(credsdir, 'cacert_graviton2-1234.pem'),
|
|
||||||
path.join(credsdir, 'cert_graviton2-1234.pem'),
|
|
||||||
path.join(credsdir, 'key_graviton2-1234.pem')
|
|
||||||
],
|
|
||||||
[]
|
|
||||||
],
|
|
||||||
])('given %p endpoint', async (endpoint: string, driver: string, envs: Record<string, string>, expectedFiles: Array<string>, expectedOpts: Array<string>) => {
|
|
||||||
fs.mkdirSync(credsdir, {recursive: true});
|
|
||||||
for (const [key, value] of Object.entries(envs)) {
|
|
||||||
process.env[key] = value;
|
|
||||||
}
|
|
||||||
expect(auth.setCredentials(credsdir, 0, driver, endpoint)).toEqual(expectedOpts);
|
|
||||||
expectedFiles.forEach( (file) => {
|
|
||||||
expect(fs.existsSync(file)).toBe(true);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
||||||
@@ -1,261 +0,0 @@
|
|||||||
import {describe, expect, it, jest, test} from '@jest/globals';
|
|
||||||
import * as fs from 'fs';
|
|
||||||
import * as os from 'os';
|
|
||||||
import * as path from 'path';
|
|
||||||
import * as buildx from '../src/buildx';
|
|
||||||
import * as context from '../src/context';
|
|
||||||
import * as semver from 'semver';
|
|
||||||
import * as exec from '@actions/exec';
|
|
||||||
|
|
||||||
const tmpdir = fs.mkdtempSync(path.join(os.tmpdir(), 'docker-setup-buildx-')).split(path.sep).join(path.posix.sep);
|
|
||||||
jest.spyOn(context, 'tmpDir').mockImplementation((): string => {
|
|
||||||
return tmpdir;
|
|
||||||
});
|
|
||||||
|
|
||||||
const tmpname = path.join(tmpdir, '.tmpname').split(path.sep).join(path.posix.sep);
|
|
||||||
jest.spyOn(context, 'tmpNameSync').mockImplementation((): string => {
|
|
||||||
return tmpname;
|
|
||||||
});
|
|
||||||
|
|
||||||
describe('isAvailable', () => {
|
|
||||||
const execSpy = jest.spyOn(exec, 'getExecOutput');
|
|
||||||
buildx.isAvailable();
|
|
||||||
|
|
||||||
// eslint-disable-next-line jest/no-standalone-expect
|
|
||||||
expect(execSpy).toHaveBeenCalledWith(`docker`, ['buildx'], {
|
|
||||||
silent: true,
|
|
||||||
ignoreReturnCode: true
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
describe('isAvailable standalone', () => {
|
|
||||||
const execSpy = jest.spyOn(exec, 'getExecOutput');
|
|
||||||
buildx.isAvailable(true);
|
|
||||||
|
|
||||||
// eslint-disable-next-line jest/no-standalone-expect
|
|
||||||
expect(execSpy).toHaveBeenCalledWith(`buildx`, [], {
|
|
||||||
silent: true,
|
|
||||||
ignoreReturnCode: true
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
describe('getVersion', () => {
|
|
||||||
it('valid', async () => {
|
|
||||||
const version = await buildx.getVersion();
|
|
||||||
expect(semver.valid(version)).not.toBeNull();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
describe('parseVersion', () => {
|
|
||||||
test.each([
|
|
||||||
['github.com/docker/buildx 0.4.1+azure bda4882a65349ca359216b135896bddc1d92461c', '0.4.1'],
|
|
||||||
['github.com/docker/buildx v0.4.1 bda4882a65349ca359216b135896bddc1d92461c', '0.4.1'],
|
|
||||||
['github.com/docker/buildx v0.4.2 fb7b670b764764dc4716df3eba07ffdae4cc47b2', '0.4.2'],
|
|
||||||
['github.com/docker/buildx f117971 f11797113e5a9b86bd976329c5dbb8a8bfdfadfa', 'f117971']
|
|
||||||
])('given %p', async (stdout, expected) => {
|
|
||||||
expect(buildx.parseVersion(stdout)).toEqual(expected);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
describe('satisfies', () => {
|
|
||||||
test.each([
|
|
||||||
['0.4.1', '>=0.3.2', true],
|
|
||||||
['bda4882a65349ca359216b135896bddc1d92461c', '>0.1.0', false],
|
|
||||||
['f117971', '>0.6.0', true]
|
|
||||||
])('given %p', async (version, range, expected) => {
|
|
||||||
expect(buildx.satisfies(version, range)).toBe(expected);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
describe('inspect', () => {
|
|
||||||
it('valid', async () => {
|
|
||||||
const builder = await buildx.inspect('');
|
|
||||||
expect(builder).not.toBeUndefined();
|
|
||||||
expect(builder.name).not.toEqual('');
|
|
||||||
expect(builder.driver).not.toEqual('');
|
|
||||||
expect(builder.nodes).not.toEqual({});
|
|
||||||
}, 100000);
|
|
||||||
});
|
|
||||||
|
|
||||||
describe('parseInspect', () => {
|
|
||||||
// prettier-ignore
|
|
||||||
test.each([
|
|
||||||
[
|
|
||||||
'inspect1.txt',
|
|
||||||
{
|
|
||||||
"nodes": [
|
|
||||||
{
|
|
||||||
"name": "builder-5cb467f7-0940-47e1-b94b-d51f54054d620",
|
|
||||||
"endpoint": "unix:///var/run/docker.sock",
|
|
||||||
"status": "running",
|
|
||||||
"buildkitd-flags": "--allow-insecure-entitlement security.insecure --allow-insecure-entitlement network.host",
|
|
||||||
"buildkit": "v0.10.4",
|
|
||||||
"platforms": "linux/amd64,linux/amd64/v2,linux/amd64/v3,linux/amd64/v4,linux/arm64,linux/riscv64,linux/386,linux/arm/v7,linux/arm/v6"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"name": "builder-5cb467f7-0940-47e1-b94b-d51f54054d62",
|
|
||||||
"driver": "docker-container"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
[
|
|
||||||
'inspect2.txt',
|
|
||||||
{
|
|
||||||
"nodes": [
|
|
||||||
{
|
|
||||||
"name": "builder-5f449644-ff29-48af-8344-abb0292d06730",
|
|
||||||
"endpoint": "unix:///var/run/docker.sock",
|
|
||||||
"driver-opts": [
|
|
||||||
"image=moby/buildkit:latest"
|
|
||||||
],
|
|
||||||
"status": "running",
|
|
||||||
"buildkitd-flags": "--allow-insecure-entitlement security.insecure --allow-insecure-entitlement network.host",
|
|
||||||
"buildkit": "v0.10.4",
|
|
||||||
"platforms": "linux/amd64,linux/amd64/v2,linux/amd64/v3,linux/amd64/v4,linux/386"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"name": "builder-5f449644-ff29-48af-8344-abb0292d0673",
|
|
||||||
"driver": "docker-container"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
[
|
|
||||||
'inspect3.txt',
|
|
||||||
{
|
|
||||||
"nodes": [
|
|
||||||
{
|
|
||||||
"name": "builder-9929e463-7954-4dc3-89cd-514cca29ff800",
|
|
||||||
"endpoint": "unix:///var/run/docker.sock",
|
|
||||||
"driver-opts": [
|
|
||||||
"image=moby/buildkit:master",
|
|
||||||
"network=host"
|
|
||||||
],
|
|
||||||
"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": "builder-9929e463-7954-4dc3-89cd-514cca29ff80",
|
|
||||||
"driver": "docker-container"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
[
|
|
||||||
'inspect4.txt',
|
|
||||||
{
|
|
||||||
"nodes": [
|
|
||||||
{
|
|
||||||
"name": "default",
|
|
||||||
"endpoint": "default",
|
|
||||||
"status": "running",
|
|
||||||
"buildkit": "20.10.17",
|
|
||||||
"platforms": "linux/amd64,linux/arm64,linux/riscv64,linux/ppc64le,linux/s390x,linux/386,linux/arm/v7,linux/arm/v6"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"name": "default",
|
|
||||||
"driver": "docker"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
[
|
|
||||||
'inspect5.txt',
|
|
||||||
{
|
|
||||||
"nodes": [
|
|
||||||
{
|
|
||||||
"name": "aws_graviton2",
|
|
||||||
"endpoint": "tcp://1.23.45.67:1234",
|
|
||||||
"driver-opts": [
|
|
||||||
"cert=/home/user/.certs/aws_graviton2/cert.pem",
|
|
||||||
"key=/home/user/.certs/aws_graviton2/key.pem",
|
|
||||||
"cacert=/home/user/.certs/aws_graviton2/ca.pem"
|
|
||||||
],
|
|
||||||
"status": "running",
|
|
||||||
"platforms": "darwin/arm64,linux/arm64,linux/arm/v5,linux/arm/v6,linux/arm/v7,windows/arm64"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"name": "remote-builder",
|
|
||||||
"driver": "remote"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
[
|
|
||||||
'inspect6.txt',
|
|
||||||
{
|
|
||||||
"nodes": [
|
|
||||||
{
|
|
||||||
"name": "builder-17cfff01-48d9-4c3d-9332-9992e308a5100",
|
|
||||||
"endpoint": "unix:///var/run/docker.sock",
|
|
||||||
"status": "running",
|
|
||||||
"buildkitd-flags": "--allow-insecure-entitlement security.insecure --allow-insecure-entitlement network.host",
|
|
||||||
"platforms": "linux/amd64,linux/amd64/v2,linux/amd64/v3,linux/386"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"name": "builder-17cfff01-48d9-4c3d-9332-9992e308a510",
|
|
||||||
"driver": "docker-container"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
])('given %p', async (inspectFile, expected) => {
|
|
||||||
expect(await buildx.parseInspect(fs.readFileSync(path.join(__dirname, 'fixtures', inspectFile)).toString())).toEqual(expected);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
describe('build', () => {
|
|
||||||
const tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), 'setup-buildx-'));
|
|
||||||
|
|
||||||
// eslint-disable-next-line jest/no-disabled-tests
|
|
||||||
it.skip('builds refs/pull/648/head', async () => {
|
|
||||||
const buildxBin = await buildx.build('https://github.com/docker/buildx.git#refs/pull/648/head', tmpDir, false);
|
|
||||||
expect(fs.existsSync(buildxBin)).toBe(true);
|
|
||||||
}, 100000);
|
|
||||||
|
|
||||||
// eslint-disable-next-line jest/no-disabled-tests
|
|
||||||
it.skip('builds 67bd6f4dc82a9cd96f34133dab3f6f7af803bb14', async () => {
|
|
||||||
const buildxBin = await buildx.build('https://github.com/docker/buildx.git#67bd6f4dc82a9cd96f34133dab3f6f7af803bb14', tmpDir, false);
|
|
||||||
expect(fs.existsSync(buildxBin)).toBe(true);
|
|
||||||
}, 100000);
|
|
||||||
});
|
|
||||||
|
|
||||||
describe('install', () => {
|
|
||||||
const tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), 'setup-buildx-'));
|
|
||||||
test.each([
|
|
||||||
['v0.4.1', false],
|
|
||||||
['latest', false],
|
|
||||||
['v0.4.1', true],
|
|
||||||
['latest', true]
|
|
||||||
])(
|
|
||||||
'acquires %p of buildx (standalone: %p)',
|
|
||||||
async (version, standalone) => {
|
|
||||||
const buildxBin = await buildx.install(version, tmpDir, standalone);
|
|
||||||
expect(fs.existsSync(buildxBin)).toBe(true);
|
|
||||||
},
|
|
||||||
100000
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
describe('getConfig', () => {
|
|
||||||
test.each([
|
|
||||||
['debug = true', false, 'debug = true', false],
|
|
||||||
[`notfound.toml`, true, '', true],
|
|
||||||
[
|
|
||||||
`${path.join(__dirname, 'fixtures', 'buildkitd.toml').split(path.sep).join(path.posix.sep)}`,
|
|
||||||
true,
|
|
||||||
`debug = true
|
|
||||||
[registry."docker.io"]
|
|
||||||
mirrors = ["mirror.gcr.io"]
|
|
||||||
`,
|
|
||||||
false
|
|
||||||
]
|
|
||||||
])('given %p config', async (val, file, exValue, invalid) => {
|
|
||||||
try {
|
|
||||||
let config: string;
|
|
||||||
if (file) {
|
|
||||||
config = await buildx.getConfigFile(val);
|
|
||||||
} else {
|
|
||||||
config = await buildx.getConfigInline(val);
|
|
||||||
}
|
|
||||||
expect(true).toBe(!invalid);
|
|
||||||
expect(config).toEqual(tmpname);
|
|
||||||
const configValue = fs.readFileSync(tmpname, 'utf-8');
|
|
||||||
expect(configValue).toEqual(exValue);
|
|
||||||
} catch (err) {
|
|
||||||
// eslint-disable-next-line jest/no-conditional-expect
|
|
||||||
expect(true).toBe(invalid);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
+70
-89
@@ -1,23 +1,19 @@
|
|||||||
import {beforeEach, describe, expect, it, jest, test} from '@jest/globals';
|
import {beforeEach, describe, expect, jest, test} from '@jest/globals';
|
||||||
import * as fs from 'fs';
|
|
||||||
import * as os from 'os';
|
|
||||||
import * as path from 'path';
|
|
||||||
import * as uuid from 'uuid';
|
import * as uuid from 'uuid';
|
||||||
|
import {Buildx} from '@docker/actions-toolkit/lib/buildx/buildx';
|
||||||
|
import {Docker} from '@docker/actions-toolkit/lib/docker/docker';
|
||||||
|
import {Toolkit} from '@docker/actions-toolkit/lib/toolkit';
|
||||||
|
import {Node} from '@docker/actions-toolkit/lib/types/builder';
|
||||||
|
|
||||||
import * as context from '../src/context';
|
import * as context from '../src/context';
|
||||||
import * as nodes from '../src/nodes';
|
|
||||||
|
|
||||||
const tmpdir = fs.mkdtempSync(path.join(os.tmpdir(), 'docker-setup-buildx-')).split(path.sep).join(path.posix.sep);
|
|
||||||
jest.spyOn(context, 'tmpDir').mockImplementation((): string => {
|
|
||||||
return tmpdir;
|
|
||||||
});
|
|
||||||
|
|
||||||
jest.spyOn(context, 'tmpNameSync').mockImplementation((): string => {
|
|
||||||
return path.join(tmpdir, '.tmpname').split(path.sep).join(path.posix.sep);
|
|
||||||
});
|
|
||||||
|
|
||||||
jest.mock('uuid');
|
jest.mock('uuid');
|
||||||
jest.spyOn(uuid, 'v4').mockReturnValue('9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d');
|
jest.spyOn(uuid, 'v4').mockReturnValue('9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d');
|
||||||
|
|
||||||
|
jest.spyOn(Docker, 'context').mockImplementation((): Promise<string> => {
|
||||||
|
return Promise.resolve('default');
|
||||||
|
});
|
||||||
|
|
||||||
describe('getCreateArgs', () => {
|
describe('getCreateArgs', () => {
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
process.env = Object.keys(process.env).reduce((object, key) => {
|
process.env = Object.keys(process.env).reduce((object, key) => {
|
||||||
@@ -32,9 +28,11 @@ describe('getCreateArgs', () => {
|
|||||||
test.each([
|
test.each([
|
||||||
[
|
[
|
||||||
0,
|
0,
|
||||||
|
'v0.10.3',
|
||||||
new Map<string, string>([
|
new Map<string, string>([
|
||||||
['install', 'false'],
|
['install', 'false'],
|
||||||
['use', 'true'],
|
['use', 'true'],
|
||||||
|
['cleanup', 'true'],
|
||||||
]),
|
]),
|
||||||
[
|
[
|
||||||
'create',
|
'create',
|
||||||
@@ -46,10 +44,12 @@ describe('getCreateArgs', () => {
|
|||||||
],
|
],
|
||||||
[
|
[
|
||||||
1,
|
1,
|
||||||
|
'v0.10.3',
|
||||||
new Map<string, string>([
|
new Map<string, string>([
|
||||||
['driver', 'docker'],
|
['driver', 'docker'],
|
||||||
['install', 'false'],
|
['install', 'false'],
|
||||||
['use', 'true'],
|
['use', 'true'],
|
||||||
|
['cleanup', 'true'],
|
||||||
]),
|
]),
|
||||||
[
|
[
|
||||||
'create',
|
'create',
|
||||||
@@ -61,10 +61,12 @@ describe('getCreateArgs', () => {
|
|||||||
],
|
],
|
||||||
[
|
[
|
||||||
2,
|
2,
|
||||||
|
'v0.10.3',
|
||||||
new Map<string, string>([
|
new Map<string, string>([
|
||||||
['install', 'false'],
|
['install', 'false'],
|
||||||
['use', 'false'],
|
['use', 'false'],
|
||||||
['driver-opts', 'image=moby/buildkit:master\nnetwork=host'],
|
['driver-opts', 'image=moby/buildkit:master\nnetwork=host'],
|
||||||
|
['cleanup', 'true'],
|
||||||
]),
|
]),
|
||||||
[
|
[
|
||||||
'create',
|
'create',
|
||||||
@@ -77,11 +79,13 @@ describe('getCreateArgs', () => {
|
|||||||
],
|
],
|
||||||
[
|
[
|
||||||
3,
|
3,
|
||||||
|
'v0.10.3',
|
||||||
new Map<string, string>([
|
new Map<string, string>([
|
||||||
['driver', 'remote'],
|
['driver', 'remote'],
|
||||||
['endpoint', 'tls://foo:1234'],
|
['endpoint', 'tls://foo:1234'],
|
||||||
['install', 'false'],
|
['install', 'false'],
|
||||||
['use', 'true'],
|
['use', 'true'],
|
||||||
|
['cleanup', 'true'],
|
||||||
]),
|
]),
|
||||||
[
|
[
|
||||||
'create',
|
'create',
|
||||||
@@ -93,12 +97,14 @@ describe('getCreateArgs', () => {
|
|||||||
],
|
],
|
||||||
[
|
[
|
||||||
4,
|
4,
|
||||||
|
'v0.10.3',
|
||||||
new Map<string, string>([
|
new Map<string, string>([
|
||||||
['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'],
|
['install', 'false'],
|
||||||
['use', 'true'],
|
['use', 'true'],
|
||||||
|
['cleanup', 'true'],
|
||||||
]),
|
]),
|
||||||
[
|
[
|
||||||
'create',
|
'create',
|
||||||
@@ -109,14 +115,52 @@ describe('getCreateArgs', () => {
|
|||||||
'tls://foo:1234'
|
'tls://foo:1234'
|
||||||
]
|
]
|
||||||
],
|
],
|
||||||
|
[
|
||||||
|
5,
|
||||||
|
'v0.10.3',
|
||||||
|
new Map<string, string>([
|
||||||
|
['install', 'false'],
|
||||||
|
['use', 'false'],
|
||||||
|
['driver-opts', `"env.no_proxy=localhost,127.0.0.1,.mydomain"`],
|
||||||
|
['cleanup', 'true'],
|
||||||
|
]),
|
||||||
|
[
|
||||||
|
'create',
|
||||||
|
'--name', 'builder-9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d',
|
||||||
|
'--driver', 'docker-container',
|
||||||
|
'--driver-opt', '"env.no_proxy=localhost,127.0.0.1,.mydomain"',
|
||||||
|
'--buildkitd-flags', '--allow-insecure-entitlement security.insecure --allow-insecure-entitlement network.host'
|
||||||
|
]
|
||||||
|
],
|
||||||
|
[
|
||||||
|
6,
|
||||||
|
'v0.10.3',
|
||||||
|
new Map<string, string>([
|
||||||
|
['install', 'false'],
|
||||||
|
['use', 'false'],
|
||||||
|
['platforms', 'linux/amd64\n"linux/arm64,linux/arm/v7"'],
|
||||||
|
['cleanup', 'true'],
|
||||||
|
]),
|
||||||
|
[
|
||||||
|
'create',
|
||||||
|
'--name', 'builder-9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d',
|
||||||
|
'--driver', 'docker-container',
|
||||||
|
'--buildkitd-flags', '--allow-insecure-entitlement security.insecure --allow-insecure-entitlement network.host',
|
||||||
|
'--platform', 'linux/amd64,linux/arm64,linux/arm/v7'
|
||||||
|
]
|
||||||
|
]
|
||||||
])(
|
])(
|
||||||
'[%d] given %p as inputs, returns %p',
|
'[%d] given buildx %s and %p as inputs, returns %p',
|
||||||
async (num: number, inputs: Map<string, string>, expected: Array<string>) => {
|
async (num: number, buildxVersion: string, inputs: Map<string, string>, expected: Array<string>) => {
|
||||||
inputs.forEach((value: string, name: string) => {
|
inputs.forEach((value: string, name: string) => {
|
||||||
setInput(name, value);
|
setInput(name, value);
|
||||||
});
|
});
|
||||||
|
const toolkit = new Toolkit();
|
||||||
|
jest.spyOn(Buildx.prototype, 'version').mockImplementation(async (): Promise<string> => {
|
||||||
|
return buildxVersion;
|
||||||
|
});
|
||||||
const inp = await context.getInputs();
|
const inp = await context.getInputs();
|
||||||
const res = await context.getCreateArgs(inp, '0.9.0');
|
const res = await context.getCreateArgs(inp, toolkit);
|
||||||
expect(res).toEqual(expected);
|
expect(res).toEqual(expected);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
@@ -136,9 +180,11 @@ describe('getAppendArgs', () => {
|
|||||||
test.each([
|
test.each([
|
||||||
[
|
[
|
||||||
0,
|
0,
|
||||||
|
'v0.10.3',
|
||||||
new Map<string, string>([
|
new Map<string, string>([
|
||||||
['install', 'false'],
|
['install', 'false'],
|
||||||
['use', 'true'],
|
['use', 'true'],
|
||||||
|
['cleanup', 'true'],
|
||||||
]),
|
]),
|
||||||
{
|
{
|
||||||
"name": "aws_graviton2",
|
"name": "aws_graviton2",
|
||||||
@@ -161,87 +207,22 @@ describe('getAppendArgs', () => {
|
|||||||
]
|
]
|
||||||
]
|
]
|
||||||
])(
|
])(
|
||||||
'[%d] given %p as inputs, returns %p',
|
'[%d] given buildx %s and %p as inputs, returns %p',
|
||||||
async (num: number, inputs: Map<string, string>, node: nodes.Node, expected: Array<string>) => {
|
async (num: number, buildxVersion: string, inputs: Map<string, string>, node: Node, expected: Array<string>) => {
|
||||||
inputs.forEach((value: string, name: string) => {
|
inputs.forEach((value: string, name: string) => {
|
||||||
setInput(name, value);
|
setInput(name, value);
|
||||||
});
|
});
|
||||||
|
const toolkit = new Toolkit();
|
||||||
|
jest.spyOn(Buildx.prototype, 'version').mockImplementation(async (): Promise<string> => {
|
||||||
|
return buildxVersion;
|
||||||
|
});
|
||||||
const inp = await context.getInputs();
|
const inp = await context.getInputs();
|
||||||
const res = await context.getAppendArgs(inp, node, '0.9.0');
|
const res = await context.getAppendArgs(inp, node, toolkit);
|
||||||
expect(res).toEqual(expected);
|
expect(res).toEqual(expected);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('getInputList', () => {
|
|
||||||
it('handles single line correctly', async () => {
|
|
||||||
await setInput('foo', 'bar');
|
|
||||||
const res = await context.getInputList('foo');
|
|
||||||
expect(res).toEqual(['bar']);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('handles multiple lines correctly', async () => {
|
|
||||||
setInput('foo', 'bar\nbaz');
|
|
||||||
const res = await context.getInputList('foo');
|
|
||||||
expect(res).toEqual(['bar', 'baz']);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('remove empty lines correctly', async () => {
|
|
||||||
setInput('foo', 'bar\n\nbaz');
|
|
||||||
const res = await context.getInputList('foo');
|
|
||||||
expect(res).toEqual(['bar', 'baz']);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('handles comma correctly', async () => {
|
|
||||||
setInput('foo', 'bar,baz');
|
|
||||||
const res = await context.getInputList('foo');
|
|
||||||
expect(res).toEqual(['bar', 'baz']);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('remove empty result correctly', async () => {
|
|
||||||
setInput('foo', 'bar,baz,');
|
|
||||||
const res = await context.getInputList('foo');
|
|
||||||
expect(res).toEqual(['bar', 'baz']);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('handles different new lines correctly', async () => {
|
|
||||||
setInput('foo', 'bar\r\nbaz');
|
|
||||||
const res = await context.getInputList('foo');
|
|
||||||
expect(res).toEqual(['bar', 'baz']);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('handles different new lines and comma correctly', async () => {
|
|
||||||
setInput('foo', 'bar\r\nbaz,bat');
|
|
||||||
const res = await context.getInputList('foo');
|
|
||||||
expect(res).toEqual(['bar', 'baz', 'bat']);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('handles multiple lines and ignoring comma correctly', async () => {
|
|
||||||
setInput('driver-opts', 'image=moby/buildkit:master\nnetwork=host');
|
|
||||||
const res = await context.getInputList('driver-opts', true);
|
|
||||||
expect(res).toEqual(['image=moby/buildkit:master', 'network=host']);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('handles different new lines and ignoring comma correctly', async () => {
|
|
||||||
setInput('driver-opts', 'image=moby/buildkit:master\r\nnetwork=host');
|
|
||||||
const res = await context.getInputList('driver-opts', true);
|
|
||||||
expect(res).toEqual(['image=moby/buildkit:master', 'network=host']);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
describe('asyncForEach', () => {
|
|
||||||
it('executes async tasks sequentially', async () => {
|
|
||||||
const testValues = [1, 2, 3, 4, 5];
|
|
||||||
const results: number[] = [];
|
|
||||||
|
|
||||||
await context.asyncForEach(testValues, async value => {
|
|
||||||
results.push(value);
|
|
||||||
});
|
|
||||||
|
|
||||||
expect(results).toEqual(testValues);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
// See: https://github.com/actions/toolkit/blob/master/packages/core/src/core.ts#L67
|
// See: https://github.com/actions/toolkit/blob/master/packages/core/src/core.ts#L67
|
||||||
function getInputName(name: string): string {
|
function getInputName(name: string): string {
|
||||||
return `INPUT_${name.replace(/ /g, '_').toUpperCase()}`;
|
return `INPUT_${name.replace(/ /g, '_').toUpperCase()}`;
|
||||||
|
|||||||
@@ -1,16 +0,0 @@
|
|||||||
import {describe, expect, it, jest} from '@jest/globals';
|
|
||||||
import * as docker from '../src/docker';
|
|
||||||
import * as exec from '@actions/exec';
|
|
||||||
|
|
||||||
describe('isAvailable', () => {
|
|
||||||
it('cli', () => {
|
|
||||||
const execSpy = jest.spyOn(exec, 'getExecOutput');
|
|
||||||
docker.isAvailable();
|
|
||||||
|
|
||||||
// eslint-disable-next-line jest/no-standalone-expect
|
|
||||||
expect(execSpy).toHaveBeenCalledWith(`docker`, undefined, {
|
|
||||||
silent: true,
|
|
||||||
ignoreReturnCode: true
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
debug = true
|
|
||||||
[registry."docker.io"]
|
|
||||||
mirrors = ["mirror.gcr.io"]
|
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
Name: builder-5cb467f7-0940-47e1-b94b-d51f54054d62
|
|
||||||
Driver: docker-container
|
|
||||||
|
|
||||||
Nodes:
|
|
||||||
Name: builder-5cb467f7-0940-47e1-b94b-d51f54054d620
|
|
||||||
Endpoint: unix:///var/run/docker.sock
|
|
||||||
Status: running
|
|
||||||
Flags: --allow-insecure-entitlement security.insecure --allow-insecure-entitlement network.host
|
|
||||||
Buildkit: v0.10.4
|
|
||||||
Platforms: linux/amd64, linux/amd64/v2, linux/amd64/v3, linux/amd64/v4, linux/arm64, linux/riscv64, linux/386, linux/arm/v7, linux/arm/v6
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
Name: builder-5f449644-ff29-48af-8344-abb0292d0673
|
|
||||||
Driver: docker-container
|
|
||||||
|
|
||||||
Nodes:
|
|
||||||
Name: builder-5f449644-ff29-48af-8344-abb0292d06730
|
|
||||||
Endpoint: unix:///var/run/docker.sock
|
|
||||||
Driver Options: image="moby/buildkit:latest"
|
|
||||||
Status: running
|
|
||||||
Flags: --allow-insecure-entitlement security.insecure --allow-insecure-entitlement network.host
|
|
||||||
Buildkit: v0.10.4
|
|
||||||
Platforms: linux/amd64, linux/amd64/v2, linux/amd64/v3, linux/amd64/v4, linux/386
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
Name: builder-9929e463-7954-4dc3-89cd-514cca29ff80
|
|
||||||
Driver: docker-container
|
|
||||||
|
|
||||||
Nodes:
|
|
||||||
Name: builder-9929e463-7954-4dc3-89cd-514cca29ff800
|
|
||||||
Endpoint: unix:///var/run/docker.sock
|
|
||||||
Driver Options: image="moby/buildkit:master" network="host"
|
|
||||||
Status: running
|
|
||||||
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
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
Name: default
|
|
||||||
Driver: docker
|
|
||||||
|
|
||||||
Nodes:
|
|
||||||
Name: default
|
|
||||||
Endpoint: default
|
|
||||||
Status: running
|
|
||||||
Buildkit: 20.10.17
|
|
||||||
Platforms: linux/amd64, linux/arm64, linux/riscv64, linux/ppc64le, linux/s390x, linux/386, linux/arm/v7, linux/arm/v6
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
Name: remote-builder
|
|
||||||
Driver: remote
|
|
||||||
|
|
||||||
Nodes:
|
|
||||||
Name: aws_graviton2
|
|
||||||
Endpoint: tcp://1.23.45.67:1234
|
|
||||||
Driver Options: cert="/home/user/.certs/aws_graviton2/cert.pem" key="/home/user/.certs/aws_graviton2/key.pem" cacert="/home/user/.certs/aws_graviton2/ca.pem"
|
|
||||||
Status: running
|
|
||||||
Platforms: darwin/arm64*, linux/arm64*, linux/arm/v5*, linux/arm/v6*, linux/arm/v7*, windows/arm64*, linux/amd64, linux/amd64/v2, linux/riscv64, linux/ppc64le, linux/s390x, linux/mips64le, linux/mips64
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
Name: builder-17cfff01-48d9-4c3d-9332-9992e308a510
|
|
||||||
Driver: docker-container
|
|
||||||
|
|
||||||
Nodes:
|
|
||||||
Name: builder-17cfff01-48d9-4c3d-9332-9992e308a5100
|
|
||||||
Endpoint: unix:///var/run/docker.sock
|
|
||||||
Status: running
|
|
||||||
Flags: --allow-insecure-entitlement security.insecure --allow-insecure-entitlement network.host
|
|
||||||
Platforms: linux/amd64, linux/amd64/v2, linux/amd64/v3, linux/386
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
import {describe, expect, it} from '@jest/globals';
|
|
||||||
import * as git from '../src/git';
|
|
||||||
|
|
||||||
describe('git', () => {
|
|
||||||
it('returns git remote ref', async () => {
|
|
||||||
const ref: string = await git.getRemoteSha('https://github.com/docker/buildx.git', 'refs/pull/648/head');
|
|
||||||
expect(ref).toEqual('f11797113e5a9b86bd976329c5dbb8a8bfdfadfa');
|
|
||||||
});
|
|
||||||
});
|
|
||||||
@@ -1,16 +0,0 @@
|
|||||||
import {describe, expect, it} from '@jest/globals';
|
|
||||||
import * as github from '../src/github';
|
|
||||||
|
|
||||||
describe('github', () => {
|
|
||||||
it('returns latest buildx GitHub release', async () => {
|
|
||||||
const release = await github.getRelease('latest');
|
|
||||||
expect(release).not.toBeNull();
|
|
||||||
expect(release?.tag_name).not.toEqual('');
|
|
||||||
});
|
|
||||||
|
|
||||||
it('returns v0.2.2 buildx GitHub release', async () => {
|
|
||||||
const release = await github.getRelease('v0.2.2');
|
|
||||||
expect(release).not.toBeNull();
|
|
||||||
expect(release?.tag_name).toEqual('v0.2.2');
|
|
||||||
});
|
|
||||||
});
|
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
import {describe, expect, test} from '@jest/globals';
|
|
||||||
import * as util from '../src/util';
|
|
||||||
|
|
||||||
describe('isValidUrl', () => {
|
|
||||||
test.each([
|
|
||||||
['https://github.com/docker/buildx.git', true],
|
|
||||||
['https://github.com/docker/buildx.git#refs/pull/648/head', true],
|
|
||||||
['v0.4.1', false]
|
|
||||||
])('given %p', async (url, expected) => {
|
|
||||||
expect(util.isValidUrl(url)).toEqual(expected);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
@@ -44,6 +44,10 @@ inputs:
|
|||||||
append:
|
append:
|
||||||
description: 'Append additional nodes to the builder'
|
description: 'Append additional nodes to the builder'
|
||||||
required: false
|
required: false
|
||||||
|
cleanup:
|
||||||
|
description: 'Cleanup temp files and remove builder at the end of a job'
|
||||||
|
default: 'true'
|
||||||
|
required: false
|
||||||
|
|
||||||
outputs:
|
outputs:
|
||||||
name:
|
name:
|
||||||
|
|||||||
@@ -71,6 +71,7 @@ ENV RUNNER_TOOL_CACHE=/tmp/github_tool_cache
|
|||||||
RUN --mount=type=bind,target=.,rw \
|
RUN --mount=type=bind,target=.,rw \
|
||||||
--mount=type=cache,target=/src/node_modules \
|
--mount=type=cache,target=/src/node_modules \
|
||||||
--mount=type=bind,from=docker,source=/usr/local/bin/docker,target=/usr/bin/docker \
|
--mount=type=bind,from=docker,source=/usr/local/bin/docker,target=/usr/bin/docker \
|
||||||
|
--mount=type=bind,from=buildx,source=/buildx,target=/usr/bin/buildx \
|
||||||
--mount=type=bind,from=buildx,source=/buildx,target=/usr/libexec/docker/cli-plugins/docker-buildx \
|
--mount=type=bind,from=buildx,source=/buildx,target=/usr/libexec/docker/cli-plugins/docker-buildx \
|
||||||
yarn run test --coverageDirectory=/tmp/coverage
|
yarn run test --coverageDirectory=/tmp/coverage
|
||||||
|
|
||||||
|
|||||||
+8
-2
File diff suppressed because one or more lines are too long
+1
-1
File diff suppressed because one or more lines are too long
+744
File diff suppressed because it is too large
Load Diff
+1
-1
File diff suppressed because one or more lines are too long
@@ -1,56 +1,3 @@
|
|||||||
# Append additional nodes to the builder
|
# Append additional nodes to the builder
|
||||||
|
|
||||||
Buildx also supports running builds on multiple machines. This is useful for
|
This page has moved to [Docker Docs website](https://docs.docker.com/build/ci/github-actions/configure-builder/#append-additional-nodes-to-the-builder)
|
||||||
building [multi-platform images](https://docs.docker.com/build/building/multi-platform/)
|
|
||||||
on native nodes for more complicated cases that are not handled by QEMU and
|
|
||||||
generally have better performance or for distributing the build across multiple
|
|
||||||
machines.
|
|
||||||
|
|
||||||
You can append nodes to the builder that is going to be created with the
|
|
||||||
`append` input in the form of a YAML string document to remove limitations
|
|
||||||
intrinsically linked to GitHub Actions (only string format is handled in the
|
|
||||||
input fields):
|
|
||||||
|
|
||||||
| Name | Type | Description |
|
|
||||||
|-------------------|--------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
|
||||||
| `name` | String | [Name of the node](https://docs.docker.com/engine/reference/commandline/buildx_create/#node). If empty, it is the name of the builder it belongs to, with an index number suffix. This is useful to set it if you want to modify/remove a node in an underlying step of you workflow. |
|
|
||||||
| `endpoint` | String | [Docker context or endpoint](https://docs.docker.com/engine/reference/commandline/buildx_create/#description) of the node to add to the builder |
|
|
||||||
| `driver-opts` | List | List of additional [driver-specific options](https://docs.docker.com/engine/reference/commandline/buildx_create/#driver-opt) |
|
|
||||||
| `buildkitd-flags` | String | [Flags for buildkitd](https://docs.docker.com/engine/reference/commandline/buildx_create/#buildkitd-flags) daemon |
|
|
||||||
| `platforms` | String | Fixed [platforms](https://docs.docker.com/engine/reference/commandline/buildx_create/#platform) for the node. If not empty, values take priority over the detected ones. |
|
|
||||||
|
|
||||||
Here is an example using remote nodes with the [`remote` driver](https://docs.docker.com/build/building/drivers/remote/)
|
|
||||||
and [TLS authentication](auth.md#tls-authentication):
|
|
||||||
|
|
||||||
```yaml
|
|
||||||
name: ci
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
buildx:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
-
|
|
||||||
name: Set up Docker Buildx
|
|
||||||
uses: docker/setup-buildx-action@v2
|
|
||||||
with:
|
|
||||||
driver: remote
|
|
||||||
endpoint: tcp://oneprovider:1234
|
|
||||||
append: |
|
|
||||||
- endpoint: tcp://graviton2:1234
|
|
||||||
platforms: linux/arm64
|
|
||||||
- endpoint: tcp://linuxone:1234
|
|
||||||
platforms: linux/s390x
|
|
||||||
env:
|
|
||||||
BUILDER_NODE_0_AUTH_TLS_CACERT: ${{ secrets.ONEPROVIDER_CA }}
|
|
||||||
BUILDER_NODE_0_AUTH_TLS_CERT: ${{ secrets.ONEPROVIDER_CERT }}
|
|
||||||
BUILDER_NODE_0_AUTH_TLS_KEY: ${{ secrets.ONEPROVIDER_KEY }}
|
|
||||||
BUILDER_NODE_1_AUTH_TLS_CACERT: ${{ secrets.GRAVITON2_CA }}
|
|
||||||
BUILDER_NODE_1_AUTH_TLS_CERT: ${{ secrets.GRAVITON2_CERT }}
|
|
||||||
BUILDER_NODE_1_AUTH_TLS_KEY: ${{ secrets.GRAVITON2_KEY }}
|
|
||||||
BUILDER_NODE_2_AUTH_TLS_CACERT: ${{ secrets.LINUXONE_CA }}
|
|
||||||
BUILDER_NODE_2_AUTH_TLS_CERT: ${{ secrets.LINUXONE_CERT }}
|
|
||||||
BUILDER_NODE_2_AUTH_TLS_KEY: ${{ secrets.LINUXONE_KEY }}
|
|
||||||
```
|
|
||||||
|
|||||||
+1
-62
@@ -1,64 +1,3 @@
|
|||||||
# Authentication support
|
# Authentication support
|
||||||
|
|
||||||
## SSH authentication
|
This page has moved to [Docker Docs website](https://docs.docker.com/build/ci/github-actions/configure-builder/#authentication-for-remote-builders)
|
||||||
|
|
||||||
To be able to connect to an SSH endpoint using the [`docker-container` driver](https://docs.docker.com/build/building/drivers/docker-container/),
|
|
||||||
you have to set up the SSH private key and configuration on the GitHub Runner:
|
|
||||||
|
|
||||||
```yaml
|
|
||||||
name: ci
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
buildx:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
-
|
|
||||||
name: Set up SSH
|
|
||||||
uses: MrSquaare/ssh-setup-action@523473d91581ccbf89565e12b40faba93f2708bd # v1.1.0
|
|
||||||
with:
|
|
||||||
host: graviton2
|
|
||||||
private-key: ${{ secrets.SSH_PRIVATE_KEY }}
|
|
||||||
private-key-name: aws_graviton2
|
|
||||||
-
|
|
||||||
name: Set up Docker Buildx
|
|
||||||
uses: docker/setup-buildx-action@v2
|
|
||||||
with:
|
|
||||||
endpoint: ssh://me@graviton2
|
|
||||||
```
|
|
||||||
|
|
||||||
## TLS authentication
|
|
||||||
|
|
||||||
You can also [set up a remote BuildKit instance](https://docs.docker.com/build/building/drivers/remote/#remote-buildkit-in-docker-container)
|
|
||||||
using the remote driver. To ease the integration in your workflow, we put in
|
|
||||||
place environment variables that will set up authentication using the BuildKit
|
|
||||||
client certificates for the `tcp://` endpoint where `<idx>` is the position of
|
|
||||||
the node in the list of nodes:
|
|
||||||
|
|
||||||
* `BUILDER_NODE_<idx>_AUTH_TLS_CACERT`
|
|
||||||
* `BUILDER_NODE_<idx>_AUTH_TLS_CERT`
|
|
||||||
* `BUILDER_NODE_<idx>_AUTH_TLS_KEY`
|
|
||||||
|
|
||||||
```yaml
|
|
||||||
name: ci
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
buildx:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
-
|
|
||||||
name: Set up Docker Buildx
|
|
||||||
uses: docker/setup-buildx-action@v2
|
|
||||||
with:
|
|
||||||
driver: remote
|
|
||||||
endpoint: tcp://graviton2:1234
|
|
||||||
env:
|
|
||||||
BUILDER_NODE_0_AUTH_TLS_CACERT: ${{ secrets.GRAVITON2_CA }}
|
|
||||||
BUILDER_NODE_0_AUTH_TLS_CERT: ${{ secrets.GRAVITON2_CERT }}
|
|
||||||
BUILDER_NODE_0_AUTH_TLS_KEY: ${{ secrets.GRAVITON2_KEY }}
|
|
||||||
```
|
|
||||||
|
|||||||
@@ -1,67 +1,3 @@
|
|||||||
# BuildKit daemon configuration
|
# BuildKit daemon configuration
|
||||||
|
|
||||||
You can provide a [BuildKit configuration](https://github.com/moby/buildkit/blob/master/docs/buildkitd.toml.md)
|
This page has moved to [Docker Docs website](https://docs.docker.com/build/ci/github-actions/configure-builder/#buildkit-daemon-configuration)
|
||||||
to your builder if you're using the [`docker-container` driver](https://docs.docker.com/build/building/drivers/docker-container/)
|
|
||||||
(default) with the `config` or `config-inline` inputs:
|
|
||||||
|
|
||||||
## Registry mirror
|
|
||||||
|
|
||||||
You can configure a registry mirror using an inline block directly in your
|
|
||||||
workflow with the `config-inline` input:
|
|
||||||
|
|
||||||
```yaml
|
|
||||||
name: ci
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
buildx:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
-
|
|
||||||
name: Checkout
|
|
||||||
uses: actions/checkout@v3
|
|
||||||
-
|
|
||||||
name: Set up Docker Buildx
|
|
||||||
uses: docker/setup-buildx-action@v2
|
|
||||||
with:
|
|
||||||
config-inline: |
|
|
||||||
[registry."docker.io"]
|
|
||||||
mirrors = ["mirror.gcr.io"]
|
|
||||||
```
|
|
||||||
|
|
||||||
## Max parallelism
|
|
||||||
|
|
||||||
You can limit the parallelism of the BuildKit solver which is particularly
|
|
||||||
useful for low-powered machines.
|
|
||||||
|
|
||||||
You can use the `config-inline` input like the previous example, or you can use
|
|
||||||
a dedicated BuildKit config file from your repo if you want with the
|
|
||||||
`config` input:
|
|
||||||
|
|
||||||
```toml
|
|
||||||
# .github/buildkitd.toml
|
|
||||||
[worker.oci]
|
|
||||||
max-parallelism = 4
|
|
||||||
```
|
|
||||||
|
|
||||||
```yaml
|
|
||||||
name: ci
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
buildx:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
-
|
|
||||||
name: Checkout
|
|
||||||
uses: actions/checkout@v3
|
|
||||||
-
|
|
||||||
name: Set up Docker Buildx
|
|
||||||
uses: docker/setup-buildx-action@v2
|
|
||||||
with:
|
|
||||||
config: .github/buildkitd.toml
|
|
||||||
```
|
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user