Compare commits

...

17 Commits

Author SHA1 Message Date
CrazyMax
5abb5fce3e Merge pull request #475 from docker/bot/buildx-releases-json
Some checks failed
publish / publish (push) Has been cancelled
Update `.github/buildx-releases.json`
2024-10-29 13:22:27 +01:00
crazy-max
a9941711bb github: update .github/buildx-releases.json
Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2024-10-29 12:08:14 +00:00
CrazyMax
68dcb5ad15 Merge pull request #474 from crazy-max/test-latest-qemu
ci: test latest qemu
2024-10-28 14:46:24 +01:00
CrazyMax
52919ae07e Merge pull request #473 from crazy-max/undock
undock install
2024-10-28 12:31:08 +01:00
CrazyMax
a9dd20af6c ci: test latest qemu
Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
2024-10-28 12:21:48 +01:00
CrazyMax
faef3be239 undock install
Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
2024-10-28 12:09:57 +01:00
CrazyMax
a2e60f6191 Merge pull request #472 from docker/bot/undock-releases-json
Update `.github/undock-releases.json`
2024-10-28 11:57:35 +01:00
crazy-max
8e2d2ceec1 github: update .github/undock-releases.json
Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2024-10-28 10:57:16 +00:00
CrazyMax
5b53556941 Merge pull request #471 from crazy-max/undock-releases
ci: undock releases json workflow
2024-10-28 11:56:45 +01:00
CrazyMax
be5b9d1575 ci: undock releases json workflow
Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
2024-10-28 11:55:51 +01:00
CrazyMax
517a5c577f Merge pull request #438 from vvoland/install-from-binimage
docker(install): support image source
2024-10-27 13:37:56 +01:00
Paweł Gronowski
e3d0e4e199 Support image source on darwin
Use undock inside lima to pull the image content.
We could mount the downloaded binaries from the host, but for some
reason lima mounts are not always mounted when the provisioning script
is run.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2024-10-18 14:57:40 +02:00
Paweł Gronowski
b143889d3e docker/install: Add tests for installing from image
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2024-10-17 12:18:17 +02:00
Paweł Gronowski
de390e0872 docker/install: Remove deprecated version and channel
Use InstallSource instead

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2024-10-17 12:18:16 +02:00
Paweł Gronowski
b8a96071a8 docker/install: Handle missing v prefix when searching GH release
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2024-10-17 12:18:15 +02:00
Paweł Gronowski
10424facaf docker/install: Install source
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2024-10-17 12:18:11 +02:00
Paweł Gronowski
1335f081af docker/install: Support version: master
Add support for installing Docker `master` packages from `moby/moby-bin`
and `dockereng/cli-bin` images.

This could also allow to install arbitrary version from these images but
for now it's only used for `master`.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2024-10-17 12:18:09 +02:00
16 changed files with 1054 additions and 51 deletions

View File

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

251
.github/undock-releases.json vendored Normal file
View File

