Compare commits

...

39 Commits

Author SHA1 Message Date
CrazyMax
db6372e84f Merge pull request #491 from docker/dependabot/github_actions/codecov/codecov-action-5
Some checks failed
publish / publish (push) Has been cancelled
build(deps): bump codecov/codecov-action from 4 to 5
2024-11-18 16:42:10 +01:00
CrazyMax
ed273243e8 Merge pull request #495 from docker/dependabot/npm_and_yarn/cross-spawn-7.0.6
build(deps): bump cross-spawn from 7.0.3 to 7.0.6
2024-11-18 16:38:48 +01:00
CrazyMax
749fc87fb2 ci: fix deprecated input for codecov-action
Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
2024-11-18 16:17:16 +01:00
dependabot[bot]
9f6ff3da7f build(deps): bump cross-spawn from 7.0.3 to 7.0.6
Bumps [cross-spawn](https://github.com/moxystudio/node-cross-spawn) from 7.0.3 to 7.0.6.
- [Changelog](https://github.com/moxystudio/node-cross-spawn/blob/master/CHANGELOG.md)
- [Commits](https://github.com/moxystudio/node-cross-spawn/compare/v7.0.3...v7.0.6)

---
updated-dependencies:
- dependency-name: cross-spawn
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-11-18 15:16:48 +00:00
CrazyMax
c2a62c4476 Merge pull request #494 from crazy-max/ci-drop-macos-12
ci: remove deprecated macos-12 runner
2024-11-18 16:14:54 +01:00
CrazyMax
8dfe7ecbd9 ci: remove deprecated macos-12 runner
Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
2024-11-18 15:51:00 +01:00
CrazyMax
d19019dc11 Merge pull request #493 from crazy-max/qemu-check-installed
docker(install): check qemu is installed
2024-11-18 15:45:47 +01:00
CrazyMax
1362d80447 docker(install): check qemu is installed
Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
2024-11-18 15:19:43 +01:00
CrazyMax
05607289aa Merge pull request #492 from docker/bot/docker-releases-json
Update `.github/docker-releases.json`
2024-11-18 14:02:28 +01:00
crazy-max
91444bd3bd github: update .github/docker-releases.json
Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2024-11-15 00:29:29 +00:00
dependabot[bot]
cc17e76a52 build(deps): bump codecov/codecov-action from 4 to 5
Bumps [codecov/codecov-action](https://github.com/codecov/codecov-action) from 4 to 5.
- [Release notes](https://github.com/codecov/codecov-action/releases)
- [Changelog](https://github.com/codecov/codecov-action/blob/main/CHANGELOG.md)
- [Commits](https://github.com/codecov/codecov-action/compare/v4...v5)

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

Signed-off-by: dependabot[bot] <support@github.com>
2024-11-14 22:27:55 +00:00
CrazyMax
8672cc70f4 Merge pull request #489 from trim21/get-commit-data
Some checks failed
publish / publish (push) Has been cancelled
feat: add method to get commit date from git
2024-11-13 13:39:55 +01:00
Trim21
31cb9c3bde feat: add method to get commit date from git
Signed-off-by: Trim21 <trim21.me@gmail.com>
2024-11-13 20:11:46 +08:00
CrazyMax
781874f7fa Merge pull request #486 from vvoland/docker-install-rootless2
docker/install: Fix rootless install, make teardown also cleanup the toolDir
2024-11-13 12:04:15 +01:00
Paweł Gronowski
54e0f74a84 docker/install: Stop docker service on Windows
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2024-11-08 18:07:31 +01:00
Paweł Gronowski
15a9f92044 docker/install: Copy all rootless-extras files
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2024-11-08 17:58:08 +01:00
Paweł Gronowski
0b611e6c46 docker/install: Clean up toolDir in teardown
The `toolDir` is added to `PATH` on install, so make sure the binaries
aren't accessible after a teardown.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2024-11-08 17:58:05 +01:00
Paweł Gronowski
4980de30fc test/install: Use separate runDir for each test
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2024-11-08 17:58:03 +01:00
CrazyMax
37b0f81ca2 Merge pull request #485 from vvoland/docker-install-rootless
Some checks failed
publish / publish (push) Has been cancelled
docker/install: Support rootless
2024-11-07 12:04:37 +01:00
Paweł Gronowski
2d2bc848fe docker/install: Support rootless
Add support for running a rootless daemon. Currently only Linux host is
supported.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2024-11-06 18:02:02 +01:00
CrazyMax
8c97b0d9b4 Merge pull request #483 from docker/bot/buildx-lab-releases-json
Update `.github/buildx-lab-releases.json`
2024-11-02 17:36:11 +01:00
crazy-max
9da4a47d60 github: update .github/buildx-lab-releases.json
Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2024-11-02 11:47:16 +00:00
CrazyMax
80e4f3c485 Merge pull request #484 from docker/dependabot/npm_and_yarn/actions/cache-3.3.0
build(deps): bump @actions/cache from 3.2.4 to 3.3.0
2024-11-02 12:46:50 +01:00
dependabot[bot]
cb33662ebc build(deps): bump @actions/cache from 3.2.4 to 3.3.0
Bumps [@actions/cache](https://github.com/actions/toolkit/tree/HEAD/packages/cache) from 3.2.4 to 3.3.0.
- [Changelog](https://github.com/actions/toolkit/blob/main/packages/cache/RELEASES.md)
- [Commits](https://github.com/actions/toolkit/commits/HEAD/packages/cache)

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

Signed-off-by: dependabot[bot] <support@github.com>
2024-11-01 22:42:41 +00:00
CrazyMax
1b63de84b1 Merge pull request #482 from tonistiigi/update-buildx-v0.18.0
update buildx to v0.18.0
2024-10-31 08:59:17 +01:00
Tonis Tiigi
577f9b9555 update buildx to v0.18.0
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2024-10-30 15:51:36 -07:00
Tõnis Tiigi
c6389d840e Merge pull request #481 from docker/bot/buildx-releases-json
Update `.github/buildx-releases.json`
2024-10-30 15:50:15 -07:00
tonistiigi
d90b053e7c github: update .github/buildx-releases.json
Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2024-10-30 22:49:32 +00:00
CrazyMax
853d5fa804 Merge pull request #480 from vvoland/docker-install-image-latest-fix
Some checks failed
publish / publish (push) Has been cancelled
docker/install: Fix latest image install on lima
2024-10-30 16:22:35 +01:00
Paweł Gronowski
61c10b2d7d docker/install: Fix latest image install on lima
`latest` is not a valid git tag or revision to get the matching systemd
unit files.
Look up the exact source git commit from the
`'org.opencontainers.image.revision` image config label.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2024-10-30 15:45:37 +01:00
CrazyMax
e84b18afd5 Merge pull request #479 from crazy-max/dockerfile-validate
dockerfile validation
2024-10-30 10:34:42 +01:00
CrazyMax
f06ec3b4a1 ci: use list-targets subaction
Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
2024-10-30 09:43:45 +01:00
CrazyMax
991feac6c3 fix dockerfile checks
Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
2024-10-30 09:43:44 +01:00
CrazyMax
a79473b652 dockerfile validation
Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
2024-10-30 09:43:20 +01:00
CrazyMax
6f86e0250d Merge pull request #476 from crazy-max/undock-run
undock: run and extract
2024-10-30 09:14:05 +01:00
CrazyMax
0a09638c5b undock: run
Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
2024-10-30 07:35:55 +01:00
CrazyMax
ea7b423421 Merge pull request #478 from docker/bot/buildx-releases-json
Update `.github/buildx-releases.json`
2024-10-30 06:42:00 +01:00
crazy-max
24115c327a github: update .github/buildx-releases.json
Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2024-10-30 00:20:21 +00:00
CrazyMax
735c66bebf undock: check for availability
Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
2024-10-29 14:30:05 +01:00
20 changed files with 668 additions and 131 deletions

View File

@@ -40,6 +40,47 @@
"https://github.com/docker/buildx-desktop/releases/download/v0.17.1-desktop.1/checksums.txt"
]
},
"v0.18.0-desktop.2": {
"id": 183082748,
"tag_name": "v0.18.0-desktop.2",
"html_url": "https://github.com/docker/buildx-desktop/releases/tag/v0.18.0-desktop.2",
"assets": [
"https://github.com/docker/buildx-desktop/releases/download/v0.18.0-desktop.2/buildx-v0.18.0-desktop.2.darwin-amd64",
"https://github.com/docker/buildx-desktop/releases/download/v0.18.0-desktop.2/buildx-v0.18.0-desktop.2.darwin-amd64.provenance.json",
"https://github.com/docker/buildx-desktop/releases/download/v0.18.0-desktop.2/buildx-v0.18.0-desktop.2.darwin-amd64.sbom.json",
"https://github.com/docker/buildx-desktop/releases/download/v0.18.0-desktop.2/buildx-v0.18.0-desktop.2.darwin-arm64",
"https://github.com/docker/buildx-desktop/releases/download/v0.18.0-desktop.2/buildx-v0.18.0-desktop.2.darwin-arm64.provenance.json",
"https://github.com/docker/buildx-desktop/releases/download/v0.18.0-desktop.2/buildx-v0.18.0-desktop.2.darwin-arm64.sbom.json",
"https://github.com/docker/buildx-desktop/releases/download/v0.18.0-desktop.2/buildx-v0.18.0-desktop.2.linux-amd64",
"https://github.com/docker/buildx-desktop/releases/download/v0.18.0-desktop.2/buildx-v0.18.0-desktop.2.linux-amd64.provenance.json",
"https://github.com/docker/buildx-desktop/releases/download/v0.18.0-desktop.2/buildx-v0.18.0-desktop.2.linux-amd64.sbom.json",
"https://github.com/docker/buildx-desktop/releases/download/v0.18.0-desktop.2/buildx-v0.18.0-desktop.2.linux-arm-v6",
"https://github.com/docker/buildx-desktop/releases/download/v0.18.0-desktop.2/buildx-v0.18.0-desktop.2.linux-arm-v6.provenance.json",
"https://github.com/docker/buildx-desktop/releases/download/v0.18.0-desktop.2/buildx-v0.18.0-desktop.2.linux-arm-v6.sbom.json",
"https://github.com/docker/buildx-desktop/releases/download/v0.18.0-desktop.2/buildx-v0.18.0-desktop.2.linux-arm-v7",
"https://github.com/docker/buildx-desktop/releases/download/v0.18.0-desktop.2/buildx-v0.18.0-desktop.2.linux-arm-v7.provenance.json",
"https://github.com/docker/buildx-desktop/releases/download/v0.18.0-desktop.2/buildx-v0.18.0-desktop.2.linux-arm-v7.sbom.json",
"https://github.com/docker/buildx-desktop/releases/download/v0.18.0-desktop.2/buildx-v0.18.0-desktop.2.linux-arm64",
"https://github.com/docker/buildx-desktop/releases/download/v0.18.0-desktop.2/buildx-v0.18.0-desktop.2.linux-arm64.provenance.json",
"https://github.com/docker/buildx-desktop/releases/download/v0.18.0-desktop.2/buildx-v0.18.0-desktop.2.linux-arm64.sbom.json",
"https://github.com/docker/buildx-desktop/releases/download/v0.18.0-desktop.2/buildx-v0.18.0-desktop.2.linux-ppc64le",
"https://github.com/docker/buildx-desktop/releases/download/v0.18.0-desktop.2/buildx-v0.18.0-desktop.2.linux-ppc64le.provenance.json",
"https://github.com/docker/buildx-desktop/releases/download/v0.18.0-desktop.2/buildx-v0.18.0-desktop.2.linux-ppc64le.sbom.json",
"https://github.com/docker/buildx-desktop/releases/download/v0.18.0-desktop.2/buildx-v0.18.0-desktop.2.linux-riscv64",
"https://github.com/docker/buildx-desktop/releases/download/v0.18.0-desktop.2/buildx-v0.18.0-desktop.2.linux-riscv64.provenance.json",
"https://github.com/docker/buildx-desktop/releases/download/v0.18.0-desktop.2/buildx-v0.18.0-desktop.2.linux-riscv64.sbom.json",
"https://github.com/docker/buildx-desktop/releases/download/v0.18.0-desktop.2/buildx-v0.18.0-desktop.2.linux-s390x",
"https://github.com/docker/buildx-desktop/releases/download/v0.18.0-desktop.2/buildx-v0.18.0-desktop.2.linux-s390x.provenance.json",
"https://github.com/docker/buildx-desktop/releases/download/v0.18.0-desktop.2/buildx-v0.18.0-desktop.2.linux-s390x.sbom.json",
"https://github.com/docker/buildx-desktop/releases/download/v0.18.0-desktop.2/buildx-v0.18.0-desktop.2.windows-amd64.exe",
"https://github.com/docker/buildx-desktop/releases/download/v0.18.0-desktop.2/buildx-v0.18.0-desktop.2.windows-amd64.provenance.json",
"https://github.com/docker/buildx-desktop/releases/download/v0.18.0-desktop.2/buildx-v0.18.0-desktop.2.windows-amd64.sbom.json",
"https://github.com/docker/buildx-desktop/releases/download/v0.18.0-desktop.2/buildx-v0.18.0-desktop.2.windows-arm64.exe",
"https://github.com/docker/buildx-desktop/releases/download/v0.18.0-desktop.2/buildx-v0.18.0-desktop.2.windows-arm64.provenance.json",
"https://github.com/docker/buildx-desktop/releases/download/v0.18.0-desktop.2/buildx-v0.18.0-desktop.2.windows-arm64.sbom.json",
"https://github.com/docker/buildx-desktop/releases/download/v0.18.0-desktop.2/checksums.txt"
]
},
"v0.17.1-desktop.1": {
"id": 174998914,
"tag_name": "v0.17.1-desktop.1",

View File

@@ -1,43 +1,125 @@
{
"latest": {
"id": 174985224,
"tag_name": "v0.17.1",
"html_url": "https://github.com/docker/buildx/releases/tag/v0.17.1",
"id": 182806222,
"tag_name": "v0.18.0",
"html_url": "https://github.com/docker/buildx/releases/tag/v0.18.0",
"assets": [
"https://github.com/docker/buildx/releases/download/v0.17.1/buildx-v0.17.1.darwin-amd64",
"https://github.com/docker/buildx/releases/download/v0.17.1/buildx-v0.17.1.darwin-amd64.provenance.json",
"https://github.com/docker/buildx/releases/download/v0.17.1/buildx-v0.17.1.darwin-amd64.sbom.json",
"https://github.com/docker/buildx/releases/download/v0.17.1/buildx-v0.17.1.darwin-arm64",
"https://github.com/docker/buildx/releases/download/v0.17.1/buildx-v0.17.1.darwin-arm64.provenance.json",
"https://github.com/docker/buildx/releases/download/v0.17.1/buildx-v0.17.1.darwin-arm64.sbom.json",
"https://github.com/docker/buildx/releases/download/v0.17.1/buildx-v0.17.1.linux-amd64",
"https://github.com/docker/buildx/releases/download/v0.17.1/buildx-v0.17.1.linux-amd64.provenance.json",
"https://github.com/docker/buildx/releases/download/v0.17.1/buildx-v0.17.1.linux-amd64.sbom.json",
"https://github.com/docker/buildx/releases/download/v0.17.1/buildx-v0.17.1.linux-arm-v6",
"https://github.com/docker/buildx/releases/download/v0.17.1/buildx-v0.17.1.linux-arm-v6.provenance.json",
"https://github.com/docker/buildx/releases/download/v0.17.1/buildx-v0.17.1.linux-arm-v6.sbom.json",
"https://github.com/docker/buildx/releases/download/v0.17.1/buildx-v0.17.1.linux-arm-v7",
"https://github.com/docker/buildx/releases/download/v0.17.1/buildx-v0.17.1.linux-arm-v7.provenance.json",
"https://github.com/docker/buildx/releases/download/v0.17.1/buildx-v0.17.1.linux-arm-v7.sbom.json",
"https://github.com/docker/buildx/releases/download/v0.17.1/buildx-v0.17.1.linux-arm64",
"https://github.com/docker/buildx/releases/download/v0.17.1/buildx-v0.17.1.linux-arm64.provenance.json",
"https://github.com/docker/buildx/releases/download/v0.17.1/buildx-v0.17.1.linux-arm64.sbom.json",
"https://github.com/docker/buildx/releases/download/v0.17.1/buildx-v0.17.1.linux-ppc64le",
"https://github.com/docker/buildx/releases/download/v0.17.1/buildx-v0.17.1.linux-ppc64le.provenance.json",
"https://github.com/docker/buildx/releases/download/v0.17.1/buildx-v0.17.1.linux-ppc64le.sbom.json",
"https://github.com/docker/buildx/releases/download/v0.17.1/buildx-v0.17.1.linux-riscv64",
"https://github.com/docker/buildx/releases/download/v0.17.1/buildx-v0.17.1.linux-riscv64.provenance.json",
"https://github.com/docker/buildx/releases/download/v0.17.1/buildx-v0.17.1.linux-riscv64.sbom.json",
"https://github.com/docker/buildx/releases/download/v0.17.1/buildx-v0.17.1.linux-s390x",
"https://github.com/docker/buildx/releases/download/v0.17.1/buildx-v0.17.1.linux-s390x.provenance.json",
"https://github.com/docker/buildx/releases/download/v0.17.1/buildx-v0.17.1.linux-s390x.sbom.json",
"https://github.com/docker/buildx/releases/download/v0.17.1/buildx-v0.17.1.windows-amd64.exe",
"https://github.com/docker/buildx/releases/download/v0.17.1/buildx-v0.17.1.windows-amd64.provenance.json",
"https://github.com/docker/buildx/releases/download/v0.17.1/buildx-v0.17.1.windows-amd64.sbom.json",
"https://github.com/docker/buildx/releases/download/v0.17.1/buildx-v0.17.1.windows-arm64.exe",
"https://github.com/docker/buildx/releases/download/v0.17.1/buildx-v0.17.1.windows-arm64.provenance.json",
"https://github.com/docker/buildx/releases/download/v0.17.1/buildx-v0.17.1.windows-arm64.sbom.json",
"https://github.com/docker/buildx/releases/download/v0.17.1/checksums.txt"
"https://github.com/docker/buildx/releases/download/v0.18.0/buildx-v0.18.0.darwin-amd64",
"https://github.com/docker/buildx/releases/download/v0.18.0/buildx-v0.18.0.darwin-amd64.provenance.json",
"https://github.com/docker/buildx/releases/download/v0.18.0/buildx-v0.18.0.darwin-amd64.sbom.json",
"https://github.com/docker/buildx/releases/download/v0.18.0/buildx-v0.18.0.darwin-arm64",
"https://github.com/docker/buildx/releases/download/v0.18.0/buildx-v0.18.0.darwin-arm64.provenance.json",
"https://github.com/docker/buildx/releases/download/v0.18.0/buildx-v0.18.0.darwin-arm64.sbom.json",
"https://github.com/docker/buildx/releases/download/v0.18.0/buildx-v0.18.0.linux-amd64",
"https://github.com/docker/buildx/releases/download/v0.18.0/buildx-v0.18.0.linux-amd64.provenance.json",
"https://github.com/docker/buildx/releases/download/v0.18.0/buildx-v0.18.0.linux-amd64.sbom.json",
"https://github.com/docker/buildx/releases/download/v0.18.0/buildx-v0.18.0.linux-arm-v6",
"https://github.com/docker/buildx/releases/download/v0.18.0/buildx-v0.18.0.linux-arm-v6.provenance.json",
"https://github.com/docker/buildx/releases/download/v0.18.0/buildx-v0.18.0.linux-arm-v6.sbom.json",
"https://github.com/docker/buildx/releases/download/v0.18.0/buildx-v0.18.0.linux-arm-v7",
"https://github.com/docker/buildx/releases/download/v0.18.0/buildx-v0.18.0.linux-arm-v7.provenance.json",
"https://github.com/docker/buildx/releases/download/v0.18.0/buildx-v0.18.0.linux-arm-v7.sbom.json",
"https://github.com/docker/buildx/releases/download/v0.18.0/buildx-v0.18.0.linux-arm64",
"https://github.com/docker/buildx/releases/download/v0.18.0/buildx-v0.18.0.linux-arm64.provenance.json",
"https://github.com/docker/buildx/releases/download/v0.18.0/buildx-v0.18.0.linux-arm64.sbom.json",
"https://github.com/docker/buildx/releases/download/v0.18.0/buildx-v0.18.0.linux-ppc64le",
"https://github.com/docker/buildx/releases/download/v0.18.0/buildx-v0.18.0.linux-ppc64le.provenance.json",
"https://github.com/docker/buildx/releases/download/v0.18.0/buildx-v0.18.0.linux-ppc64le.sbom.json",
"https://github.com/docker/buildx/releases/download/v0.18.0/buildx-v0.18.0.linux-riscv64",
"https://github.com/docker/buildx/releases/download/v0.18.0/buildx-v0.18.0.linux-riscv64.provenance.json",
"https://github.com/docker/buildx/releases/download/v0.18.0/buildx-v0.18.0.linux-riscv64.sbom.json",
"https://github.com/docker/buildx/releases/download/v0.18.0/buildx-v0.18.0.linux-s390x",
"https://github.com/docker/buildx/releases/download/v0.18.0/buildx-v0.18.0.linux-s390x.provenance.json",
"https://github.com/docker/buildx/releases/download/v0.18.0/buildx-v0.18.0.linux-s390x.sbom.json",
"https://github.com/docker/buildx/releases/download/v0.18.0/buildx-v0.18.0.windows-amd64.exe",
"https://github.com/docker/buildx/releases/download/v0.18.0/buildx-v0.18.0.windows-amd64.provenance.json",
"https://github.com/docker/buildx/releases/download/v0.18.0/buildx-v0.18.0.windows-amd64.sbom.json",
"https://github.com/docker/buildx/releases/download/v0.18.0/buildx-v0.18.0.windows-arm64.exe",
"https://github.com/docker/buildx/releases/download/v0.18.0/buildx-v0.18.0.windows-arm64.provenance.json",
"https://github.com/docker/buildx/releases/download/v0.18.0/buildx-v0.18.0.windows-arm64.sbom.json",
"https://github.com/docker/buildx/releases/download/v0.18.0/checksums.txt"
]
},
"v0.18.0": {
"id": 182806222,
"tag_name": "v0.18.0",
"html_url": "https://github.com/docker/buildx/releases/tag/v0.18.0",
"assets": [
"https://github.com/docker/buildx/releases/download/v0.18.0/buildx-v0.18.0.darwin-amd64",
"https://github.com/docker/buildx/releases/download/v0.18.0/buildx-v0.18.0.darwin-amd64.provenance.json",
"https://github.com/docker/buildx/releases/download/v0.18.0/buildx-v0.18.0.darwin-amd64.sbom.json",
"https://github.com/docker/buildx/releases/download/v0.18.0/buildx-v0.18.0.darwin-arm64",
"https://github.com/docker/buildx/releases/download/v0.18.0/buildx-v0.18.0.darwin-arm64.provenance.json",
"https://github.com/docker/buildx/releases/download/v0.18.0/buildx-v0.18.0.darwin-arm64.sbom.json",
"https://github.com/docker/buildx/releases/download/v0.18.0/buildx-v0.18.0.linux-amd64",
"https://github.com/docker/buildx/releases/download/v0.18.0/buildx-v0.18.0.linux-amd64.provenance.json",
"https://github.com/docker/buildx/releases/download/v0.18.0/buildx-v0.18.0.linux-amd64.sbom.json",
"https://github.com/docker/buildx/releases/download/v0.18.0/buildx-v0.18.0.linux-arm-v6",
"https://github.com/docker/buildx/releases/download/v0.18.0/buildx-v0.18.0.linux-arm-v6.provenance.json",
"https://github.com/docker/buildx/releases/download/v0.18.0/buildx-v0.18.0.linux-arm-v6.sbom.json",
"https://github.com/docker/buildx/releases/download/v0.18.0/buildx-v0.18.0.linux-arm-v7",
"https://github.com/docker/buildx/releases/download/v0.18.0/buildx-v0.18.0.linux-arm-v7.provenance.json",
"https://github.com/docker/buildx/releases/download/v0.18.0/buildx-v0.18.0.linux-arm-v7.sbom.json",
"https://github.com/docker/buildx/releases/download/v0.18.0/buildx-v0.18.0.linux-arm64",
"https://github.com/docker/buildx/releases/download/v0.18.0/buildx-v0.18.0.linux-arm64.provenance.json",
"https://github.com/docker/buildx/releases/download/v0.18.0/buildx-v0.18.0.linux-arm64.sbom.json",
"https://github.com/docker/buildx/releases/download/v0.18.0/buildx-v0.18.0.linux-ppc64le",
"https://github.com/docker/buildx/releases/download/v0.18.0/buildx-v0.18.0.linux-ppc64le.provenance.json",
"https://github.com/docker/buildx/releases/download/v0.18.0/buildx-v0.18.0.linux-ppc64le.sbom.json",
"https://github.com/docker/buildx/releases/download/v0.18.0/buildx-v0.18.0.linux-riscv64",
"https://github.com/docker/buildx/releases/download/v0.18.0/buildx-v0.18.0.linux-riscv64.provenance.json",
"https://github.com/docker/buildx/releases/download/v0.18.0/buildx-v0.18.0.linux-riscv64.sbom.json",
"https://github.com/docker/buildx/releases/download/v0.18.0/buildx-v0.18.0.linux-s390x",
"https://github.com/docker/buildx/releases/download/v0.18.0/buildx-v0.18.0.linux-s390x.provenance.json",
"https://github.com/docker/buildx/releases/download/v0.18.0/buildx-v0.18.0.linux-s390x.sbom.json",
"https://github.com/docker/buildx/releases/download/v0.18.0/buildx-v0.18.0.windows-amd64.exe",
"https://github.com/docker/buildx/releases/download/v0.18.0/buildx-v0.18.0.windows-amd64.provenance.json",
"https://github.com/docker/buildx/releases/download/v0.18.0/buildx-v0.18.0.windows-amd64.sbom.json",
"https://github.com/docker/buildx/releases/download/v0.18.0/buildx-v0.18.0.windows-arm64.exe",
"https://github.com/docker/buildx/releases/download/v0.18.0/buildx-v0.18.0.windows-arm64.provenance.json",
"https://github.com/docker/buildx/releases/download/v0.18.0/buildx-v0.18.0.windows-arm64.sbom.json",
"https://github.com/docker/buildx/releases/download/v0.18.0/checksums.txt"
]
},
"v0.18.0-rc3": {
"id": 182564109,
"tag_name": "v0.18.0-rc3",
"html_url": "https://github.com/docker/buildx/releases/tag/v0.18.0-rc3",
"assets": [
"https://github.com/docker/buildx/releases/download/v0.18.0-rc3/buildx-v0.18.0-rc3.darwin-amd64",
"https://github.com/docker/buildx/releases/download/v0.18.0-rc3/buildx-v0.18.0-rc3.darwin-amd64.provenance.json",
"https://github.com/docker/buildx/releases/download/v0.18.0-rc3/buildx-v0.18.0-rc3.darwin-amd64.sbom.json",
"https://github.com/docker/buildx/releases/download/v0.18.0-rc3/buildx-v0.18.0-rc3.darwin-arm64",
"https://github.com/docker/buildx/releases/download/v0.18.0-rc3/buildx-v0.18.0-rc3.darwin-arm64.provenance.json",
"https://github.com/docker/buildx/releases/download/v0.18.0-rc3/buildx-v0.18.0-rc3.darwin-arm64.sbom.json",
"https://github.com/docker/buildx/releases/download/v0.18.0-rc3/buildx-v0.18.0-rc3.linux-amd64",
"https://github.com/docker/buildx/releases/download/v0.18.0-rc3/buildx-v0.18.0-rc3.linux-amd64.provenance.json",
"https://github.com/docker/buildx/releases/download/v0.18.0-rc3/buildx-v0.18.0-rc3.linux-amd64.sbom.json",
"https://github.com/docker/buildx/releases/download/v0.18.0-rc3/buildx-v0.18.0-rc3.linux-arm-v6",
"https://github.com/docker/buildx/releases/download/v0.18.0-rc3/buildx-v0.18.0-rc3.linux-arm-v6.provenance.json",
"https://github.com/docker/buildx/releases/download/v0.18.0-rc3/buildx-v0.18.0-rc3.linux-arm-v6.sbom.json",
"https://github.com/docker/buildx/releases/download/v0.18.0-rc3/buildx-v0.18.0-rc3.linux-arm-v7",
"https://github.com/docker/buildx/releases/download/v0.18.0-rc3/buildx-v0.18.0-rc3.linux-arm-v7.provenance.json",
"https://github.com/docker/buildx/releases/download/v0.18.0-rc3/buildx-v0.18.0-rc3.linux-arm-v7.sbom.json",
"https://github.com/docker/buildx/releases/download/v0.18.0-rc3/buildx-v0.18.0-rc3.linux-arm64",
"https://github.com/docker/buildx/releases/download/v0.18.0-rc3/buildx-v0.18.0-rc3.linux-arm64.provenance.json",
"https://github.com/docker/buildx/releases/download/v0.18.0-rc3/buildx-v0.18.0-rc3.linux-arm64.sbom.json",
"https://github.com/docker/buildx/releases/download/v0.18.0-rc3/buildx-v0.18.0-rc3.linux-ppc64le",
"https://github.com/docker/buildx/releases/download/v0.18.0-rc3/buildx-v0.18.0-rc3.linux-ppc64le.provenance.json",
"https://github.com/docker/buildx/releases/download/v0.18.0-rc3/buildx-v0.18.0-rc3.linux-ppc64le.sbom.json",
"https://github.com/docker/buildx/releases/download/v0.18.0-rc3/buildx-v0.18.0-rc3.linux-riscv64",
"https://github.com/docker/buildx/releases/download/v0.18.0-rc3/buildx-v0.18.0-rc3.linux-riscv64.provenance.json",
"https://github.com/docker/buildx/releases/download/v0.18.0-rc3/buildx-v0.18.0-rc3.linux-riscv64.sbom.json",
"https://github.com/docker/buildx/releases/download/v0.18.0-rc3/buildx-v0.18.0-rc3.linux-s390x",
"https://github.com/docker/buildx/releases/download/v0.18.0-rc3/buildx-v0.18.0-rc3.linux-s390x.provenance.json",
"https://github.com/docker/buildx/releases/download/v0.18.0-rc3/buildx-v0.18.0-rc3.linux-s390x.sbom.json",
"https://github.com/docker/buildx/releases/download/v0.18.0-rc3/buildx-v0.18.0-rc3.windows-amd64.exe",
"https://github.com/docker/buildx/releases/download/v0.18.0-rc3/buildx-v0.18.0-rc3.windows-amd64.provenance.json",
"https://github.com/docker/buildx/releases/download/v0.18.0-rc3/buildx-v0.18.0-rc3.windows-amd64.sbom.json",
"https://github.com/docker/buildx/releases/download/v0.18.0-rc3/buildx-v0.18.0-rc3.windows-arm64.exe",
"https://github.com/docker/buildx/releases/download/v0.18.0-rc3/buildx-v0.18.0-rc3.windows-arm64.provenance.json",
"https://github.com/docker/buildx/releases/download/v0.18.0-rc3/buildx-v0.18.0-rc3.windows-arm64.sbom.json",
"https://github.com/docker/buildx/releases/download/v0.18.0-rc3/checksums.txt"
]
},
"v0.18.0-rc2": {

View File

@@ -5,6 +5,12 @@
"html_url": "https://github.com/moby/moby/releases/tag/v27.3.1",
"assets": []
},
"v27.4.0-rc.1": {
"id": 185528936,
"tag_name": "v27.4.0-rc.1",
"html_url": "https://github.com/moby/moby/releases/tag/v27.4.0-rc.1",
"assets": []
},
"v23.0.15": {
"id": 178729348,
"tag_name": "v23.0.15",

View File

@@ -15,8 +15,8 @@ on:
env:
NODE_VERSION: "20"
BUILDX_VERSION: "v0.17.1"
BUILDKIT_IMAGE: "moby/buildkit:v0.16.0"
BUILDX_VERSION: "v0.18.0"
BUILDKIT_IMAGE: "moby/buildkit:v0.17.0"
jobs:
test:
@@ -43,10 +43,10 @@ jobs:
shell: bash
-
name: Upload coverage
uses: codecov/codecov-action@v4
uses: codecov/codecov-action@v5
if: env.RUN_CODECOV == 'true'
with:
file: ./coverage/clover.xml
files: ./coverage/clover.xml
flags: unit
token: ${{ secrets.CODECOV_TOKEN }}
@@ -98,7 +98,6 @@ jobs:
- ubuntu-latest
#- macos-14 # no virt: https://github.com/docker/actions-toolkit/issues/317
- macos-13
- macos-12
- windows-latest
steps:
-
@@ -163,9 +162,9 @@ jobs:
shell: bash
-
name: Upload coverage
uses: codecov/codecov-action@v4
uses: codecov/codecov-action@v5
if: env.RUN_CODECOV == 'true'
with:
file: ./coverage/clover.xml
files: ./coverage/clover.xml
flags: itg
token: ${{ secrets.CODECOV_TOKEN }}

View File

@@ -17,16 +17,17 @@ jobs:
prepare:
runs-on: ubuntu-20.04
outputs:
targets: ${{ steps.targets.outputs.matrix }}
targets: ${{ steps.generate.outputs.targets }}
steps:
-
name: Checkout
uses: actions/checkout@v4
-
name: Matrix
id: targets
run: |
echo "matrix=$(docker buildx bake validate --print | jq -cr '.group.validate.targets')" >> $GITHUB_OUTPUT
name: List targets
id: generate
uses: docker/bake-action/subaction/list-targets@v5
with:
target: validate
validate:
runs-on: ubuntu-latest

View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/
import {jest, describe, expect, test, beforeEach, afterEach} from '@jest/globals';
import {jest, describe, test, beforeEach, afterEach, expect} from '@jest/globals';
import fs from 'fs';
import os from 'os';
import path from 'path';
@@ -23,7 +23,7 @@ import {Install, InstallSourceArchive, InstallSourceImage} from '../../src/docke
import {Docker} from '../../src/docker/docker';
import {Exec} from '../../src/exec';
const tmpDir = fs.mkdtempSync(path.join(process.env.TEMP || os.tmpdir(), 'docker-install-itg-'));
const tmpDir = () => fs.mkdtempSync(path.join(process.env.TEMP || os.tmpdir(), 'docker-install-itg-'));
describe('install', () => {
const originalEnv = process.env;
@@ -43,34 +43,82 @@ aarch64:https://cloud.debian.org/images/cloud/bookworm/20231013-1532/debian-12-g
test.each([
{type: 'image', tag: '27.3.1'} as InstallSourceImage,
{type: 'image', tag: 'master'} as InstallSourceImage,
{type: 'image', tag: 'latest'} as InstallSourceImage,
{type: 'archive', version: 'v26.1.4', channel: 'stable'} as InstallSourceArchive,
{type: 'archive', version: 'latest', channel: 'stable'} as InstallSourceArchive,
])(
'install docker %s', async (source) => {
if (process.env.ImageOS && process.env.ImageOS.startsWith('ubuntu')) {
// Remove containerd first on ubuntu runners to make sure it takes
// ones packaged with docker
await Exec.exec('sudo', ['apt-get', 'remove', '-y', 'containerd.io'], {
env: Object.assign({}, process.env, {
DEBIAN_FRONTEND: 'noninteractive'
}) as {
[key: string]: string;
}
});
}
await ensureNoSystemContainerd();
const install = new Install({
source: source,
runDir: tmpDir,
runDir: tmpDir(),
contextName: 'foo',
daemonConfig: `{"debug":true,"features":{"containerd-snapshotter":true}}`
});
await expect((async () => {
await install.download();
await install.install();
await Docker.printVersion();
await Docker.printInfo();
})().finally(async () => {
await install.tearDown();
})).resolves.not.toThrow();
await expect(tryInstall(install)).resolves.not.toThrow();
}, 30 * 60 * 1000);
});
describe('rootless', () => {
// prettier-ignore
test.each([
{type: 'image', tag: 'latest'} as InstallSourceImage,
{type: 'archive', version: 'latest', channel: 'stable'} as InstallSourceArchive,
])(
'install %s', async (source) => {
// Skip on non linux
if (os.platform() !== 'linux') {
return;
}
await ensureNoSystemContainerd();
const install = new Install({
source: source,
runDir: tmpDir(),
contextName: 'foo',
daemonConfig: `{"debug":true}`,
rootless: true
});
await expect(
tryInstall(install, async () => {
const out = await Docker.getExecOutput(['info', '-f', '{{json .SecurityOptions}}']);
expect(out.exitCode).toBe(0);
expect(out.stderr.trim()).toBe('');
expect(out.stdout.trim()).toContain('rootless');
})
).resolves.not.toThrow();
},
30 * 60 * 1000
);
});
async function tryInstall(install: Install, extraCheck?: () => Promise<void>): Promise<void> {
try {
await install.download();
await install.install();
await Docker.printVersion();
await Docker.printInfo();
if (extraCheck) {
await extraCheck();
}
} catch (error) {
console.error(error);
throw error;
} finally {
await install.tearDown();
}
}
async function ensureNoSystemContainerd() {
if (process.env.ImageOS && process.env.ImageOS.startsWith('ubuntu')) {
// Remove containerd first on ubuntu runners to make sure it takes
// ones packaged with docker
await Exec.exec('sudo', ['apt-get', 'remove', '-y', 'containerd.io'], {
env: Object.assign({}, process.env, {
DEBIAN_FRONTEND: 'noninteractive'
}) as {
[key: string]: string;
}
});
}
}

View File

@@ -279,3 +279,10 @@ describe('tag', () => {
});
});
});
describe('getCommitDate', () => {
it('head', async () => {
const date = await Git.commitDate('HEAD');
await expect(date).toBeInstanceOf(Date);
});
});

View File

@@ -0,0 +1,84 @@
/**
* Copyright 2024 actions-toolkit authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import fs from 'fs';
import os from 'os';
import path from 'path';
import {describe, expect, it, jest, test} from '@jest/globals';
import * as semver from 'semver';
import {Exec} from '../../src/exec';
import {Undock} from '../../src/undock/undock';
const tmpDir = fs.mkdtempSync(path.join(process.env.TEMP || os.tmpdir(), 'undock-undock-'));
describe('run', () => {
it('extracts moby/moby-bin:26.1.5', async () => {
const undock = new Undock();
await expect(
(async () => {
// prettier-ignore
await undock.run({
source: 'moby/moby-bin:26.1.5',
dist: tmpDir,
all: true
});
})()
).resolves.not.toThrow();
}, 100000);
});
describe('isAvailable', () => {
it('checks undock is available', async () => {
const execSpy = jest.spyOn(Exec, 'getExecOutput');
const undock = new Undock();
await undock.isAvailable();
// eslint-disable-next-line jest/no-standalone-expect
expect(execSpy).toHaveBeenCalledWith(`undock`, [], {
silent: true,
ignoreReturnCode: true
});
});
});
describe('printVersion', () => {
it('prints undock version', async () => {
const execSpy = jest.spyOn(Exec, 'exec');
const undock = new Undock();
await undock.printVersion();
expect(execSpy).toHaveBeenCalledWith(`undock`, ['--version'], {
failOnStdErr: false
});
});
});
describe('version', () => {
it('valid', async () => {
const undock = new Undock();
expect(semver.valid(await undock.version())).not.toBeUndefined();
});
});
describe('versionSatisfies', () => {
test.each([
['v0.4.1', '>=0.3.2', true],
['v0.8.0', '>0.6.0', true],
['v0.8.0', '<0.3.0', false]
])('given %p', async (version, range, expected) => {
const undock = new Undock();
expect(await undock.versionSatisfies(range, version)).toBe(expected);
});
});

View File

@@ -16,7 +16,8 @@
ARG NODE_VERSION=20
ARG DOCKER_VERSION=27.2.1
ARG BUILDX_VERSION=0.17.1
ARG BUILDX_VERSION=0.18.0
ARG UNDOCK_VERSION=0.8.0
FROM node:${NODE_VERSION}-alpine AS base
RUN apk add --no-cache cpio findutils git
@@ -73,8 +74,9 @@ RUN --mount=type=bind,target=.,rw \
--mount=type=cache,target=/src/node_modules \
yarn run lint
FROM docker:${DOCKER_VERSION} as docker
FROM docker/buildx-bin:${BUILDX_VERSION} as buildx
FROM docker:${DOCKER_VERSION} AS docker
FROM docker/buildx-bin:${BUILDX_VERSION} AS buildx
FROM crazymax/undock:${UNDOCK_VERSION} AS undock
FROM deps AS test
RUN --mount=type=bind,target=.,rw \
@@ -83,6 +85,7 @@ RUN --mount=type=bind,target=.,rw \
--mount=type=bind,from=docker,source=/usr/local/bin/docker,target=/usr/bin/docker \
--mount=type=bind,from=buildx,source=/buildx,target=/usr/libexec/docker/cli-plugins/docker-buildx \
--mount=type=bind,from=buildx,source=/buildx,target=/usr/bin/buildx \
--mount=type=bind,from=undock,source=/usr/local/bin/undock,target=/usr/bin/undock \
--mount=type=secret,id=GITHUB_TOKEN \
GITHUB_TOKEN=$(cat /run/secrets/GITHUB_TOKEN) yarn run test:coverage --coverageDirectory=/tmp/coverage

View File

@@ -21,7 +21,7 @@ group "pre-checkin" {
}
group "validate" {
targets = ["lint", "vendor-validate", "license-validate"]
targets = ["lint", "vendor-validate", "dockerfile-validate", "license-validate"]
}
target "build" {
@@ -54,6 +54,18 @@ target "vendor-validate" {
output = ["type=cacheonly"]
}
target "dockerfile-validate" {
matrix = {
dockerfile = [
"dev.Dockerfile",
"./hack/dockerfiles/license.Dockerfile"
]
}
name = "dockerfile-validate-${md5(dockerfile)}"
dockerfile = dockerfile
call = "check"
}
target "test" {
dockerfile = "dev.Dockerfile"
target = "test"

View File

@@ -46,7 +46,7 @@
},
"dependencies": {
"@actions/artifact": "^2.1.11",
"@actions/cache": "^3.2.4",
"@actions/cache": "^3.3.0",
"@actions/core": "^1.11.1",
"@actions/exec": "^1.1.1",
"@actions/github": "^6.0.0",

View File

@@ -237,12 +237,10 @@ provision:
HOME=/tmp undock moby/moby-bin:{{srcImageTag}} /usr/local/bin
wget https://raw.githubusercontent.com/moby/moby/{{srcImageTag}}/contrib/init/systemd/docker.service \
https://raw.githubusercontent.com/moby/moby/v{{srcImageTag}}/contrib/init/systemd/docker.service \
-O /etc/systemd/system/docker.service || true
wget https://raw.githubusercontent.com/moby/moby/{{srcImageTag}}/contrib/init/systemd/docker.socket \
https://raw.githubusercontent.com/moby/moby/v{{srcImageTag}}/contrib/init/systemd/docker.socket \
-O /etc/systemd/system/docker.socket || true
wget https://raw.githubusercontent.com/moby/moby/{{gitCommit}}/contrib/init/systemd/docker.service \
-O /etc/systemd/system/docker.service
wget https://raw.githubusercontent.com/moby/moby/{{gitCommit}}/contrib/init/systemd/docker.socket \
-O /etc/systemd/system/docker.socket
sed -i 's|^ExecStart=.*|ExecStart=/usr/local/bin/dockerd -H fd://|' /etc/systemd/system/docker.service
sed -i 's|containerd.service||' /etc/systemd/system/docker.service

View File

@@ -21,7 +21,6 @@ import os from 'os';
import path from 'path';
import retry from 'async-retry';
import * as handlebars from 'handlebars';
import * as util from 'util';
import * as core from '@actions/core';
import * as httpm from '@actions/http-client';
import * as io from '@actions/io';
@@ -34,6 +33,7 @@ import {Util} from '../util';
import {limaYamlData, dockerServiceLogsPs1, setupDockerWinPs1} from './assets';
import {GitHubRelease} from '../types/github';
import {HubRepository} from '../hubRepository';
import {Image} from '../types/oci/config';
export interface InstallSourceImage {
type: 'image';
@@ -55,6 +55,7 @@ export interface InstallOpts {
runDir: string;
contextName?: string;
daemonConfig?: string;
rootless?: boolean;
}
interface LimaImage {
@@ -64,17 +65,21 @@ interface LimaImage {
}
export class Install {
private readonly runDir: string;
private runDir: string;
private readonly source: InstallSource;
private readonly contextName: string;
private readonly daemonConfig?: string;
private _version: string | undefined;
private _toolDir: string | undefined;
private rootless: boolean;
private gitCommit: string | undefined;
private readonly limaInstanceName = 'docker-actions-toolkit';
constructor(opts: InstallOpts) {
this.runDir = opts.runDir;
this.rootless = opts.rootless || false;
this.source = opts.source || {
type: 'archive',
version: 'latest',
@@ -88,25 +93,25 @@ export class Install {
return this._toolDir || Context.tmpDir();
}
async downloadStaticArchive(src: InstallSourceArchive): Promise<string> {
async downloadStaticArchive(component: 'docker' | 'docker-rootless-extras', src: InstallSourceArchive): Promise<string> {
const release: GitHubRelease = await Install.getRelease(src.version);
this._version = release.tag_name.replace(/^v+|v+$/g, '');
core.debug(`docker.Install.download version: ${this._version}`);
const downloadURL = this.downloadURL(this._version, src.channel);
const downloadURL = this.downloadURL(component, this._version, src.channel);
core.info(`Downloading ${downloadURL}`);
const downloadPath = await tc.downloadTool(downloadURL);
core.debug(`docker.Install.download downloadPath: ${downloadPath}`);
let extractFolder: string;
let extractFolder;
if (os.platform() == 'win32') {
extractFolder = await tc.extractZip(downloadPath);
extractFolder = await tc.extractZip(downloadPath, extractFolder);
} else {
extractFolder = await tc.extractTar(downloadPath);
extractFolder = await tc.extractTar(downloadPath, extractFolder);
}
if (Util.isDirectory(path.join(extractFolder, 'docker'))) {
extractFolder = path.join(extractFolder, 'docker');
if (Util.isDirectory(path.join(extractFolder, component))) {
extractFolder = path.join(extractFolder, component);
}
core.debug(`docker.Install.download extractFolder: ${extractFolder}`);
return extractFolder;
@@ -127,12 +132,28 @@ export class Install {
const cli = await HubRepository.build('dockereng/cli-bin');
extractFolder = await cli.extractImage(tag);
const moby = await HubRepository.build('moby/moby-bin');
if (['win32', 'linux'].includes(platform)) {
core.info(`Downloading dockerd from moby/moby-bin:${tag}`);
const moby = await HubRepository.build('moby/moby-bin');
await moby.extractImage(tag, extractFolder);
} else if (platform == 'darwin') {
// On macOS, the docker daemon binary will be downloaded inside the lima VM
// On macOS, the docker daemon binary will be downloaded inside the lima VM.
// However, we will get the exact git revision from the image config
// to get the matching systemd unit files.
core.info(`Getting git revision from moby/moby-bin:${tag}`);
// There's no macOS image for moby/moby-bin - a linux daemon is run inside lima.
const manifest = await moby.getPlatformManifest(tag, 'linux');
const config = await moby.getJSONBlob<Image>(manifest.config.digest);
core.debug(`Config ${JSON.stringify(config.config)}`);
this.gitCommit = config.config?.Labels?.['org.opencontainers.image.revision'];
if (!this.gitCommit) {
core.warning(`No git revision can be determined from the image. Will use master.`);
this.gitCommit = 'master';
}
core.info(`Git revision is ${this.gitCommit}`);
} else {
core.warning(`dockerd not supported on ${platform}, only the Docker cli will be available`);
}
@@ -145,7 +166,16 @@ export class Install {
this._version = version;
core.info(`Downloading Docker ${version} from ${this.source.channel} at download.docker.com`);
extractFolder = await this.downloadStaticArchive(this.source);
extractFolder = await this.downloadStaticArchive('docker', this.source);
if (this.rootless) {
core.info(`Downloading Docker rootless extras ${version} from ${this.source.channel} at download.docker.com`);
const extrasFolder = await this.downloadStaticArchive('docker-rootless-extras', this.source);
fs.readdirSync(extrasFolder).forEach(file => {
const src = path.join(extrasFolder, file);
const dest = path.join(extractFolder, file);
fs.copyFileSync(src, dest);
});
}
break;
}
}
@@ -176,7 +206,13 @@ export class Install {
if (!this.runDir) {
throw new Error('runDir must be set');
}
switch (os.platform()) {
const platform = os.platform();
if (this.rootless && platform != 'linux') {
// TODO: Support on macOS (via lima)
throw new Error(`rootless is only supported on linux`);
}
switch (platform) {
case 'darwin': {
return await this.installDarwin();
}
@@ -193,6 +229,9 @@ export class Install {
}
private async installDarwin(): Promise<string> {
if (this.source.type == 'image' && !this.gitCommit) {
throw new Error('gitCommit must be set. Run download first.');
}
const src = this.source;
const limaDir = path.join(os.homedir(), '.lima', this.limaInstanceName);
await io.mkdirP(limaDir);
@@ -229,6 +268,7 @@ export class Install {
customImages: Install.limaCustomImages(),
daemonConfig: limaDaemonConfig,
dockerSock: `${limaDir}/docker.sock`,
gitCommit: this.gitCommit,
srcType: src.type,
srcArchiveVersion: this._version, // Use the resolved version (e.g. latest -> 27.4.0)
srcArchiveChannel: srcArchive.channel,
@@ -239,9 +279,14 @@ export class Install {
core.info(limaCfg);
});
const qemuArch = await Install.qemuArch();
if (!(await Install.qemuInstalled())) {
await core.group('Installing QEMU', async () => {
await Exec.exec('brew', ['install', 'qemu'], {env: envs});
});
}
const qemuBin = await Install.qemuBin();
await core.group('QEMU version', async () => {
await Exec.exec(`qemu-system-${qemuArch} --version`);
await Exec.exec(qemuBin, ['--version']);
});
// lima might already be started on the runner so env var added in download
@@ -316,21 +361,34 @@ export class Install {
}
const envs = Object.assign({}, process.env, {
PATH: `${this.toolDir}:${process.env.PATH}`
PATH: `${this.toolDir}:${process.env.PATH}`,
XDG_RUNTIME_DIR: (this.rootless && this.runDir) || undefined
}) as {
[key: string]: string;
};
await core.group('Start Docker daemon', async () => {
const bashPath: string = await io.which('bash', true);
const cmd = `${this.toolDir}/dockerd --host="${dockerHost}" --config-file="${daemonConfigPath}" --exec-root="${this.runDir}/execroot" --data-root="${this.runDir}/data" --pidfile="${this.runDir}/docker.pid" --userland-proxy=false`;
let dockerPath = `${this.toolDir}/dockerd`;
if (this.rootless) {
dockerPath = `${this.toolDir}/dockerd-rootless.sh`;
if (fs.existsSync('/proc/sys/kernel/apparmor_restrict_unprivileged_userns')) {
await Exec.exec('sudo', ['sh', '-c', 'echo 0 > /proc/sys/kernel/apparmor_restrict_unprivileged_userns']);
}
}
const cmd = `${dockerPath} --host="${dockerHost}" --config-file="${daemonConfigPath}" --exec-root="${this.runDir}/execroot" --data-root="${this.runDir}/data" --pidfile="${this.runDir}/docker.pid"`;
core.info(`[command] ${cmd}`); // https://github.com/actions/toolkit/blob/3d652d3133965f63309e4b2e1c8852cdbdcb3833/packages/exec/src/toolrunner.ts#L47
let sudo = 'sudo';
if (this.rootless) {
sudo += ' -u \\#1001';
}
const proc = await child_process.spawn(
// We can't use Exec.exec here because we need to detach the process to
// avoid killing it when the action finishes running. Even if detached,
// we also need to run dockerd in a subshell and unref the process so
// GitHub Action doesn't wait for it to finish.
`sudo env "PATH=$PATH" ${bashPath} << EOF
`${sudo} env "PATH=$PATH" ${bashPath} << EOF
( ${cmd} 2>&1 | tee "${this.runDir}/dockerd.log" ) &
EOF`,
[],
@@ -443,6 +501,13 @@ EOF`,
throw new Error(`Unsupported platform: ${os.platform()}`);
}
}
await core.group(`Cleaning up toolDir`, async () => {
if (!this._toolDir) {
return;
}
fs.rmSync(this._toolDir, {recursive: true, force: true});
});
}
private async tearDownDarwin(): Promise<void> {
@@ -492,13 +557,16 @@ EOF`,
await core.group('Removing Docker context', async () => {
await Docker.exec(['context', 'rm', '-f', this.contextName]);
});
await core.group('Stopping Docker daemon service', async () => {
await Exec.exec('powershell', ['-Command', `Stop-Service -Name docker -Force`]);
});
}
private downloadURL(version: string, channel: string): string {
private downloadURL(component: 'docker' | 'docker-rootless-extras', version: string, channel: string): string {
const platformOS = Install.platformOS();
const platformArch = Install.platformArch();
const ext = platformOS === 'win' ? '.zip' : '.tgz';
return util.format('https://download.docker.com/%s/static/%s/%s/docker-%s%s', platformOS, channel, platformArch, version, ext);
return `https://download.docker.com/${platformOS}/static/${channel}/${platformArch}/${component}-${version}${ext}`;
}
private static platformOS(): string {
@@ -554,29 +622,42 @@ EOF`,
return await io
.which('lima', true)
.then(res => {
core.debug(`docker.Install.limaAvailable ok: ${res}`);
core.debug(`docker.Install.limaInstalled ok: ${res}`);
return true;
})
.catch(error => {
core.debug(`docker.Install.limaAvailable error: ${error}`);
core.debug(`docker.Install.limaInstalled error: ${error}`);
return false;
});
}
private static async qemuArch(): Promise<string> {
private static async qemuBin(): Promise<string> {
switch (os.arch()) {
case 'x64': {
return 'x86_64';
return `qemu-system-x86_64`;
}
case 'arm64': {
return 'aarch64';
return `qemu-system-aarch64`;
}
default: {
return os.arch();
return `qemu-system-${os.arch()}`;
}
}
}
private static async qemuInstalled(): Promise<boolean> {
return await io
.which(await Install.qemuBin(), true)
.then(res => {
core.debug(`docker.Install.qemuInstalled ok: ${res}`);
return true;
})
.catch(error => {
core.debug(`docker.Install.qemuInstalled error: ${error}`);
return false;
});
}
public static async getRelease(version: string): Promise<GitHubRelease> {
const url = `https://raw.githubusercontent.com/docker/actions-toolkit/main/.github/docker-releases.json`;
const http: httpm.HttpClient = new httpm.HttpClient('docker-actions-toolkit');

View File

@@ -163,4 +163,8 @@ export class Git {
return res.stdout.trim();
});
}
public static async commitDate(ref: string): Promise<Date> {
return new Date(await Git.exec(['show', '-s', '--format="%ci"', ref]));
}
}

View File

@@ -21,8 +21,8 @@ import * as core from '@actions/core';
import {Manifest} from './types/oci/manifest';
import * as tc from '@actions/tool-cache';
import fs from 'fs';
import {MEDIATYPE_IMAGE_INDEX_V1, MEDIATYPE_IMAGE_MANIFEST_V1} from './types/oci/mediatype';
import {MEDIATYPE_IMAGE_MANIFEST_V2, MEDIATYPE_IMAGE_MANIFEST_LIST_V2} from './types/docker/mediatype';
import {MEDIATYPE_IMAGE_CONFIG_V1, MEDIATYPE_IMAGE_INDEX_V1, MEDIATYPE_IMAGE_MANIFEST_V1} from './types/oci/mediatype';
import {MEDIATYPE_IMAGE_CONFIG_V1 as DOCKER_MEDIATYPE_IMAGE_CONFIG_V1, MEDIATYPE_IMAGE_MANIFEST_LIST_V2, MEDIATYPE_IMAGE_MANIFEST_V2} from './types/docker/mediatype';
import {DockerHub} from './dockerhub';
export class HubRepository {
@@ -40,15 +40,20 @@ export class HubRepository {
return new HubRepository(repository, token);
}
public async getPlatformManifest(tagOrDigest: string, os?: string): Promise<Manifest> {
const index = await this.getManifest<Index>(tagOrDigest);
if (index.mediaType != MEDIATYPE_IMAGE_INDEX_V1 && index.mediaType != MEDIATYPE_IMAGE_MANIFEST_LIST_V2) {
core.error(`Unsupported image media type: ${index.mediaType}`);
throw new Error(`Unsupported image media type: ${index.mediaType}`);
}
const digest = HubRepository.getPlatformManifestDigest(index, os);
return await this.getManifest<Manifest>(digest);
}
// Unpacks the image layers and returns the path to the extracted image.
// Only OCI indexes/manifest list are supported for now.
public async extractImage(tag: string, destDir?: string): Promise<string> {
const index = await this.getManifest<Index>(tag);
if (index.mediaType != MEDIATYPE_IMAGE_INDEX_V1 && index.mediaType != MEDIATYPE_IMAGE_MANIFEST_LIST_V2) {
throw new Error(`Unsupported image media type: ${index.mediaType}`);
}
const digest = HubRepository.getPlatformManifestDigest(index);
const manifest = await this.getManifest<Manifest>(digest);
const manifest = await this.getPlatformManifest(tag);
const paths = manifest.layers.map(async layer => {
const url = this.blobUrl(layer.digest);
@@ -99,25 +104,35 @@ export class HubRepository {
}
public async getManifest<T>(tagOrDigest: string): Promise<T> {
const url = `https://registry-1.docker.io/v2/${this.repo}/manifests/${tagOrDigest}`;
return await this.registryGet<T>(tagOrDigest, 'manifests', [MEDIATYPE_IMAGE_INDEX_V1, MEDIATYPE_IMAGE_MANIFEST_LIST_V2, MEDIATYPE_IMAGE_MANIFEST_V1, MEDIATYPE_IMAGE_MANIFEST_V2]);
}
public async getJSONBlob<T>(tagOrDigest: string): Promise<T> {
return await this.registryGet<T>(tagOrDigest, 'blobs', [MEDIATYPE_IMAGE_CONFIG_V1, DOCKER_MEDIATYPE_IMAGE_CONFIG_V1]);
}
private async registryGet<T>(tagOrDigest: string, endpoint: 'manifests' | 'blobs', accept: Array<string>): Promise<T> {
const url = `https://registry-1.docker.io/v2/${this.repo}/${endpoint}/${tagOrDigest}`;
const headers = {
Authorization: `Bearer ${this.token}`,
Accept: [MEDIATYPE_IMAGE_INDEX_V1, MEDIATYPE_IMAGE_MANIFEST_LIST_V2, MEDIATYPE_IMAGE_MANIFEST_V1, MEDIATYPE_IMAGE_MANIFEST_V2].join(', ')
Accept: accept.join(', ')
};
const resp = await HubRepository.http.get(url, headers);
const body = await resp.readBody();
const statusCode = resp.message.statusCode || 500;
if (statusCode != 200) {
core.error(`registryGet(${this.repo}:${tagOrDigest}) failed: ${statusCode} ${body}`);
throw DockerHub.parseError(resp, body);
}
return <T>JSON.parse(body);
}
private static getPlatformManifestDigest(index: Index): string {
private static getPlatformManifestDigest(index: Index, osOverride?: string): string {
// This doesn't handle all possible platforms normalizations, but it's good enough for now.
let pos: string = os.platform();
let pos: string = osOverride || os.platform();
if (pos == 'win32') {
pos = 'windows';
}
@@ -150,8 +165,10 @@ export class HubRepository {
return true;
});
if (!manifest) {
core.error(`Cannot find manifest for ${pos}/${arch}/${variant}`);
throw new Error(`Cannot find manifest for ${pos}/${arch}/${variant}`);
}
return manifest.digest;
}
}

View File

@@ -20,6 +20,7 @@ import {Bake as BuildxBake} from './buildx/bake';
import {Install as BuildxInstall} from './buildx/install';
import {Builder} from './buildx/builder';
import {BuildKit} from './buildkit/buildkit';
import {Undock} from './undock/undock';
import {GitHub} from './github';
export interface ToolkitOpts {
@@ -38,6 +39,7 @@ export class Toolkit {
public buildxInstall: BuildxInstall;
public builder: Builder;
public buildkit: BuildKit;
public undock: Undock;
constructor(opts: ToolkitOpts = {}) {
this.github = new GitHub({token: opts.githubToken});
@@ -47,5 +49,6 @@ export class Toolkit {
this.buildxInstall = new BuildxInstall();
this.builder = new Builder({buildx: this.buildx});
this.buildkit = new BuildKit({buildx: this.buildx});
this.undock = new Undock();
}
}

View File

@@ -17,3 +17,5 @@
export const MEDIATYPE_IMAGE_MANIFEST_LIST_V2 = 'application/vnd.docker.distribution.manifest.list.v2+json';
export const MEDIATYPE_IMAGE_MANIFEST_V2 = 'application/vnd.docker.distribution.manifest.v2+json';
export const MEDIATYPE_IMAGE_CONFIG_V1 = 'application/vnd.docker.container.image.v1+json';

View File

@@ -23,3 +23,5 @@ export const MEDIATYPE_IMAGE_INDEX_V1 = 'application/vnd.oci.image.index.v1+json
export const MEDIATYPE_IMAGE_LAYER_V1 = 'application/vnd.oci.image.layer.v1.tar';
export const MEDIATYPE_EMPTY_JSON_V1 = 'application/vnd.oci.empty.v1+json';
export const MEDIATYPE_IMAGE_CONFIG_V1 = 'application/vnd.oci.image.config.v1+json';

148
src/undock/undock.ts Normal file
View File

@@ -0,0 +1,148 @@
/**
* Copyright 2024 actions-toolkit authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import * as core from '@actions/core';
import * as semver from 'semver';
import {Exec} from '../exec';
export interface UndockOpts {
binPath?: string;
}
export interface UndockRunOpts {
source: string;
dist: string;
logLevel?: string;
logCaller?: boolean;
cacheDir?: string;
platform?: string;
all?: boolean;
include?: Array<string>;
insecure?: boolean;
rmDist?: boolean;
wrap?: boolean;
}
export class Undock {
private readonly binPath: string;
private _version: string;
private _versionOnce: boolean;
constructor(opts?: UndockOpts) {
this.binPath = opts?.binPath || 'undock';
this._version = '';
this._versionOnce = false;
}
public async run(opts: UndockRunOpts): Promise<void> {
if (!opts.source) {
throw new Error('source is required');
}
if (!opts.dist) {
throw new Error('dist is required');
}
const args: Array<string> = [];
if (opts.logLevel) {
args.push(`--log-level=${opts.logLevel}`);
}
if (opts.logCaller) {
args.push('--log-caller');
}
if (opts.cacheDir) {
args.push(`--cachedir=${opts.cacheDir}`);
}
if (opts.platform) {
args.push(`--platform=${opts.platform}`);
}
if (opts.all) {
args.push('--all');
}
if (opts.include) {
opts.include.forEach(i => {
args.push(`--include=${i}`);
});
}
if (opts.insecure) {
args.push('--insecure');
}
if (opts.rmDist) {
args.push('--rm-dist');
}
if (opts.wrap) {
args.push('--wrap');
}
args.push(opts.source, opts.dist);
await Exec.exec(this.binPath, args, {
failOnStdErr: false
});
}
public async isAvailable(): Promise<boolean> {
const ok: boolean = await Exec.getExecOutput(this.binPath, [], {
ignoreReturnCode: true,
silent: true
})
.then(res => {
if (res.stderr.length > 0 && res.exitCode != 0) {
core.debug(`Undock.isAvailable cmd err: ${res.stderr.trim()}`);
return false;
}
return res.exitCode == 0;
})
.catch(error => {
core.debug(`Undock.isAvailable error: ${error}`);
return false;
});
core.debug(`Undock.isAvailable: ${ok}`);
return ok;
}
public async version(): Promise<string> {
if (this._versionOnce) {
return this._version;
}
this._versionOnce = true;
this._version = await Exec.getExecOutput(this.binPath, ['--version'], {
ignoreReturnCode: true,
silent: true
}).then(res => {
if (res.stderr.length > 0 && res.exitCode != 0) {
throw new Error(res.stderr.trim());
}
return res.stdout.trim();
});
return this._version;
}
public async printVersion() {
await Exec.exec(this.binPath, ['--version'], {
failOnStdErr: false
});
}
public async versionSatisfies(range: string, version?: string): Promise<boolean> {
const ver = version ?? (await this.version());
if (!ver) {
core.debug(`Undock.versionSatisfies false: undefined version`);
return false;
}
const res = semver.satisfies(ver, range) || /^[0-9a-f]{7}$/.exec(ver) !== null;
core.debug(`Undock.versionSatisfies ${ver} statisfies ${range}: ${res}`);
return res;
}
}

View File

@@ -33,11 +33,11 @@ __metadata:
languageName: node
linkType: hard
"@actions/cache@npm:^3.2.4":
version: 3.2.4
resolution: "@actions/cache@npm:3.2.4"
"@actions/cache@npm:^3.3.0":
version: 3.3.0
resolution: "@actions/cache@npm:3.3.0"
dependencies:
"@actions/core": ^1.10.0
"@actions/core": ^1.11.1
"@actions/exec": ^1.0.1
"@actions/glob": ^0.1.0
"@actions/http-client": ^2.1.1
@@ -46,8 +46,7 @@ __metadata:
"@azure/ms-rest-js": ^2.6.0
"@azure/storage-blob": ^12.13.0
semver: ^6.3.1
uuid: ^3.3.3
checksum: 5bf5f7541bea4906b553440a9ffee5699e11dfb729365c6cb0bbd37e147a1a0993369fdad16bfa3e2b01ec7fa57dac66276278bfd4a389009246a75ea953e61d
checksum: f0761b1491b7706a80b44d68ed52eb48c04653fc939525a7c7b606e9d9251c40c7e4ac20846ab92ac32db6869e1a6f0f574bd6b7fec1ab9378c8e199c5acc9c9
languageName: node
linkType: hard
@@ -1109,7 +1108,7 @@ __metadata:
resolution: "@docker/actions-toolkit@workspace:."
dependencies:
"@actions/artifact": ^2.1.11
"@actions/cache": ^3.2.4
"@actions/cache": ^3.3.0
"@actions/core": ^1.11.1
"@actions/exec": ^1.1.1
"@actions/github": ^6.0.0
@@ -3404,13 +3403,13 @@ __metadata:
linkType: hard
"cross-spawn@npm:^7.0.0, cross-spawn@npm:^7.0.2, cross-spawn@npm:^7.0.3":
version: 7.0.3
resolution: "cross-spawn@npm:7.0.3"
version: 7.0.6
resolution: "cross-spawn@npm:7.0.6"
dependencies:
path-key: ^3.1.0
shebang-command: ^2.0.0
which: ^2.0.1
checksum: 671cc7c7288c3a8406f3c69a3ae2fc85555c04169e9d611def9a675635472614f1c0ed0ef80955d5b6d4e724f6ced67f0ad1bb006c2ea643488fcfef994d7f52
checksum: 8d306efacaf6f3f60e0224c287664093fa9185680b2d195852ba9a863f85d02dcc737094c6e512175f8ee0161f9b87c73c6826034c2422e39de7d6569cf4503b
languageName: node
linkType: hard
@@ -8363,7 +8362,7 @@ __metadata:
languageName: node
linkType: hard
"uuid@npm:^3.3.2, uuid@npm:^3.3.3":
"uuid@npm:^3.3.2":
version: 3.4.0
resolution: "uuid@npm:3.4.0"
bin: