Skip to content

Commit 2c7b4c9

Browse files
authored
Merge pull request #24 from crazy-max/daemon-config
daemon-config input
2 parents d298db0 + 0e98cdf commit 2c7b4c9

File tree

8 files changed

+82
-8
lines changed

8 files changed

+82
-8
lines changed

.github/workflows/ci.yml

+29
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,35 @@ jobs:
7474
if: always()
7575
uses: crazy-max/ghaction-dump-context@v2
7676

77+
daemon-config:
78+
runs-on: ${{ matrix.os }}
79+
strategy:
80+
fail-fast: false
81+
matrix:
82+
os:
83+
- ubuntu-latest
84+
- macos-latest
85+
- windows-latest
86+
steps:
87+
-
88+
name: Checkout
89+
uses: actions/checkout@v3
90+
-
91+
name: Set up Docker
92+
uses: ./
93+
with:
94+
daemon-config: |
95+
{
96+
"debug": true,
97+
"features": {
98+
"containerd-snapshotter": true
99+
}
100+
}
101+
-
102+
name: Dump context
103+
if: always()
104+
uses: crazy-max/ghaction-dump-context@v2
105+
77106
context:
78107
runs-on: ${{ matrix.os }}
79108
strategy:

README.md

+40-5
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ Works on Linux, macOS and Windows.
1414
___
1515

1616
* [Usage](#usage)
17+
* [Quick start](#quick-start)
18+
* [Daemon configuration](#daemon-configuration)
1719
* [Customizing](#customizing)
1820
* [inputs](#inputs)
1921
* [Notes](#notes)
@@ -22,6 +24,30 @@ ___
2224

2325
## Usage
2426

27+
### Quick start
28+
29+
```yaml
30+
name: ci
31+
32+
on:
33+
push:
34+
35+
jobs:
36+
docker:
37+
runs-on: ubuntu-latest
38+
steps:
39+
-
40+
name: Set up Docker
41+
uses: crazy-max/ghaction-setup-docker@v1
42+
```
43+
44+
### Daemon configuration
45+
46+
You can [configure the Docker daemon](https://docs.docker.com/engine/reference/commandline/dockerd/#daemon-configuration-file)
47+
using the `daemon-config` input. In the following example, we configure the
48+
Docker daemon to enable debug and the [containerd image store](https://docs.docker.com/storage/containerd/)
49+
feature:
50+
2551
```yaml
2652
name: ci
2753
@@ -35,6 +61,14 @@ jobs:
3561
-
3662
name: Set up Docker
3763
uses: crazy-max/ghaction-setup-docker@v1
64+
with:
65+
daemon-config: |
66+
{
67+
"debug": true,
68+
"features": {
69+
"containerd-snapshotter": true
70+
}
71+
}
3872
```
3973

4074
## Customizing
@@ -43,11 +77,12 @@ jobs:
4377

4478
Following inputs can be used as `step.with` keys
4579

46-
| Name | Type | Default | Description |
47-
|-----------|--------|-----------------------|---------------------------------------------------------------------------------------------------|
48-
| `version` | String | `latest` | Docker CE version (e.g., `v23.0.1`). |
49-
| `channel` | String | `stable` | Docker CE [channel](https://download.docker.com/linux/static/) (e.g, `stable`, `edge` or `test`). |
50-
| `context` | String | `setup-docker-action` | Docker context name. |
80+
| Name | Type | Default | Description |
81+
|-----------------|--------|-----------------------|-----------------------------------------------------------------------------------------------------------------------------|
82+
| `version` | String | `latest` | Docker CE version (e.g., `v23.0.1`). |
83+
| `channel` | String | `stable` | Docker CE [channel](https://download.docker.com/linux/static/) (e.g, `stable`, `edge` or `test`). |
84+
| `daemon-config` | String | | [Docker daemon JSON configuration](https://docs.docker.com/engine/reference/commandline/dockerd/#daemon-configuration-file) |
85+
| `context` | String | `setup-docker-action` | Docker context name. |
5186

5287
## Notes
5388

__tests__/context.test.ts

+4
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ describe('getInputs', () => {
2323
version: 'v23.0.1',
2424
channel: '',
2525
context: '',
26+
daemonConfig: '',
2627
} as context.Inputs
2728
],
2829
[
@@ -31,11 +32,13 @@ describe('getInputs', () => {
3132
['version', 'v23.0.0-rc.4'],
3233
['channel', 'test'],
3334
['context', 'foo'],
35+
['daemon-config', `{"debug":true,"features":{"containerd-snapshotter":true}}`],
3436
]),
3537
{
3638
version: 'v23.0.0-rc.4',
3739
channel: 'test',
3840
context: 'foo',
41+
daemonConfig: `{"debug":true,"features":{"containerd-snapshotter":true}}`,
3942
} as context.Inputs
4043
],
4144
[
@@ -45,6 +48,7 @@ describe('getInputs', () => {
4548
version: 'latest',
4649
channel: '',
4750
context: '',
51+
daemonConfig: '',
4852
} as context.Inputs
4953
]
5054
])(

action.yml

+3
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ inputs:
1414
channel:
1515
description: 'Docker CE channel. (e.g, stable, edge or test)'
1616
required: false
17+
daemon-config:
18+
description: 'Docker daemon JSON configuration'
19+
required: false
1720
context:
1821
description: 'Docker context name. (default setup-docker-action)'
1922
required: false

dist/index.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/index.js.map

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/context.ts

+2
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,15 @@ import * as core from '@actions/core';
33
export interface Inputs {
44
version: string;
55
channel: string;
6+
daemonConfig?: string;
67
context: string;
78
}
89

910
export function getInputs(): Inputs {
1011
return {
1112
version: core.getInput('version') || 'latest',
1213
channel: core.getInput('channel'),
14+
daemonConfig: core.getInput('daemon-config'),
1315
context: core.getInput('context')
1416
};
1517
}

src/main.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@ actionsToolkit.run(
2323
runDir: runDir,
2424
version: input.version,
2525
channel: input.channel || 'stable',
26-
contextName: input.context || 'setup-docker-action'
26+
contextName: input.context || 'setup-docker-action',
27+
daemonConfig: input.daemonConfig
2728
});
2829
let toolDir;
2930
if (!(await Docker.isAvailable()) || input.version) {

0 commit comments

Comments
 (0)