@@ -0,0 +1,251 @@
{
"latest": {
"id": 162880608,
"tag_name": "v0.8.0",
"html_url": "https://github.com/crazy-max/undock/releases/tag/v0.8.0",
"assets": [
"https://github.com/crazy-max/undock/releases/download/v0.8.0/checksums.txt",
"https://github.com/crazy-max/undock/releases/download/v0.8.0/undock_0.8.0_darwin_amd64.provenance.json",
"https://github.com/crazy-max/undock/releases/download/v0.8.0/undock_0.8.0_darwin_amd64.sbom.json",
"https://github.com/crazy-max/undock/releases/download/v0.8.0/undock_0.8.0_darwin_amd64.tar.gz",
"https://github.com/crazy-max/undock/releases/download/v0.8.0/undock_0.8.0_darwin_arm64.provenance.json",
"https://github.com/crazy-max/undock/releases/download/v0.8.0/undock_0.8.0_darwin_arm64.sbom.json",
"https://github.com/crazy-max/undock/releases/download/v0.8.0/undock_0.8.0_darwin_arm64.tar.gz",
"https://github.com/crazy-max/undock/releases/download/v0.8.0/undock_0.8.0_linux_amd64.provenance.json",
"https://github.com/crazy-max/undock/releases/download/v0.8.0/undock_0.8.0_linux_amd64.sbom.json",
"https://github.com/crazy-max/undock/releases/download/v0.8.0/undock_0.8.0_linux_amd64.tar.gz",
"https://github.com/crazy-max/undock/releases/download/v0.8.0/undock_0.8.0_linux_arm64.provenance.json",
"https://github.com/crazy-max/undock/releases/download/v0.8.0/undock_0.8.0_linux_arm64.sbom.json",
"https://github.com/crazy-max/undock/releases/download/v0.8.0/undock_0.8.0_linux_arm64.tar.gz",
"https://github.com/crazy-max/undock/releases/download/v0.8.0/undock_0.8.0_linux_armv5.provenance.json",
"https://github.com/crazy-max/undock/releases/download/v0.8.0/undock_0.8.0_linux_armv5.sbom.json",
"https://github.com/crazy-max/undock/releases/download/v0.8.0/undock_0.8.0_linux_armv5.tar.gz",
"https://github.com/crazy-max/undock/releases/download/v0.8.0/undock_0.8.0_linux_armv6.provenance.json",
"https://github.com/crazy-max/undock/releases/download/v0.8.0/undock_0.8.0_linux_armv6.sbom.json",
"https://github.com/crazy-max/undock/releases/download/v0.8.0/undock_0.8.0_linux_armv6.tar.gz",
"https://github.com/crazy-max/undock/releases/download/v0.8.0/undock_0.8.0_linux_armv7.provenance.json",
"https://github.com/crazy-max/undock/releases/download/v0.8.0/undock_0.8.0_linux_armv7.sbom.json",
"https://github.com/crazy-max/undock/releases/download/v0.8.0/undock_0.8.0_linux_armv7.tar.gz",
"https://github.com/crazy-max/undock/releases/download/v0.8.0/undock_0.8.0_linux_ppc64le.provenance.json",
"https://github.com/crazy-max/undock/releases/download/v0.8.0/undock_0.8.0_linux_ppc64le.sbom.json",
"https://github.com/crazy-max/undock/releases/download/v0.8.0/undock_0.8.0_linux_ppc64le.tar.gz",
"https://github.com/crazy-max/undock/releases/download/v0.8.0/undock_0.8.0_linux_riscv64.provenance.json",
"https://github.com/crazy-max/undock/releases/download/v0.8.0/undock_0.8.0_linux_riscv64.sbom.json",
"https://github.com/crazy-max/undock/releases/download/v0.8.0/undock_0.8.0_linux_riscv64.tar.gz",
"https://github.com/crazy-max/undock/releases/download/v0.8.0/undock_0.8.0_linux_s390x.provenance.json",
"https://github.com/crazy-max/undock/releases/download/v0.8.0/undock_0.8.0_linux_s390x.sbom.json",
"https://github.com/crazy-max/undock/releases/download/v0.8.0/undock_0.8.0_linux_s390x.tar.gz",
"https://github.com/crazy-max/undock/releases/download/v0.8.0/undock_0.8.0_windows_amd64.provenance.json",
"https://github.com/crazy-max/undock/releases/download/v0.8.0/undock_0.8.0_windows_amd64.sbom.json",
"https://github.com/crazy-max/undock/releases/download/v0.8.0/undock_0.8.0_windows_amd64.zip",
"https://github.com/crazy-max/undock/releases/download/v0.8.0/undock_0.8.0_windows_arm64.provenance.json",
"https://github.com/crazy-max/undock/releases/download/v0.8.0/undock_0.8.0_windows_arm64.sbom.json",
"https://github.com/crazy-max/undock/releases/download/v0.8.0/undock_0.8.0_windows_arm64.zip"
]
},
"v0.8.0": {
"id": 162880608,
"tag_name": "v0.8.0",
"html_url": "https://github.com/crazy-max/undock/releases/tag/v0.8.0",
"assets": [
"https://github.com/crazy-max/undock/releases/download/v0.8.0/checksums.txt",
"https://github.com/crazy-max/undock/releases/download/v0.8.0/undock_0.8.0_darwin_amd64.provenance.json",
"https://github.com/crazy-max/undock/releases/download/v0.8.0/undock_0.8.0_darwin_amd64.sbom.json",
"https://github.com/crazy-max/undock/releases/download/v0.8.0/undock_0.8.0_darwin_amd64.tar.gz",
"https://github.com/crazy-max/undock/releases/download/v0.8.0/undock_0.8.0_darwin_arm64.provenance.json",
"https://github.com/crazy-max/undock/releases/download/v0.8.0/undock_0.8.0_darwin_arm64.sbom.json",
"https://github.com/crazy-max/undock/releases/download/v0.8.0/undock_0.8.0_darwin_arm64.tar.gz",
"https://github.com/crazy-max/undock/releases/download/v0.8.0/undock_0.8.0_linux_amd64.provenance.json",
"https://github.com/crazy-max/undock/releases/download/v0.8.0/undock_0.8.0_linux_amd64.sbom.json",
"https://github.com/crazy-max/undock/releases/download/v0.8.0/undock_0.8.0_linux_amd64.tar.gz",
"https://github.com/crazy-max/undock/releases/download/v0.8.0/undock_0.8.0_linux_arm64.provenance.json",
"https://github.com/crazy-max/undock/releases/download/v0.8.0/undock_0.8.0_linux_arm64.sbom.json",
"https://github.com/crazy-max/undock/releases/download/v0.8.0/undock_0.8.0_linux_arm64.tar.gz",
"https://github.com/crazy-max/undock/releases/download/v0.8.0/undock_0.8.0_linux_armv5.provenance.json",
"https://github.com/crazy-max/undock/releases/download/v0.8.0/undock_0.8.0_linux_armv5.sbom.json",
"https://github.com/crazy-max/undock/releases/download/v0.8.0/undock_0.8.0_linux_armv5.tar.gz",
"https://github.com/crazy-max/undock/releases/download/v0.8.0/undock_0.8.0_linux_armv6.provenance.json",
"https://github.com/crazy-max/undock/releases/download/v0.8.0/undock_0.8.0_linux_armv6.sbom.json",
"https://github.com/crazy-max/undock/releases/download/v0.8.0/undock_0.8.0_linux_armv6.tar.gz",
"https://github.com/crazy-max/undock/releases/download/v0.8.0/undock_0.8.0_linux_armv7.provenance.json",
"https://github.com/crazy-max/undock/releases/download/v0.8.0/undock_0.8.0_linux_armv7.sbom.json",
"https://github.com/crazy-max/undock/releases/download/v0.8.0/undock_0.8.0_linux_armv7.tar.gz",
"https://github.com/crazy-max/undock/releases/download/v0.8.0/undock_0.8.0_linux_ppc64le.provenance.json",
"https://github.com/crazy-max/undock/releases/download/v0.8.0/undock_0.8.0_linux_ppc64le.sbom.json",
"https://github.com/crazy-max/undock/releases/download/v0.8.0/undock_0.8.0_linux_ppc64le.tar.gz",
"https://github.com/crazy-max/undock/releases/download/v0.8.0/undock_0.8.0_linux_riscv64.provenance.json",
"https://github.com/crazy-max/undock/releases/download/v0.8.0/undock_0.8.0_linux_riscv64.sbom.json",
"https://github.com/crazy-max/undock/releases/download/v0.8.0/undock_0.8.0_linux_riscv64.tar.gz",
"https://github.com/crazy-max/undock/releases/download/v0.8.0/undock_0.8.0_linux_s390x.provenance.json",
"https://github.com/crazy-max/undock/releases/download/v0.8.0/undock_0.8.0_linux_s390x.sbom.json",
"https://github.com/crazy-max/undock/releases/download/v0.8.0/undock_0.8.0_linux_s390x.tar.gz",
"https://github.com/crazy-max/undock/releases/download/v0.8.0/undock_0.8.0_windows_amd64.provenance.json",
"https://github.com/crazy-max/undock/releases/download/v0.8.0/undock_0.8.0_windows_amd64.sbom.json",
"https://github.com/crazy-max/undock/releases/download/v0.8.0/undock_0.8.0_windows_amd64.zip",
"https://github.com/crazy-max/undock/releases/download/v0.8.0/undock_0.8.0_windows_arm64.provenance.json",
"https://github.com/crazy-max/undock/releases/download/v0.8.0/undock_0.8.0_windows_arm64.sbom.json",
"https://github.com/crazy-max/undock/releases/download/v0.8.0/undock_0.8.0_windows_arm64.zip"
]
},
"v0.7.0": {
"id": 134823476,
"tag_name": "v0.7.0",
"html_url": "https://github.com/crazy-max/undock/releases/tag/v0.7.0",
"assets": [
"https://github.com/crazy-max/undock/releases/download/v0.7.0/checksums.txt",
"https://github.com/crazy-max/undock/releases/download/v0.7.0/provenance.json",
"https://github.com/crazy-max/undock/releases/download/v0.7.0/undock_0.7.0_darwin_amd64.tar.gz",
"https://github.com/crazy-max/undock/releases/download/v0.7.0/undock_0.7.0_darwin_arm64.tar.gz",
"https://github.com/crazy-max/undock/releases/download/v0.7.0/undock_0.7.0_linux_amd64.tar.gz",
"https://github.com/crazy-max/undock/releases/download/v0.7.0/undock_0.7.0_linux_arm64.tar.gz",
"https://github.com/crazy-max/undock/releases/download/v0.7.0/undock_0.7.0_linux_armv5.tar.gz",
"https://github.com/crazy-max/undock/releases/download/v0.7.0/undock_0.7.0_linux_armv6.tar.gz",
"https://github.com/crazy-max/undock/releases/download/v0.7.0/undock_0.7.0_linux_armv7.tar.gz",
"https://github.com/crazy-max/undock/releases/download/v0.7.0/undock_0.7.0_linux_ppc64le.tar.gz",
"https://github.com/crazy-max/undock/releases/download/v0.7.0/undock_0.7.0_linux_riscv64.tar.gz",
"https://github.com/crazy-max/undock/releases/download/v0.7.0/undock_0.7.0_linux_s390x.tar.gz",
"https://github.com/crazy-max/undock/releases/download/v0.7.0/undock_0.7.0_windows_amd64.zip",
"https://github.com/crazy-max/undock/releases/download/v0.7.0/undock_0.7.0_windows_arm64.zip"
]
},
"v0.7.0-rc.1": {
"id": 134495651,
"tag_name": "v0.7.0-rc.1",
"html_url": "https://github.com/crazy-max/undock/releases/tag/v0.7.0-rc.1",
"assets": [
"https://github.com/crazy-max/undock/releases/download/v0.7.0-rc.1/checksums.txt",
"https://github.com/crazy-max/undock/releases/download/v0.7.0-rc.1/provenance.json",
"https://github.com/crazy-max/undock/releases/download/v0.7.0-rc.1/undock_0.7.0-rc.1_darwin_amd64.tar.gz",
"https://github.com/crazy-max/undock/releases/download/v0.7.0-rc.1/undock_0.7.0-rc.1_darwin_arm64.tar.gz",
"https://github.com/crazy-max/undock/releases/download/v0.7.0-rc.1/undock_0.7.0-rc.1_linux_amd64.tar.gz",
"https://github.com/crazy-max/undock/releases/download/v0.7.0-rc.1/undock_0.7.0-rc.1_linux_arm64.tar.gz",
"https://github.com/crazy-max/undock/releases/download/v0.7.0-rc.1/undock_0.7.0-rc.1_linux_armv5.tar.gz",
"https://github.com/crazy-max/undock/releases/download/v0.7.0-rc.1/undock_0.7.0-rc.1_linux_armv6.tar.gz",
"https://github.com/crazy-max/undock/releases/download/v0.7.0-rc.1/undock_0.7.0-rc.1_linux_armv7.tar.gz",
"https://github.com/crazy-max/undock/releases/download/v0.7.0-rc.1/undock_0.7.0-rc.1_linux_ppc64le.tar.gz",
"https://github.com/crazy-max/undock/releases/download/v0.7.0-rc.1/undock_0.7.0-rc.1_linux_riscv64.tar.gz",
"https://github.com/crazy-max/undock/releases/download/v0.7.0-rc.1/undock_0.7.0-rc.1_linux_s390x.tar.gz",
"https://github.com/crazy-max/undock/releases/download/v0.7.0-rc.1/undock_0.7.0-rc.1_windows_amd64.zip",
"https://github.com/crazy-max/undock/releases/download/v0.7.0-rc.1/undock_0.7.0-rc.1_windows_arm64.zip"
]
},
"v0.6.0": {
"id": 121362767,
"tag_name": "v0.6.0",
"html_url": "https://github.com/crazy-max/undock/releases/tag/v0.6.0",
"assets": [
"https://github.com/crazy-max/undock/releases/download/v0.6.0/checksums.txt",
"https://github.com/crazy-max/undock/releases/download/v0.6.0/provenance.json",
"https://github.com/crazy-max/undock/releases/download/v0.6.0/undock_0.6.0_darwin_amd64.tar.gz",
"https://github.com/crazy-max/undock/releases/download/v0.6.0/undock_0.6.0_darwin_arm64.tar.gz",
"https://github.com/crazy-max/undock/releases/download/v0.6.0/undock_0.6.0_linux_amd64.tar.gz",
"https://github.com/crazy-max/undock/releases/download/v0.6.0/undock_0.6.0_linux_arm64.tar.gz",
"https://github.com/crazy-max/undock/releases/download/v0.6.0/undock_0.6.0_linux_armv5.tar.gz",
"https://github.com/crazy-max/undock/releases/download/v0.6.0/undock_0.6.0_linux_armv6.tar.gz",
"https://github.com/crazy-max/undock/releases/download/v0.6.0/undock_0.6.0_linux_armv7.tar.gz",
"https://github.com/crazy-max/undock/releases/download/v0.6.0/undock_0.6.0_linux_ppc64le.tar.gz",
"https://github.com/crazy-max/undock/releases/download/v0.6.0/undock_0.6.0_linux_riscv64.tar.gz",
"https://github.com/crazy-max/undock/releases/download/v0.6.0/undock_0.6.0_linux_s390x.tar.gz",
"https://github.com/crazy-max/undock/releases/download/v0.6.0/undock_0.6.0_windows_amd64.zip",
"https://github.com/crazy-max/undock/releases/download/v0.6.0/undock_0.6.0_windows_arm64.zip"
]
},
"v0.5.0": {
"id": 110766698,
"tag_name": "v0.5.0",
"html_url": "https://github.com/crazy-max/undock/releases/tag/v0.5.0",
"assets": [
"https://github.com/crazy-max/undock/releases/download/v0.5.0/checksums.txt",
"https://github.com/crazy-max/undock/releases/download/v0.5.0/provenance.json",
"https://github.com/crazy-max/undock/releases/download/v0.5.0/undock_0.5.0_darwin_amd64.tar.gz",
"https://github.com/crazy-max/undock/releases/download/v0.5.0/undock_0.5.0_darwin_arm64.tar.gz",
"https://github.com/crazy-max/undock/releases/download/v0.5.0/undock_0.5.0_linux_amd64.tar.gz",
"https://github.com/crazy-max/undock/releases/download/v0.5.0/undock_0.5.0_linux_arm64.tar.gz",
"https://github.com/crazy-max/undock/releases/download/v0.5.0/undock_0.5.0_linux_armv5.tar.gz",
"https://github.com/crazy-max/undock/releases/download/v0.5.0/undock_0.5.0_linux_armv6.tar.gz",
"https://github.com/crazy-max/undock/releases/download/v0.5.0/undock_0.5.0_linux_armv7.tar.gz",
"https://github.com/crazy-max/undock/releases/download/v0.5.0/undock_0.5.0_linux_ppc64le.tar.gz",
"https://github.com/crazy-max/undock/releases/download/v0.5.0/undock_0.5.0_linux_riscv64.tar.gz",
"https://github.com/crazy-max/undock/releases/download/v0.5.0/undock_0.5.0_linux_s390x.tar.gz",
"https://github.com/crazy-max/undock/releases/download/v0.5.0/undock_0.5.0_windows_amd64.zip",
"https://github.com/crazy-max/undock/releases/download/v0.5.0/undock_0.5.0_windows_arm64.zip"
]
},
"v0.4.0": {
"id": 92330136,
"tag_name": "v0.4.0",
"html_url": "https://github.com/crazy-max/undock/releases/tag/v0.4.0",
"assets": [
"https://github.com/crazy-max/undock/releases/download/v0.4.0/checksums.txt",
"https://github.com/crazy-max/undock/releases/download/v0.4.0/undock_0.4.0_darwin_amd64.tar.gz",
"https://github.com/crazy-max/undock/releases/download/v0.4.0/undock_0.4.0_darwin_arm64.tar.gz",
"https://github.com/crazy-max/undock/releases/download/v0.4.0/undock_0.4.0_linux_amd64.tar.gz",
"https://github.com/crazy-max/undock/releases/download/v0.4.0/undock_0.4.0_linux_arm64.tar.gz",
"https://github.com/crazy-max/undock/releases/download/v0.4.0/undock_0.4.0_linux_armv5.tar.gz",
"https://github.com/crazy-max/undock/releases/download/v0.4.0/undock_0.4.0_linux_armv6.tar.gz",
"https://github.com/crazy-max/undock/releases/download/v0.4.0/undock_0.4.0_linux_armv7.tar.gz",
"https://github.com/crazy-max/undock/releases/download/v0.4.0/undock_0.4.0_linux_ppc64le.tar.gz",
"https://github.com/crazy-max/undock/releases/download/v0.4.0/undock_0.4.0_linux_riscv64.tar.gz",
"https://github.com/crazy-max/undock/releases/download/v0.4.0/undock_0.4.0_linux_s390x.tar.gz",
"https://github.com/crazy-max/undock/releases/download/v0.4.0/undock_0.4.0_windows_amd64.zip",
"https://github.com/crazy-max/undock/releases/download/v0.4.0/undock_0.4.0_windows_arm64.zip"
]
},
"v0.3.0": {
"id": 62906231,
"tag_name": "v0.3.0",
"html_url": "https://github.com/crazy-max/undock/releases/tag/v0.3.0",
"assets": [
"https://github.com/crazy-max/undock/releases/download/v0.3.0/undock_0.3.0_darwin_amd64.tar.gz",
"https://github.com/crazy-max/undock/releases/download/v0.3.0/undock_0.3.0_darwin_arm64.tar.gz",
"https://github.com/crazy-max/undock/releases/download/v0.3.0/undock_0.3.0_linux_amd64.tar.gz",
"https://github.com/crazy-max/undock/releases/download/v0.3.0/undock_0.3.0_linux_arm64.tar.gz",
"https://github.com/crazy-max/undock/releases/download/v0.3.0/undock_0.3.0_linux_armv5.tar.gz",
"https://github.com/crazy-max/undock/releases/download/v0.3.0/undock_0.3.0_linux_armv6.tar.gz",
"https://github.com/crazy-max/undock/releases/download/v0.3.0/undock_0.3.0_linux_armv7.tar.gz",
"https://github.com/crazy-max/undock/releases/download/v0.3.0/undock_0.3.0_linux_ppc64le.tar.gz",
"https://github.com/crazy-max/undock/releases/download/v0.3.0/undock_0.3.0_linux_riscv64.tar.gz",
"https://github.com/crazy-max/undock/releases/download/v0.3.0/undock_0.3.0_linux_s390x.tar.gz",
"https://github.com/crazy-max/undock/releases/download/v0.3.0/undock_0.3.0_windows_amd64.zip",
"https://github.com/crazy-max/undock/releases/download/v0.3.0/undock_0.3.0_windows_arm64.zip"
]
},
"v0.2.0": {
"id": 59443285,
"tag_name": "v0.2.0",
"html_url": "https://github.com/crazy-max/undock/releases/tag/v0.2.0",
"assets": [
"https://github.com/crazy-max/undock/releases/download/v0.2.0/undock_0.2.0_darwin_amd64.tar.gz",
"https://github.com/crazy-max/undock/releases/download/v0.2.0/undock_0.2.0_darwin_arm64.tar.gz",
"https://github.com/crazy-max/undock/releases/download/v0.2.0/undock_0.2.0_linux_amd64.tar.gz",
"https://github.com/crazy-max/undock/releases/download/v0.2.0/undock_0.2.0_linux_arm64.tar.gz",
"https://github.com/crazy-max/undock/releases/download/v0.2.0/undock_0.2.0_linux_armv5.tar.gz",
"https://github.com/crazy-max/undock/releases/download/v0.2.0/undock_0.2.0_linux_armv6.tar.gz",
"https://github.com/crazy-max/undock/releases/download/v0.2.0/undock_0.2.0_linux_armv7.tar.gz",
"https://github.com/crazy-max/undock/releases/download/v0.2.0/undock_0.2.0_linux_ppc64le.tar.gz",
"https://github.com/crazy-max/undock/releases/download/v0.2.0/undock_0.2.0_linux_riscv64.tar.gz",
"https://github.com/crazy-max/undock/releases/download/v0.2.0/undock_0.2.0_linux_s390x.tar.gz",
"https://github.com/crazy-max/undock/releases/download/v0.2.0/undock_0.2.0_windows_amd64.zip",
"https://github.com/crazy-max/undock/releases/download/v0.2.0/undock_0.2.0_windows_arm64.zip"
]
},
"v0.1.0": {
"id": 57827645,
"tag_name": "v0.1.0",
"html_url": "https://github.com/crazy-max/undock/releases/tag/v0.1.0",
"assets": [
"https://github.com/crazy-max/undock/releases/download/v0.1.0/undock_0.1.0_darwin_amd64.tar.gz",
"https://github.com/crazy-max/undock/releases/download/v0.1.0/undock_0.1.0_darwin_arm64.tar.gz",
"https://github.com/crazy-max/undock/releases/download/v0.1.0/undock_0.1.0_linux_amd64.tar.gz",
"https://github.com/crazy-max/undock/releases/download/v0.1.0/undock_0.1.0_linux_arm64.tar.gz",
"https://github.com/crazy-max/undock/releases/download/v0.1.0/undock_0.1.0_linux_armv5.tar.gz",
"https://github.com/crazy-max/undock/releases/download/v0.1.0/undock_0.1.0_linux_armv6.tar.gz",
"https://github.com/crazy-max/undock/releases/download/v0.1.0/undock_0.1.0_linux_armv7.tar.gz",
"https://github.com/crazy-max/undock/releases/download/v0.1.0/undock_0.1.0_linux_ppc64le.tar.gz",
"https://github.com/crazy-max/undock/releases/download/v0.1.0/undock_0.1.0_linux_riscv64.tar.gz",
"https://github.com/crazy-max/undock/releases/download/v0.1.0/undock_0.1.0_linux_s390x.tar.gz",
"https://github.com/crazy-max/undock/releases/download/v0.1.0/undock_0.1.0_windows_amd64.zip",
"https://github.com/crazy-max/undock/releases/download/v0.1.0/undock_0.1.0_windows_arm64.zip"
]
}
}

