mirror of
https://github.com/docker/bake-action.git
synced 2025-12-06 07:48:26 +08:00
support building from remote bake definition
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
This commit is contained in:
25
.github/workflows/ci.yml
vendored
25
.github/workflows/ci.yml
vendored
@@ -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
|
||||
|
||||
21
README.md
21
README.md
@@ -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
|
||||
|
||||
|
||||
@@ -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
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
@@ -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);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user