Compare commits

..

31 Commits

Author SHA1 Message Date
CrazyMax
33d4b448ac Merge pull request #350 from crazy-max/gha-rest
Some checks failed
publish / publish (push) Has been cancelled
buildx(build): resolveCacheToAttrs func
2024-06-10 13:39:47 +02:00
CrazyMax
ee91773603 Merge pull request #353 from crazy-max/fix-docker-install-linux
docker(install): add tooldir to path for linux and windows
2024-06-10 13:38:59 +02:00
CrazyMax
5186ba6fdf test: bump docker to 26.1.4
Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
2024-06-10 13:34:09 +02:00
CrazyMax
1309d2023e docker(install): add tooldir to path for linux and windows
Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
2024-06-10 13:34:09 +02:00
CrazyMax
6a4479ebc2 Merge pull request #340 from crazy-max/oci
oci: loadArchive to import an index from a tar archive image bundle
2024-06-07 14:50:14 +02:00
CrazyMax
cd9f97a8c5 Merge pull request #352 from docker/bot/buildx-releases-json
Update `.github/buildx-releases.json`
2024-06-07 10:00:51 +02:00
crazy-max
65f5b77696 github: update .github/buildx-releases.json
Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2024-06-07 07:59:06 +00:00
CrazyMax
9ba5af418c Merge pull request #351 from docker/bot/docker-releases-json
Update `.github/docker-releases.json`
2024-06-07 09:58:38 +02:00
crazy-max
93ae2ded04 github: update .github/docker-releases.json
Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2024-06-06 00:22:40 +00:00
CrazyMax
15788e8b93 buildx(build): resolveCacheToAttrs func
Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
2024-06-05 13:59:57 +02:00
CrazyMax
92053e1988 Merge pull request #348 from docker/bot/docker-releases-json
Update `.github/docker-releases.json`
2024-06-04 09:22:31 +02:00
CrazyMax
6d856fd53e Merge pull request #349 from docker/bot/buildx-releases-json
Update `.github/buildx-releases.json`
2024-06-04 09:22:06 +02:00
crazy-max
e67313ac6d github: update .github/buildx-releases.json
Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2024-06-04 00:16:35 +00:00
crazy-max
881230f4b0 github: update .github/docker-releases.json
Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2024-05-30 00:22:56 +00:00
CrazyMax
6fb52d2a23 oci: loadArchive to import an index from a tar archive image bundle
Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
2024-05-29 11:11:12 +02:00
CrazyMax
2941f52b66 Merge pull request #346 from crazy-max/gh-workflow-run-retries
github: set attempts to workflowRunURL
2024-05-28 09:44:05 +02:00
CrazyMax
760d0c2369 github: set attempts to workflowRunURL
Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
2024-05-27 19:57:40 +02:00
CrazyMax
d344961874 Merge pull request #345 from crazy-max/move-types
Some checks failed
publish / publish (push) Has been cancelled
move types to the right place
2024-05-27 12:15:48 +02:00
CrazyMax
5958c823ef Merge pull request #344 from docker/bot/buildx-lab-releases-json
Update `.github/buildx-lab-releases.json`
2024-05-27 12:07:38 +02:00
CrazyMax
a033bb70cd move types to the right place
Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
2024-05-27 12:06:52 +02:00
crazy-max
8f8c0bb7ec github: update .github/buildx-lab-releases.json
Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2024-05-27 10:02:50 +00:00
CrazyMax
0903e498a4 Merge pull request #324 from crazy-max/build-summary
github: write build summary
2024-05-27 12:02:24 +02:00
CrazyMax
1e903f84b6 github: write build summary
Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
2024-05-27 11:41:36 +02:00
CrazyMax
3a2e4a89a6 Merge pull request #342 from tonistiigi/update-buildx-v0.14.1
update buildx to v0.14.1
2024-05-22 21:07:46 +02:00
CrazyMax
b3dc87c0e0 Merge pull request #341 from docker/bot/docker-releases-json
Update `.github/docker-releases.json`
2024-05-22 21:07:21 +02:00
Tonis Tiigi
bd1955c564 update buildx to v0.14.1
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2024-05-22 11:26:21 -07:00
tonistiigi
956acbf3c6 github: update .github/docker-releases.json
Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2024-05-22 18:21:03 +00:00
Tõnis Tiigi
ea36deec7f Merge pull request #343 from docker/bot/buildx-releases-json
Update `.github/buildx-releases.json`
2024-05-22 11:20:38 -07:00
tonistiigi
9d829e4f4a github: update .github/buildx-releases.json
Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2024-05-22 18:19:56 +00:00
CrazyMax
66c00b9bbd Merge pull request #339 from crazy-max/update-virtual-env
ci(virtual-env): add ubuntu-24.04 to the matrix
2024-05-15 14:38:26 +02:00
CrazyMax
448f9ac218 ci(virtual-env): add ubuntu-24.04 to the matrix
Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
2024-05-15 14:28:30 +02:00
62 changed files with 1317 additions and 80 deletions

1
.gitattributes vendored
View File

