58 Commits

Author SHA1 Message Date
94fed099f6 Merge pull request #32 from crazy-max/update-node20
chore: node 20 as default runtime
2023-09-10 15:38:19 +02:00
87e8022576 chore: node 20 as default runtime 2023-09-10 05:21:16 +02:00
64ced80536 chore: update generated content 2023-09-10 05:21:16 +02:00
cc7ab4747a vendor: bump @docker/actions-toolkit from 0.12.0-rc.1 to 0.12.0 2023-09-10 05:19:58 +02:00
2105ee4f68 chore: update dev dependencies 2023-09-10 05:19:31 +02:00
32402da4e2 chore: update to node 20 2023-09-10 05:18:52 +02:00
6a07d2066a Merge pull request #33 from crazy-max/update-yarn
chore: update yarn to 3.6.3
2023-09-10 05:13:51 +02:00
8fac59bbad chore: update generated content 2023-09-10 05:03:30 +02:00
e031a1afa4 chore: update yarn to 3.6.3 2023-09-10 05:01:37 +02:00
bba98f9cf3 codecov: update config 2023-09-09 11:50:16 +02:00
c9a433aeef Merge pull request #28 from crazy-max/dependabot/github_actions/actions/checkout-4
Bump actions/checkout from 3 to 4
2023-09-06 20:27:36 +02:00
35358c035e Bump actions/checkout from 3 to 4
Bumps [actions/checkout](https://github.com/actions/checkout) from 3 to 4.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v3...v4)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-09-05 10:10:05 +00:00
ce60bfdfe1 Merge pull request #26 from crazy-max/colima-start-args
docs: define custom "colima start" arguments
2023-08-28 09:12:42 +02:00
24d5692d29 docs: define custom "colima start" arguments 2023-08-28 08:54:24 +02:00
c322702919 Merge pull request #25 from crazy-max/update-toolkit
bump @docker/actions-toolkit from 0.11.0 to 0.12.0-rc.1
2023-08-28 08:44:44 +02:00
ba6df22a99 update generated content 2023-08-28 08:36:20 +02:00
751eb0de7b bump @docker/actions-toolkit from 0.11.0 to 0.12.0-rc.1 2023-08-28 08:35:21 +02:00
2c7b4c9ba9 Merge pull request #24 from crazy-max/daemon-config
daemon-config input
2023-08-27 15:53:33 +02:00
0e98cdfc95 update generated content 2023-08-27 14:49:25 +02:00
e5467b74ef daemon-config input 2023-08-27 14:49:24 +02:00
d298db0f7d Merge pull request #23 from crazy-max/update-toolkit
bump @docker/actions-toolkit from 0.10.0 to 0.11.0
2023-08-27 14:21:47 +02:00
74272b7110 update generated content 2023-08-27 14:17:53 +02:00
d3292ed6bc bump @docker/actions-toolkit from 0.10.0 to 0.11.0 2023-08-27 14:15:30 +02:00
5566df4cd9 Merge pull request #22 from crazy-max/update-toolkit-2
bump @docker/actions-toolkit from 0.9.0 to 0.10.0
2023-08-26 12:55:15 +02:00
766484b9a8 update generated content 2023-08-26 12:49:11 +02:00
1a21164cad bump @docker/actions-toolkit from 0.9.0 to 0.10.0 2023-08-26 12:49:11 +02:00
0b0e2e14f8 ci: dump context 2023-08-26 12:49:11 +02:00
3ff7a3f336 ci: fix build-linux workflow 2023-08-26 12:21:53 +02:00
d1b108b3cc Merge pull request #21 from crazy-max/update-toolkit
bump @docker/actions-toolkit from 0.8.0 to 0.9.0
2023-08-26 12:21:12 +02:00
ff0fd563eb update generated content 2023-08-26 11:55:45 +02:00
3edb28603d docs: workaround for colima issue 2023-08-26 11:54:42 +02:00
0a0eee06ff bump @docker/actions-toolkit from 0.8.0 to 0.9.0 2023-08-26 11:54:33 +02:00
d00caf720d Merge pull request #20 from crazy-max/ci-dispatch
ci: workflow dispatch
2023-08-18 10:28:14 +02:00
26bcb039d3 ci: workflow dispatch 2023-08-18 10:27:44 +02:00
e22f202df2 Merge pull request #19 from crazy-max/ci-pin-docker
ci: pin docker version
2023-08-18 08:59:59 +02:00
99e070f51d ci: pin docker version 2023-08-17 19:05:52 +02:00
f5b7761d05 Merge pull request #17 from crazy-max/dependabot/npm_and_yarn/docker/actions-toolkit-0.8.0
Bump @docker/actions-toolkit from 0.1.0-beta.18 to 0.8.0
2023-08-17 10:19:29 +02:00
2dcc4846c6 update generated content 2023-08-17 10:16:12 +02:00
92951761fa Bump @docker/actions-toolkit from 0.1.0-beta.18 to 0.8.0
Bumps [@docker/actions-toolkit](https://github.com/docker/actions-toolkit) from 0.1.0-beta.18 to 0.8.0.
- [Release notes](https://github.com/docker/actions-toolkit/releases)
- [Commits](https://github.com/docker/actions-toolkit/compare/v0.1.0-beta.18...v0.8.0)

---
updated-dependencies:
- dependency-name: "@docker/actions-toolkit"
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-08-16 10:46:25 +00:00
dd105ffea1 Merge pull request #14 from crazy-max/dependabot/github_actions/docker/bake-action-3
Bump docker/bake-action from 2 to 3
2023-05-01 23:53:05 +02:00
8ad3d347be Bump docker/bake-action from 2 to 3
Bumps [docker/bake-action](https://github.com/docker/bake-action) from 2 to 3.
- [Release notes](https://github.com/docker/bake-action/releases)
- [Commits](https://github.com/docker/bake-action/compare/v2...v3)

---
updated-dependencies:
- dependency-name: docker/bake-action
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-04-18 11:07:28 +00:00
92e1039e6d Merge pull request #9 from crazy-max/update-community-files
update community files
2023-03-10 10:19:53 +00:00
50de6aefe9 update community files 2023-03-10 11:17:01 +01:00
a2ce6b1772 Merge pull request #8 from crazy-max/fix-version-latest
fix version to latest
2023-03-10 10:15:15 +00:00
5265cc143e update generated content 2023-03-10 11:09:24 +01:00
008acd5bc6 fix version to latest 2023-03-10 11:09:18 +01:00
e8785f775f Merge pull request #3 from crazy-max/ci-test
ci: test build Dockerfile
2023-03-10 10:04:19 +00:00
cb1f376ddb ci: test build Dockerfile 2023-03-10 10:54:14 +01:00
c3a68cbeca Merge pull request #7 from crazy-max/context-input
context input
2023-03-10 01:35:42 +00:00
0a682c046a update generated content 2023-03-10 02:01:38 +01:00
e4a53ed864 context input 2023-03-10 02:01:38 +01:00
3dcc76c352 Merge pull request #6 from crazy-max/channel
channel support
2023-03-10 00:08:13 +00:00
d131482129 update generated content 2023-03-10 00:57:37 +01:00
59b62980d1 channel support 2023-03-10 00:57:37 +01:00
475e5bf1db Merge pull request #5 from crazy-max/dependabot/npm_and_yarn/docker/actions-toolkit-0.1.0-beta.18
Bump @docker/actions-toolkit from 0.1.0-beta.17 to 0.1.0-beta.18
2023-03-09 23:31:13 +00:00
a7db17d9b4 update generated content 2023-03-10 00:26:42 +01:00
34c4964b4a use new implementation 2023-03-10 00:26:41 +01:00
3e758a2d14 Bump @docker/actions-toolkit from 0.1.0-beta.17 to 0.1.0-beta.18
Bumps [@docker/actions-toolkit](https://github.com/docker/actions-toolkit) from 0.1.0-beta.17 to 0.1.0-beta.18.
- [Release notes](https://github.com/docker/actions-toolkit/releases)
- [Commits](https://github.com/docker/actions-toolkit/compare/v0.1.0-beta.17...v0.1.0-beta.18)

---
updated-dependencies:
- dependency-name: "@docker/actions-toolkit"
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-03-08 11:17:48 +00:00
30 changed files with 8220 additions and 3742 deletions

View File

@ -1,2 +1,12 @@
/coverage
/node_modules
# Dependency directories
node_modules/
jspm_packages/
# yarn v2
.yarn/cache
.yarn/unplugged
.yarn/build-state.yml
.yarn/install-state.gz
.pnp.*

3
.eslintignore Normal file
View File

@ -0,0 +1,3 @@
/dist/**
/coverage/**
/node_modules/**

View File

@ -1,11 +1,12 @@
{
"env": {
"node": true,
"es2021": true,
"es6": true,
"jest": true
},
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/eslint-recommended",
"plugin:@typescript-eslint/recommended",
"plugin:jest/recommended",
"plugin:prettier/recommended"

2
.gitattributes vendored
View File

@ -1,2 +1,4 @@
/.yarn/releases/** binary
/.yarn/plugins/** binary
/dist/** linguist-generated=true
/lib/** linguist-generated=true

View File

@ -1,6 +1,7 @@
name: ci
on:
workflow_dispatch:
schedule:
- cron: '0 10 * * *'
push:
@ -11,6 +12,10 @@ on:
- 'v*'
pull_request:
env:
DOCKER_VERSION: v23.0.6
SIGN_QEMU_BINARY: 1
jobs:
main:
runs-on: ${{ matrix.os }}
@ -21,12 +26,220 @@ jobs:
- ubuntu-latest
- macos-latest
- windows-latest
version:
- pinned
- latest
steps:
-
name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
-
name: Set version
shell: bash
run: |
if [ "${{ matrix.version }}" != "pinned" ]; then
echo "DOCKER_VERSION=${{ matrix.version }}" >> $GITHUB_ENV
fi
-
name: Set up Docker
uses: ./
with:
version: 23.0.0
version: ${{ env.DOCKER_VERSION }}
-
name: Dump context
if: always()
uses: crazy-max/ghaction-dump-context@v2
channel:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os:
- ubuntu-latest
- macos-latest
- windows-latest
steps:
-
name: Checkout
uses: actions/checkout@v4
-
name: Set up Docker
uses: ./
with:
version: v23.0.0-rc.4
channel: test
-
name: Dump context
if: always()
uses: crazy-max/ghaction-dump-context@v2
daemon-config:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os:
- ubuntu-latest
- macos-latest
- windows-latest
steps:
-
name: Checkout
uses: actions/checkout@v4
-
name: Set up Docker
uses: ./
with:
daemon-config: |
{
"debug": true,
"features": {
"containerd-snapshotter": true
}
}
-
name: Dump context
if: always()
uses: crazy-max/ghaction-dump-context@v2
context:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os:
- ubuntu-latest
- macos-latest
- windows-latest
steps:
-
name: Checkout
uses: actions/checkout@v4
-
name: Set up Docker
uses: ./
with:
version: ${{ env.DOCKER_VERSION }}
context: foo
-
name: Check context
run: |
docker context inspect foo
-
name: Dump context
if: always()
uses: crazy-max/ghaction-dump-context@v2
colima-start-args:
runs-on: macos-latest
steps:
-
name: Checkout
uses: actions/checkout@v4
-
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
build-linux:
runs-on: ubuntu-latest
steps:
-
name: Checkout
uses: actions/checkout@v4
-
name: Set up Docker
uses: ./
with:
version: ${{ env.DOCKER_VERSION }}
-
name: Start registry
run: |
docker run -d -p 5000:5000 --restart=always --name registry registry:2
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
with:
driver: docker
driver-opts: network=host
-
name: Build and push
uses: docker/build-push-action@v4
with:
context: ./test
push: true
tags: |
localhost:5000/name/app:latest
-
name: Inspect
run: |
docker buildx imagetools inspect localhost:5000/name/app:latest --format '{{json .}}'
-
name: Dump context
if: always()
uses: crazy-max/ghaction-dump-context@v2
build-macos:
runs-on: macos-latest
steps:
-
name: Checkout
uses: actions/checkout@v4
-
name: Set up Docker
uses: ./
with:
version: ${{ env.DOCKER_VERSION }}
-
name: Start registry
run: |
docker run -d -p 5000:5000 --restart=always --name registry registry:2
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
with:
driver: docker
driver-opts: network=host
-
name: Build and push
uses: docker/build-push-action@v4
with:
context: ./test
push: true
tags: |
localhost:5000/name/app:latest
-
name: Inspect
run: |
docker buildx imagetools inspect localhost:5000/name/app:latest --format '{{json .}}'
-
name: Dump context
if: always()
uses: crazy-max/ghaction-dump-context@v2
build-windows:
runs-on: windows-latest
steps:
-
name: Checkout
uses: actions/checkout@v4
-
name: Set up Docker
uses: ./
with:
version: ${{ env.DOCKER_VERSION }}
-
name: Build
working-directory: ./test
run: |
docker build -f win.Dockerfile -t test .
-
name: Inspect
run: |
docker image inspect test
-
name: Dump context
if: always()
uses: crazy-max/ghaction-dump-context@v2

View File

@ -13,10 +13,10 @@ jobs:
steps:
-
name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
-
name: Test
uses: docker/bake-action@v2
uses: docker/bake-action@v3
with:
targets: test
-

View File

@ -15,7 +15,7 @@ jobs:
steps:
-
name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
-
name: Targets matrix
id: targets
@ -33,9 +33,9 @@ jobs:
steps:
-
name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
-
name: Validate
uses: docker/bake-action@v2
uses: docker/bake-action@v3
with:
targets: ${{ matrix.target }}

66
.gitignore vendored
View File

@ -1,7 +1,5 @@
node_modules
lib
# https://raw.githubusercontent.com/github/gitignore/main/Node.gitignore
# Rest of the file pulled from https://github.com/github/gitignore/blob/master/Node.gitignore
# Logs
logs
*.log
@ -9,6 +7,7 @@ npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*
.pnpm-debug.log*
# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
@ -19,34 +18,14 @@ pids
*.seed
*.pid.lock
# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov
# Coverage directory used by tools like istanbul
coverage
*.lcov
# nyc test coverage
.nyc_output
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
.grunt
# Bower dependency directory (https://bower.io/)
bower_components
# node-waf configuration
.lock-wscript
# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release
# Dependency directories
node_modules/
jspm_packages/
# TypeScript v1 declaration files
typings/
# TypeScript cache
*.tsbuildinfo
@ -56,36 +35,19 @@ typings/
# Optional eslint cache
.eslintcache
# Optional REPL history
.node_repl_history
# Output of 'npm pack'
*.tgz
# Yarn Integrity file
.yarn-integrity
# dotenv environment variables file
# dotenv environment variable files
.env
.env.test
.env.development.local
.env.test.local
.env.production.local
.env.local
# parcel-bundler cache (https://parceljs.org/)
.cache
# next.js build output
.next
# nuxt.js build output
.nuxt
# vuepress build output
.vuepress/dist
# Serverless directories
.serverless/
# FuseBox cache
.fusebox/
# DynamoDB Local files
.dynamodb/
# yarn v2
.yarn/cache
.yarn/unplugged
.yarn/build-state.yml
.yarn/install-state.gz
.pnp.*

6
.prettierignore Normal file
View File

@ -0,0 +1,6 @@
# Dependency directories
node_modules/
jspm_packages/
# yarn v2
.yarn/

File diff suppressed because one or more lines are too long

874
.yarn/releases/yarn-3.6.3.cjs vendored Normal file

File diff suppressed because one or more lines are too long

15
.yarnrc.yml Normal file
View File

@ -0,0 +1,15 @@
logFilters:
- code: YN0013
level: discard
- code: YN0019
level: discard
- code: YN0076
level: discard
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

144
README.md
View File

@ -6,20 +6,49 @@
## About
GitHub Action to set up [Docker CE](https://docs.docker.com/engine/). Works on
Linux, macOS and Windows.
GitHub Action to set up (download and install) [Docker CE](https://docs.docker.com/engine/).
Works on Linux, macOS and Windows.
![Screenshot](.github/setup-docker-action.png)
___
* [Usage](#usage)
* [Quick start](#quick-start)
* [Daemon configuration](#daemon-configuration)
* [Define custom `colima start` arguments (macOS)](#define-custom-colima-start-arguments-macos)
* [Customizing](#customizing)
* [inputs](#inputs)
* [Notes](#notes)
* [Contributing](#contributing)
* [License](#license)
## Usage
### Quick start
```yaml
name: ci
on:
push:
jobs:
docker:
runs-on: ubuntu-latest
steps:
-
name: Set up Docker
uses: crazy-max/ghaction-setup-docker@v1
```
### Daemon configuration
You can [configure the Docker daemon](https://docs.docker.com/engine/reference/commandline/dockerd/#daemon-configuration-file)
using the `daemon-config` input. In the following example, we configure the
Docker daemon to enable debug and the [containerd image store](https://docs.docker.com/storage/containerd/)
feature:
```yaml
name: ci
@ -34,7 +63,35 @@ jobs:
name: Set up Docker
uses: crazy-max/ghaction-setup-docker@v1
with:
version: 23.0.1
daemon-config: |
{
"debug": true,
"features": {
"containerd-snapshotter": true
}
}
```
### Define custom `colima 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:
```yaml
name: ci
on:
push:
jobs:
docker:
runs-on: macos-latest
steps:
-
name: Set up Docker
uses: crazy-max/ghaction-setup-docker@v1
env:
COLIMA_START_ARGS: --cpu 4 --memory 8 --disk 32
```
## Customizing
@ -43,11 +100,82 @@ jobs:
Following inputs can be used as `step.with` keys
| Name | Type | Description |
|-----------|--------|-------------------------------------|
| `version` | String | Docker CE version (e.g., `23.0.1`). |
| Name | Type | Default | Description |
|-----------------|--------|-----------------------|-----------------------------------------------------------------------------------------------------------------------------|
| `version` | String | `latest` | Docker CE version (e.g., `v23.0.1`). |
| `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. |
## Notes
### 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@v1
env:
SIGN_QEMU_BINARY: 1
```
## Contributing
Want to contribute? Awesome! You can find information about contributing to
this project in the [CONTRIBUTING.md](/.github/CONTRIBUTING.md)
Want to contribute? Awesome! The most basic way to show your support is to star
the project, or to raise issues. If you want to open a pull request, please
read the [contributing guidelines](.github/CONTRIBUTING.md).
You can also support this project by [**becoming a sponsor on GitHub**](https://github.com/sponsors/crazy-max)
or by making a [PayPal donation](https://www.paypal.me/crazyws) to ensure this
journey continues indefinitely!
Thanks again for your support, it is much appreciated! :pray:
## License
Apache-2.0. See `LICENSE` for more details.

View File

@ -17,10 +17,38 @@ describe('getInputs', () => {
[
0,
new Map<string, string>([
['version', '23.0.1'],
['version', 'v23.0.1'],
]),
{
version: '23.0.1',
version: 'v23.0.1',
channel: '',
context: '',
daemonConfig: '',
} as context.Inputs
],
[
1,
new Map<string, string>([
['version', 'v23.0.0-rc.4'],
['channel', 'test'],
['context', 'foo'],
['daemon-config', `{"debug":true,"features":{"containerd-snapshotter":true}}`],
]),
{
version: 'v23.0.0-rc.4',
channel: 'test',
context: 'foo',
daemonConfig: `{"debug":true,"features":{"containerd-snapshotter":true}}`,
} as context.Inputs
],
[
2,
new Map<string, string>([]),
{
version: 'latest',
channel: '',
context: '',
daemonConfig: '',
} as context.Inputs
]
])(

View File

@ -1,17 +1,27 @@
# https://help.github.com/en/articles/metadata-syntax-for-github-actions
name: 'Docker Setup Docker'
description: 'Set up Docker'
author: 'docker'
description: 'Set up Docker for use in GitHub Actions by downloading and installing a version of Docker CE'
author: 'crazy-max'
branding:
icon: 'anchor'
color: 'blue'
inputs:
version:
description: 'Docker CE version. (e.g, 23.0.1)'
description: 'Docker CE version. (e.g, v23.0.1)'
required: false
default: 'latest'
channel:
description: 'Docker CE channel. (e.g, stable, edge or test)'
required: false
daemon-config:
description: 'Docker daemon JSON configuration'
required: false
context:
description: 'Docker context name. (default setup-docker-action)'
required: false
runs:
using: 'node16'
using: 'node20'
main: 'dist/index.js'
post: 'dist/index.js'

View File

@ -1,3 +1,12 @@
comment: false
coverage:
status:
project: # settings affecting project coverage
default:
target: auto # auto % coverage target
threshold: 5% # allow for 5% reduction of coverage without failing
patch: off
github_checks:
annotations: false

View File

@ -1,13 +1,15 @@
# syntax=docker/dockerfile:1
ARG NODE_VERSION=16
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
FROM base AS deps
RUN --mount=type=bind,target=.,rw \
--mount=type=cache,target=/src/.yarn/cache \
--mount=type=cache,target=/src/node_modules \
yarn install && mkdir /vendor && cp yarn.lock /vendor
@ -28,6 +30,7 @@ EOT
FROM deps AS build
RUN --mount=type=bind,target=.,rw \
--mount=type=cache,target=/src/.yarn/cache \
--mount=type=cache,target=/src/node_modules \
yarn run build && mkdir /out && cp -Rf dist /out/
@ -48,6 +51,7 @@ EOT
FROM deps AS format
RUN --mount=type=bind,target=.,rw \
--mount=type=cache,target=/src/.yarn/cache \
--mount=type=cache,target=/src/node_modules \
yarn run format \
&& mkdir /out && find . -name '*.ts' -not -path './node_modules/*' | cpio -pdm /out
@ -57,13 +61,15 @@ COPY --from=format /out /
FROM deps AS lint
RUN --mount=type=bind,target=.,rw \
--mount=type=cache,target=/src/.yarn/cache \
--mount=type=cache,target=/src/node_modules \
yarn run lint
FROM deps AS test
RUN --mount=type=bind,target=.,rw \
--mount=type=cache,target=/src/.yarn/cache \
--mount=type=cache,target=/src/node_modules \
yarn run test --coverageDirectory=/tmp/coverage
yarn run test --coverage --coverageDirectory=/tmp/coverage
FROM scratch AS test-coverage
COPY --from=test /tmp/coverage /

6
dist/index.js generated vendored

File diff suppressed because one or more lines are too long

2
dist/index.js.map generated vendored

File diff suppressed because one or more lines are too long

105
dist/licenses.txt generated vendored
View File

@ -450,16 +450,6 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
@vercel/ncc
MIT
Copyright 2018 ZEIT, Inc.
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
async-retry
MIT
The MIT License (MIT)
@ -806,6 +796,26 @@ ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
encoding
MIT
Copyright (c) 2012-2014 Andris Reinman
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
fs.realpath
ISC
The ISC License
@ -901,6 +911,31 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
iconv-lite
MIT
Copyright (c) 2011 Alexander Shtuchkin
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
inflight
ISC
The ISC License
@ -965,6 +1000,31 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
js-yaml
MIT
(The MIT License)
Copyright (C) 2011-2015 by Vitaly Puzrin
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
jwt-decode
MIT
The MIT License (MIT)
@ -1123,6 +1183,31 @@ ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
safer-buffer
MIT
MIT License
Copyright (c) 2018 Nikita Skovoroda <chalkerx@gmail.com>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
semver
ISC
The ISC License

2
dist/sourcemap-register.js generated vendored

File diff suppressed because one or more lines are too long

View File

@ -15,6 +15,7 @@ process.env = Object.assign({}, process.env, {
module.exports = {
clearMocks: true,
testEnvironment: 'node',
moduleFileExtensions: ['js', 'ts'],
testMatch: ['**/*.test.ts'],
transform: {

View File

@ -1,12 +1,16 @@
{
"name": "docker-setup-docker",
"description": "Set up Docker CE",
"description": "Set up Docker for use in GitHub Actions by downloading and installing a version of Docker CE",
"main": "lib/main.js",
"scripts": {
"build": "ncc build src/main.ts --source-map --minify --license licenses.txt",
"lint": "eslint src/**/*.ts __tests__/**/*.ts",
"format": "eslint --fix src/**/*.ts __tests__/**/*.ts",
"test": "jest --coverage",
"lint": "yarn run prettier && yarn run eslint",
"format": "yarn run prettier:fix && yarn run eslint:fix",
"eslint": "eslint --max-warnings=0 .",
"eslint:fix": "eslint --fix .",
"prettier": "prettier --check \"./**/*.ts\"",
"prettier:fix": "prettier --write \"./**/*.ts\"",
"test": "jest",
"all": "yarn run build && yarn run format && yarn test"
},
"repository": {
@ -18,32 +22,27 @@
"docker",
"engine"
],
"author": "Docker",
"contributors": [
{
"name": "CrazyMax",
"url": "https://crazymax.dev"
}
],
"author": "CrazyMax",
"license": "Apache-2.0",
"packageManager": "yarn@3.6.3",
"dependencies": {
"@actions/core": "^1.10.0",
"@docker/actions-toolkit": "^0.1.0-beta.17",
"@docker/actions-toolkit": "^0.12.0",
"uuid": "^9.0.0"
},
"devDependencies": {
"@types/node": "^16.11.26",
"@typescript-eslint/eslint-plugin": "^5.14.0",
"@typescript-eslint/parser": "^5.14.0",
"@vercel/ncc": "^0.33.3",
"eslint": "^8.11.0",
"eslint-config-prettier": "^8.5.0",
"eslint-plugin-jest": "^26.1.1",
"eslint-plugin-prettier": "^4.0.0",
"jest": "^27.2.5",
"prettier": "^2.3.1",
"ts-jest": "^27.1.2",
"ts-node": "^10.7.0",
"typescript": "^4.4.4"
"@types/node": "^20.6.0",
"@typescript-eslint/eslint-plugin": "^6.6.0",
"@typescript-eslint/parser": "^6.6.0",
"@vercel/ncc": "^0.38.0",
"eslint": "^8.49.0",
"eslint-config-prettier": "^9.0.0",
"eslint-plugin-jest": "^27.2.3",
"eslint-plugin-prettier": "^5.0.0",
"jest": "^29.6.4",
"prettier": "^3.0.3",
"ts-jest": "^29.1.1",
"ts-node": "^10.9.1",
"typescript": "^5.2.2"
}
}

View File

@ -2,10 +2,16 @@ import * as core from '@actions/core';
export interface Inputs {
version: string;
channel: string;
daemonConfig?: string;
context: string;
}
export function getInputs(): Inputs {
return {
version: core.getInput('version')
version: core.getInput('version') || 'latest',
channel: core.getInput('channel'),
daemonConfig: core.getInput('daemon-config'),
context: core.getInput('context')
};
}

View File

@ -13,18 +13,28 @@ actionsToolkit.run(
// main
async () => {
const input: context.Inputs = context.getInputs();
const runDir = path.join(os.homedir(), `setup-docker-action-${uuid.v4()}`);
const install = new Install();
if (input.context == 'default') {
throw new Error(`'default' context cannot be used.`);
}
const install = new Install({
runDir: runDir,
version: input.version,
channel: input.channel || 'stable',
contextName: input.context || 'setup-docker-action',
daemonConfig: input.daemonConfig
});
let toolDir;
if (!(await Docker.isAvailable()) || input.version) {
await core.group(`Download docker`, async () => {
toolDir = await install.download(input.version || 'latest');
toolDir = await install.download();
});
}
if (toolDir) {
const runDir = path.join(os.homedir(), `setup-docker-action-${uuid.v4()}`);
stateHelper.setRunDir(runDir);
await install.install(toolDir, runDir, input.version);
await install.install();
}
await core.group(`Docker info`, async () => {
@ -37,7 +47,9 @@ actionsToolkit.run(
if (stateHelper.runDir.length == 0) {
return;
}
const install = new Install();
await install.tearDown(stateHelper.runDir);
const install = new Install({
runDir: stateHelper.runDir
});
await install.tearDown();
}
);

9
test/Dockerfile Normal file
View File

@ -0,0 +1,9 @@
# syntax=docker/dockerfile:1
FROM --platform=$BUILDPLATFORM golang:alpine AS build
ARG TARGETPLATFORM
ARG BUILDPLATFORM
RUN echo "I am running on $BUILDPLATFORM, building for $TARGETPLATFORM" > /log
FROM alpine
COPY --from=build /log /log

22
test/hello.txt Normal file
View File

@ -0,0 +1,22 @@
Hello from Docker!
This message shows that your installation appears to be working correctly.
To generate this message, Docker took the following steps:
1. The Docker client contacted the Docker daemon.
2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
(windows-amd64, nanoserver-1809)
3. The Docker daemon created a new container from that image which runs the
executable that produces the output you are currently reading.
4. The Docker daemon streamed that output to the Docker client, which sent it
to your terminal.
To try something more ambitious, you can run a Windows Server container with:
PS C:\> docker run -it mcr.microsoft.com/windows/servercore:ltsc2019 powershell
Share images, automate workflows, and more with a free Docker ID:
https://hub.docker.com/
For more examples and ideas, visit:
https://docs.docker.com/get-started/

3
test/win.Dockerfile Normal file
View File

@ -0,0 +1,3 @@
FROM mcr.microsoft.com/windows/nanoserver:1809
COPY hello.txt C:
CMD ["cmd", "/C", "type C:\\hello.txt"]

View File

@ -3,7 +3,6 @@
"esModuleInterop": true,
"target": "es6",
"module": "commonjs",
"strict": true,
"newLine": "lf",
"outDir": "./lib",
"rootDir": "./src",
@ -13,9 +12,8 @@
"useUnknownInCatchVariables": false,
},
"exclude": [
"./__tests__/**/*",
"./lib/**/*",
"node_modules",
"**/*.test.ts",
"jest.config.ts"
]
}

9765
yarn.lock

File diff suppressed because it is too large Load Diff