mirror of
https://github.com/docker/setup-docker-action.git
synced 2025-06-12 14:47:12 +02:00
Compare commits
55 Commits
Author | SHA1 | Date | |
---|---|---|---|
78318f8be5 | |||
54f3988321 | |||
f437b67409 | |||
06b9bc80b3 | |||
a6fae2d4e8 | |||
a4ef905acc | |||
41a5151e81 | |||
e96e0e2c98 | |||
8d0a8e33ff | |||
9bd97ff018 | |||
bca5e4d3e2 | |||
031a2987b7 | |||
753106f35c | |||
a1e4314d8f | |||
a7f3aad3f5 | |||
faa196892b | |||
796ce734cb | |||
3eb24de4f6 | |||
5bddaa4323 | |||
17819a1af9 | |||
d20884258e | |||
b74351ab97 | |||
0f5a011c3d | |||
99cad45695 | |||
aceee1722e | |||
0cb459c59a | |||
81886c7276 | |||
fdc6583d4e | |||
a4b15f09d5 | |||
c2351bbd0b | |||
c14b6e1c32 | |||
f1d16883d0 | |||
5de1d6bef5 | |||
7d4fd999a5 | |||
38c07112bd | |||
c6f8a8a2ba | |||
2960188cea | |||
8e060aa468 | |||
fc6fa62ba9 | |||
7864da88cb | |||
36eedea576 | |||
95a170fa60 | |||
1ea15ee881 | |||
729d91c21f | |||
c553dd0c3f | |||
a307846a9f | |||
57929789e6 | |||
d9be6cade4 | |||
e1c24ba1f0 | |||
979d352bf6 | |||
db8a75eba6 | |||
69b561f709 | |||
c33ee55bce | |||
12e445b81b | |||
60457dabd3 |
67
.github/workflows/ci.yml
vendored
67
.github/workflows/ci.yml
vendored
@ -1,5 +1,9 @@
|
||||
name: ci
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
schedule:
|
||||
@ -13,7 +17,7 @@ on:
|
||||
pull_request:
|
||||
|
||||
env:
|
||||
DOCKER_VERSION: v23.0.6
|
||||
DOCKER_VERSION: v24.0.9
|
||||
|
||||
jobs:
|
||||
main:
|
||||
@ -23,7 +27,8 @@ jobs:
|
||||
matrix:
|
||||
os:
|
||||
- ubuntu-latest
|
||||
- macos-latest
|
||||
#- macos-14 # no virt: https://github.com/docker/actions-toolkit/issues/317
|
||||
- macos-13
|
||||
- windows-latest
|
||||
version:
|
||||
- pinned
|
||||
@ -56,7 +61,8 @@ jobs:
|
||||
matrix:
|
||||
os:
|
||||
- ubuntu-latest
|
||||
- macos-latest
|
||||
#- macos-14 # no virt: https://github.com/docker/actions-toolkit/issues/317
|
||||
- macos-13
|
||||
- windows-latest
|
||||
steps:
|
||||
-
|
||||
@ -66,7 +72,7 @@ jobs:
|
||||
name: Set up Docker
|
||||
uses: ./
|
||||
with:
|
||||
version: v23.0.0-rc.4
|
||||
version: v24.0.0-rc.4
|
||||
channel: test
|
||||
-
|
||||
name: Dump context
|
||||
@ -80,7 +86,8 @@ jobs:
|
||||
matrix:
|
||||
os:
|
||||
- ubuntu-latest
|
||||
- macos-latest
|
||||
#- macos-14 # no virt: https://github.com/docker/actions-toolkit/issues/317
|
||||
- macos-13
|
||||
- windows-latest
|
||||
steps:
|
||||
-
|
||||
@ -109,7 +116,8 @@ jobs:
|
||||
matrix:
|
||||
os:
|
||||
- ubuntu-latest
|
||||
- macos-latest
|
||||
#- macos-14 # no virt: https://github.com/docker/actions-toolkit/issues/317
|
||||
- macos-13
|
||||
- windows-latest
|
||||
steps:
|
||||
-
|
||||
@ -130,8 +138,9 @@ jobs:
|
||||
if: always()
|
||||
uses: crazy-max/ghaction-dump-context@v2
|
||||
|
||||
colima-start-args:
|
||||
runs-on: macos-latest
|
||||
lima-start-args:
|
||||
#runs-on: macos-14 # no virt: https://github.com/docker/actions-toolkit/issues/317
|
||||
runs-on: macos-13
|
||||
steps:
|
||||
-
|
||||
name: Checkout
|
||||
@ -140,14 +149,25 @@ jobs:
|
||||
name: Set up Docker
|
||||
uses: ./
|
||||
env:
|
||||
COLIMA_START_ARGS: --cpu 4 --memory 8 --disk 32 --dns 1.1.1.1 --dns 8.8.8.8 --dns-host example.com=1.2.3.4
|
||||
LIMA_START_ARGS: --cpus 4 --memory 8
|
||||
|
||||
build-linux:
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
containerd:
|
||||
- containerd-system
|
||||
- containerd-tarball
|
||||
steps:
|
||||
-
|
||||
name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
-
|
||||
name: Uninstall containerd
|
||||
if: matrix.containerd == 'containerd-tarball'
|
||||
run: |
|
||||
sudo apt-get remove -y containerd.io
|
||||
-
|
||||
name: Set up Docker
|
||||
uses: ./
|
||||
@ -181,7 +201,14 @@ jobs:
|
||||
uses: crazy-max/ghaction-dump-context@v2
|
||||
|
||||
build-macos:
|
||||
runs-on: macos-latest
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
os:
|
||||
#- macos-14 # no virt: https://github.com/docker/actions-toolkit/issues/317
|
||||
- macos-13
|
||||
- macos-12
|
||||
steps:
|
||||
-
|
||||
name: Checkout
|
||||
@ -242,3 +269,23 @@ jobs:
|
||||
name: Dump context
|
||||
if: always()
|
||||
uses: crazy-max/ghaction-dump-context@v2
|
||||
|
||||
set-host:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
-
|
||||
name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
-
|
||||
name: Set up Docker
|
||||
uses: ./
|
||||
with:
|
||||
set-host: true
|
||||
-
|
||||
name: List contexts
|
||||
run: |
|
||||
docker context ls
|
||||
-
|
||||
name: Dump context
|
||||
if: always()
|
||||
uses: crazy-max/ghaction-dump-context@v2
|
||||
|
7
.github/workflows/test.yml
vendored
7
.github/workflows/test.yml
vendored
@ -1,5 +1,9 @@
|
||||
name: test
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
@ -21,6 +25,7 @@ jobs:
|
||||
targets: test
|
||||
-
|
||||
name: Upload coverage
|
||||
uses: codecov/codecov-action@v3
|
||||
uses: codecov/codecov-action@v4
|
||||
with:
|
||||
file: ./coverage/clover.xml
|
||||
token: ${{ secrets.CODECOV_TOKEN }}
|
||||
|
4
.github/workflows/validate.yml
vendored
4
.github/workflows/validate.yml
vendored
@ -1,5 +1,9 @@
|
||||
name: validate
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
|
874
.yarn/releases/yarn-3.6.3.cjs
vendored
874
.yarn/releases/yarn-3.6.3.cjs
vendored
File diff suppressed because one or more lines are too long
@ -11,5 +11,3 @@ nodeLinker: node-modules
|
||||
plugins:
|
||||
- path: .yarn/plugins/@yarnpkg/plugin-interactive-tools.cjs
|
||||
spec: "@yarnpkg/plugin-interactive-tools"
|
||||
|
||||
yarnPath: .yarn/releases/yarn-3.6.3.cjs
|
||||
|
33
README.md
33
README.md
@ -9,6 +9,11 @@
|
||||
GitHub Action to set up (download and install) [Docker CE](https://docs.docker.com/engine/).
|
||||
Works on Linux, macOS and Windows.
|
||||
|
||||
> [!WARNING]
|
||||
> Does not work on macOS runners with ARM architecture (no nested virtualization):
|
||||
> * https://github.com/crazy-max/ghaction-setup-docker/pull/53
|
||||
> * https://github.com/docker/actions-toolkit/issues/317
|
||||
|
||||

|
||||
|
||||
___
|
||||
@ -16,9 +21,10 @@ ___
|
||||
* [Usage](#usage)
|
||||
* [Quick start](#quick-start)
|
||||
* [Daemon configuration](#daemon-configuration)
|
||||
* [Define custom `colima start` arguments (macOS)](#define-custom-colima-start-arguments-macos)
|
||||
* [Define custom `limactl start` arguments (macOS)](#define-custom-limactl-start-arguments-macos)
|
||||
* [Customizing](#customizing)
|
||||
* [inputs](#inputs)
|
||||
* [outputs](#outputs)
|
||||
* [Contributing](#contributing)
|
||||
* [License](#license)
|
||||
|
||||
@ -38,7 +44,7 @@ jobs:
|
||||
steps:
|
||||
-
|
||||
name: Set up Docker
|
||||
uses: crazy-max/ghaction-setup-docker@v2
|
||||
uses: crazy-max/ghaction-setup-docker@v3
|
||||
```
|
||||
|
||||
### Daemon configuration
|
||||
@ -60,7 +66,7 @@ jobs:
|
||||
steps:
|
||||
-
|
||||
name: Set up Docker
|
||||
uses: crazy-max/ghaction-setup-docker@v2
|
||||
uses: crazy-max/ghaction-setup-docker@v3
|
||||
with:
|
||||
daemon-config: |
|
||||
{
|
||||
@ -71,10 +77,10 @@ jobs:
|
||||
}
|
||||
```
|
||||
|
||||
### Define custom `colima start` arguments (macOS)
|
||||
### Define custom `limactl start` arguments (macOS)
|
||||
|
||||
You can define custom [`colima start` arguments](https://github.com/abiosoft/colima#customizing-the-vm)
|
||||
using the `COLIMA_START_ARGS` environment variable to customize the VM:
|
||||
You can define custom [`limactl start` arguments](https://lima-vm.io/docs/reference/limactl_start/)
|
||||
using the `LIMA_START_ARGS` environment variable to customize the VM:
|
||||
|
||||
```yaml
|
||||
name: ci
|
||||
@ -88,16 +94,16 @@ jobs:
|
||||
steps:
|
||||
-
|
||||
name: Set up Docker
|
||||
uses: crazy-max/ghaction-setup-docker@v2
|
||||
uses: crazy-max/ghaction-setup-docker@v3
|
||||
env:
|
||||
COLIMA_START_ARGS: --cpu 4 --memory 8 --disk 32
|
||||
LIMA_START_ARGS: --cpus 4 --memory 8
|
||||
```
|
||||
|
||||
## Customizing
|
||||
|
||||
### inputs
|
||||
|
||||
Following inputs can be used as `step.with` keys
|
||||
The following inputs can be used as `step.with` keys
|
||||
|
||||
| Name | Type | Default | Description |
|
||||
|-----------------|--------|-----------------------|-----------------------------------------------------------------------------------------------------------------------------|
|
||||
@ -105,6 +111,15 @@ Following inputs can be used as `step.with` keys
|
||||
| `channel` | String | `stable` | Docker CE [channel](https://download.docker.com/linux/static/) (e.g, `stable`, `edge` or `test`). |
|
||||
| `daemon-config` | String | | [Docker daemon JSON configuration](https://docs.docker.com/engine/reference/commandline/dockerd/#daemon-configuration-file) |
|
||||
| `context` | String | `setup-docker-action` | Docker context name. |
|
||||
| `set-host` | Bool | `false` | Set `DOCKER_HOST` environment variable to docker socket path. |
|
||||
|
||||
### outputs
|
||||
|
||||
The following outputs are available
|
||||
|
||||
| Name | Type | Description |
|
||||
|--------|--------|--------------------|
|
||||
| `sock` | String | Docker socket path |
|
||||
|
||||
## Contributing
|
||||
|
||||
|
@ -1,56 +0,0 @@
|
||||
# Troubleshooting
|
||||
|
||||
## macOS: `qemu[stderr]: qemu-system-x86_64: Unknown Error`
|
||||
|
||||
Colima may fail to start with the following error:
|
||||
|
||||
```
|
||||
time="2023-08-26T06:30:33Z" level=info msg="[hostagent] Starting QEMU (hint: to watch the boot progress, see \"/Users/runner/.lima/colima/serial*.log\")"
|
||||
time="2023-08-26T06:30:34Z" level=info msg="SSH Local Port: 49209"
|
||||
time="2023-08-26T06:30:34Z" level=info msg="[hostagent] Waiting for the essential requirement 1 of 3: \"ssh\""
|
||||
time="2023-08-26T06:30:34Z" level=info msg="[hostagent] Driver stopped due to error: \"exit status 255\""
|
||||
time="2023-08-26T06:30:34Z" level=info msg="[hostagent] Shutting down the host agent"
|
||||
time="2023-08-26T06:30:34Z" level=warning msg="[hostagent] failed to exit SSH master"
|
||||
time="2023-08-26T06:30:34Z" level=info msg="[hostagent] Shutting down QEMU with ACPI"
|
||||
time="2023-08-26T06:30:34Z" level=warning msg="[hostagent] failed to open the QMP socket \"/Users/runner/.lima/colima/qmp.sock\", forcibly killing QEMU"
|
||||
time="2023-08-26T06:30:34Z" level=info msg="[hostagent] QEMU has already exited"
|
||||
time="2023-08-26T06:30:34Z" level=fatal msg="exiting, status={Running:false Degraded:false Exiting:true Errors:[] SSHLocalPort:0} (hint: see \"/Users/runner/.lima/colima/ha.stderr.log\")"
|
||||
time="2023-08-26T06:30:34Z" level=fatal msg="error starting vm: error at 'creating and starting': exit status 1"
|
||||
```
|
||||
|
||||
```
|
||||
{"level":"debug","msg":"executing [ssh-keygen -t ed25519 -q -N -f /Users/runner/.lima/_config/user]","time":"2023-08-26T07:16:40Z"}
|
||||
{"level":"debug","msg":"Creating iso file /Users/runner/.lima/colima/cidata.iso","time":"2023-08-26T07:16:41Z"}
|
||||
{"level":"debug","msg":"Using /var/folders/24/8k48jl6d249_n_qfxwsl6xvm0000gn/T/diskfs_iso3418167253 as workspace","time":"2023-08-26T07:16:41Z"}
|
||||
{"level":"debug","msg":"OpenSSH version 8.6.1 detected","time":"2023-08-26T07:16:41Z"}
|
||||
{"level":"debug","msg":"AES accelerator seems available, prioritizing aes128-gcm@openssh.com and aes256-gcm@openssh.com","time":"2023-08-26T07:16:41Z"}
|
||||
{"level":"debug","msg":"QEMU version 8.0.4 detected","time":"2023-08-26T07:16:43Z"}
|
||||
{"level":"debug","msg":"firmware candidates = [/Users/runner/.local/share/qemu/edk2-x86_64-code.fd /Users/runner/.colima/_wrapper/4e1b408f843d1c63afbbdcf80c40e4c88d33509f/share/qemu/edk2-x86_64-code.fd /usr/share/OVMF/OVMF_CODE.fd /usr/share/qemu/ovmf-x86_64-code.bin /usr/share/edk2-ovmf/x64/OVMF_CODE.fd]","time":"2023-08-26T07:16:43Z"}
|
||||
{"level":"info","msg":"Starting QEMU (hint: to watch the boot progress, see \"/Users/runner/.lima/colima/serial*.log\")","time":"2023-08-26T07:16:43Z"}
|
||||
{"level":"debug","msg":"qCmd.Args: [/Users/runner/.colima/_wrapper/4e1b408f843d1c63afbbdcf80c40e4c88d33509f/bin/qemu-system-x86_64 -m 2048 -cpu host,-pdpe1gb -machine q35,accel=hvf -smp 2,sockets=1,cores=2,threads=1 -drive if=pflash,format=raw,readonly=on,file=/Users/runner/.colima/_wrapper/4e1b408f843d1c63afbbdcf80c40e4c88d33509f/share/qemu/edk2-x86_64-code.fd -boot order=d,splash-time=0,menu=on -drive file=/Users/runner/.lima/colima/basedisk,format=raw,media=cdrom,readonly=on -drive file=/Users/runner/.lima/colima/diffdisk,if=virtio,discard=on -drive id=cdrom0,if=none,format=raw,readonly=on,file=/Users/runner/.lima/colima/cidata.iso -device virtio-scsi-pci,id=scsi0 -device scsi-cd,bus=scsi0.0,drive=cdrom0 -netdev user,id=net0,net=192.168.5.0/24,dhcpstart=192.168.5.15,hostfwd=tcp:127.0.0.1:49168-:22 -device virtio-net-pci,netdev=net0,mac=52:55:55:be:6e:dd -device virtio-rng-pci -display none -device virtio-vga -device virtio-keyboard-pci -device virtio-mouse-pci -device qemu-xhci,id=usb-bus -parallel none -chardev socket,id=char-serial,path=/Users/runner/.lima/colima/serial.sock,server=on,wait=off,logfile=/Users/runner/.lima/colima/serial.log -serial chardev:char-serial -chardev socket,id=char-serial-virtio,path=/Users/runner/.lima/colima/serialv.sock,server=on,wait=off,logfile=/Users/runner/.lima/colima/serialv.log -device virtio-serial-pci,id=virtio-serial0,max_ports=1 -device virtconsole,chardev=char-serial-virtio,id=console0 -virtfs local,mount_tag=mount0,path=/Users/runner,security_model=none -virtfs local,mount_tag=mount1,path=/tmp/colima,security_model=none -chardev socket,id=char-qmp,path=/Users/runner/.lima/colima/qmp.sock,server=on,wait=off -qmp chardev:char-qmp -name lima-colima -pidfile /Users/runner/.lima/colima/qemu.pid]","time":"2023-08-26T07:16:43Z"}
|
||||
{"level":"info","msg":"Waiting for the essential requirement 1 of 3: \"ssh\"","time":"2023-08-26T07:16:43Z"}
|
||||
{"level":"debug","msg":"executing script \"ssh\"","time":"2023-08-26T07:16:43Z"}
|
||||
{"level":"debug","msg":"executing ssh for script \"ssh\": /usr/bin/ssh [ssh -F /dev/null -o IdentityFile=\"/Users/runner/.lima/_config/user\" -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o NoHostAuthenticationForLocalhost=yes -o GSSAPIAuthentication=no -o PreferredAuthentications=publickey -o Compression=no -o BatchMode=yes -o IdentitiesOnly=yes -o Ciphers=\"^aes128-gcm@openssh.com,aes256-gcm@openssh.com\" -o User=runner -o ControlMaster=auto -o ControlPath=\"/Users/runner/.lima/colima/ssh.sock\" -o ControlPersist=5m -p 49168 127.0.0.1 -- /bin/bash]","time":"2023-08-26T07:16:43Z"}
|
||||
{"level":"debug","msg":"stdout=\"\", stderr=\"ssh: connect to host 127.0.0.1 port 49168: Connection refused\\r\\n\", err=failed to execute script \"ssh\": stdout=\"\", stderr=\"ssh: connect to host 127.0.0.1 port 49168: Connection refused\\r\\n\": exit status 255","time":"2023-08-26T07:16:43Z"}
|
||||
{"level":"debug","msg":"qemu[stderr]: qemu-system-x86_64: Unknown Error","time":"2023-08-26T07:16:43Z"}
|
||||
{"level":"info","msg":"Driver stopped due to error: \"exit status 255\"","time":"2023-08-26T07:16:43Z"}
|
||||
{"level":"info","msg":"Shutting down the host agent","time":"2023-08-26T07:16:44Z"}
|
||||
{"level":"debug","msg":"shutting down the SSH master","time":"2023-08-26T07:16:44Z"}
|
||||
{"level":"debug","msg":"executing ssh for exiting the master: /usr/bin/ssh [ssh -F /dev/null -o IdentityFile=\"/Users/runner/.lima/_config/user\" -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o NoHostAuthenticationForLocalhost=yes -o GSSAPIAuthentication=no -o PreferredAuthentications=publickey -o Compression=no -o BatchMode=yes -o IdentitiesOnly=yes -o Ciphers=\"^aes128-gcm@openssh.com,aes256-gcm@openssh.com\" -o User=runner -o ControlMaster=auto -o ControlPath=\"/Users/runner/.lima/colima/ssh.sock\" -o ControlPersist=5m -O exit -p 49168 127.0.0.1]","time":"2023-08-26T07:16:44Z"}
|
||||
{"error":"failed to execute `ssh -O exit -p 49168 127.0.0.1`, out=\"Control socket connect(/Users/runner/.lima/colima/ssh.sock): No such file or directory\\r\\n\": exit status 255","level":"warning","msg":"failed to exit SSH master","time":"2023-08-26T07:16:44Z"}
|
||||
{"level":"info","msg":"Shutting down QEMU with ACPI","time":"2023-08-26T07:16:44Z"}
|
||||
{"error":"dial unix /Users/runner/.lima/colima/qmp.sock: connect: connection refused","level":"warning","msg":"failed to open the QMP socket \"/Users/runner/.lima/colima/qmp.sock\", forcibly killing QEMU","time":"2023-08-26T07:16:44Z"}
|
||||
{"level":"info","msg":"QEMU has already exited","time":"2023-08-26T07:16:44Z"}
|
||||
```
|
||||
|
||||
To fix this issue you can replace the existing signature of QEMU binary with
|
||||
the required entitlements as suggested in https://github.com/abiosoft/colima/issues/786#issuecomment-1693629650.
|
||||
This can be done within this action by setting the env var `SIGN_QEMU_BINARY=1`:
|
||||
|
||||
```yaml
|
||||
-
|
||||
name: Set up Docker
|
||||
uses: crazy-max/ghaction-setup-docker@v2
|
||||
env:
|
||||
SIGN_QEMU_BINARY: 1
|
||||
```
|
@ -17,38 +17,45 @@ describe('getInputs', () => {
|
||||
[
|
||||
0,
|
||||
new Map<string, string>([
|
||||
['version', 'v23.0.1'],
|
||||
['version', 'v24.0.8'],
|
||||
['set-host', 'false'],
|
||||
]),
|
||||
{
|
||||
version: 'v23.0.1',
|
||||
version: 'v24.0.8',
|
||||
channel: '',
|
||||
context: '',
|
||||
daemonConfig: '',
|
||||
setHost: false
|
||||
} as context.Inputs
|
||||
],
|
||||
[
|
||||
1,
|
||||
new Map<string, string>([
|
||||
['version', 'v23.0.0-rc.4'],
|
||||
['version', 'v24.0.0-rc.4'],
|
||||
['channel', 'test'],
|
||||
['context', 'foo'],
|
||||
['daemon-config', `{"debug":true,"features":{"containerd-snapshotter":true}}`],
|
||||
['set-host', 'false'],
|
||||
]),
|
||||
{
|
||||
version: 'v23.0.0-rc.4',
|
||||
version: 'v24.0.0-rc.4',
|
||||
channel: 'test',
|
||||
context: 'foo',
|
||||
daemonConfig: `{"debug":true,"features":{"containerd-snapshotter":true}}`,
|
||||
setHost: false
|
||||
} as context.Inputs
|
||||
],
|
||||
[
|
||||
2,
|
||||
new Map<string, string>([]),
|
||||
new Map<string, string>([
|
||||
['set-host', 'true'],
|
||||
]),
|
||||
{
|
||||
version: 'latest',
|
||||
channel: '',
|
||||
context: '',
|
||||
daemonConfig: '',
|
||||
setHost: true
|
||||
} as context.Inputs
|
||||
]
|
||||
])(
|
||||
|
10
action.yml
10
action.yml
@ -8,7 +8,7 @@ branding:
|
||||
|
||||
inputs:
|
||||
version:
|
||||
description: 'Docker CE version. (e.g, v23.0.1)'
|
||||
description: 'Docker CE version. (e.g, v24.0.9)'
|
||||
required: false
|
||||
default: 'latest'
|
||||
channel:
|
||||
@ -20,6 +20,14 @@ inputs:
|
||||
context:
|
||||
description: 'Docker context name. (default setup-docker-action)'
|
||||
required: false
|
||||
set-host:
|
||||
description: 'Set DOCKER_HOST environment variable to docker socket path'
|
||||
default: 'false'
|
||||
required: false
|
||||
|
||||
outputs:
|
||||
sock:
|
||||
description: "Docker socket path"
|
||||
|
||||
runs:
|
||||
using: 'node20'
|
||||
|
@ -4,8 +4,13 @@ ARG NODE_VERSION=20
|
||||
|
||||
FROM node:${NODE_VERSION}-alpine AS base
|
||||
RUN apk add --no-cache cpio findutils git
|
||||
RUN yarn config set --home enableTelemetry 0
|
||||
WORKDIR /src
|
||||
RUN --mount=type=bind,target=.,rw \
|
||||
--mount=type=cache,target=/src/.yarn/cache <<EOT
|
||||
corepack enable
|
||||
yarn --version
|
||||
yarn config set --home enableTelemetry 0
|
||||
EOT
|
||||
|
||||
FROM base AS deps
|
||||
RUN --mount=type=bind,target=.,rw \
|
||||
|
94
dist/index.js
generated
vendored
94
dist/index.js
generated
vendored
File diff suppressed because one or more lines are too long
2
dist/index.js.map
generated
vendored
2
dist/index.js.map
generated
vendored
File diff suppressed because one or more lines are too long
3273
dist/licenses.txt
generated
vendored
3273
dist/licenses.txt
generated
vendored
File diff suppressed because it is too large
Load Diff
@ -27,8 +27,8 @@
|
||||
"packageManager": "yarn@3.6.3",
|
||||
"dependencies": {
|
||||
"@actions/core": "^1.10.1",
|
||||
"@docker/actions-toolkit": "^0.13.0",
|
||||
"uuid": "^9.0.1"
|
||||
"@docker/actions-toolkit": "^0.25.0",
|
||||
"uuid": "^10.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "^20.6.0",
|
||||
|
@ -5,6 +5,7 @@ export interface Inputs {
|
||||
channel: string;
|
||||
daemonConfig?: string;
|
||||
context: string;
|
||||
setHost: boolean;
|
||||
}
|
||||
|
||||
export function getInputs(): Inputs {
|
||||
@ -12,6 +13,7 @@ export function getInputs(): Inputs {
|
||||
version: core.getInput('version') || 'latest',
|
||||
channel: core.getInput('channel'),
|
||||
daemonConfig: core.getInput('daemon-config'),
|
||||
context: core.getInput('context')
|
||||
context: core.getInput('context'),
|
||||
setHost: core.getBooleanInput('set-host')
|
||||
};
|
||||
}
|
||||
|
15
src/main.ts
15
src/main.ts
@ -13,7 +13,7 @@ actionsToolkit.run(
|
||||
// main
|
||||
async () => {
|
||||
const input: context.Inputs = context.getInputs();
|
||||
const runDir = path.join(os.homedir(), `setup-docker-action-${uuid.v4()}`);
|
||||
const runDir = path.join(os.homedir(), `setup-docker-action-${uuid.v4().slice(0, 8)}`);
|
||||
|
||||
if (input.context == 'default') {
|
||||
throw new Error(`'default' context cannot be used.`);
|
||||
@ -34,7 +34,18 @@ actionsToolkit.run(
|
||||
}
|
||||
if (toolDir) {
|
||||
stateHelper.setRunDir(runDir);
|
||||
await install.install();
|
||||
const sockPath = await install.install();
|
||||
await core.group(`Setting outputs`, async () => {
|
||||
core.info(`sock=${sockPath}`);
|
||||
core.setOutput('sock', sockPath);
|
||||
});
|
||||
|
||||
if (input.setHost) {
|
||||
await core.group(`Setting Docker host`, async () => {
|
||||
core.exportVariable('DOCKER_HOST', sockPath);
|
||||
core.info(`DOCKER_HOST=${sockPath}`);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
await core.group(`Docker info`, async () => {
|
||||
|
Reference in New Issue
Block a user