@@ -1,2 +1,3 @@
/.yarn/releases/** binary
/.yarn/plugins/** binary
/__tests__/fixtures/oci-archive/** binary

View File

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

View File

@@ -1,43 +1,166 @@
{
"latest": {
"id": 151768856,
"tag_name": "v0.14.0",
"html_url": "https://github.com/docker/buildx/releases/tag/v0.14.0",
"id": 156924662,
"tag_name": "v0.14.1",
"html_url": "https://github.com/docker/buildx/releases/tag/v0.14.1",
"assets": [
"https://github.com/docker/buildx/releases/download/v0.14.0/buildx-v0.14.0.darwin-amd64",
"https://github.com/docker/buildx/releases/download/v0.14.0/buildx-v0.14.0.darwin-amd64.provenance.json",
"https://github.com/docker/buildx/releases/download/v0.14.0/buildx-v0.14.0.darwin-amd64.sbom.json",
"https://github.com/docker/buildx/releases/download/v0.14.0/buildx-v0.14.0.darwin-arm64",
"https://github.com/docker/buildx/releases/download/v0.14.0/buildx-v0.14.0.darwin-arm64.provenance.json",
"https://github.com/docker/buildx/releases/download/v0.14.0/buildx-v0.14.0.darwin-arm64.sbom.json",
"https://github.com/docker/buildx/releases/download/v0.14.0/buildx-v0.14.0.linux-amd64",
"https://github.com/docker/buildx/releases/download/v0.14.0/buildx-v0.14.0.linux-amd64.provenance.json",
"https://github.com/docker/buildx/releases/download/v0.14.0/buildx-v0.14.0.linux-amd64.sbom.json",
"https://github.com/docker/buildx/releases/download/v0.14.0/buildx-v0.14.0.linux-arm-v6",
"https://github.com/docker/buildx/releases/download/v0.14.0/buildx-v0.14.0.linux-arm-v6.provenance.json",
"https://github.com/docker/buildx/releases/download/v0.14.0/buildx-v0.14.0.linux-arm-v6.sbom.json",
"https://github.com/docker/buildx/releases/download/v0.14.0/buildx-v0.14.0.linux-arm-v7",
"https://github.com/docker/buildx/releases/download/v0.14.0/buildx-v0.14.0.linux-arm-v7.provenance.json",
"https://github.com/docker/buildx/releases/download/v0.14.0/buildx-v0.14.0.linux-arm-v7.sbom.json",
"https://github.com/docker/buildx/releases/download/v0.14.0/buildx-v0.14.0.linux-arm64",
"https://github.com/docker/buildx/releases/download/v0.14.0/buildx-v0.14.0.linux-arm64.provenance.json",
"https://github.com/docker/buildx/releases/download/v0.14.0/buildx-v0.14.0.linux-arm64.sbom.json",
"https://github.com/docker/buildx/releases/download/v0.14.0/buildx-v0.14.0.linux-ppc64le",
"https://github.com/docker/buildx/releases/download/v0.14.0/buildx-v0.14.0.linux-ppc64le.provenance.json",
"https://github.com/docker/buildx/releases/download/v0.14.0/buildx-v0.14.0.linux-ppc64le.sbom.json",
"https://github.com/docker/buildx/releases/download/v0.14.0/buildx-v0.14.0.linux-riscv64",
"https://github.com/docker/buildx/releases/download/v0.14.0/buildx-v0.14.0.linux-riscv64.provenance.json",
"https://github.com/docker/buildx/releases/download/v0.14.0/buildx-v0.14.0.linux-riscv64.sbom.json",
"https://github.com/docker/buildx/releases/download/v0.14.0/buildx-v0.14.0.linux-s390x",
"https://github.com/docker/buildx/releases/download/v0.14.0/buildx-v0.14.0.linux-s390x.provenance.json",
"https://github.com/docker/buildx/releases/download/v0.14.0/buildx-v0.14.0.linux-s390x.sbom.json",
"https://github.com/docker/buildx/releases/download/v0.14.0/buildx-v0.14.0.windows-amd64.exe",
"https://github.com/docker/buildx/releases/download/v0.14.0/buildx-v0.14.0.windows-amd64.provenance.json",
"https://github.com/docker/buildx/releases/download/v0.14.0/buildx-v0.14.0.windows-amd64.sbom.json",
"https://github.com/docker/buildx/releases/download/v0.14.0/buildx-v0.14.0.windows-arm64.exe",
"https://github.com/docker/buildx/releases/download/v0.14.0/buildx-v0.14.0.windows-arm64.provenance.json",
"https://github.com/docker/buildx/releases/download/v0.14.0/buildx-v0.14.0.windows-arm64.sbom.json",
"https://github.com/docker/buildx/releases/download/v0.14.0/checksums.txt"
"https://github.com/docker/buildx/releases/download/v0.14.1/buildx-v0.14.1.darwin-amd64",
"https://github.com/docker/buildx/releases/download/v0.14.1/buildx-v0.14.1.darwin-amd64.provenance.json",
"https://github.com/docker/buildx/releases/download/v0.14.1/buildx-v0.14.1.darwin-amd64.sbom.json",
"https://github.com/docker/buildx/releases/download/v0.14.1/buildx-v0.14.1.darwin-arm64",
"https://github.com/docker/buildx/releases/download/v0.14.1/buildx-v0.14.1.darwin-arm64.provenance.json",
"https://github.com/docker/buildx/releases/download/v0.14.1/buildx-v0.14.1.darwin-arm64.sbom.json",
"https://github.com/docker/buildx/releases/download/v0.14.1/buildx-v0.14.1.linux-amd64",
"https://github.com/docker/buildx/releases/download/v0.14.1/buildx-v0.14.1.linux-amd64.provenance.json",
"https://github.com/docker/buildx/releases/download/v0.14.1/buildx-v0.14.1.linux-amd64.sbom.json",
"https://github.com/docker/buildx/releases/download/v0.14.1/buildx-v0.14.1.linux-arm-v6",
"https://github.com/docker/buildx/releases/download/v0.14.1/buildx-v0.14.1.linux-arm-v6.provenance.json",
"https://github.com/docker/buildx/releases/download/v0.14.1/buildx-v0.14.1.linux-arm-v6.sbom.json",
"https://github.com/docker/buildx/releases/download/v0.14.1/buildx-v0.14.1.linux-arm-v7",
"https://github.com/docker/buildx/releases/download/v0.14.1/buildx-v0.14.1.linux-arm-v7.provenance.json",
"https://github.com/docker/buildx/releases/download/v0.14.1/buildx-v0.14.1.linux-arm-v7.sbom.json",
"https://github.com/docker/buildx/releases/download/v0.14.1/buildx-v0.14.1.linux-arm64",
"https://github.com/docker/buildx/releases/download/v0.14.1/buildx-v0.14.1.linux-arm64.provenance.json",
"https://github.com/docker/buildx/releases/download/v0.14.1/buildx-v0.14.1.linux-arm64.sbom.json",
"https://github.com/docker/buildx/releases/download/v0.14.1/buildx-v0.14.1.linux-ppc64le",
"https://github.com/docker/buildx/releases/download/v0.14.1/buildx-v0.14.1.linux-ppc64le.provenance.json",
"https://github.com/docker/buildx/releases/download/v0.14.1/buildx-v0.14.1.linux-ppc64le.sbom.json",
"https://github.com/docker/buildx/releases/download/v0.14.1/buildx-v0.14.1.linux-riscv64",
"https://github.com/docker/buildx/releases/download/v0.14.1/buildx-v0.14.1.linux-riscv64.provenance.json",
"https://github.com/docker/buildx/releases/download/v0.14.1/buildx-v0.14.1.linux-riscv64.sbom.json",
"https://github.com/docker/buildx/releases/download/v0.14.1/buildx-v0.14.1.linux-s390x",
"https://github.com/docker/buildx/releases/download/v0.14.1/buildx-v0.14.1.linux-s390x.provenance.json",
"https://github.com/docker/buildx/releases/download/v0.14.1/buildx-v0.14.1.linux-s390x.sbom.json",
"https://github.com/docker/buildx/releases/download/v0.14.1/buildx-v0.14.1.windows-amd64.exe",
"https://github.com/docker/buildx/releases/download/v0.14.1/buildx-v0.14.1.windows-amd64.provenance.json",
"https://github.com/docker/buildx/releases/download/v0.14.1/buildx-v0.14.1.windows-amd64.sbom.json",
"https://github.com/docker/buildx/releases/download/v0.14.1/buildx-v0.14.1.windows-arm64.exe",
"https://github.com/docker/buildx/releases/download/v0.14.1/buildx-v0.14.1.windows-arm64.provenance.json",
"https://github.com/docker/buildx/releases/download/v0.14.1/buildx-v0.14.1.windows-arm64.sbom.json",
"https://github.com/docker/buildx/releases/download/v0.14.1/checksums.txt"
]
},
"v0.15.0-rc2": {
"id": 159285616,
"tag_name": "v0.15.0-rc2",
"html_url": "https://github.com/docker/buildx/releases/tag/v0.15.0-rc2",
"assets": [
"https://github.com/docker/buildx/releases/download/v0.15.0-rc2/buildx-v0.15.0-rc2.darwin-amd64",
"https://github.com/docker/buildx/releases/download/v0.15.0-rc2/buildx-v0.15.0-rc2.darwin-amd64.provenance.json",
"https://github.com/docker/buildx/releases/download/v0.15.0-rc2/buildx-v0.15.0-rc2.darwin-amd64.sbom.json",
"https://github.com/docker/buildx/releases/download/v0.15.0-rc2/buildx-v0.15.0-rc2.darwin-arm64",
"https://github.com/docker/buildx/releases/download/v0.15.0-rc2/buildx-v0.15.0-rc2.darwin-arm64.provenance.json",
"https://github.com/docker/buildx/releases/download/v0.15.0-rc2/buildx-v0.15.0-rc2.darwin-arm64.sbom.json",
"https://github.com/docker/buildx/releases/download/v0.15.0-rc2/buildx-v0.15.0-rc2.linux-amd64",
"https://github.com/docker/buildx/releases/download/v0.15.0-rc2/buildx-v0.15.0-rc2.linux-amd64.provenance.json",
"https://github.com/docker/buildx/releases/download/v0.15.0-rc2/buildx-v0.15.0-rc2.linux-amd64.sbom.json",
"https://github.com/docker/buildx/releases/download/v0.15.0-rc2/buildx-v0.15.0-rc2.linux-arm-v6",
"https://github.com/docker/buildx/releases/download/v0.15.0-rc2/buildx-v0.15.0-rc2.linux-arm-v6.provenance.json",
"https://github.com/docker/buildx/releases/download/v0.15.0-rc2/buildx-v0.15.0-rc2.linux-arm-v6.sbom.json",
"https://github.com/docker/buildx/releases/download/v0.15.0-rc2/buildx-v0.15.0-rc2.linux-arm-v7",
"https://github.com/docker/buildx/releases/download/v0.15.0-rc2/buildx-v0.15.0-rc2.linux-arm-v7.provenance.json",
"https://github.com/docker/buildx/releases/download/v0.15.0-rc2/buildx-v0.15.0-rc2.linux-arm-v7.sbom.json",
"https://github.com/docker/buildx/releases/download/v0.15.0-rc2/buildx-v0.15.0-rc2.linux-arm64",
"https://github.com/docker/buildx/releases/download/v0.15.0-rc2/buildx-v0.15.0-rc2.linux-arm64.provenance.json",
"https://github.com/docker/buildx/releases/download/v0.15.0-rc2/buildx-v0.15.0-rc2.linux-arm64.sbom.json",
"https://github.com/docker/buildx/releases/download/v0.15.0-rc2/buildx-v0.15.0-rc2.linux-ppc64le",
"https://github.com/docker/buildx/releases/download/v0.15.0-rc2/buildx-v0.15.0-rc2.linux-ppc64le.provenance.json",
"https://github.com/docker/buildx/releases/download/v0.15.0-rc2/buildx-v0.15.0-rc2.linux-ppc64le.sbom.json",
"https://github.com/docker/buildx/releases/download/v0.15.0-rc2/buildx-v0.15.0-rc2.linux-riscv64",
"https://github.com/docker/buildx/releases/download/v0.15.0-rc2/buildx-v0.15.0-rc2.linux-riscv64.provenance.json",
"https://github.com/docker/buildx/releases/download/v0.15.0-rc2/buildx-v0.15.0-rc2.linux-riscv64.sbom.json",
"https://github.com/docker/buildx/releases/download/v0.15.0-rc2/buildx-v0.15.0-rc2.linux-s390x",
"https://github.com/docker/buildx/releases/download/v0.15.0-rc2/buildx-v0.15.0-rc2.linux-s390x.provenance.json",
"https://github.com/docker/buildx/releases/download/v0.15.0-rc2/buildx-v0.15.0-rc2.linux-s390x.sbom.json",
"https://github.com/docker/buildx/releases/download/v0.15.0-rc2/buildx-v0.15.0-rc2.windows-amd64.exe",
"https://github.com/docker/buildx/releases/download/v0.15.0-rc2/buildx-v0.15.0-rc2.windows-amd64.provenance.json",
"https://github.com/docker/buildx/releases/download/v0.15.0-rc2/buildx-v0.15.0-rc2.windows-amd64.sbom.json",
"https://github.com/docker/buildx/releases/download/v0.15.0-rc2/buildx-v0.15.0-rc2.windows-arm64.exe",
"https://github.com/docker/buildx/releases/download/v0.15.0-rc2/buildx-v0.15.0-rc2.windows-arm64.provenance.json",
"https://github.com/docker/buildx/releases/download/v0.15.0-rc2/buildx-v0.15.0-rc2.windows-arm64.sbom.json",
"https://github.com/docker/buildx/releases/download/v0.15.0-rc2/checksums.txt"
]
},
"v0.15.0-rc1": {
"id": 158684634,
"tag_name": "v0.15.0-rc1",
"html_url": "https://github.com/docker/buildx/releases/tag/v0.15.0-rc1",
"assets": [
"https://github.com/docker/buildx/releases/download/v0.15.0-rc1/buildx-v0.15.0-rc1.darwin-amd64",
"https://github.com/docker/buildx/releases/download/v0.15.0-rc1/buildx-v0.15.0-rc1.darwin-amd64.provenance.json",
"https://github.com/docker/buildx/releases/download/v0.15.0-rc1/buildx-v0.15.0-rc1.darwin-amd64.sbom.json",
"https://github.com/docker/buildx/releases/download/v0.15.0-rc1/buildx-v0.15.0-rc1.darwin-arm64",
"https://github.com/docker/buildx/releases/download/v0.15.0-rc1/buildx-v0.15.0-rc1.darwin-arm64.provenance.json",
"https://github.com/docker/buildx/releases/download/v0.15.0-rc1/buildx-v0.15.0-rc1.darwin-arm64.sbom.json",
"https://github.com/docker/buildx/releases/download/v0.15.0-rc1/buildx-v0.15.0-rc1.linux-amd64",
"https://github.com/docker/buildx/releases/download/v0.15.0-rc1/buildx-v0.15.0-rc1.linux-amd64.provenance.json",
"https://github.com/docker/buildx/releases/download/v0.15.0-rc1/buildx-v0.15.0-rc1.linux-amd64.sbom.json",
"https://github.com/docker/buildx/releases/download/v0.15.0-rc1/buildx-v0.15.0-rc1.linux-arm-v6",
"https://github.com/docker/buildx/releases/download/v0.15.0-rc1/buildx-v0.15.0-rc1.linux-arm-v6.provenance.json",
"https://github.com/docker/buildx/releases/download/v0.15.0-rc1/buildx-v0.15.0-rc1.linux-arm-v6.sbom.json",
"https://github.com/docker/buildx/releases/download/v0.15.0-rc1/buildx-v0.15.0-rc1.linux-arm-v7",
"https://github.com/docker/buildx/releases/download/v0.15.0-rc1/buildx-v0.15.0-rc1.linux-arm-v7.provenance.json",
"https://github.com/docker/buildx/releases/download/v0.15.0-rc1/buildx-v0.15.0-rc1.linux-arm-v7.sbom.json",
"https://github.com/docker/buildx/releases/download/v0.15.0-rc1/buildx-v0.15.0-rc1.linux-arm64",
"https://github.com/docker/buildx/releases/download/v0.15.0-rc1/buildx-v0.15.0-rc1.linux-arm64.provenance.json",
"https://github.com/docker/buildx/releases/download/v0.15.0-rc1/buildx-v0.15.0-rc1.linux-arm64.sbom.json",
"https://github.com/docker/buildx/releases/download/v0.15.0-rc1/buildx-v0.15.0-rc1.linux-ppc64le",
"https://github.com/docker/buildx/releases/download/v0.15.0-rc1/buildx-v0.15.0-rc1.linux-ppc64le.provenance.json",
"https://github.com/docker/buildx/releases/download/v0.15.0-rc1/buildx-v0.15.0-rc1.linux-ppc64le.sbom.json",
"https://github.com/docker/buildx/releases/download/v0.15.0-rc1/buildx-v0.15.0-rc1.linux-riscv64",
"https://github.com/docker/buildx/releases/download/v0.15.0-rc1/buildx-v0.15.0-rc1.linux-riscv64.provenance.json",
"https://github.com/docker/buildx/releases/download/v0.15.0-rc1/buildx-v0.15.0-rc1.linux-riscv64.sbom.json",
"https://github.com/docker/buildx/releases/download/v0.15.0-rc1/buildx-v0.15.0-rc1.linux-s390x",
"https://github.com/docker/buildx/releases/download/v0.15.0-rc1/buildx-v0.15.0-rc1.linux-s390x.provenance.json",
"https://github.com/docker/buildx/releases/download/v0.15.0-rc1/buildx-v0.15.0-rc1.linux-s390x.sbom.json",
"https://github.com/docker/buildx/releases/download/v0.15.0-rc1/buildx-v0.15.0-rc1.windows-amd64.exe",
"https://github.com/docker/buildx/releases/download/v0.15.0-rc1/buildx-v0.15.0-rc1.windows-amd64.provenance.json",
"https://github.com/docker/buildx/releases/download/v0.15.0-rc1/buildx-v0.15.0-rc1.windows-amd64.sbom.json",
"https://github.com/docker/buildx/releases/download/v0.15.0-rc1/buildx-v0.15.0-rc1.windows-arm64.exe",
"https://github.com/docker/buildx/releases/download/v0.15.0-rc1/buildx-v0.15.0-rc1.windows-arm64.provenance.json",
"https://github.com/docker/buildx/releases/download/v0.15.0-rc1/buildx-v0.15.0-rc1.windows-arm64.sbom.json",
"https://github.com/docker/buildx/releases/download/v0.15.0-rc1/checksums.txt"
]
},
"v0.14.1": {
"id": 156924662,
"tag_name": "v0.14.1",
"html_url": "https://github.com/docker/buildx/releases/tag/v0.14.1",
"assets": [
"https://github.com/docker/buildx/releases/download/v0.14.1/buildx-v0.14.1.darwin-amd64",
"https://github.com/docker/buildx/releases/download/v0.14.1/buildx-v0.14.1.darwin-amd64.provenance.json",
"https://github.com/docker/buildx/releases/download/v0.14.1/buildx-v0.14.1.darwin-amd64.sbom.json",
"https://github.com/docker/buildx/releases/download/v0.14.1/buildx-v0.14.1.darwin-arm64",
"https://github.com/docker/buildx/releases/download/v0.14.1/buildx-v0.14.1.darwin-arm64.provenance.json",
"https://github.com/docker/buildx/releases/download/v0.14.1/buildx-v0.14.1.darwin-arm64.sbom.json",
"https://github.com/docker/buildx/releases/download/v0.14.1/buildx-v0.14.1.linux-amd64",
"https://github.com/docker/buildx/releases/download/v0.14.1/buildx-v0.14.1.linux-amd64.provenance.json",
"https://github.com/docker/buildx/releases/download/v0.14.1/buildx-v0.14.1.linux-amd64.sbom.json",
"https://github.com/docker/buildx/releases/download/v0.14.1/buildx-v0.14.1.linux-arm-v6",
"https://github.com/docker/buildx/releases/download/v0.14.1/buildx-v0.14.1.linux-arm-v6.provenance.json",
"https://github.com/docker/buildx/releases/download/v0.14.1/buildx-v0.14.1.linux-arm-v6.sbom.json",
"https://github.com/docker/buildx/releases/download/v0.14.1/buildx-v0.14.1.linux-arm-v7",
"https://github.com/docker/buildx/releases/download/v0.14.1/buildx-v0.14.1.linux-arm-v7.provenance.json",
"https://github.com/docker/buildx/releases/download/v0.14.1/buildx-v0.14.1.linux-arm-v7.sbom.json",
"https://github.com/docker/buildx/releases/download/v0.14.1/buildx-v0.14.1.linux-arm64",
"https://github.com/docker/buildx/releases/download/v0.14.1/buildx-v0.14.1.linux-arm64.provenance.json",
"https://github.com/docker/buildx/releases/download/v0.14.1/buildx-v0.14.1.linux-arm64.sbom.json",
"https://github.com/docker/buildx/releases/download/v0.14.1/buildx-v0.14.1.linux-ppc64le",
"https://github.com/docker/buildx/releases/download/v0.14.1/buildx-v0.14.1.linux-ppc64le.provenance.json",
"https://github.com/docker/buildx/releases/download/v0.14.1/buildx-v0.14.1.linux-ppc64le.sbom.json",
"https://github.com/docker/buildx/releases/download/v0.14.1/buildx-v0.14.1.linux-riscv64",
"https://github.com/docker/buildx/releases/download/v0.14.1/buildx-v0.14.1.linux-riscv64.provenance.json",
"https://github.com/docker/buildx/releases/download/v0.14.1/buildx-v0.14.1.linux-riscv64.sbom.json",
"https://github.com/docker/buildx/releases/download/v0.14.1/buildx-v0.14.1.linux-s390x",
"https://github.com/docker/buildx/releases/download/v0.14.1/buildx-v0.14.1.linux-s390x.provenance.json",
"https://github.com/docker/buildx/releases/download/v0.14.1/buildx-v0.14.1.linux-s390x.sbom.json",
"https://github.com/docker/buildx/releases/download/v0.14.1/buildx-v0.14.1.windows-amd64.exe",
"https://github.com/docker/buildx/releases/download/v0.14.1/buildx-v0.14.1.windows-amd64.provenance.json",
"https://github.com/docker/buildx/releases/download/v0.14.1/buildx-v0.14.1.windows-amd64.sbom.json",
"https://github.com/docker/buildx/releases/download/v0.14.1/buildx-v0.14.1.windows-arm64.exe",
"https://github.com/docker/buildx/releases/download/v0.14.1/buildx-v0.14.1.windows-arm64.provenance.json",
"https://github.com/docker/buildx/releases/download/v0.14.1/buildx-v0.14.1.windows-arm64.sbom.json",
"https://github.com/docker/buildx/releases/download/v0.14.1/checksums.txt"
]
},
"v0.14.0": {

View File

@@ -1,8 +1,26 @@
{
"latest": {
"id": 154733361,
"tag_name": "v26.1.2",
"html_url": "https://github.com/moby/moby/releases/tag/v26.1.2",
"id": 159031384,
"tag_name": "v26.1.4",
"html_url": "https://github.com/moby/moby/releases/tag/v26.1.4",
"assets": []
},
"v26.1.4": {
"id": 159031384,
"tag_name": "v26.1.4",
"html_url": "https://github.com/moby/moby/releases/tag/v26.1.4",
"assets": []
},
"v23.0.12": {
"id": 158038616,
"tag_name": "v23.0.12",
"html_url": "https://github.com/moby/moby/releases/tag/v23.0.12",
"assets": []
},
"v26.1.3": {
"id": 155867714,
"tag_name": "v26.1.3",
"html_url": "https://github.com/moby/moby/releases/tag/v26.1.3",
"assets": []
},
"v26.1.2": {

View File

@@ -15,7 +15,7 @@ on:
env:
NODE_VERSION: "20"
BUILDX_VERSION: "v0.14.0"
BUILDX_VERSION: "v0.14.1"
jobs:
test:

View File

@@ -21,6 +21,7 @@ jobs:
matrix:
os:
- ubuntu-latest
- ubuntu-24.04
- ubuntu-22.04
- ubuntu-20.04
steps:
@@ -42,7 +43,7 @@ jobs:
-
name: Docker daemon conf
run: |
cat /etc/docker/daemon.json
cat /etc/docker/daemon.json || true
-
name: Docker info
run: docker info

View File

@@ -22,7 +22,8 @@ export const context = {
repo: 'actions-toolkit'
},
ref: 'refs/heads/master',
runId: 123,
runId: 2188748038,
runNumber: 15,
payload: {
after: '860c1904a1ce19322e91ac35af1ab07466440c37',
base_ref: null,

View File

@@ -19,7 +19,7 @@ import {beforeEach, describe, expect, it, jest, test} from '@jest/globals';
import {BuildKit} from '../../src/buildkit/buildkit';
import {Builder} from '../../src/buildx/builder';
import {BuilderInfo} from '../../src/types/builder';
import {BuilderInfo} from '../../src/types/buildx/builder';
beforeEach(() => {
jest.clearAllMocks();

View File

@@ -19,7 +19,7 @@ import * as fs from 'fs';
import * as path from 'path';
import {Bake} from '../../src/buildx/bake';
import {BakeDefinition} from '../../src/types/bake';
import {BakeDefinition} from '../../src/types/buildx/bake';
const fixturesDir = path.join(__dirname, '..', 'fixtures');

View File

@@ -23,7 +23,7 @@ import {Bake} from '../../src/buildx/bake';
import {Context} from '../../src/context';
import {ExecOptions} from '@actions/exec';
import {BakeDefinition, BakeMetadata} from '../../src/types/bake';
import {BakeDefinition, BakeMetadata} from '../../src/types/buildx/bake';
const fixturesDir = path.join(__dirname, '..', 'fixtures');
// prettier-ignore

View File

@@ -22,7 +22,7 @@ import * as rimraf from 'rimraf';
import {Context} from '../../src/context';
import {Build} from '../../src/buildx/build';
import {BuildMetadata} from '../../src/types/build';
import {BuildMetadata} from '../../src/types/buildx/build';
const fixturesDir = path.join(__dirname, '..', 'fixtures');
// prettier-ignore
@@ -100,7 +100,7 @@ describe('getProvenanceInput', () => {
test.each([
[
'true',
'builder-id=https://github.com/docker/actions-toolkit/actions/runs/123'
'builder-id=https://github.com/docker/actions-toolkit/actions/runs/2188748038/attempts/2'
],
[
'false',
@@ -108,11 +108,11 @@ describe('getProvenanceInput', () => {
],
[
'mode=min',
'mode=min,builder-id=https://github.com/docker/actions-toolkit/actions/runs/123'
'mode=min,builder-id=https://github.com/docker/actions-toolkit/actions/runs/2188748038/attempts/2'
],
[
'mode=max',
'mode=max,builder-id=https://github.com/docker/actions-toolkit/actions/runs/123'
'mode=max,builder-id=https://github.com/docker/actions-toolkit/actions/runs/2188748038/attempts/2'
],
[
'builder-id=foo',
@@ -137,11 +137,11 @@ describe('resolveProvenanceAttrs', () => {
test.each([
[
'mode=min',
'mode=min,builder-id=https://github.com/docker/actions-toolkit/actions/runs/123'
'mode=min,builder-id=https://github.com/docker/actions-toolkit/actions/runs/2188748038/attempts/2'
],
[
'mode=max',
'mode=max,builder-id=https://github.com/docker/actions-toolkit/actions/runs/123'
'mode=max,builder-id=https://github.com/docker/actions-toolkit/actions/runs/2188748038/attempts/2'
],
[
'builder-id=foo',
@@ -153,7 +153,7 @@ describe('resolveProvenanceAttrs', () => {
],
[
'',
'builder-id=https://github.com/docker/actions-toolkit/actions/runs/123'
'builder-id=https://github.com/docker/actions-toolkit/actions/runs/2188748038/attempts/2'
],
])('given %p', async (input: string, expected: string) => {
expect(Build.resolveProvenanceAttrs(input)).toEqual(expected);
@@ -202,6 +202,54 @@ describe('resolveSecret', () => {
});
});
describe('resolveCacheToAttrs', () => {
// prettier-ignore
test.each([
[
'',
undefined,
''
],
[
'user/app:cache',
undefined,
'user/app:cache'
],
[
'type=inline',
undefined,
'type=inline'
],
[
'type=gha',
undefined,
'type=gha,repository=docker/actions-toolkit',
],
[
'type=gha,mode=max',
undefined,
'type=gha,mode=max,repository=docker/actions-toolkit',
],
[
'type=gha,mode=max',
'abcd1234',
'type=gha,mode=max,repository=docker/actions-toolkit,ghtoken=abcd1234',
],
[
'type=gha,repository=foo/bar,mode=max',
undefined,
'type=gha,repository=foo/bar,mode=max',
],
[
'type=gha,repository=foo/bar,mode=max',
'abcd1234',
'type=gha,repository=foo/bar,mode=max,ghtoken=abcd1234',
],
])('given %p', async (input: string, githubToken: string | undefined, expected: string) => {
expect(Build.resolveCacheToAttrs(input, githubToken)).toEqual(expected);
});
});
describe('hasLocalExporter', () => {
// prettier-ignore
test.each([

View File

@@ -21,7 +21,7 @@ import * as path from 'path';
import {Builder} from '../../src/buildx/builder';
import {Exec} from '../../src/exec';
import {BuilderInfo} from '../../src/types/builder';
import {BuilderInfo} from '../../src/types/buildx/builder';
const fixturesDir = path.join(__dirname, '..', 'fixtures');

View File

@@ -24,7 +24,7 @@ import {Buildx} from '../../src/buildx/buildx';
import {Context} from '../../src/context';
import {Exec} from '../../src/exec';
import {Cert} from '../../src/types/buildx';
import {Cert} from '../../src/types/buildx/buildx';
const fixturesDir = path.join(__dirname, '..', 'fixtures');
// prettier-ignore

View File

@@ -86,6 +86,7 @@ maybe('exportBuild', () => {
expect(exportRes?.dockerbuildFilename).toBeDefined();
expect(exportRes?.dockerbuildSize).toBeDefined();
expect(fs.existsSync(exportRes?.dockerbuildFilename)).toBe(true);
expect(exportRes?.summaries).toBeDefined();
});
// prettier-ignore
@@ -147,5 +148,6 @@ maybe('exportBuild', () => {
expect(exportRes?.dockerbuildFilename).toBeDefined();
expect(exportRes?.dockerbuildSize).toBeDefined();
expect(fs.existsSync(exportRes?.dockerbuildFilename)).toBe(true);
expect(exportRes?.summaries).toBeDefined();
});
});

View File

@@ -24,7 +24,7 @@ import * as rimraf from 'rimraf';
import {Docker} from '../../src/docker/docker';
import {Exec} from '../../src/exec';
import {ConfigFile} from '../../src/types/docker';
import {ConfigFile} from '../../src/types/docker/docker';
const fixturesDir = path.join(__dirname, '..', 'fixtures');

View File

@@ -19,6 +19,7 @@ import {jest, describe, expect, test, beforeEach, afterEach} from '@jest/globals
import {Install} from '../../src/docker/install';
import {Docker} from '../../src/docker/docker';
import {Exec} from '../../src/exec';
// prettier-ignore
const tmpDir = path.join(process.env.TEMP || '/tmp', 'docker-install-jest');
@@ -38,8 +39,19 @@ aarch64:https://cloud.debian.org/images/cloud/bookworm/20231013-1532/debian-12-g
process.env = originalEnv;
});
// prettier-ignore
test.each(['v24.0.4'])(
test.each(['v26.1.4'])(
'install docker %s', async (version) => {
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 expect((async () => {
const install = new Install({
version: version,

View File

@@ -14,7 +14,10 @@
# See the License for the specific language governing permissions and
# limitations under the License.
FROM busybox
FROM busybox AS build
ARG NAME=foo
ARG TARGETPLATFORM
RUN echo "Hello $NAME from $TARGETPLATFORM"
RUN echo "Hello $NAME from $TARGETPLATFORM" > foo
FROM scratch
COPY --from=build /foo /

Binary file not shown.

Binary file not shown.

View File

@@ -14,13 +14,22 @@
* limitations under the License.
*/
import {beforeEach, describe, expect, it, jest} from '@jest/globals';
import {beforeEach, describe, expect, it, jest, test} from '@jest/globals';
import fs from 'fs';
import * as path from 'path';
import {Buildx} from '../src/buildx/buildx';
import {Bake} from '../src/buildx/bake';
import {Build} from '../src/buildx/build';
import {Exec} from '../src/exec';
import {GitHub} from '../src/github';
import {History} from '../src/buildx/history';
const fixturesDir = path.join(__dirname, 'fixtures');
// prettier-ignore
const tmpDir = path.join(process.env.TEMP || '/tmp', 'github-jest');
const maybe = !process.env.GITHUB_ACTIONS || (process.env.GITHUB_ACTIONS === 'true' && process.env.ImageOS && process.env.ImageOS.startsWith('ubuntu')) ? describe : describe.skip;
beforeEach(() => {
@@ -39,3 +48,149 @@ maybe('uploadArtifact', () => {
expect(res?.url).toBeDefined();
});
});
maybe('writeBuildSummary', () => {
// prettier-ignore
test.each([
[
"single",
[
'build',
'-f', path.join(fixturesDir, 'hello.Dockerfile'),
fixturesDir
],
],
[
"multiplatform",
[
'build',
'-f', path.join(fixturesDir, 'hello.Dockerfile'),
'--platform', 'linux/amd64,linux/arm64',
fixturesDir
],
]
])('write build summary %p', async (_, bargs) => {
const buildx = new Buildx();
const build = new Build({buildx: buildx});
fs.mkdirSync(tmpDir, {recursive: true});
await expect(
(async () => {
// prettier-ignore
const buildCmd = await buildx.getCommand([
'--builder', process.env.CTN_BUILDER_NAME ?? 'default',
...bargs,
'--metadata-file', build.getMetadataFilePath()
]);
await Exec.exec(buildCmd.command, buildCmd.args);
})()
).resolves.not.toThrow();
const metadata = build.resolveMetadata();
expect(metadata).toBeDefined();
const buildRef = build.resolveRef(metadata);
expect(buildRef).toBeDefined();
const history = new History({buildx: buildx});
const exportRes = await history.export({
refs: [buildRef ?? '']
});
expect(exportRes).toBeDefined();
expect(exportRes?.dockerbuildFilename).toBeDefined();
expect(exportRes?.dockerbuildSize).toBeDefined();
expect(exportRes?.summaries).toBeDefined();
const uploadRes = await GitHub.uploadArtifact({
filename: exportRes?.dockerbuildFilename,
mimeType: 'application/gzip',
retentionDays: 1
});
expect(uploadRes).toBeDefined();
expect(uploadRes?.url).toBeDefined();
await GitHub.writeBuildSummary({
exportRes: exportRes,
uploadRes: uploadRes,
inputs: {
context: fixturesDir,
file: path.join(fixturesDir, 'hello.Dockerfile')
}
});
});
// prettier-ignore
test.each([
[
'single',
[
'bake',
'-f', path.join(fixturesDir, 'hello-bake.hcl'),
'hello'
],
],
[
'group',
[
'bake',
'-f', path.join(fixturesDir, 'hello-bake.hcl'),
'hello-all'
],
],
[
'matrix',
[
'bake',
'-f', path.join(fixturesDir, 'hello-bake.hcl'),
'hello-matrix'
],
]
])('write bake summary %p', async (_, bargs) => {
const buildx = new Buildx();
const bake = new Bake({buildx: buildx});
fs.mkdirSync(tmpDir, {recursive: true});
await expect(
(async () => {
// prettier-ignore
const buildCmd = await buildx.getCommand([
'--builder', process.env.CTN_BUILDER_NAME ?? 'default',
...bargs,
'--metadata-file', bake.getMetadataFilePath()
]);
await Exec.exec(buildCmd.command, buildCmd.args, {
cwd: fixturesDir
});
})()
).resolves.not.toThrow();
const metadata = bake.resolveMetadata();
expect(metadata).toBeDefined();
const buildRefs = bake.resolveRefs(metadata);
expect(buildRefs).toBeDefined();
const history = new History({buildx: buildx});
const exportRes = await history.export({
refs: buildRefs ?? []
});
expect(exportRes).toBeDefined();
expect(exportRes?.dockerbuildFilename).toBeDefined();
expect(exportRes?.dockerbuildSize).toBeDefined();
expect(exportRes?.summaries).toBeDefined();
const uploadRes = await GitHub.uploadArtifact({
filename: exportRes?.dockerbuildFilename,
mimeType: 'application/gzip',
retentionDays: 1
});
expect(uploadRes).toBeDefined();
expect(uploadRes?.url).toBeDefined();
await GitHub.writeBuildSummary({
exportRes: exportRes,
uploadRes: uploadRes,
inputs: {
files: path.join(fixturesDir, 'hello-bake.hcl')
}
});
});
});

