diff --git a/.github/workflows/setup-buildx-ci.yml b/.github/workflows/setup-buildx-ci.yml index 8c60c84..83df57f 100644 --- a/.github/workflows/setup-buildx-ci.yml +++ b/.github/workflows/setup-buildx-ci.yml @@ -15,7 +15,7 @@ on: - setup-buildx/** jobs: - build: + main: runs-on: ubuntu-latest strategy: fail-fast: false @@ -62,6 +62,44 @@ jobs: run: | docker build --help + driver: + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + driver: + - docker-container + - docker + steps: + - + name: Checkout + uses: actions/checkout@v2.3.1 + - + name: Set up Docker Buildx + id: buildx + uses: ./setup-buildx/ + with: + driver: ${{ matrix.driver }} + + driver-opt: + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + driver-opt: + - image=moby/buildkit:latest + - image=moby/buildkit:master + steps: + - + name: Checkout + uses: actions/checkout@v2.3.1 + - + name: Set up Docker Buildx + id: buildx + uses: ./setup-buildx/ + with: + driver-opt: ${{ matrix.driver-opt }} + with-qemu: runs-on: ubuntu-latest strategy: diff --git a/.github/workflows/setup-qemu-ci.yml b/.github/workflows/setup-qemu-ci.yml index 122e553..594872d 100644 --- a/.github/workflows/setup-qemu-ci.yml +++ b/.github/workflows/setup-qemu-ci.yml @@ -15,7 +15,7 @@ on: - setup-qemu/** jobs: - build: + main: runs-on: ubuntu-latest strategy: fail-fast: false diff --git a/setup-buildx/README.md b/setup-buildx/README.md index 4919532..a668fb6 100644 --- a/setup-buildx/README.md +++ b/setup-buildx/README.md @@ -88,10 +88,12 @@ jobs: Following inputs can be used as `step.with` keys -| Name | Type | Default | Description | -|------------------|---------|-----------|------------------------------------| -| `buildx-version` | String | `latest` | [Buildx](https://github.com/docker/buildx) version. Example: `v0.3.0` | -| `install` | Bool | `false` | Sets up `docker build` command as an alias to `docker buildx` | +| Name | Type | Default | Description | +|------------------|---------|---------------------|------------------------------------| +| `buildx-version` | String | `latest` | [Buildx](https://github.com/docker/buildx) version. e.g. `v0.3.0` | +| `driver` | String | `docker-container` | Sets the [builder driver](https://github.com/docker/buildx#--driver-driver) to be used. | +| `driver-opt` | String | | Passes additional [driver-specific options](https://github.com/docker/buildx#--driver-opt-options). e.g. `image=moby/buildkit:master` | +| `install` | Bool | `false` | Sets up `docker build` command as an alias to `docker buildx` | ### outputs diff --git a/setup-buildx/action.yml b/setup-buildx/action.yml index b1871bb..1f9e633 100644 --- a/setup-buildx/action.yml +++ b/setup-buildx/action.yml @@ -8,9 +8,16 @@ branding: inputs: buildx-version: - description: 'Buildx version. Example: v0.3.0' + description: 'Buildx version. e.g. v0.3.0' default: 'latest' required: false + driver: + description: 'Sets the builder driver to be used' + default: 'docker-container' + required: false + driver-opt: + description: 'Passes additional driver-specific options. Eg. image=moby/buildkit:master' + required: false install: description: 'Sets up docker build command as an alias to docker buildx' default: 'false' diff --git a/setup-buildx/dist/index.js b/setup-buildx/dist/index.js index 7477162..b5d108a 100644 --- a/setup-buildx/dist/index.js +++ b/setup-buildx/dist/index.js @@ -2492,21 +2492,27 @@ function run() { return; } const buildxVer = core.getInput('buildx-version') || 'latest'; + const driver = core.getInput('driver') || 'docker-container'; + const driverOpt = core.getInput('driver-opt'); const install = /true/i.test(core.getInput('install')); const dockerConfigHome = process.env.DOCKER_CONFIG || path.join(os.homedir(), '.docker'); yield installer.buildx(buildxVer, dockerConfigHome); core.info('📣 Buildx info'); yield exec.exec('docker', ['buildx', 'version']); core.info('🔨 Creating a new builder instance...'); - yield exec.exec('docker', [ + let createArgs = [ 'buildx', 'create', + '--use', '--name', `builder-${process.env.GITHUB_SHA}`, '--driver', - 'docker-container', - '--use' - ]); + driver + ]; + if (driverOpt) { + createArgs.push('--driver-opt', driverOpt); + } + yield exec.exec('docker', createArgs); core.info('🏃 Booting builder...'); yield exec.exec('docker', ['buildx', 'inspect', '--bootstrap']); if (install) { diff --git a/setup-buildx/src/main.ts b/setup-buildx/src/main.ts index b50d165..9293823 100644 --- a/setup-buildx/src/main.ts +++ b/setup-buildx/src/main.ts @@ -14,6 +14,8 @@ async function run(): Promise { } const buildxVer: string = core.getInput('buildx-version') || 'latest'; + const driver: string = core.getInput('driver') || 'docker-container'; + const driverOpt: string = core.getInput('driver-opt'); const install: boolean = /true/i.test(core.getInput('install')); const dockerConfigHome: string = process.env.DOCKER_CONFIG || path.join(os.homedir(), '.docker'); await installer.buildx(buildxVer, dockerConfigHome); @@ -22,15 +24,21 @@ async function run(): Promise { await exec.exec('docker', ['buildx', 'version']); core.info('🔨 Creating a new builder instance...'); - await exec.exec('docker', [ + let createArgs: Array = [ 'buildx', 'create', + '--use', '--name', `builder-${process.env.GITHUB_SHA}`, '--driver', - 'docker-container', - '--use' - ]); + driver + ]; + + if (driverOpt) { + createArgs.push('--driver-opt', driverOpt); + } + + await exec.exec('docker', createArgs); core.info('🏃 Booting builder...'); await exec.exec('docker', ['buildx', 'inspect', '--bootstrap']); diff --git a/setup-qemu/README.md b/setup-qemu/README.md index c2addea..924571e 100644 --- a/setup-qemu/README.md +++ b/setup-qemu/README.md @@ -48,8 +48,8 @@ Following inputs can be used as `step.with` keys | Name | Type | Default | Description | |------------------|---------|-----------------------------|------------------------------------| -| `image` | String | `tonistiigi/binfmt:latest` | QEMU static binaries Docker image. Example: [`tonistiigi/binfmt:latest`](https://hub.docker.com/r/tonistiigi/binfmt/tags) | -| `platforms` | String | `all` | Platforms to install. Example: `arm64,riscv64,arm` | +| `image` | String | `tonistiigi/binfmt:latest` | QEMU static binaries Docker image. e.g. [`tonistiigi/binfmt:latest`](https://hub.docker.com/r/tonistiigi/binfmt/tags) | +| `platforms` | String | `all` | Platforms to install. e.g. `arm64,riscv64,arm` | ### outputs diff --git a/setup-qemu/action.yml b/setup-qemu/action.yml index ab728b0..8834984 100644 --- a/setup-qemu/action.yml +++ b/setup-qemu/action.yml @@ -8,11 +8,11 @@ branding: inputs: image: - description: 'QEMU static binaries Docker image. Example: tonistiigi/binfmt:latest' + description: 'QEMU static binaries Docker image. e.g. tonistiigi/binfmt:latest' default: 'tonistiigi/binfmt:latest' required: false platforms: - description: 'Platforms to install. Example: arm64,riscv64,arm' + description: 'Platforms to install. e.g. arm64,riscv64,arm' default: 'all' required: false