Skip to content

Commit

Permalink
add cgroup-parent, quiet, shm-size, ulimit inputs
Browse files Browse the repository at this point in the history
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
  • Loading branch information
crazy-max committed Nov 16, 2021
1 parent 91274a0 commit 064c20d
Show file tree
Hide file tree
Showing 12 changed files with 235 additions and 28 deletions.
104 changes: 104 additions & 0 deletions .github/workflows/ci.yml
Expand Up @@ -336,6 +336,110 @@ jobs:
if: always()
uses: crazy-max/ghaction-dump-context@v1

quiet:
runs-on: ubuntu-latest
steps:
-
name: Checkout
uses: actions/checkout@v2
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
with:
version: v0.7.0
-
name: Build
uses: ./
with:
context: ./test
tags: name/app:latest
load: true
quiet: true
-
name: Dump context
if: always()
uses: crazy-max/ghaction-dump-context@v1

shm-size:
runs-on: ubuntu-latest
steps:
-
name: Checkout
uses: actions/checkout@v2
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
with:
version: v0.7.0
driver-opts: |
image=moby/buildkit:master
-
name: Build
uses: ./
with:
context: ./test
file: ./test/shmsize.Dockerfile
tags: name/app:latest
shm-size: 2g
-
name: Dump context
if: always()
uses: crazy-max/ghaction-dump-context@v1

ulimit:
runs-on: ubuntu-latest
steps:
-
name: Checkout
uses: actions/checkout@v2
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
with:
version: v0.7.0
driver-opts: |
image=moby/buildkit:master
-
name: Build
uses: ./
with:
context: ./test
file: ./test/ulimit.Dockerfile
tags: name/app:latest
ulimit: |
nofile=1024:1024
nproc=3
-
name: Dump context
if: always()
uses: crazy-max/ghaction-dump-context@v1

cgroup-parent:
runs-on: ubuntu-latest
steps:
-
name: Checkout
uses: actions/checkout@v2
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
with:
version: v0.7.0
driver-opts: |
image=moby/buildkit:master
-
name: Build
uses: ./
with:
context: ./test
file: ./test/cgroup.Dockerfile
tags: name/app:latest
cgroup-parent: foo
-
name: Dump context
if: always()
uses: crazy-max/ghaction-dump-context@v1

multi:
runs-on: ubuntu-latest
strategy:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/e2e.yml
Expand Up @@ -3,7 +3,7 @@ name: e2e
on:
workflow_dispatch:
schedule:
- cron: '0 10 * * *' # everyday at 10am
- cron: '0 10 * * *'
push:
branches:
- master
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/example.yml
@@ -1,9 +1,9 @@
# This workflow is provided just as an usage example and not for repo testing/verification
# This workflow is provided just as an example and not for repo testing/verification
name: example

on:
schedule:
- cron: '0 10 * * 0' # everyday sunday at 10am
- cron: '0 10 * * 0'
push:
branches:
- '**'
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/virtual-env.yml
Expand Up @@ -3,7 +3,7 @@ name: virtual-env
on:
workflow_dispatch:
schedule:
- cron: '0 10 * * *' # everyday at 10am
- cron: '0 10 * * *'

jobs:
os:
Expand Down
14 changes: 9 additions & 5 deletions README.md
Expand Up @@ -190,11 +190,12 @@ Following inputs can be used as `step.with` keys
| Name | Type | Description |
|---------------------|----------|------------------------------------|
| `allow` | List/CSV | List of [extra privileged entitlement](https://github.com/docker/buildx/blob/master/docs/reference/buildx_build.md#allow) (eg. `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) |
| `build-args` | List | List of build-time variables |
| `cache-from` | List | List of [external cache sources](https://github.com/docker/buildx/blob/master/docs/reference/buildx_build.md#cache-from) (eg. `type=local,src=path/to/dir`) |
| `cache-to` | List | List of [cache export destinations](https://github.com/docker/buildx/blob/master/docs/reference/buildx_build.md#cache-to) (eg. `type=local,dest=path/to/dir`) |
| `cache-from` | List | List of [external cache sources](https://github.com/docker/buildx/blob/master/docs/reference/buildx_build.md#cache-from) (e.g., `type=local,src=path/to/dir`) |
| `cache-to` | List | List of [cache export destinations](https://github.com/docker/buildx/blob/master/docs/reference/buildx_build.md#cache-to) (e.g., `type=local,dest=path/to/dir`) |
| `cgroup-parent` | String | Optional [parent cgroup](https://docs.docker.com/engine/reference/commandline/build/#use-a-custom-parent-cgroup---cgroup-parent) for the container used in the build |
| `context` | String | Build's context is the set of files located in the specified [`PATH` or `URL`](https://docs.docker.com/engine/reference/commandline/build/) (default [Git context](#git-context)) |
| `file` | String | Path to the Dockerfile. (default `{context}/Dockerfile`) |
| `labels` | List | List of metadata for an image |
Expand All @@ -205,11 +206,14 @@ Following inputs can be used as `step.with` keys
| `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 a newer version of the image (default `false`) |
| `push` | Bool | [Push](https://github.com/docker/buildx/blob/master/docs/reference/buildx_build.md#push) is a shorthand for `--output=type=registry` (default `false`) |
| `secrets` | List | List of secrets to expose to the build (eg. `key=string`, `GIT_AUTH_TOKEN=mytoken`) |
| `secret-files` | List | List of secret files to expose to the build (eg. `key=filename`, `MY_SECRET=./secret.txt`) |
| `quiet` | Bool | Suppress the build output and print image ID on success (default `false`) |
| `secrets` | List | List of secrets to expose to the build (e.g., `key=string`, `GIT_AUTH_TOKEN=mytoken`) |
| `secret-files` | List | List of secret files to expose to the build (e.g., `key=filename`, `MY_SECRET=./secret.txt`) |
| `shm-size` | String | Size of [`/dev/shm`](https://github.com/docker/buildx/blob/master/docs/reference/buildx_build.md#-size-of-devshm---shm-size) (e.g., `2g`) |
| `ssh` | List | List of SSH agent socket or keys to expose to the build |
| `tags` | List/CSV | List of tags |
| `target` | String | Sets the target stage to build |
| `ulimit` | List | [Ulimit](https://github.com/docker/buildx/blob/master/docs/reference/buildx_build.md#-set-ulimits---ulimit) options (e.g., `nofile=1024:1024`) |
### outputs
Expand Down
72 changes: 58 additions & 14 deletions __tests__/context.test.ts
Expand Up @@ -147,7 +147,8 @@ describe('getArgs', () => {
['load', 'false'],
['no-cache', 'false'],
['push', 'false'],
['pull', 'false']
['pull', 'false'],
['quiet', 'false'],
]),
[
'buildx',
Expand All @@ -164,7 +165,8 @@ describe('getArgs', () => {
['load', 'false'],
['no-cache', 'false'],
['push', 'false'],
['pull', 'false']
['pull', 'false'],
['quiet', 'false'],
]),
[
'buildx',
Expand All @@ -183,7 +185,8 @@ describe('getArgs', () => {
['load', 'false'],
['no-cache', 'false'],
['push', 'false'],
['pull', 'false']
['pull', 'false'],
['quiet', 'false'],
]),
[
'buildx',
Expand All @@ -204,7 +207,8 @@ describe('getArgs', () => {
['load', 'false'],
['no-cache', 'false'],
['push', 'false'],
['pull', 'false']
['pull', 'false'],
['quiet', 'false'],
]),
[
'buildx',
Expand All @@ -224,7 +228,8 @@ describe('getArgs', () => {
['load', 'false'],
['no-cache', 'false'],
['push', 'false'],
['pull', 'false']
['pull', 'false'],
['quiet', 'false'],
]),
[
'buildx',
Expand All @@ -241,7 +246,8 @@ describe('getArgs', () => {
['load', 'false'],
['no-cache', 'false'],
['push', 'false'],
['pull', 'false']
['pull', 'false'],
['quiet', 'false'],
]),
[
'buildx',
Expand All @@ -259,7 +265,8 @@ describe('getArgs', () => {
['load', 'false'],
['no-cache', 'false'],
['push', 'false'],
['pull', 'false']
['pull', 'false'],
['quiet', 'false'],
]),
[
'buildx',
Expand All @@ -278,7 +285,8 @@ describe('getArgs', () => {
['load', 'false'],
['no-cache', 'false'],
['push', 'false'],
['pull', 'false']
['pull', 'false'],
['quiet', 'false'],
]),
[
'buildx',
Expand All @@ -301,7 +309,8 @@ describe('getArgs', () => {
['load', 'false'],
['no-cache', 'false'],
['push', 'true'],
['pull', 'false']
['pull', 'false'],
['quiet', 'false'],
]),
[
'buildx',
Expand Down Expand Up @@ -336,7 +345,8 @@ ccc"`],
['load', 'false'],
['no-cache', 'false'],
['push', 'true'],
['pull', 'false']
['pull', 'false'],
['quiet', 'false'],
]),
[
'buildx',
Expand Down Expand Up @@ -374,7 +384,8 @@ ccc`],
['load', 'false'],
['no-cache', 'false'],
['push', 'true'],
['pull', 'false']
['pull', 'false'],
['quiet', 'false'],
]),
[
'buildx',
Expand Down Expand Up @@ -404,7 +415,8 @@ ccc`],
['load', 'false'],
['no-cache', 'false'],
['push', 'true'],
['pull', 'false']
['pull', 'false'],
['quiet', 'false'],
]),
[
'buildx',
Expand All @@ -428,7 +440,8 @@ ccc`],
['load', 'false'],
['no-cache', 'false'],
['push', 'false'],
['pull', 'false']
['pull', 'false'],
['quiet', 'false'],
]),
[
'buildx',
Expand All @@ -450,7 +463,8 @@ ccc`],
['load', 'false'],
['no-cache', 'false'],
['push', 'true'],
['pull', 'false']
['pull', 'false'],
['quiet', 'false'],
]),
[
'buildx',
Expand All @@ -463,6 +477,36 @@ ccc`],
'.'
]
],
[
14,
'0.7.0',
new Map<string, string>([
['context', '.'],
['file', './test/Dockerfile'],
['cgroup-parent', 'foo'],
['shm-size', '2g'],
['ulimit', `nofile=1024:1024
nproc=3`],
['load', 'false'],
['no-cache', 'false'],
['push', 'false'],
['pull', 'false'],
['quiet', 'true'],
]),
[
'buildx',
'build',
'--cgroup-parent', 'foo',
'--file', './test/Dockerfile',
'--iidfile', '/tmp/.docker-build-push-jest/iidfile',
'--quiet',
'--shm-size', '2g',
'--ulimit', 'nofile=1024:1024',
'--ulimit', 'nproc=3',
'--metadata-file', '/tmp/.docker-build-push-jest/metadata-file',
'.'
]
],
])(
'[%d] given %p with %p as inputs, returns %p',
async (num: number, buildxVersion: string, inputs: Map<string, any>, expected: Array<string>) => {
Expand Down

0 comments on commit 064c20d

Please sign in to comment.