Merge pull request #653 from crazy-max/no-cache-filters

`no-cache-filters` input
This commit is contained in:
CrazyMax 2022-07-19 17:04:40 +02:00 committed by GitHub
commit 1cb9d22b93
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 73 additions and 42 deletions

View file

@ -310,7 +310,6 @@ jobs:
name: Set up Docker Buildx name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2 uses: docker/setup-buildx-action@v2
with: with:
version: v0.7.0
driver-opts: | driver-opts: |
image=moby/buildkit:master image=moby/buildkit:master
- -
@ -332,7 +331,6 @@ jobs:
name: Set up Docker Buildx name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2 uses: docker/setup-buildx-action@v2
with: with:
version: v0.7.0
driver-opts: | driver-opts: |
image=moby/buildkit:master image=moby/buildkit:master
- -
@ -356,7 +354,6 @@ jobs:
name: Set up Docker Buildx name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2 uses: docker/setup-buildx-action@v2
with: with:
version: v0.7.0
driver-opts: | driver-opts: |
image=moby/buildkit:master image=moby/buildkit:master
- -
@ -397,8 +394,6 @@ jobs:
- -
name: Set up Docker Buildx name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2 uses: docker/setup-buildx-action@v2
with:
version: v0.8.0
- -
name: Build name: Build
uses: ./ uses: ./
@ -409,6 +404,26 @@ jobs:
alpine=docker-image://debian:stable-slim alpine=docker-image://debian:stable-slim
tags: name/app:latest tags: name/app:latest
no-cache-filters:
runs-on: ubuntu-latest
steps:
-
name: Checkout
uses: actions/checkout@v3
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
-
name: Build
uses: ./
with:
context: ./test
file: ./test/nocachefilter.Dockerfile
no-cache-filters: build
tags: name/app:latest
cache-from: type=gha,scope=nocachefilter
cache-to: type=gha,scope=nocachefilter,mode=max
multi: multi:
runs-on: ubuntu-latest runs-on: ubuntu-latest
strategy: strategy:
@ -506,7 +521,6 @@ jobs:
name: Set up Docker Buildx name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2 uses: docker/setup-buildx-action@v2
with: with:
version: v0.8.0
driver: ${{ matrix.driver }} driver: ${{ matrix.driver }}
driver-opts: | driver-opts: |
network=host network=host

View file

@ -198,7 +198,7 @@ Following inputs can be used as `step.with` keys
> ``` > ```
| Name | Type | Description | | Name | Type | Description |
|---------------------|----------|------------------------------------| |--------------------|----------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `add-hosts` | List/CSV | List of [customs host-to-IP mapping](https://docs.docker.com/engine/reference/commandline/build/#add-entries-to-container-hosts-file---add-host) (e.g., `docker:10.180.0.1`) | | `add-hosts` | List/CSV | List of [customs host-to-IP mapping](https://docs.docker.com/engine/reference/commandline/build/#add-entries-to-container-hosts-file---add-host) (e.g., `docker:10.180.0.1`) |
| `allow` | List/CSV | List of [extra privileged entitlement](https://github.com/docker/buildx/blob/master/docs/reference/buildx_build.md#allow) (e.g., `network.host,security.insecure`) | | `allow` | List/CSV | List of [extra privileged entitlement](https://github.com/docker/buildx/blob/master/docs/reference/buildx_build.md#allow) (e.g., `network.host,security.insecure`) |
| `builder` | String | Builder instance (see [setup-buildx](https://github.com/docker/setup-buildx-action) action) | | `builder` | String | Builder instance (see [setup-buildx](https://github.com/docker/setup-buildx-action) action) |
@ -213,6 +213,7 @@ Following inputs can be used as `step.with` keys
| `load` | Bool | [Load](https://github.com/docker/buildx/blob/master/docs/reference/buildx_build.md#load) is a shorthand for `--output=type=docker` (default `false`) | | `load` | Bool | [Load](https://github.com/docker/buildx/blob/master/docs/reference/buildx_build.md#load) is a shorthand for `--output=type=docker` (default `false`) |
| `network` | String | Set the networking mode for the `RUN` instructions during build | | `network` | String | Set the networking mode for the `RUN` instructions during build |
| `no-cache` | Bool | Do not use cache when building the image (default `false`) | | `no-cache` | Bool | Do not use cache when building the image (default `false`) |
| `no-cache-filters` | List/CSV | Do not cache specified stages |
| `outputs` | List | List of [output destinations](https://github.com/docker/buildx/blob/master/docs/reference/buildx_build.md#output) (format: `type=local,dest=path`) | | `outputs` | List | List of [output destinations](https://github.com/docker/buildx/blob/master/docs/reference/buildx_build.md#output) (format: `type=local,dest=path`) |
| `platforms` | List/CSV | List of [target platforms](https://github.com/docker/buildx/blob/master/docs/reference/buildx_build.md#platform) for build | | `platforms` | List/CSV | List of [target platforms](https://github.com/docker/buildx/blob/master/docs/reference/buildx_build.md#platform) for build |
| `pull` | Bool | Always attempt to pull all referenced images (default `false`) | | `pull` | Bool | Always attempt to pull all referenced images (default `false`) |
@ -231,7 +232,7 @@ Following inputs can be used as `step.with` keys
Following outputs are available Following outputs are available
| Name | Type | Description | | Name | Type | Description |
|-------------------|---------|---------------------------------------| |------------|---------|-----------------------------------------|
| `imageid` | String | Image ID | | `imageid` | String | Image ID |
| `digest` | String | Image digest | | `digest` | String | Image digest |
| `metadata` | JSON | Build result metadata | | `metadata` | JSON | Build result metadata |

View file

@ -51,6 +51,9 @@ inputs:
description: "Do not use cache when building the image" description: "Do not use cache when building the image"
required: false required: false
default: 'false' default: 'false'
no-cache-filters:
description: "Do not cache specified stages"
required: false
outputs: outputs:
description: "List of output destinations (format: type=local,dest=path)" description: "List of output destinations (format: type=local,dest=path)"
required: false required: false

4
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

@ -28,6 +28,7 @@ export interface Inputs {
load: boolean; load: boolean;
network: string; network: string;
noCache: boolean; noCache: boolean;
noCacheFilters: string[];
outputs: string[]; outputs: string[];
platforms: string[]; platforms: string[];
pull: boolean; pull: boolean;
@ -83,6 +84,7 @@ export async function getInputs(defaultContext: string): Promise<Inputs> {
load: core.getBooleanInput('load'), load: core.getBooleanInput('load'),
network: core.getInput('network'), network: core.getInput('network'),
noCache: core.getBooleanInput('no-cache'), noCache: core.getBooleanInput('no-cache'),
noCacheFilters: await getInputList('no-cache-filters'),
outputs: await getInputList('outputs', true), outputs: await getInputList('outputs', true),
platforms: await getInputList('platforms'), platforms: await getInputList('platforms'),
pull: core.getBooleanInput('pull'), pull: core.getBooleanInput('pull'),
@ -141,6 +143,9 @@ async function getBuildArgs(inputs: Inputs, defaultContext: string, buildxVersio
await asyncForEach(inputs.labels, async label => { await asyncForEach(inputs.labels, async label => {
args.push('--label', label); args.push('--label', label);
}); });
await asyncForEach(inputs.noCacheFilters, async noCacheFilter => {
args.push('--no-cache-filter', noCacheFilter);
});
await asyncForEach(inputs.outputs, async output => { await asyncForEach(inputs.outputs, async output => {
args.push('--output', output); args.push('--output', output);
}); });

View file

@ -0,0 +1,8 @@
FROM busybox AS base
RUN echo "Hello world!" > /hello
FROM alpine AS build
COPY --from=base /hello /hello
RUN uname -a
FROM build