support building from remote bake definition

Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
This commit is contained in:
CrazyMax
2022-06-24 10:56:51 +02:00
parent 438d016327
commit bb2d1b0aab
6 changed files with 35 additions and 25 deletions

View File

@@ -51,10 +51,6 @@ jobs:
targets: |
${{ matrix.target }}
push: false # set to true when https://github.com/docker/buildx/issues/179 is fixed
-
name: Dump context
if: always()
uses: crazy-max/ghaction-dump-context@v1
error-msg:
runs-on: ubuntu-latest
@@ -71,10 +67,6 @@ jobs:
./test/config.hcl
set: |
*.platform=linux/amd64,linux/ppc64le,linux/s390x
-
name: Dump context
if: always()
uses: crazy-max/ghaction-dump-context@v1
error-check:
runs-on: ubuntu-latest
@@ -102,10 +94,6 @@ jobs:
echo "::error::Should have failed"
exit 1
fi
-
name: Dump context
if: always()
uses: crazy-max/ghaction-dump-context@v1
standalone:
runs-on: ubuntu-latest
@@ -126,3 +114,16 @@ jobs:
with:
files: |
./test/config.hcl
source:
runs-on: ubuntu-latest
steps:
-
name: Checkout
uses: actions/checkout@v3
-
name: Build
uses: ./
with:
source: https://github.com/docker/buildx.git#v0.8.2
targets: update-docs

View File

@@ -78,16 +78,17 @@ Following inputs can be used as `step.with` keys
> targets: default,release
> ```
| Name | Type | Description |
|------------------|----------|------------------------------------|
| `builder` | String | Builder instance (see [setup-buildx](https://github.com/docker/setup-buildx-action) action) |
| `files` | List/CSV | List of [bake definition files](https://github.com/docker/buildx/blob/master/docs/reference/buildx_bake.md#file) |
| `targets` | List/CSV | List of bake targets |
| `no-cache` | Bool | Do not use cache when building the image (default `false`) |
| `pull` | Bool | Always attempt to pull a newer version of the image (default `false`) |
| `load` | Bool | Load is a shorthand for `--set=*.output=type=docker` (default `false`) |
| `push` | Bool | Push is a shorthand for `--set=*.output=type=registry` (default `false`) |
| `set` | List | List of [targets values to override](https://github.com/docker/buildx/blob/master/docs/reference/buildx_bake.md#set) (eg: `targetpattern.key=value`) |
| Name | Type | Description |
|------------|----------|------------------------------------------------------------------------------------------------------------------------------------------------------|
| `builder` | String | Builder instance (see [setup-buildx](https://github.com/docker/setup-buildx-action) action) |
| `files` | List/CSV | List of [bake definition files](https://github.com/docker/buildx/blob/master/docs/reference/buildx_bake.md#file) |
| `targets` | List/CSV | List of bake targets |
| `no-cache` | Bool | Do not use cache when building the image (default `false`) |
| `pull` | Bool | Always attempt to pull a newer version of the image (default `false`) |
| `load` | Bool | Load is a shorthand for `--set=*.output=type=docker` (default `false`) |
| `push` | Bool | Push is a shorthand for `--set=*.output=type=registry` (default `false`) |
| `set` | List | List of [targets values to override](https://github.com/docker/buildx/blob/master/docs/reference/buildx_bake.md#set) (eg: `targetpattern.key=value`) |
| `source` | String | [Remote bake definition](https://github.com/docker/buildx/blob/master/docs/guides/bake/file-definition.md#remote-definition) to build from |
### outputs

View File

@@ -35,6 +35,9 @@ inputs:
set:
description: "List of targets values to override (eg. targetpattern.key=value)"
required: false
source:
description: "Remote bake definition to build from"
required: false
outputs:
metadata:

2
dist/index.js generated vendored

File diff suppressed because one or more lines are too long

2
dist/index.js.map generated vendored

File diff suppressed because one or more lines are too long

View File

@@ -18,6 +18,7 @@ export interface Inputs {
load: boolean;
push: boolean;
set: string[];
source: string;
}
export function tmpDir(): string {
@@ -40,7 +41,8 @@ export async function getInputs(): Promise<Inputs> {
pull: core.getBooleanInput('pull'),
load: core.getBooleanInput('load'),
push: core.getBooleanInput('push'),
set: getInputList('set', true)
set: getInputList('set', true),
source: core.getInput('source')
};
}
@@ -55,6 +57,9 @@ export async function getArgs(inputs: Inputs, buildxVersion: string): Promise<Ar
async function getBakeArgs(inputs: Inputs, buildxVersion: string): Promise<Array<string>> {
const args: Array<string> = ['bake'];
if (inputs.source) {
args.push(inputs.source);
}
await asyncForEach(inputs.files, async file => {
args.push('--file', file);
});