Skip to content

Commit

Permalink
Merge pull request #501 from crazy-max/new-inputs
Browse files Browse the repository at this point in the history
add `cgroup-parent`, `shm-size`, `ulimit` inputs
  • Loading branch information
crazy-max committed Nov 17, 2021
2 parents 4222161 + 67ff4df commit 9ed5823
Show file tree
Hide file tree
Showing 13 changed files with 268 additions and 124 deletions.
80 changes: 80 additions & 0 deletions .github/workflows/ci.yml
Expand Up @@ -336,6 +336,86 @@ jobs:
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
13 changes: 8 additions & 5 deletions README.md
Expand Up @@ -181,11 +181,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 @@ -196,11 +197,13 @@ 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`) |
| `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
7 changes: 0 additions & 7 deletions __tests__/buildx.test.ts
Expand Up @@ -28,21 +28,17 @@ jest.spyOn(context, 'tmpNameSync').mockImplementation((): string => {
describe('getImageID', () => {
it('matches', async () => {
const imageIDFile = await buildx.getImageIDFile();
console.log(`imageIDFile: ${imageIDFile}`);
await fs.writeFileSync(imageIDFile, digest);
const imageID = await buildx.getImageID();
console.log(`imageID: ${imageID}`);
expect(imageID).toEqual(digest);
});
});

describe('getMetadata', () => {
it('matches', async () => {
const metadataFile = await buildx.getMetadataFile();
console.log(`metadataFile: ${metadataFile}`);
await fs.writeFileSync(metadataFile, metadata);
const expected = await buildx.getMetadata();
console.log(`metadata: ${expected}`);
expect(expected).toEqual(metadata);
});
});
Expand Down Expand Up @@ -132,7 +128,6 @@ describe('getVersion', () => {
'valid',
async () => {
const version = await buildx.getVersion();
console.log(`version: ${version}`);
expect(semver.valid(version)).not.toBeNull();
},
100000
Expand Down Expand Up @@ -179,10 +174,8 @@ describe('getSecret', () => {
secret = await buildx.getSecretString(kvp);
}
expect(true).toBe(!invalid);
console.log(`secret: ${secret}`);
expect(secret).toEqual(`id=${exKey},src=${tmpNameSync}`);
const secretValue = await fs.readFileSync(tmpNameSync, 'utf-8');
console.log(`secretValue: ${secretValue}`);
expect(secretValue).toEqual(exValue);
} catch (err) {
expect(true).toBe(invalid);
Expand Down

0 comments on commit 9ed5823

Please sign in to comment.