View File

@@ -32,7 +32,7 @@ jest.spyOn(GitHub.prototype, 'repoData').mockImplementation((): Promise<GitHubRe
});
describe('repoData', () => {
it('returns GitHub repository', async () => {
it('returns GitHub repo data', async () => {
const github = new GitHub();
expect((await github.repoData()).name).toEqual('Hello-World');
});
@@ -89,9 +89,15 @@ describe('apiURL', () => {
});
});
describe('repository', () => {
it('returns GitHub repository', async () => {
expect(GitHub.repository).toEqual('docker/actions-toolkit');
});
});
describe('workflowRunURL', () => {
it('returns 123', async () => {
expect(GitHub.workflowRunURL).toEqual('https://github.com/docker/actions-toolkit/actions/runs/123');
it('returns 2188748038', async () => {
expect(GitHub.workflowRunURL).toEqual('https://github.com/docker/actions-toolkit/actions/runs/2188748038/attempts/2');
});
});

50
__tests__/oci/oci.test.ts Normal file
View File

@@ -0,0 +1,50 @@
/**
* 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 {afterEach, beforeEach, describe, expect, jest, test} from '@jest/globals';
import * as fs from 'fs';
import path from 'path';
import * as rimraf from 'rimraf';
import {OCI} from '../../src/oci/oci';
const fixturesDir = path.join(__dirname, '..', 'fixtures');
// prettier-ignore
const tmpDir = path.join(process.env.TEMP || '/tmp', 'docker-jest');
beforeEach(() => {
jest.clearAllMocks();
});
afterEach(function () {
rimraf.sync(tmpDir);
});
describe('loadArchive', () => {
// prettier-ignore
test.each(fs.readdirSync(path.join(fixturesDir, 'oci-archive')).filter(file => {
return fs.statSync(path.join(path.join(fixturesDir, 'oci-archive'), file)).isFile();
}).map(filename => [filename]))('extracting %p', async (filename) => {
const res = await OCI.loadArchive({
file: path.join(fixturesDir, 'oci-archive', filename)
});
expect(res).toBeDefined();
expect(res?.root.index).toBeDefined();
expect(res?.root.layout).toBeDefined();
// console.log(JSON.stringify(res, null, 2));
});
});

View File

@@ -16,7 +16,7 @@
ARG NODE_VERSION=20
ARG DOCKER_VERSION=26.0.2
ARG BUILDX_VERSION=0.14.0
ARG BUILDX_VERSION=0.14.1
FROM node:${NODE_VERSION}-alpine AS base
RUN apk add --no-cache cpio findutils git

View File

@@ -23,6 +23,9 @@ const tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), 'docker-actions-toolkit-'))
process.env = Object.assign({}, process.env, {
TEMP: tmpDir,
GITHUB_REPOSITORY: 'docker/actions-toolkit',
GITHUB_RUN_ATTEMPT: 2,
GITHUB_RUN_ID: 2188748038,
GITHUB_RUN_NUMBER: 15,
RUNNER_TEMP: path.join(tmpDir, 'runner-temp'),
RUNNER_TOOL_CACHE: path.join(tmpDir, 'runner-tool-cache')
}) as {

View File

@@ -23,6 +23,9 @@ const tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), 'docker-actions-toolkit-'))
process.env = Object.assign({}, process.env, {
TEMP: tmpDir,
GITHUB_REPOSITORY: 'docker/actions-toolkit',
GITHUB_RUN_ATTEMPT: 2,
GITHUB_RUN_ID: 2188748038,
GITHUB_RUN_NUMBER: 15,
RUNNER_TEMP: path.join(tmpDir, 'runner-temp'),
RUNNER_TOOL_CACHE: path.join(tmpDir, 'runner-tool-cache')
}) as {

View File

@@ -58,15 +58,21 @@
"@octokit/plugin-rest-endpoint-methods": "^10.4.0",
"async-retry": "^1.3.3",
"csv-parse": "^5.5.6",
"gunzip-maybe": "^1.4.2",
"handlebars": "^4.7.8",
"js-yaml": "^4.1.0",
"jwt-decode": "^4.0.0",
"semver": "^7.6.2",
"tar-stream": "^3.1.7",
"tmp": "^0.2.3"
},
"devDependencies": {
"@types/csv-parse": "^1.2.2",
"@types/gunzip-maybe": "^1.4.2",
"@types/js-yaml": "^4.0.9",
"@types/node": "^20.12.10",
"@types/semver": "^7.5.8",
"@types/tar-stream": "^3.1.3",
"@types/tmp": "^0.2.6",
"@typescript-eslint/eslint-plugin": "^7.8.0",
"@typescript-eslint/parser": "^7.8.0",

View File

@@ -22,7 +22,7 @@ import {Builder} from '../buildx/builder';
import {Config} from './config';
import {Exec} from '../exec';
import {BuilderInfo, NodeInfo} from '../types/builder';
import {BuilderInfo, NodeInfo} from '../types/buildx/builder';
export interface BuildKitOpts {
buildx?: Buildx;

View File

@@ -24,7 +24,7 @@ import {Exec} from '../exec';
import {Util} from '../util';
import {ExecOptions} from '@actions/exec';
import {BakeDefinition, BakeMetadata} from '../types/bake';
import {BakeDefinition, BakeMetadata} from '../types/buildx/bake';
export interface BakeOpts {
buildx?: Buildx;

View File

@@ -24,7 +24,7 @@ import {Context} from '../context';
import {GitHub} from '../github';
import {Util} from '../util';
import {BuildMetadata} from '../types/build';
import {BuildMetadata} from '../types/buildx/build';
export interface BuildOpts {
buildx?: Buildx;
@@ -161,6 +161,45 @@ export class Build {
return `${input},builder-id=${GitHub.workflowRunURL}`;
}
public static resolveCacheToAttrs(input: string, githubToken?: string): string {
if (!input) {
return input;
}
let cacheType = 'registry';
let ghaCacheRepository = '';
let ghaCacheGHToken = '';
const fields = parse(input, {
relaxColumnCount: true,
skipEmptyLines: true
})[0];
for (const field of fields) {
const parts = field
.toString()
.split(/(?<=^[^=]+?)=/)
.map(item => item.trim());
if (parts[0] === 'type') {
cacheType = parts[1];
} else if (parts[0] === 'repository') {
ghaCacheRepository = parts[1];
} else if (parts[0] === 'ghtoken') {
ghaCacheGHToken = parts[1];
}
}
if (cacheType === 'gha') {
if (!ghaCacheRepository) {
input = `${input},repository=${GitHub.repository}`;
}
if (!ghaCacheGHToken && githubToken) {
input = `${input},ghtoken=${githubToken}`;
}
}
return input;
}
public static hasLocalExporter(exporters: string[]): boolean {
return Build.hasExporterType('local', exporters);
}

View File

@@ -19,7 +19,7 @@ import * as core from '@actions/core';
import {Buildx} from './buildx';
import {Exec} from '../exec';
import {BuilderInfo, GCPolicy, NodeInfo} from '../types/builder';
import {BuilderInfo, GCPolicy, NodeInfo} from '../types/buildx/builder';
export interface BuilderOpts {
buildx?: Buildx;

View File

@@ -22,7 +22,7 @@ import * as semver from 'semver';
import {Docker} from '../docker/docker';
import {Exec} from '../exec';
import {Cert, LocalRefsOpts, LocalRefsResponse, LocalState} from '../types/buildx';
import {Cert, LocalRefsOpts, LocalRefsResponse, LocalState} from '../types/buildx/buildx';
export interface BuildxOpts {
standalone?: boolean;

View File

@@ -27,7 +27,7 @@ import {Docker} from '../docker/docker';
import {Exec} from '../exec';
import {GitHub} from '../github';
import {ExportRecordOpts, ExportRecordResponse} from '../types/history';
import {ExportRecordOpts, ExportRecordResponse, Summaries} from '../types/buildx/history';
export interface HistoryOpts {
buildx?: Buildx;
@@ -95,6 +95,7 @@ export class History {
buildxDialStdioProc.stdout.pipe(fs.createWriteStream(buildxOutFifoPath));
const tmpDockerbuildFilename = path.join(outDir, 'rec.dockerbuild');
const summaryFilename = path.join(outDir, 'summary.json');
await new Promise<void>((resolve, reject) => {
const ebargs: Array<string> = ['--ref-state-dir=/buildx-refs', `--node=${builderName}/${nodeName}`];
@@ -145,9 +146,14 @@ export class History {
fs.renameSync(tmpDockerbuildFilename, dockerbuildPath);
const dockerbuildStats = fs.statSync(dockerbuildPath);
core.info(`Parsing ${summaryFilename}`);
fs.statSync(summaryFilename);
const summaries = <Summaries>JSON.parse(fs.readFileSync(summaryFilename, {encoding: 'utf-8'}));
return {
dockerbuildFilename: dockerbuildPath,
dockerbuildSize: dockerbuildStats.size,
summaries: summaries,
builderName: builderName,
nodeName: nodeName,
refs: refs

View File

@@ -31,7 +31,7 @@ import {Docker} from '../docker/docker';
import {Git} from '../git';
import {Util} from '../util';
import {DownloadVersion} from '../types/buildx';
import {DownloadVersion} from '../types/buildx/buildx';
import {GitHubRelease} from '../types/github';
export interface InstallOpts {

View File

@@ -79,6 +79,9 @@ if (Get-Service docker -ErrorAction SilentlyContinue) {
Write-Host "Service removed"
}
$env:Path = "$ToolDir;" + [System.Environment]::GetEnvironmentVariable("Path","Machine") + ";" + [System.Environment]::GetEnvironmentVariable("Path","User")
Write-Host "Path: $env:Path"
$env:DOCKER_HOST = $DockerHost
Write-Host "DOCKER_HOST: $env:DOCKER_HOST"

View File

@@ -25,7 +25,7 @@ import {Cache} from '../cache';
import {Exec} from '../exec';
import {Util} from '../util';
import {ConfigFile} from '../types/docker';
import {ConfigFile} from '../types/docker/docker';
export class Docker {
static get configDir(): string {

View File

@@ -253,6 +253,12 @@ export class Install {
});
}
const envs = Object.assign({}, process.env, {
PATH: `${this.toolDir}:${process.env.PATH}`
}) 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`;
@@ -262,11 +268,12 @@ export class Install {
// 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 -E ${bashPath} << EOF
`sudo env "PATH=$PATH" ${bashPath} << EOF
( ${cmd} 2>&1 | tee "${this.runDir}/dockerd.log" ) &
EOF`,
[],
{
env: envs,
detached: true,
shell: true,
stdio: ['ignore', process.stdout, process.stderr]
@@ -280,7 +287,7 @@ EOF`,
try {
await Exec.getExecOutput(`docker version`, undefined, {
silent: true,
env: Object.assign({}, process.env, {
env: Object.assign({}, envs, {
DOCKER_HOST: dockerHost
}) as {
[key: string]: string;

View File

@@ -16,6 +16,8 @@
import crypto from 'crypto';
import fs from 'fs';
import jsyaml from 'js-yaml';
import os from 'os';
import path from 'path';
import {CreateArtifactRequest, FinalizeArtifactRequest, StringValue} from '@actions/artifact/lib/generated';
import {internalArtifactTwirpClient} from '@actions/artifact/lib/internal/shared/artifact-twirp-client';
@@ -23,6 +25,7 @@ import {getBackendIdsFromToken} from '@actions/artifact/lib/internal/shared/util
import {getExpiration} from '@actions/artifact/lib/internal/upload/retention';
import {InvalidResponseError, NetworkError} from '@actions/artifact';
import * as core from '@actions/core';
import {SummaryTableCell} from '@actions/core/lib/summary';
import * as github from '@actions/github';
import {GitHub as Octokit} from '@actions/github/lib/utils';
import {Context} from '@actions/github/lib/context';
@@ -30,7 +33,9 @@ import {TransferProgressEvent} from '@azure/core-http';
import {BlobClient, BlobHTTPHeaders} from '@azure/storage-blob';
import {jwtDecode, JwtPayload} from 'jwt-decode';
import {GitHubActionsRuntimeToken, GitHubActionsRuntimeTokenAC, GitHubRepo, UploadArtifactOpts, UploadArtifactResponse} from './types/github';
import {Util} from './util';
import {BuildSummaryOpts, GitHubActionsRuntimeToken, GitHubActionsRuntimeTokenAC, GitHubRepo, UploadArtifactOpts, UploadArtifactResponse} from './types/github';
export interface GitHubOpts {
token?: string;
@@ -59,8 +64,14 @@ export class GitHub {
return process.env.GITHUB_API_URL || 'https://api.github.com';
}
static get repository(): string {
return `${github.context.repo.owner}/${github.context.repo.repo}`;
}
static get workflowRunURL(): string {
return `${GitHub.serverURL}/${github.context.repo.owner}/${github.context.repo.repo}/actions/runs/${github.context.runId}`;
const runID = process.env.GITHUB_RUN_ID || github.context.runId;
const runAttempt = process.env.GITHUB_RUN_ATTEMPT || 1;
return `${GitHub.serverURL}/${GitHub.repository}/actions/runs/${runID}/attempts/${runAttempt}`;
}
static get actionsRuntimeToken(): GitHubActionsRuntimeToken | undefined {
@@ -190,4 +201,84 @@ export class GitHub {
url: artifactURL
};
}
public static async writeBuildSummary(opts: BuildSummaryOpts): Promise<void> {
// can't use original core.summary.addLink due to the need to make
// EOL optional
const addLink = function (text: string, url: string, addEOL = false): string {
return `<a href="${url}">${text}</a>` + (addEOL ? os.EOL : '');
};
const refsSize = Object.keys(opts.exportRes.refs).length;
// prettier-ignore
const sum = core.summary
.addHeading('Docker Build summary', 1)
.addRaw(`<p>`)
.addRaw(`For a detailed look at the build, download the following build record archive and import it into Docker Desktop's Builds view. `)
.addBreak()
.addRaw(`Build records include details such as timing, dependencies, results, logs, traces, and other information about a build. `)
.addRaw(addLink('Learn more', 'https://docs.docker.com/go/build-summary/'))
.addRaw('</p>')
.addRaw(`<p>`)
.addRaw(`:arrow_down: ${addLink(`<strong>${opts.uploadRes.filename}</strong>`, opts.uploadRes.url)} (${Util.formatFileSize(opts.uploadRes.size)})`)
.addBreak()
.addRaw(`This file includes <strong>${refsSize} build record${refsSize > 1 ? 's' : ''}</strong>.`)
.addRaw(`</p>`)
.addRaw(`<p>`)
.addRaw(`Find this useful? `)
.addRaw(addLink('Let us know', 'https://docs.docker.com/feedback/gha-build-summary'))
.addRaw('</p>');
sum.addHeading('Preview', 2);
const summaryTableData: Array<Array<SummaryTableCell>> = [
[
{header: true, data: 'ID'},
{header: true, data: 'Name'},
{header: true, data: 'Status'},
{header: true, data: 'Cached'},
{header: true, data: 'Duration'}
]
];
let summaryError: string | undefined;
for (const ref in opts.exportRes.summaries) {
if (Object.prototype.hasOwnProperty.call(opts.exportRes.summaries, ref)) {
const summary = opts.exportRes.summaries[ref];
// prettier-ignore
summaryTableData.push([
{data: `<code>${ref.substring(0, 6).toUpperCase()}</code>`},
{data: `<strong>${summary.name}</strong>`},
{data: `${summary.status === 'completed' ? ':white_check_mark:' : summary.status === 'canceled' ? ':no_entry_sign:' : ':x:'} ${summary.status}`},
{data: `${summary.numCachedSteps > 0 ? Math.round((summary.numCachedSteps / summary.numTotalSteps) * 100) : 0}%`},
{data: summary.duration}
]);
if (summary.error) {
summaryError = summary.error;
}
}
}
sum.addTable([...summaryTableData]);
if (summaryError) {
sum.addHeading('Error', 4);
sum.addCodeBlock(summaryError, 'text');
}
if (opts.inputs) {
sum.addHeading('Build inputs', 2).addCodeBlock(
jsyaml.dump(opts.inputs, {
indent: 2,
lineWidth: -1
}),
'yaml'
);
}
if (opts.bakeDefinition) {
sum.addHeading('Bake definition', 2).addCodeBlock(JSON.stringify(opts.bakeDefinition, null, 2), 'json');
}
core.info(`Writing summary`);
await sum.addSeparator().write();
}
}

163
src/oci/oci.ts Normal file
View File

@@ -0,0 +1,163 @@
/**
* 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 gunzip from 'gunzip-maybe';
import * as path from 'path';
import {Readable} from 'stream';
import * as tar from 'tar-stream';
import {Archive, LoadArchiveOpts} from '../types/oci/oci';
import {Index} from '../types/oci';
import {Manifest} from '../types/oci/manifest';
import {Image} from '../types/oci/config';
import {IMAGE_BLOBS_DIR_V1, IMAGE_INDEX_FILE_V1, IMAGE_LAYOUT_FILE_V1, ImageLayout} from '../types/oci/layout';
import {MEDIATYPE_IMAGE_INDEX_V1, MEDIATYPE_IMAGE_MANIFEST_V1} from '../types/oci/mediatype';
export class OCI {
public static loadArchive(opts: LoadArchiveOpts): Promise<Archive> {
return new Promise<Archive>((resolve, reject) => {
const tarex: tar.Extract = tar.extract();
let rootIndex: Index;
let rootLayout: ImageLayout;
const indexes: Record<string, Index> = {};
const manifests: Record<string, Manifest> = {};
const images: Record<string, Image> = {};
const blobs: Record<string, unknown> = {};
tarex.on('entry', async (header, stream, next) => {
if (header.type === 'file') {
const filename = path.normalize(header.name);
if (filename === IMAGE_INDEX_FILE_V1) {
rootIndex = await OCI.streamToJson<Index>(stream);
} else if (filename === IMAGE_LAYOUT_FILE_V1) {
rootLayout = await OCI.streamToJson<ImageLayout>(stream);
} else if (filename.startsWith(path.join(IMAGE_BLOBS_DIR_V1, path.sep))) {
const blob = await OCI.extractBlob(stream);
const digest = `${filename.split(path.sep)[1]}:${filename.split(path.sep)[filename.split(path.sep).length - 1]}`;
if (OCI.isIndex(blob)) {
indexes[digest] = <Index>JSON.parse(blob);
} else if (OCI.isManifest(blob)) {
manifests[digest] = <Manifest>JSON.parse(blob);
} else if (OCI.isImage(blob)) {
images[digest] = <Image>JSON.parse(blob);
} else {
blobs[digest] = blob;
}
} else {
reject(new Error(`Invalid OCI archive: unexpected file ${filename}`));
}
}
stream.resume();
next();
});
tarex.on('finish', () => {
if (!rootIndex || !rootLayout) {
reject(new Error('Invalid OCI archive: missing index or layout'));
}
resolve({
root: {
index: rootIndex,
layout: rootLayout
},
indexes: indexes,
manifests: manifests,
images: images,
blobs: blobs
} as Archive);
});
tarex.on('error', error => {
reject(error);
});
fs.createReadStream(opts.file).pipe(gunzip()).pipe(tarex);
});
}
// eslint-disable-next-line @typescript-eslint/no-explicit-any
private static isIndex(blob: any): boolean {
try {
const index = <Index>JSON.parse(blob);
return index.mediaType === MEDIATYPE_IMAGE_INDEX_V1;
} catch {
return false;
}
}
// eslint-disable-next-line @typescript-eslint/no-explicit-any
private static isManifest(blob: any): boolean {
try {
const manifest = <Manifest>JSON.parse(blob);
return manifest.mediaType === MEDIATYPE_IMAGE_MANIFEST_V1 && manifest.layers.length > 0;
} catch {
return false;
}
}
// eslint-disable-next-line @typescript-eslint/no-explicit-any
private static isImage(blob: any): boolean {
try {
const image = <Image>JSON.parse(blob);
return image.rootfs.type !== '';
} catch {
return false;
}
}
// eslint-disable-next-line @typescript-eslint/no-explicit-any
private static extractBlob(stream: Readable): Promise<any> {
return new Promise<unknown>((resolve, reject) => {
const chunks: Buffer[] = [];
const dstream = stream.pipe(gunzip());
dstream.on('data', chunk => {
chunks.push(chunk);
});
dstream.on('end', () => {
resolve(Buffer.concat(chunks).toString('utf8'));
});
dstream.on('error', async error => {
reject(error);
});
});
}
private static async streamToJson<T>(stream: Readable): Promise<T> {
return new Promise<T>((resolve, reject) => {
const chunks: string[] = [];
let bytes = 0;
stream.on('data', chunk => {
bytes += chunk.length;
if (bytes <= 2 * 1024 * 1024) {
chunks.push(chunk.toString('utf8'));
} else {
reject(new Error('The data stream exceeds the size limit for JSON parsing.'));
}
});
stream.on('end', () => {
try {
resolve(JSON.parse(chunks.join('')));
} catch (error) {
reject(error);
}
});
stream.on('error', async error => {
reject(error);
});
});
}
}

View File

@@ -22,7 +22,23 @@ export interface ExportRecordOpts {
export interface ExportRecordResponse {
dockerbuildFilename: string;
dockerbuildSize: number;
summaries: Summaries;
builderName: string;
nodeName: string;
refs: Array<string>;
}
export interface Summaries {
[ref: string]: RecordSummary;
}
export interface RecordSummary {
name: string;
status: string;
duration: string;
numCachedSteps: number;
numTotalSteps: number;
numCompletedSteps: number;
frontendAttrs: Record<string, string>;
error?: string;
}

View File

@@ -17,6 +17,9 @@
import {components as OctoOpenApiTypes} from '@octokit/openapi-types';
import {JwtPayload} from 'jwt-decode';
import {BakeDefinition} from './buildx/bake';
import {ExportRecordResponse} from './buildx/history';
export interface GitHubRelease {
id: number;
tag_name: string;
@@ -47,3 +50,11 @@ export interface UploadArtifactResponse {
size: number;
url: string;
}
export interface BuildSummaryOpts {
exportRes: ExportRecordResponse;
uploadRes: UploadArtifactResponse;
// eslint-disable-next-line @typescript-eslint/no-explicit-any
inputs?: any;
bakeDefinition?: BakeDefinition;
}

52
src/types/oci/config.ts Normal file
View File

@@ -0,0 +1,52 @@
/**
* 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 {Digest} from './digest';
import {Platform} from './descriptor';
export interface ImageConfig {
User?: string;
ExposedPorts?: Record<string, unknown>;
Env?: string[];
Entrypoint?: string[];
Cmd?: string[];
Volumes?: Record<string, unknown>;
WorkingDir?: string;
Labels?: Record<string, string>;
StopSignal?: string;
ArgsEscaped?: boolean;
}
export interface RootFS {
type: string;
diff_ids: Digest[];
}
export interface History {
created?: string; // assuming RFC 3339 formatted string
created_by?: string;
author?: string;
comment?: string;
empty_layer?: boolean;
}
export interface Image extends Platform {
created?: string; // assuming RFC 3339 formatted string
author?: string;
config?: ImageConfig;
rootfs: RootFS;
history?: History[];
}

View File

@@ -0,0 +1,45 @@
/**
* 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 {Digest} from './digest';
import {MEDIATYPE_EMPTY_JSON_V1} from './mediatype';
export interface Descriptor {
mediaType: string;
digest: Digest;
size: number;
urls?: string[];
annotations?: Record<string, string>;
data?: string;
platform?: Platform;
artifactType?: string;
}
export interface Platform {
architecture: string;
os: string;
'os.version'?: string;
'os.features'?: string[];
variant?: string;
}
export const DescriptorEmptyJSON: Descriptor = {
mediaType: MEDIATYPE_EMPTY_JSON_V1,
digest: 'sha256:44136fa355b3678a1146ad16f7e8649e94fb4fc21fe77e8310c060f61caaff8a',
size: 2,
data: '{}'
};

17
src/types/oci/digest.ts Normal file
View File

@@ -0,0 +1,17 @@
/**
* 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 type Digest = string;

26
src/types/oci/index.ts Normal file
View File

@@ -0,0 +1,26 @@
/**
* 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 {Versioned} from './versioned';
import {Descriptor} from './descriptor';
export interface Index extends Versioned {
mediaType?: string;
artifactType?: string;
manifests: Descriptor[];
subject?: Descriptor;
annotations?: Record<string, string>;
}

27
src/types/oci/layout.ts Normal file
View File

@@ -0,0 +1,27 @@
/**
* 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 const IMAGE_LAYOUT_FILE_V1 = 'oci-layout';
export const IMAGE_LAYOUT_VERSION_V1 = '1.0.0';
export const IMAGE_INDEX_FILE_V1 = 'index.json';
export const IMAGE_BLOBS_DIR_V1 = 'blobs';
export interface ImageLayout {
version: string;
}

27
src/types/oci/manifest.ts Normal file
View File

@@ -0,0 +1,27 @@
/**
* 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 {Descriptor} from './descriptor';
import {Versioned} from './versioned';
export interface Manifest extends Versioned {
mediaType?: string;
artifactType?: string;
config: Descriptor;
layers: Descriptor[];
subject?: Descriptor;
annotations?: Record<string, string>;
}

View File

@@ -0,0 +1,25 @@
/**
* 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 const MEDIATYPE_DESCRIPTOR_V1 = 'application/vnd.oci.descriptor.v1+json';
export const MEDIATYPE_IMAGE_MANIFEST_V1 = 'application/vnd.oci.image.manifest.v1+json';
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';

36
src/types/oci/oci.ts Normal file
View File

@@ -0,0 +1,36 @@
/**
* 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 {Index} from './index';
import {ImageLayout} from './layout';
import {Manifest} from './manifest';
import {Image} from './config';
export interface LoadArchiveOpts {
file: string;
}
export interface Archive {
root: {
index: Index;
layout: ImageLayout;
};
indexes: Record<string, Index>;
manifests: Record<string, Manifest>;
images: Record<string, Image>;
// eslint-disable-next-line @typescript-eslint/no-explicit-any
blobs: Record<string, any>;
}

View File

@@ -0,0 +1,19 @@
/**
* 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 Versioned {
schemaVersion: number;
}

162
yarn.lock
View File

@@ -1111,8 +1111,11 @@ __metadata:
"@octokit/core": ^5.1.0
"@octokit/plugin-rest-endpoint-methods": ^10.4.0
"@types/csv-parse": ^1.2.2
"@types/gunzip-maybe": ^1.4.2
"@types/js-yaml": ^4.0.9
"@types/node": ^20.12.10
"@types/semver": ^7.5.8
"@types/tar-stream": ^3.1.3
"@types/tmp": ^0.2.6
"@typescript-eslint/eslint-plugin": ^7.8.0
"@typescript-eslint/parser": ^7.8.0
@@ -1124,12 +1127,15 @@ __metadata:
eslint-plugin-import: ^2.29.1
eslint-plugin-jest: ^28.5.0
eslint-plugin-prettier: ^5.1.3
gunzip-maybe: ^1.4.2
handlebars: ^4.7.8
jest: ^29.7.0
js-yaml: ^4.1.0
jwt-decode: ^4.0.0
prettier: ^3.2.5
rimraf: ^5.0.5
semver: ^7.6.2
tar-stream: ^3.1.7
tmp: ^0.2.3
ts-jest: ^29.1.2
ts-node: ^10.9.2
@@ -2160,6 +2166,15 @@ __metadata:
languageName: node
linkType: hard
"@types/gunzip-maybe@npm:^1.4.2":
version: 1.4.2
resolution: "@types/gunzip-maybe@npm:1.4.2"
dependencies:
"@types/node": "*"
checksum: 9be931d6b74ea4e28f2682e3aac6c242448128c6e06bee2e5758e8747ef51f231c46f11e27783092530f81c51f0a5ce6f87217e92e7e80b55e7132c7538e5f3e
languageName: node
linkType: hard
"@types/istanbul-lib-coverage@npm:*, @types/istanbul-lib-coverage@npm:^2.0.0, @types/istanbul-lib-coverage@npm:^2.0.1":
version: 2.0.3
resolution: "@types/istanbul-lib-coverage@npm:2.0.3"
@@ -2185,6 +2200,13 @@ __metadata:
languageName: node
linkType: hard
"@types/js-yaml@npm:^4.0.9":
version: 4.0.9
resolution: "@types/js-yaml@npm:4.0.9"
checksum: e5e5e49b5789a29fdb1f7d204f82de11cb9e8f6cb24ab064c616da5d6e1b3ccfbf95aa5d1498a9fbd3b9e745564e69b4a20b6c530b5a8bbb2d4eb830cda9bc69
languageName: node
linkType: hard
"@types/json-schema@npm:^7.0.15":
version: 7.0.15
resolution: "@types/json-schema@npm:7.0.15"
@@ -2239,6 +2261,15 @@ __metadata:
languageName: node
linkType: hard
"@types/tar-stream@npm:^3.1.3":
version: 3.1.3
resolution: "@types/tar-stream@npm:3.1.3"
dependencies:
"@types/node": "*"
checksum: 187387748288b35924284afc26cf36b6b966377f5131398bf484c475f7191c50f5e5903c94a7391049b6cdfce174ae2e63f776dea9425d94ddc6bd31ebe386ee
languageName: node
linkType: hard
"@types/tmp@npm:^0.2.6":
version: 0.2.6
resolution: "@types/tmp@npm:0.2.6"
@@ -2933,6 +2964,15 @@ __metadata:
languageName: node
linkType: hard
"browserify-zlib@npm:^0.1.4":
version: 0.1.4
resolution: "browserify-zlib@npm:0.1.4"
dependencies:
pako: ~0.2.0
checksum: abee4cb4349e8a21391fd874564f41b113fe691372913980e6fa06a777e4ea2aad4e942af14ab99bce190d5ac8f5328201432f4ef0eae48c6d02208bc212976f
languageName: node
linkType: hard
"browserslist@npm:^4.17.5":
version: 4.19.3
resolution: "browserslist@npm:4.19.3"
@@ -3618,6 +3658,18 @@ __metadata:
languageName: node
linkType: hard
"duplexify@npm:^3.5.0, duplexify@npm:^3.6.0":
version: 3.7.1
resolution: "duplexify@npm:3.7.1"
dependencies:
end-of-stream: ^1.0.0
inherits: ^2.0.1
readable-stream: ^2.0.0
stream-shift: ^1.0.0
checksum: 3c2ed2223d956a5da713dae12ba8295acb61d9acd966ccbba938090d04f4574ca4dca75cca089b5077c2d7e66101f32e6ea9b36a78ca213eff574e7a8b8accf2
languageName: node
linkType: hard
"eastasianwidth@npm:^0.2.0":
version: 0.2.0
resolution: "eastasianwidth@npm:0.2.0"
@@ -3669,6 +3721,15 @@ __metadata:
languageName: node
linkType: hard
"end-of-stream@npm:^1.0.0, end-of-stream@npm:^1.1.0":
version: 1.4.4
resolution: "end-of-stream@npm:1.4.4"
dependencies:
once: ^1.4.0
checksum: 530a5a5a1e517e962854a31693dbb5c0b2fc40b46dad2a56a2deec656ca040631124f4795823acc68238147805f8b021abbe221f4afed5ef3c8e8efc2024908b
languageName: node
linkType: hard
"env-paths@npm:^2.2.0":
version: 2.2.1
resolution: "env-paths@npm:2.2.1"
@@ -4725,6 +4786,22 @@ __metadata:
languageName: node
linkType: hard
"gunzip-maybe@npm:^1.4.2":
version: 1.4.2
resolution: "gunzip-maybe@npm:1.4.2"
dependencies:
browserify-zlib: ^0.1.4
is-deflate: ^1.0.0
is-gzip: ^1.0.0
peek-stream: ^1.1.0
pumpify: ^1.3.3
through2: ^2.0.3
bin:
gunzip-maybe: bin.js
checksum: bc4d4977c24a2860238df271de75d53dd72a359d19f1248d1c613807dc221d3b8ae09624e3085c8106663e3e1b59db62a85b261d1138c2cc24efad9df577d4e1
languageName: node
linkType: hard
"handlebars@npm:^4.7.8":
version: 4.7.8
resolution: "handlebars@npm:4.7.8"
@@ -4980,7 +5057,7 @@ __metadata:
languageName: node
linkType: hard
"inherits@npm:2, inherits@npm:^2.0.3, inherits@npm:~2.0.3":
"inherits@npm:2, inherits@npm:^2.0.1, inherits@npm:^2.0.3, inherits@npm:~2.0.3":
version: 2.0.4
resolution: "inherits@npm:2.0.4"
checksum: 4a48a733847879d6cf6691860a6b1e3f0f4754176e4d71494c41f3475553768b10f84b5ce1d40fbd0e34e6bfbb864ee35858ad4dd2cf31e02fc4a154b724d7f1
@@ -5144,6 +5221,13 @@ __metadata:
languageName: node
linkType: hard
"is-deflate@npm:^1.0.0":
version: 1.0.0
resolution: "is-deflate@npm:1.0.0"
checksum: c2f9f2d3db79ac50c5586697d1e69a55282a2b0cc5e437b3c470dd47f24e40b6216dcd7e024511e21381607bf57afa019343e3bd0e08a119032818b596004262
languageName: node
linkType: hard
"is-extglob@npm:^2.1.1":
version: 2.1.1
resolution: "is-extglob@npm:2.1.1"
@@ -5174,6 +5258,13 @@ __metadata:
languageName: node
linkType: hard
"is-gzip@npm:^1.0.0":
version: 1.0.0
resolution: "is-gzip@npm:1.0.0"
checksum: 0d28931c1f445fa29c900cf9f48e06e9d1d477a3bf7bd7332e7ce68f1333ccd8cb381de2f0f62a9a262d9c0912608a9a71b4a40e788e201b3dbd67072bb20d86
languageName: node
linkType: hard
"is-lambda@npm:^1.0.1":
version: 1.0.1
resolution: "is-lambda@npm:1.0.1"
@@ -6582,7 +6673,7 @@ __metadata:
languageName: node
linkType: hard
"once@npm:^1.3.0, once@npm:^1.4.0":
"once@npm:^1.3.0, once@npm:^1.3.1, once@npm:^1.4.0":
version: 1.4.0
resolution: "once@npm:1.4.0"
dependencies:
@@ -6666,6 +6757,13 @@ __metadata:
languageName: node
linkType: hard
"pako@npm:~0.2.0":
version: 0.2.9
resolution: "pako@npm:0.2.9"
checksum: 055f9487cd57fbb78df84315873bbdd089ba286f3499daed47d2effdc6253e981f5db6898c23486de76d4a781559f890d643bd3a49f70f1b4a18019c98aa5125
languageName: node
linkType: hard
"parent-module@npm:^1.0.0":
version: 1.0.1
resolution: "parent-module@npm:1.0.1"
@@ -6749,6 +6847,17 @@ __metadata:
languageName: node
linkType: hard
"peek-stream@npm:^1.1.0":
version: 1.1.3
resolution: "peek-stream@npm:1.1.3"
dependencies:
buffer-from: ^1.0.0
duplexify: ^3.5.0
through2: ^2.0.3
checksum: a0e09d6d1a8a01158a3334f20d6b1cdd91747eba24eb06a1d742eefb620385593121a76d4378cc81f77cdce6a66df0575a41041b1189c510254aec91878afc99
languageName: node
linkType: hard
"picocolors@npm:^1.0.0":
version: 1.0.0
resolution: "picocolors@npm:1.0.0"
@@ -6879,6 +6988,27 @@ __metadata:
languageName: node
linkType: hard
"pump@npm:^2.0.0":
version: 2.0.1
resolution: "pump@npm:2.0.1"
dependencies:
end-of-stream: ^1.1.0
once: ^1.3.1
checksum: e9f26a17be00810bff37ad0171edb35f58b242487b0444f92fb7d78bc7d61442fa9b9c5bd93a43fd8fd8ddd3cc75f1221f5e04c790f42907e5baab7cf5e2b931
languageName: node
linkType: hard
"pumpify@npm:^1.3.3":
version: 1.5.1
resolution: "pumpify@npm:1.5.1"
dependencies:
duplexify: ^3.6.0
inherits: ^2.0.3
pump: ^2.0.0
checksum: 26ca412ec8d665bd0d5e185c1b8f627728eff603440d75d22a58e421e3c66eaf86ec6fc6a6efc54808ecef65979279fa8e99b109a23ec1fa8d79f37e6978c9bd
languageName: node
linkType: hard
"punycode@npm:^2.1.0":
version: 2.1.1
resolution: "punycode@npm:2.1.1"
@@ -6921,7 +7051,7 @@ __metadata:
languageName: node
linkType: hard
"readable-stream@npm:^2.0.5":
"readable-stream@npm:^2.0.0, readable-stream@npm:^2.0.5, readable-stream@npm:~2.3.6":
version: 2.3.8
resolution: "readable-stream@npm:2.3.8"
dependencies:
@@ -7432,6 +7562,13 @@ __metadata:
languageName: node
linkType: hard
"stream-shift@npm:^1.0.0":
version: 1.0.3
resolution: "stream-shift@npm:1.0.3"
checksum: a24c0a3f66a8f9024bd1d579a533a53be283b4475d4e6b4b3211b964031447bdf6532dd1f3c2b0ad66752554391b7c62bd7ca4559193381f766534e723d50242
languageName: node
linkType: hard
"streamx@npm:^2.15.0":
version: 2.16.1
resolution: "streamx@npm:2.16.1"
@@ -7673,7 +7810,7 @@ __metadata:
languageName: node
linkType: hard
"tar-stream@npm:^3.0.0":
"tar-stream@npm:^3.0.0, tar-stream@npm:^3.1.7":
version: 3.1.7
resolution: "tar-stream@npm:3.1.7"
dependencies:
@@ -7716,6 +7853,16 @@ __metadata:
languageName: node
linkType: hard
"through2@npm:^2.0.3":
version: 2.0.5
resolution: "through2@npm:2.0.5"
dependencies:
readable-stream: ~2.3.6
xtend: ~4.0.1
checksum: beb0f338aa2931e5660ec7bf3ad949e6d2e068c31f4737b9525e5201b824ac40cac6a337224856b56bd1ddd866334bbfb92a9f57cd6f66bc3f18d3d86fc0fe50
languageName: node
linkType: hard
"tmp@npm:^0.2.3":
version: 0.2.3
resolution: "tmp@npm:0.2.3"
@@ -8394,6 +8541,13 @@ __metadata:
languageName: node
linkType: hard
"xtend@npm:~4.0.1":
version: 4.0.2
resolution: "xtend@npm:4.0.2"
checksum: ac5dfa738b21f6e7f0dd6e65e1b3155036d68104e67e5d5d1bde74892e327d7e5636a076f625599dc394330a731861e87343ff184b0047fef1360a7ec0a5a36a
languageName: node
linkType: hard
"y18n@npm:^5.0.5":
version: 5.0.8
resolution: "y18n@npm:5.0.8"