View File

@@ -119,10 +119,6 @@ jobs:
run: |
corepack enable
yarn --version
-
name: Set up QEMU
if: startsWith(matrix.os, 'macos')
uses: ./.github/actions/macos-setup-qemu
-
name: Setup Node
uses: actions/setup-node@v4

View File

@@ -0,0 +1,58 @@
name: undock-releases-json
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
on:
workflow_dispatch:
schedule:
- cron: '0 */12 * * *'
push:
branches:
- 'main'
pull_request:
paths:
- '.github/workflows/undock-releases-json.yml'
jobs:
generate:
uses: crazy-max/.github/.github/workflows/releases-json.yml@fa6141aedf23596fb8bdcceab9cce8dadaa31bd9
with:
repository: crazy-max/undock
artifact_name: undock-releases-json
filename: undock-releases.json
secrets: inherit
open-pr:
runs-on: ubuntu-22.04
if: github.event_name != 'pull_request'
needs:
- generate
steps:
-
name: Checkout
uses: actions/checkout@v4
-
name: Download
uses: actions/download-artifact@v4
with:
name: undock-releases-json
path: .github
-
name: Commit changes
run: |
git add -A .
-
name: Create PR
uses: peter-evans/create-pull-request@5e914681df9dc83aa4e4905692ca88beb2f9e91f # v7.0.5
with:
base: main
branch: bot/undock-releases-json
commit-message: "github: update .github/undock-releases.json"
signoff: true
delete-branch: true
title: "Update `.github/undock-releases.json`"
body: |
Update `.github/undock-releases.json` to keep in sync with [https://github.com/crazy-max/undock](https://github.com/crazy-max/undock).
draft: false

View File

@@ -24,7 +24,7 @@ const maybe = !process.env.GITHUB_ACTIONS || (process.env.GITHUB_ACTIONS === 'tr
maybe('download', () => {
// prettier-ignore
test.each(['latest'])(
'install docker %s', async (version) => {
'install buildx %s', async (version) => {
await expect((async () => {
const install = new Install({
standalone: true

View File

@@ -19,7 +19,7 @@ import fs from 'fs';
import os from 'os';
import path from 'path';
import {Install} from '../../src/docker/install';
import {Install, InstallSourceArchive, InstallSourceImage} from '../../src/docker/install';
import {Docker} from '../../src/docker/docker';
import {Exec} from '../../src/exec';
@@ -40,8 +40,12 @@ aarch64:https://cloud.debian.org/images/cloud/bookworm/20231013-1532/debian-12-g
process.env = originalEnv;
});
// prettier-ignore
test.each(['v26.1.4'])(
'install docker %s', async (version) => {
test.each([
{type: 'image', tag: '27.3.1'} as InstallSourceImage,
{type: 'image', tag: 'master'} as InstallSourceImage,
{type: 'archive', version: 'v26.1.4', 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
@@ -53,18 +57,19 @@ aarch64:https://cloud.debian.org/images/cloud/bookworm/20231013-1532/debian-12-g
}
});
}
const install = new Install({
source: source,
runDir: tmpDir,
contextName: 'foo',
daemonConfig: `{"debug":true,"features":{"containerd-snapshotter":true}}`
});
await expect((async () => {
const install = new Install({
version: version,
runDir: tmpDir,
contextName: 'foo',
daemonConfig: `{"debug":true,"features":{"containerd-snapshotter":true}}`
});
await install.download();
await install.install();
await Docker.printVersion();
await Docker.printInfo();
})().finally(async () => {
await install.tearDown();
})()).resolves.not.toThrow();
}, 1200000);
})).resolves.not.toThrow();
}, 30 * 60 * 1000);
});

View File

@@ -21,7 +21,7 @@ import path from 'path';
import * as rimraf from 'rimraf';
import osm = require('os');
import {Install} from '../../src/docker/install';
import {Install, InstallSourceArchive, InstallSourceImage} from '../../src/docker/install';
const tmpDir = fs.mkdtempSync(path.join(process.env.TEMP || os.tmpdir(), 'docker-install-'));
@@ -29,18 +29,39 @@ afterEach(function () {
rimraf.sync(tmpDir);
});
const archive = (version: string, channel: string): InstallSourceArchive => {
return {
type: 'archive',
version: version,
channel: channel
};
};
const image = (tag: string): InstallSourceImage => {
return {
type: 'image',
tag: tag
};
};
describe('download', () => {
// prettier-ignore
test.each([
['v19.03.14', 'linux'],
['v20.10.22', 'linux'],
['v20.10.22', 'darwin'],
['v20.10.22', 'win32'],
[archive('v19.03.14', 'stable'), 'linux'],
[archive('v20.10.22', 'stable'), 'linux'],
[archive('v20.10.22', 'stable'), 'darwin'],
[archive('v20.10.22', 'stable'), 'win32'],
[image('master'), 'linux'],
[image('master'), 'win32'],
[image('27.3.1'), 'linux'],
[image('27.3.1'), 'win32'],
])(
'acquires %p of docker (%s)', async (version, platformOS) => {
'acquires %p of docker (%s)', async (source, platformOS) => {
jest.spyOn(osm, 'platform').mockImplementation(() => platformOS as NodeJS.Platform);
const install = new Install({
version: version,
source: source,
runDir: tmpDir,
});
const toolPath = await install.download();

View File

@@ -0,0 +1,38 @@
/**
* 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 {describe, expect, test} from '@jest/globals';
import * as fs from 'fs';
import {Install} from '../../src/undock/install';
describe('download', () => {
// prettier-ignore
test.each(['latest'])(
'install undock %s', async (version) => {
await expect((async () => {
const install = new Install();
const toolPath = await install.download(version);
if (!fs.existsSync(toolPath)) {
throw new Error('toolPath does not exist');
}
const binPath = await install.install(toolPath);
if (!fs.existsSync(binPath)) {
throw new Error('binPath does not exist');
}
})()).resolves.not.toThrow();
}, 60000);
});

View File

@@ -0,0 +1,129 @@
/**
* 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 {describe, expect, it, jest, test, afterEach} from '@jest/globals';
import fs from 'fs';
import os from 'os';
import path from 'path';
import * as rimraf from 'rimraf';
import osm = require('os');
import {Install} from '../../src/undock/install';
const tmpDir = fs.mkdtempSync(path.join(process.env.TEMP || os.tmpdir(), 'undock-install-'));
afterEach(function () {
rimraf.sync(tmpDir);
});
describe('download', () => {
// prettier-ignore
test.each([
['v0.4.0'],
['v0.7.0'],
['latest']
])(
'acquires %p of undock (standalone: %p)', async (version) => {
const install = new Install();
const toolPath = await install.download(version);
expect(fs.existsSync(toolPath)).toBe(true);
const undockBin = await install.install(toolPath, tmpDir);
expect(fs.existsSync(undockBin)).toBe(true);
},
100000
);
// prettier-ignore
test.each([
// following versions are already cached to htc from previous test cases
['v0.4.0'],
['v0.7.0'],
])(
'acquires %p of undock with cache', async (version) => {
const install = new Install();
const toolPath = await install.download(version);
expect(fs.existsSync(toolPath)).toBe(true);
});
// prettier-ignore
test.each([
['v0.5.0'],
['v0.6.0'],
])(
'acquires %p of undock without cache', async (version) => {
const install = new Install();
const toolPath = await install.download(version, true);
expect(fs.existsSync(toolPath)).toBe(true);
});
// TODO: add tests for arm
// prettier-ignore
test.each([
['win32', 'x64'],
['win32', 'arm64'],
['darwin', 'x64'],
['darwin', 'arm64'],
['linux', 'x64'],
['linux', 'arm64'],
['linux', 'ppc64'],
['linux', 's390x'],
])(
'acquires undock for %s/%s', async (os, arch) => {
jest.spyOn(osm, 'platform').mockImplementation(() => os as NodeJS.Platform);
jest.spyOn(osm, 'arch').mockImplementation(() => arch);
const install = new Install();
const undockBin = await install.download('latest');
expect(fs.existsSync(undockBin)).toBe(true);
},
100000
);
});
describe('getDownloadVersion', () => {
it('returns latest download version', async () => {
const version = await Install.getDownloadVersion('latest');
expect(version.version).toEqual('latest');
expect(version.downloadURL).toEqual('https://github.com/crazy-max/undock/releases/download/v%s/%s');
expect(version.releasesURL).toEqual('https://raw.githubusercontent.com/docker/actions-toolkit/main/.github/undock-releases.json');
});
it('returns v0.6.0 download version', async () => {
const version = await Install.getDownloadVersion('v0.6.0');
expect(version.version).toEqual('v0.6.0');
expect(version.downloadURL).toEqual('https://github.com/crazy-max/undock/releases/download/v%s/%s');
expect(version.releasesURL).toEqual('https://raw.githubusercontent.com/docker/actions-toolkit/main/.github/undock-releases.json');
});
});
describe('getRelease', () => {
it('returns latest GitHub release', async () => {
const version = await Install.getDownloadVersion('latest');
const release = await Install.getRelease(version);
expect(release).not.toBeNull();
expect(release?.tag_name).not.toEqual('');
});
it('returns v0.6.0 GitHub release', async () => {
const version = await Install.getDownloadVersion('v0.6.0');
const release = await Install.getRelease(version);
expect(release).not.toBeNull();
expect(release?.id).toEqual(121362767);
expect(release?.tag_name).toEqual('v0.6.0');
expect(release?.html_url).toEqual('https://github.com/crazy-max/undock/releases/tag/v0.6.0');
});
it('unknown release', async () => {
const version = await Install.getDownloadVersion('foo');
await expect(Install.getRelease(version)).rejects.toThrow(new Error('Cannot find Undock release foo in https://raw.githubusercontent.com/docker/actions-toolkit/main/.github/undock-releases.json'));
});
});

View File

@@ -221,16 +221,49 @@ provision:
EOF
fi
export DEBIAN_FRONTEND=noninteractive
curl -fsSL https://get.docker.com | sh -s -- --channel {{dockerBinChannel}} --version {{dockerBinVersion}}
if [ "{{srcType}}" == "archive" ]; then
curl -fsSL https://get.docker.com | sh -s -- --channel {{srcArchiveChannel}} --version {{srcArchiveVersion}}
elif [ "{{srcType}}" == "image" ]; then
arch=$(uname -m)
case $arch in
x86_64) arch=amd64;;
aarch64) arch=arm64;;
esac
url="https://github.com/crazy-max/undock/releases/download/v0.8.0/undock_0.8.0_linux_$arch.tar.gz"
wget "$url" -O /tmp/undock.tar.gz
tar -C /usr/local/bin -xvf /tmp/undock.tar.gz
undock --version
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
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
if ! getent group docker; then
groupadd --system docker
fi
systemctl daemon-reload
fail=0
if ! systemctl enable --now docker; then
fail=1
fi
systemctl status docker.socket || true
systemctl status docker.service || true
exit $fail
fi
probes:
- script: |
#!/bin/bash
set -eux -o pipefail
if ! timeout 30s bash -c "until command -v docker >/dev/null 2>&1; do sleep 3; done"; then
echo >&2 "docker is not installed yet"
exit 1
fi
# Don't check for docker CLI as it's not installed in the VM (only on the host)
if ! timeout 30s bash -c "until pgrep dockerd; do sleep 3; done"; then
echo >&2 "dockerd is not running"
exit 1

View File

@@ -33,10 +33,25 @@ import {Exec} from '../exec';
import {Util} from '../util';
import {limaYamlData, dockerServiceLogsPs1, setupDockerWinPs1} from './assets';
import {GitHubRelease} from '../types/github';
import {HubRepository} from '../hubRepository';
export interface InstallSourceImage {
type: 'image';
tag: string;
}
export interface InstallSourceArchive {
type: 'archive';
version: string;
channel: string;
}
export type InstallSource = InstallSourceImage | InstallSourceArchive;
export interface InstallOpts {
version?: string;
channel?: string;
source?: InstallSource;
// ...
runDir: string;
contextName?: string;
daemonConfig?: string;
@@ -50,8 +65,7 @@ interface LimaImage {
export class Install {
private readonly runDir: string;
private readonly version: string;
private readonly channel: string;
private readonly source: InstallSource;
private readonly contextName: string;
private readonly daemonConfig?: string;
private _version: string | undefined;
@@ -61,8 +75,11 @@ export class Install {
constructor(opts: InstallOpts) {
this.runDir = opts.runDir;
this.version = opts.version || 'latest';
this.channel = opts.channel || 'stable';
this.source = opts.source || {
type: 'archive',
version: 'latest',
channel: 'stable'
};
this.contextName = opts.contextName || 'setup-docker-action';
this.daemonConfig = opts.daemonConfig;
}
@@ -71,12 +88,12 @@ export class Install {
return this._toolDir || Context.tmpDir();
}
public async download(): Promise<string> {
const release: GitHubRelease = await Install.getRelease(this.version);
async downloadStaticArchive(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, this.channel);
const downloadURL = this.downloadURL(this._version, src.channel);
core.info(`Downloading ${downloadURL}`);
const downloadPath = await tc.downloadTool(downloadURL);
@@ -92,6 +109,46 @@ export class Install {
extractFolder = path.join(extractFolder, 'docker');
}
core.debug(`docker.Install.download extractFolder: ${extractFolder}`);
return extractFolder;
}
public async download(): Promise<string> {
let extractFolder: string;
let cacheKey: string;
const platform = os.platform();
switch (this.source.type) {
case 'image': {
const tag = this.source.tag;
this._version = tag;
cacheKey = `docker-image`;
core.info(`Downloading docker cli from dockereng/cli-bin:${tag}`);
const cli = await HubRepository.build('dockereng/cli-bin');
extractFolder = await cli.extractImage(tag);
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
} else {
core.warning(`dockerd not supported on ${platform}, only the Docker cli will be available`);
}
break;
}
case 'archive': {
const version = this.source.version;
const channel = this.source.channel;
cacheKey = `docker-archive-${channel}`;
this._version = version;
core.info(`Downloading Docker ${version} from ${this.source.channel} at download.docker.com`);
extractFolder = await this.downloadStaticArchive(this.source);
break;
}
}
core.info('Fixing perms');
fs.readdir(path.join(extractFolder), function (err, files) {
@@ -104,7 +161,7 @@ export class Install {
});
});
const tooldir = await tc.cacheDir(extractFolder, `docker-${this.channel}`, this._version.replace(/(0+)([1-9]+)/, '$2'));
const tooldir = await tc.cacheDir(extractFolder, cacheKey, this._version.replace(/(0+)([1-9]+)/, '$2'));
core.addPath(tooldir);
core.info('Added Docker to PATH');
@@ -136,6 +193,7 @@ export class Install {
}
private async installDarwin(): Promise<string> {
const src = this.source;
const limaDir = path.join(os.homedir(), '.lima', this.limaInstanceName);
await io.mkdirP(limaDir);
const dockerHost = `unix://${limaDir}/docker.sock`;
@@ -166,12 +224,15 @@ export class Install {
handlebars.registerHelper('stringify', function (obj) {
return new handlebars.SafeString(JSON.stringify(obj));
});
const srcArchive = src as InstallSourceArchive;
const limaCfg = handlebars.compile(limaYamlData)({
customImages: Install.limaCustomImages(),
daemonConfig: limaDaemonConfig,
dockerSock: `${limaDir}/docker.sock`,
dockerBinVersion: this._version,
dockerBinChannel: this.channel
srcType: src.type,
srcArchiveVersion: srcArchive.version?.replace(/^v/, ''),
srcArchiveChannel: srcArchive.channel,
srcImageTag: (src as InstallSourceImage).tag
});
core.info(`Writing lima config to ${path.join(limaDir, 'lima.yaml')}`);
fs.writeFileSync(path.join(limaDir, 'lima.yaml'), limaCfg);
@@ -527,7 +588,10 @@ EOF`,
}
const releases = <Record<string, GitHubRelease>>JSON.parse(body);
if (!releases[version]) {
throw new Error(`Cannot find Docker release ${version} in ${url}`);
if (!releases['v' + version]) {
throw new Error(`Cannot find Docker release ${version} in ${url}`);
}
return releases['v' + version];
}
return releases[version];
}

View File

@@ -111,17 +111,21 @@ export class DockerHub {
const body = await resp.readBody();
resp.message.statusCode = resp.message.statusCode || HttpCodes.InternalServerError;
if (resp.message.statusCode < 200 || resp.message.statusCode >= 300) {
if (resp.message.statusCode == HttpCodes.Unauthorized) {
throw new Error(`Docker Hub API: operation not permitted`);
}
const errResp = <Record<string, string>>JSON.parse(body);
for (const k of ['message', 'detail', 'error']) {
if (errResp[k]) {
throw new Error(`Docker Hub API: bad status code ${resp.message.statusCode}: ${errResp[k]}`);
}
}
throw new Error(`Docker Hub API: bad status code ${resp.message.statusCode}`);
throw DockerHub.parseError(resp, body);
}
return body;
}
public static parseError(resp: httpm.HttpClientResponse, body: string): Error {
if (resp.message.statusCode == HttpCodes.Unauthorized) {
throw new Error(`Docker Hub API: operation not permitted`);
}
const errResp = <Record<string, string>>JSON.parse(body);
for (const k of ['message', 'detail', 'error']) {
if (errResp[k]) {
throw new Error(`Docker Hub API: bad status code ${resp.message.statusCode}: ${errResp[k]}`);
}
}
throw new Error(`Docker Hub API: bad status code ${resp.message.statusCode}`);
}
}

157
src/hubRepository.ts Normal file
View File

@@ -0,0 +1,157 @@
/**
* Copyright 2023 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 httpm from '@actions/http-client';
import {Index} from './types/oci';
import os from 'os';
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 {DockerHub} from './dockerhub';
export class HubRepository {
private repo: string;
private token: string;
private static readonly http: httpm.HttpClient = new httpm.HttpClient('setup-docker-action');
private constructor(repository: string, token: string) {
this.repo = repository;
this.token = token;
}
public static async build(repository: string): Promise<HubRepository> {
const token = await this.getToken(repository);
return new HubRepository(repository, token);
}
// 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 paths = manifest.layers.map(async layer => {
const url = this.blobUrl(layer.digest);
return await tc.downloadTool(url, undefined, undefined, {
authorization: `Bearer ${this.token}`
});
});
let files = await Promise.all(paths);
let extractFolder: string;
if (!destDir) {
extractFolder = await tc.extractTar(files[0]);
files = files.slice(1);
} else {
extractFolder = destDir;
}
await Promise.all(
files.map(async file => {
return await tc.extractTar(file, extractFolder);
})
);
fs.readdirSync(extractFolder).forEach(file => {
core.info(`extractImage(${this.repo}:${tag}) file: ${file}`);
});
return extractFolder;
}
private static async getToken(repo: string): Promise<string> {
const url = `https://auth.docker.io/token?service=registry.docker.io&scope=repository:${repo}:pull`;
const resp = await this.http.get(url);
const body = await resp.readBody();
const statusCode = resp.message.statusCode || 500;
if (statusCode != 200) {
throw DockerHub.parseError(resp, body);
}
const json = JSON.parse(body);
return json.token;
}
private blobUrl(digest: string): string {
return `https://registry-1.docker.io/v2/${this.repo}/blobs/${digest}`;
}
public async getManifest<T>(tagOrDigest: string): Promise<T> {
const url = `https://registry-1.docker.io/v2/${this.repo}/manifests/${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(', ')
};
const resp = await HubRepository.http.get(url, headers);
const body = await resp.readBody();
const statusCode = resp.message.statusCode || 500;
if (statusCode != 200) {
throw DockerHub.parseError(resp, body);
}
return <T>JSON.parse(body);
}
private static getPlatformManifestDigest(index: Index): string {
// This doesn't handle all possible platforms normalizations, but it's good enough for now.
let pos: string = os.platform();
if (pos == 'win32') {
pos = 'windows';
}
let arch = os.arch();
if (arch == 'x64') {
arch = 'amd64';
}
let variant = '';
if (arch == 'arm') {
variant = 'v7';
}
const manifest = index.manifests.find(m => {
if (!m.platform) {
return false;
}
if (m.platform.os != pos) {
core.debug(`Skipping manifest ${m.digest} because of os: ${m.platform.os} != ${pos}`);
return false;
}
if (m.platform.architecture != arch) {
core.debug(`Skipping manifest ${m.digest} because of arch: ${m.platform.architecture} != ${arch}`);
return false;
}
if ((m.platform.variant || '') != variant) {
core.debug(`Skipping manifest ${m.digest} because of variant: ${m.platform.variant} != ${variant}`);
return false;
}
return true;
});
if (!manifest) {
throw new Error(`Cannot find manifest for ${pos}/${arch}/${variant}`);
}
return manifest.digest;
}
}

View File

@@ -0,0 +1,19 @@
/**
* Copyright 2023 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.
*/
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';

View File

@@ -0,0 +1,21 @@
/**
* 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.
*/
export interface DownloadVersion {
version: string;
downloadURL: string;
releasesURL: string;
}

166
src/undock/install.ts Normal file
View File

@@ -0,0 +1,166 @@
/**
* 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 * as core from '@actions/core';
import * as httpm from '@actions/http-client';
import * as tc from '@actions/tool-cache';
import * as semver from 'semver';
import * as util from 'util';
import {Cache} from '../cache';
import {Context} from '../context';
import {GitHubRelease} from '../types/github';
import {DownloadVersion} from '../types/undock/undock';
export class Install {
/*
* Download undock binary from GitHub release
* @param v: version semver version or latest
* @param ghaNoCache: disable binary caching in GitHub Actions cache backend
* @returns path to the undock binary
*/
public async download(v: string, ghaNoCache?: boolean): Promise<string> {
const version: DownloadVersion = await Install.getDownloadVersion(v);
core.debug(`Install.download version: ${version.version}`);
const release: GitHubRelease = await Install.getRelease(version);
core.debug(`Install.download release tag name: ${release.tag_name}`);
const vspec = await this.vspec(release.tag_name);
core.debug(`Install.download vspec: ${vspec}`);
const c = semver.clean(vspec) || '';
if (!semver.valid(c)) {
throw new Error(`Invalid Undock version "${vspec}".`);
}
const installCache = new Cache({
htcName: 'undock-dl-bin',
htcVersion: vspec,
baseCacheDir: path.join(os.homedir(), '.bin'),
cacheFile: os.platform() == 'win32' ? 'undock.exe' : 'undock',
ghaNoCache: ghaNoCache
});
const cacheFoundPath = await installCache.find();
if (cacheFoundPath) {
core.info(`Unodck binary found in ${cacheFoundPath}`);
return cacheFoundPath;
}
const downloadURL = util.format(version.downloadURL, vspec, this.filename(vspec));
core.info(`Downloading ${downloadURL}`);
const htcDownloadPath = await tc.downloadTool(downloadURL);
core.debug(`Install.download htcDownloadPath: ${htcDownloadPath}`);
let htcExtPath: string;
if (os.platform() == 'win32') {
htcExtPath = await tc.extractZip(htcDownloadPath);
} else {
htcExtPath = await tc.extractTar(htcDownloadPath);
}
core.info(`Extracted to ${htcExtPath}`);
const exePath: string = path.join(htcExtPath, os.platform() == 'win32' ? 'undock.exe' : 'undock');
core.debug(`Install.download exePath: ${exePath}`);
const cacheSavePath = await installCache.save(exePath);
core.info(`Cached to ${cacheSavePath}`);
return cacheSavePath;
}
public async install(binPath: string, dest?: string): Promise<string> {
dest = dest || Context.tmpDir();
const binDir = path.join(dest, 'undock-bin');
if (!fs.existsSync(binDir)) {
fs.mkdirSync(binDir, {recursive: true});
}
const binName: string = os.platform() == 'win32' ? 'undock.exe' : 'undock';
const undockPath: string = path.join(binDir, binName);
fs.copyFileSync(binPath, undockPath);
core.info('Fixing perms');
fs.chmodSync(undockPath, '0755');
core.addPath(binDir);
core.info('Added Unodck to PATH');
core.info(`Binary path: ${undockPath}`);
return undockPath;
}
private filename(version: string): string {
let arch: string;
switch (os.arch()) {
case 'x64': {
arch = 'amd64';
break;
}
case 'ppc64': {
arch = 'ppc64le';
break;
}
case 'arm': {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const arm_version = (process.config.variables as any).arm_version;
arch = arm_version ? 'armv' + arm_version : 'arm';
break;
}
default: {
arch = os.arch();
break;
}
}
const platform: string = os.platform() == 'win32' ? 'windows' : os.platform();
const ext: string = os.platform() == 'win32' ? '.zip' : '.tar.gz';
return util.format('undock_%s_%s_%s%s', version, platform, arch, ext);
}
private async vspec(version: string): Promise<string> {
const v = version.replace(/^v+|v+$/g, '');
core.info(`Use ${v} version spec cache key for ${version}`);
return v;
}
public static async getDownloadVersion(v: string): Promise<DownloadVersion> {
return {
version: v,
downloadURL: 'https://github.com/crazy-max/undock/releases/download/v%s/%s',
releasesURL: 'https://raw.githubusercontent.com/docker/actions-toolkit/main/.github/undock-releases.json'
};
}
public static async getRelease(version: DownloadVersion): Promise<GitHubRelease> {
const http: httpm.HttpClient = new httpm.HttpClient('docker-actions-toolkit');
const resp: httpm.HttpClientResponse = await http.get(version.releasesURL);
const body = await resp.readBody();
const statusCode = resp.message.statusCode || 500;
if (statusCode >= 400) {
throw new Error(`Failed to get Undock releases from ${version.releasesURL} with status code ${statusCode}: ${body}`);
}
const releases = <Record<string, GitHubRelease>>JSON.parse(body);
if (!releases[version.version]) {
throw new Error(`Cannot find Undock release ${version.version} in ${version.releasesURL}`);
}
return releases[version.version];
}
}