Skip to content

Commit 9ed5823

Browse files
authored
Merge pull request #501 from crazy-max/new-inputs
add `cgroup-parent`, `shm-size`, `ulimit` inputs
2 parents 4222161 + 67ff4df commit 9ed5823

File tree

13 files changed

+268
-124
lines changed

13 files changed

+268
-124
lines changed

.github/workflows/ci.yml

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -336,6 +336,86 @@ jobs:
336336
if: always()
337337
uses: crazy-max/ghaction-dump-context@v1
338338

339+
shm-size:
340+
runs-on: ubuntu-latest
341+
steps:
342+
-
343+
name: Checkout
344+
uses: actions/checkout@v2
345+
-
346+
name: Set up Docker Buildx
347+
uses: docker/setup-buildx-action@v1
348+
with:
349+
version: v0.7.0
350+
driver-opts: |
351+
image=moby/buildkit:master
352+
-
353+
name: Build
354+
uses: ./
355+
with:
356+
context: ./test
357+
file: ./test/shmsize.Dockerfile
358+
tags: name/app:latest
359+
shm-size: 2g
360+
-
361+
name: Dump context
362+
if: always()
363+
uses: crazy-max/ghaction-dump-context@v1
364+
365+
ulimit:
366+
runs-on: ubuntu-latest
367+
steps:
368+
-
369+
name: Checkout
370+
uses: actions/checkout@v2
371+
-
372+
name: Set up Docker Buildx
373+
uses: docker/setup-buildx-action@v1
374+
with:
375+
version: v0.7.0
376+
driver-opts: |
377+
image=moby/buildkit:master
378+
-
379+
name: Build
380+
uses: ./
381+
with:
382+
context: ./test
383+
file: ./test/ulimit.Dockerfile
384+
tags: name/app:latest
385+
ulimit: |
386+
nofile=1024:1024
387+
nproc=3
388+
-
389+
name: Dump context
390+
if: always()
391+
uses: crazy-max/ghaction-dump-context@v1
392+
393+
cgroup-parent:
394+
runs-on: ubuntu-latest
395+
steps:
396+
-
397+
name: Checkout
398+
uses: actions/checkout@v2
399+
-
400+
name: Set up Docker Buildx
401+
uses: docker/setup-buildx-action@v1
402+
with:
403+
version: v0.7.0
404+
driver-opts: |
405+
image=moby/buildkit:master
406+
-
407+
name: Build
408+
uses: ./
409+
with:
410+
context: ./test
411+
file: ./test/cgroup.Dockerfile
412+
tags: name/app:latest
413+
cgroup-parent: foo
414+
-
415+
name: Dump context
416+
if: always()
417+
uses: crazy-max/ghaction-dump-context@v1
418+
339419
multi:
340420
runs-on: ubuntu-latest
341421
strategy:

.github/workflows/e2e.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name: e2e
33
on:
44
workflow_dispatch:
55
schedule:
6-
- cron: '0 10 * * *' # everyday at 10am
6+
- cron: '0 10 * * *'
77
push:
88
branches:
99
- master

.github/workflows/example.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
# This workflow is provided just as an usage example and not for repo testing/verification
1+
# This workflow is provided just as an example and not for repo testing/verification
22
name: example
33

44
on:
55
schedule:
6-
- cron: '0 10 * * 0' # everyday sunday at 10am
6+
- cron: '0 10 * * 0'
77
push:
88
branches:
99
- '**'

.github/workflows/virtual-env.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name: virtual-env
33
on:
44
workflow_dispatch:
55
schedule:
6-
- cron: '0 10 * * *' # everyday at 10am
6+
- cron: '0 10 * * *'
77

88
jobs:
99
os:

README.md

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -181,11 +181,12 @@ Following inputs can be used as `step.with` keys
181181

182182
| Name | Type | Description |
183183
|---------------------|----------|------------------------------------|
184-
| `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`) |
184+
| `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`) |
185185
| `builder` | String | Builder instance (see [setup-buildx](https://github.com/docker/setup-buildx-action) action) |
186186
| `build-args` | List | List of build-time variables |
187-
| `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`) |
188-
| `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`) |
187+
| `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`) |
188+
| `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`) |
189+
| `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 |
189190
| `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)) |
190191
| `file` | String | Path to the Dockerfile. (default `{context}/Dockerfile`) |
191192
| `labels` | List | List of metadata for an image |
@@ -196,11 +197,13 @@ Following inputs can be used as `step.with` keys
196197
| `platforms` | List/CSV | List of [target platforms](https://github.com/docker/buildx/blob/master/docs/reference/buildx_build.md#platform) for build |
197198
| `pull` | Bool | Always attempt to pull a newer version of the image (default `false`) |
198199
| `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`) |
199-
| `secrets` | List | List of secrets to expose to the build (eg. `key=string`, `GIT_AUTH_TOKEN=mytoken`) |
200-
| `secret-files` | List | List of secret files to expose to the build (eg. `key=filename`, `MY_SECRET=./secret.txt`) |
200+
| `secrets` | List | List of secrets to expose to the build (e.g., `key=string`, `GIT_AUTH_TOKEN=mytoken`) |
201+
| `secret-files` | List | List of secret files to expose to the build (e.g., `key=filename`, `MY_SECRET=./secret.txt`) |
202+
| `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`) |
201203
| `ssh` | List | List of SSH agent socket or keys to expose to the build |
202204
| `tags` | List/CSV | List of tags |
203205
| `target` | String | Sets the target stage to build |
206+
| `ulimit` | List | [Ulimit](https://github.com/docker/buildx/blob/master/docs/reference/buildx_build.md#-set-ulimits---ulimit) options (e.g., `nofile=1024:1024`) |
204207

205208
### outputs
206209

__tests__/buildx.test.ts

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,21 +28,17 @@ jest.spyOn(context, 'tmpNameSync').mockImplementation((): string => {
2828
describe('getImageID', () => {
2929
it('matches', async () => {
3030
const imageIDFile = await buildx.getImageIDFile();
31-
console.log(`imageIDFile: ${imageIDFile}`);
3231
await fs.writeFileSync(imageIDFile, digest);
3332
const imageID = await buildx.getImageID();
34-
console.log(`imageID: ${imageID}`);
3533
expect(imageID).toEqual(digest);
3634
});
3735
});
3836

3937
describe('getMetadata', () => {
4038
it('matches', async () => {
4139
const metadataFile = await buildx.getMetadataFile();
42-
console.log(`metadataFile: ${metadataFile}`);
4340
await fs.writeFileSync(metadataFile, metadata);
4441
const expected = await buildx.getMetadata();
45-
console.log(`metadata: ${expected}`);
4642
expect(expected).toEqual(metadata);
4743
});
4844
});
@@ -132,7 +128,6 @@ describe('getVersion', () => {
132128
'valid',
133129
async () => {
134130
const version = await buildx.getVersion();
135-
console.log(`version: ${version}`);
136131
expect(semver.valid(version)).not.toBeNull();
137132
},
138133
100000
@@ -179,10 +174,8 @@ describe('getSecret', () => {
179174
secret = await buildx.getSecretString(kvp);
180175
}
181176
expect(true).toBe(!invalid);
182-
console.log(`secret: ${secret}`);
183177
expect(secret).toEqual(`id=${exKey},src=${tmpNameSync}`);
184178
const secretValue = await fs.readFileSync(tmpNameSync, 'utf-8');
185-
console.log(`secretValue: ${secretValue}`);
186179
expect(secretValue).toEqual(exValue);
187180
} catch (err) {
188181
expect(true).toBe(invalid);

0 commit comments

Comments
 (0)