Compare commits

...

26 Commits

Author SHA1 Message Date
CrazyMax
b0518231d0 Merge pull request #72 from crazy-max/bump-csv-parse
Some checks failed
publish / publish (push) Has been cancelled
build(deps): bump csv-parse from 5.3.5 to 5.3.6
2023-03-13 09:55:51 +00:00
CrazyMax
c0da63f810 build(deps): bump csv-parse from 5.3.5 to 5.3.6
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
2023-03-13 10:51:00 +01:00
CrazyMax
041d9693ab Merge pull request #71 from crazy-max/bake
bake class to parse definitions and handle exporters type
2023-03-13 09:49:01 +00:00
CrazyMax
39158d8047 bake class to parse definitions and handle exporters type
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
2023-03-13 10:44:48 +01:00
CrazyMax
a6c94b5167 Merge pull request #70 from crazy-max/static-inputs
buildx: make inputs methods static
2023-03-13 09:42:37 +00:00
CrazyMax
a5943234fd Merge pull request #69 from crazy-max/bump-releases-json
Bump releases-json action to 6dc3187
2023-03-13 08:54:48 +00:00
CrazyMax
03977693c1 buildx: make inputs methods static
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
2023-03-12 23:40:54 +01:00
CrazyMax
d6d770f303 Bump releases-json action to 6dc3187
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
2023-03-12 13:13:02 +01:00
CrazyMax
8df8cee02f Merge pull request #68 from crazy-max/fix-driver-opts-parsing
Some checks failed
publish / publish (push) Has been cancelled
builder: fix regex to parse driver-opts
2023-03-11 16:47:42 +00:00
CrazyMax
94febd1da7 builder: fix regex to parse driver-opts
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
2023-03-11 16:48:56 +01:00
CrazyMax
b7cdc617ce Merge pull request #65 from docker/dependabot/npm_and_yarn/csv-parse-5.3.6
build(deps): bump csv-parse from 5.3.5 to 5.3.6
2023-03-08 18:16:10 +00:00
CrazyMax
75c0c7fac0 Merge pull request #66 from docker/dependabot/npm_and_yarn/actions/http-client-2.1.0
build(deps): bump @actions/http-client from 2.0.1 to 2.1.0
2023-03-08 18:15:51 +00:00
CrazyMax
e9cfd63e16 Merge pull request #67 from docker/bot/buildx-releases-json
Some checks failed
publish / publish (push) Has been cancelled
Update `.github/buildx-releases.json`
2023-03-07 10:07:18 +01:00
crazy-max
ac61bd8949 github: update .github/buildx-releases.json
Signed-off-by: GitHub <noreply@github.com>
2023-03-07 00:18:02 +00:00
dependabot[bot]
7b50104faa build(deps): bump @actions/http-client from 2.0.1 to 2.1.0
Bumps [@actions/http-client](https://github.com/actions/toolkit/tree/HEAD/packages/http-client) from 2.0.1 to 2.1.0.
- [Release notes](https://github.com/actions/toolkit/releases)
- [Changelog](https://github.com/actions/toolkit/blob/main/packages/http-client/RELEASES.md)
- [Commits](https://github.com/actions/toolkit/commits/HEAD/packages/http-client)

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

Signed-off-by: dependabot[bot] <support@github.com>
2023-03-06 23:20:20 +00:00
dependabot[bot]
d7735e9ddf build(deps): bump csv-parse from 5.3.5 to 5.3.6
Bumps [csv-parse](https://github.com/adaltas/node-csv/tree/HEAD/packages/csv-parse) from 5.3.5 to 5.3.6.
- [Release notes](https://github.com/adaltas/node-csv/releases)
- [Changelog](https://github.com/adaltas/node-csv/blob/master/packages/csv-parse/CHANGELOG.md)
- [Commits](https://github.com/adaltas/node-csv/commits/csv-parse@5.3.6/packages/csv-parse)

---
updated-dependencies:
- dependency-name: csv-parse
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-03-06 23:18:48 +00:00
CrazyMax
dd1544e1be Merge pull request #64 from crazy-max/builder-exists
builder: exists method
2023-03-03 15:24:01 +01:00
CrazyMax
32af66cb28 builder: exists method
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
2023-03-03 14:49:22 +01:00
CrazyMax
2090433c0d Merge pull request #63 from crazy-max/docker-latest
docker: support latest on install
2023-03-03 14:15:40 +01:00
CrazyMax
50c11e6dce docker: support latest on install
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
2023-03-03 14:07:27 +01:00
CrazyMax
0f9cc7c29f Merge pull request #62 from crazy-max/docker-custom-context
docker: allow custom context name on install
2023-03-03 14:00:23 +01:00
CrazyMax
dfc72fd31c docker: allow custom context name on install
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
2023-03-03 10:40:00 +01:00
CrazyMax
317ef51ab5 Merge pull request #60 from docker/bot/docker-releases-json
Update `.github/docker-releases.json`
2023-03-03 10:37:21 +01:00
crazy-max
3a30337d24 github: update .github/docker-releases.json
Signed-off-by: GitHub <noreply@github.com>
2023-03-03 09:36:41 +00:00
CrazyMax
fc16ecda91 Merge pull request #59 from crazy-max/docker-releases
ci: generate docker-releases.json
2023-03-03 10:36:10 +01:00
CrazyMax
48cefc1da0 ci: generate docker-releases.json
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
2023-03-02 19:16:57 +01:00
22 changed files with 1836 additions and 159 deletions

View File

@@ -1,43 +1,84 @@
{
"latest": {
"id": 92694870,
"tag_name": "v0.10.3",
"html_url": "https://github.com/docker/buildx/releases/tag/v0.10.3",
"id": 94659464,
"tag_name": "v0.10.4",
"html_url": "https://github.com/docker/buildx/releases/tag/v0.10.4",
"assets": [
"https://github.com/docker/buildx/releases/download/v0.10.3/buildx-v0.10.3.darwin-amd64",
"https://github.com/docker/buildx/releases/download/v0.10.3/buildx-v0.10.3.darwin-amd64.provenance.json",
"https://github.com/docker/buildx/releases/download/v0.10.3/buildx-v0.10.3.darwin-amd64.sbom.json",
"https://github.com/docker/buildx/releases/download/v0.10.3/buildx-v0.10.3.darwin-arm64",
"https://github.com/docker/buildx/releases/download/v0.10.3/buildx-v0.10.3.darwin-arm64.provenance.json",
"https://github.com/docker/buildx/releases/download/v0.10.3/buildx-v0.10.3.darwin-arm64.sbom.json",
"https://github.com/docker/buildx/releases/download/v0.10.3/buildx-v0.10.3.linux-amd64",
"https://github.com/docker/buildx/releases/download/v0.10.3/buildx-v0.10.3.linux-amd64.provenance.json",
"https://github.com/docker/buildx/releases/download/v0.10.3/buildx-v0.10.3.linux-amd64.sbom.json",
"https://github.com/docker/buildx/releases/download/v0.10.3/buildx-v0.10.3.linux-arm-v6",
"https://github.com/docker/buildx/releases/download/v0.10.3/buildx-v0.10.3.linux-arm-v6.provenance.json",
"https://github.com/docker/buildx/releases/download/v0.10.3/buildx-v0.10.3.linux-arm-v6.sbom.json",
"https://github.com/docker/buildx/releases/download/v0.10.3/buildx-v0.10.3.linux-arm-v7",
"https://github.com/docker/buildx/releases/download/v0.10.3/buildx-v0.10.3.linux-arm-v7.provenance.json",
"https://github.com/docker/buildx/releases/download/v0.10.3/buildx-v0.10.3.linux-arm-v7.sbom.json",
"https://github.com/docker/buildx/releases/download/v0.10.3/buildx-v0.10.3.linux-arm64",
"https://github.com/docker/buildx/releases/download/v0.10.3/buildx-v0.10.3.linux-arm64.provenance.json",
"https://github.com/docker/buildx/releases/download/v0.10.3/buildx-v0.10.3.linux-arm64.sbom.json",
"https://github.com/docker/buildx/releases/download/v0.10.3/buildx-v0.10.3.linux-ppc64le",
"https://github.com/docker/buildx/releases/download/v0.10.3/buildx-v0.10.3.linux-ppc64le.provenance.json",
"https://github.com/docker/buildx/releases/download/v0.10.3/buildx-v0.10.3.linux-ppc64le.sbom.json",
"https://github.com/docker/buildx/releases/download/v0.10.3/buildx-v0.10.3.linux-riscv64",
"https://github.com/docker/buildx/releases/download/v0.10.3/buildx-v0.10.3.linux-riscv64.provenance.json",
"https://github.com/docker/buildx/releases/download/v0.10.3/buildx-v0.10.3.linux-riscv64.sbom.json",
"https://github.com/docker/buildx/releases/download/v0.10.3/buildx-v0.10.3.linux-s390x",
"https://github.com/docker/buildx/releases/download/v0.10.3/buildx-v0.10.3.linux-s390x.provenance.json",
"https://github.com/docker/buildx/releases/download/v0.10.3/buildx-v0.10.3.linux-s390x.sbom.json",
"https://github.com/docker/buildx/releases/download/v0.10.3/buildx-v0.10.3.windows-amd64.exe",
"https://github.com/docker/buildx/releases/download/v0.10.3/buildx-v0.10.3.windows-amd64.provenance.json",
"https://github.com/docker/buildx/releases/download/v0.10.3/buildx-v0.10.3.windows-amd64.sbom.json",
"https://github.com/docker/buildx/releases/download/v0.10.3/buildx-v0.10.3.windows-arm64.exe",
"https://github.com/docker/buildx/releases/download/v0.10.3/buildx-v0.10.3.windows-arm64.provenance.json",
"https://github.com/docker/buildx/releases/download/v0.10.3/buildx-v0.10.3.windows-arm64.sbom.json",
"https://github.com/docker/buildx/releases/download/v0.10.3/checksums.txt"
"https://github.com/docker/buildx/releases/download/v0.10.4/buildx-v0.10.4.darwin-amd64",
"https://github.com/docker/buildx/releases/download/v0.10.4/buildx-v0.10.4.darwin-amd64.provenance.json",
"https://github.com/docker/buildx/releases/download/v0.10.4/buildx-v0.10.4.darwin-amd64.sbom.json",
"https://github.com/docker/buildx/releases/download/v0.10.4/buildx-v0.10.4.darwin-arm64",
"https://github.com/docker/buildx/releases/download/v0.10.4/buildx-v0.10.4.darwin-arm64.provenance.json",
"https://github.com/docker/buildx/releases/download/v0.10.4/buildx-v0.10.4.darwin-arm64.sbom.json",
"https://github.com/docker/buildx/releases/download/v0.10.4/buildx-v0.10.4.linux-amd64",
"https://github.com/docker/buildx/releases/download/v0.10.4/buildx-v0.10.4.linux-amd64.provenance.json",
"https://github.com/docker/buildx/releases/download/v0.10.4/buildx-v0.10.4.linux-amd64.sbom.json",
"https://github.com/docker/buildx/releases/download/v0.10.4/buildx-v0.10.4.linux-arm-v6",
"https://github.com/docker/buildx/releases/download/v0.10.4/buildx-v0.10.4.linux-arm-v6.provenance.json",
"https://github.com/docker/buildx/releases/download/v0.10.4/buildx-v0.10.4.linux-arm-v6.sbom.json",
"https://github.com/docker/buildx/releases/download/v0.10.4/buildx-v0.10.4.linux-arm-v7",
"https://github.com/docker/buildx/releases/download/v0.10.4/buildx-v0.10.4.linux-arm-v7.provenance.json",
"https://github.com/docker/buildx/releases/download/v0.10.4/buildx-v0.10.4.linux-arm-v7.sbom.json",
"https://github.com/docker/buildx/releases/download/v0.10.4/buildx-v0.10.4.linux-arm64",
"https://github.com/docker/buildx/releases/download/v0.10.4/buildx-v0.10.4.linux-arm64.provenance.json",
"https://github.com/docker/buildx/releases/download/v0.10.4/buildx-v0.10.4.linux-arm64.sbom.json",
"https://github.com/docker/buildx/releases/download/v0.10.4/buildx-v0.10.4.linux-ppc64le",
"https://github.com/docker/buildx/releases/download/v0.10.4/buildx-v0.10.4.linux-ppc64le.provenance.json",
"https://github.com/docker/buildx/releases/download/v0.10.4/buildx-v0.10.4.linux-ppc64le.sbom.json",
"https://github.com/docker/buildx/releases/download/v0.10.4/buildx-v0.10.4.linux-riscv64",
"https://github.com/docker/buildx/releases/download/v0.10.4/buildx-v0.10.4.linux-riscv64.provenance.json",
"https://github.com/docker/buildx/releases/download/v0.10.4/buildx-v0.10.4.linux-riscv64.sbom.json",
"https://github.com/docker/buildx/releases/download/v0.10.4/buildx-v0.10.4.linux-s390x",
"https://github.com/docker/buildx/releases/download/v0.10.4/buildx-v0.10.4.linux-s390x.provenance.json",
"https://github.com/docker/buildx/releases/download/v0.10.4/buildx-v0.10.4.linux-s390x.sbom.json",
"https://github.com/docker/buildx/releases/download/v0.10.4/buildx-v0.10.4.windows-amd64.exe",
"https://github.com/docker/buildx/releases/download/v0.10.4/buildx-v0.10.4.windows-amd64.provenance.json",
"https://github.com/docker/buildx/releases/download/v0.10.4/buildx-v0.10.4.windows-amd64.sbom.json",
"https://github.com/docker/buildx/releases/download/v0.10.4/buildx-v0.10.4.windows-arm64.exe",
"https://github.com/docker/buildx/releases/download/v0.10.4/buildx-v0.10.4.windows-arm64.provenance.json",
"https://github.com/docker/buildx/releases/download/v0.10.4/buildx-v0.10.4.windows-arm64.sbom.json",
"https://github.com/docker/buildx/releases/download/v0.10.4/checksums.txt"
]
},
"v0.10.4": {
"id": 94659464,
"tag_name": "v0.10.4",
"html_url": "https://github.com/docker/buildx/releases/tag/v0.10.4",
"assets": [
"https://github.com/docker/buildx/releases/download/v0.10.4/buildx-v0.10.4.darwin-amd64",
"https://github.com/docker/buildx/releases/download/v0.10.4/buildx-v0.10.4.darwin-amd64.provenance.json",
"https://github.com/docker/buildx/releases/download/v0.10.4/buildx-v0.10.4.darwin-amd64.sbom.json",
"https://github.com/docker/buildx/releases/download/v0.10.4/buildx-v0.10.4.darwin-arm64",
"https://github.com/docker/buildx/releases/download/v0.10.4/buildx-v0.10.4.darwin-arm64.provenance.json",
"https://github.com/docker/buildx/releases/download/v0.10.4/buildx-v0.10.4.darwin-arm64.sbom.json",
"https://github.com/docker/buildx/releases/download/v0.10.4/buildx-v0.10.4.linux-amd64",
"https://github.com/docker/buildx/releases/download/v0.10.4/buildx-v0.10.4.linux-amd64.provenance.json",
"https://github.com/docker/buildx/releases/download/v0.10.4/buildx-v0.10.4.linux-amd64.sbom.json",
"https://github.com/docker/buildx/releases/download/v0.10.4/buildx-v0.10.4.linux-arm-v6",
"https://github.com/docker/buildx/releases/download/v0.10.4/buildx-v0.10.4.linux-arm-v6.provenance.json",
"https://github.com/docker/buildx/releases/download/v0.10.4/buildx-v0.10.4.linux-arm-v6.sbom.json",
"https://github.com/docker/buildx/releases/download/v0.10.4/buildx-v0.10.4.linux-arm-v7",
"https://github.com/docker/buildx/releases/download/v0.10.4/buildx-v0.10.4.linux-arm-v7.provenance.json",
"https://github.com/docker/buildx/releases/download/v0.10.4/buildx-v0.10.4.linux-arm-v7.sbom.json",
"https://github.com/docker/buildx/releases/download/v0.10.4/buildx-v0.10.4.linux-arm64",
"https://github.com/docker/buildx/releases/download/v0.10.4/buildx-v0.10.4.linux-arm64.provenance.json",
"https://github.com/docker/buildx/releases/download/v0.10.4/buildx-v0.10.4.linux-arm64.sbom.json",
"https://github.com/docker/buildx/releases/download/v0.10.4/buildx-v0.10.4.linux-ppc64le",
"https://github.com/docker/buildx/releases/download/v0.10.4/buildx-v0.10.4.linux-ppc64le.provenance.json",
"https://github.com/docker/buildx/releases/download/v0.10.4/buildx-v0.10.4.linux-ppc64le.sbom.json",
"https://github.com/docker/buildx/releases/download/v0.10.4/buildx-v0.10.4.linux-riscv64",
"https://github.com/docker/buildx/releases/download/v0.10.4/buildx-v0.10.4.linux-riscv64.provenance.json",
"https://github.com/docker/buildx/releases/download/v0.10.4/buildx-v0.10.4.linux-riscv64.sbom.json",
"https://github.com/docker/buildx/releases/download/v0.10.4/buildx-v0.10.4.linux-s390x",
"https://github.com/docker/buildx/releases/download/v0.10.4/buildx-v0.10.4.linux-s390x.provenance.json",
"https://github.com/docker/buildx/releases/download/v0.10.4/buildx-v0.10.4.linux-s390x.sbom.json",
"https://github.com/docker/buildx/releases/download/v0.10.4/buildx-v0.10.4.windows-amd64.exe",
"https://github.com/docker/buildx/releases/download/v0.10.4/buildx-v0.10.4.windows-amd64.provenance.json",
"https://github.com/docker/buildx/releases/download/v0.10.4/buildx-v0.10.4.windows-amd64.sbom.json",
"https://github.com/docker/buildx/releases/download/v0.10.4/buildx-v0.10.4.windows-arm64.exe",
"https://github.com/docker/buildx/releases/download/v0.10.4/buildx-v0.10.4.windows-arm64.provenance.json",
"https://github.com/docker/buildx/releases/download/v0.10.4/buildx-v0.10.4.windows-arm64.sbom.json",
"https://github.com/docker/buildx/releases/download/v0.10.4/checksums.txt"
]
},
"v0.10.3": {

728
.github/docker-releases.json vendored Normal file
View File

@@ -0,0 +1,728 @@
{
"latest": {
"id": 91964526,
"tag_name": "v23.0.1",
"html_url": "https://github.com/moby/moby/releases/tag/v23.0.1",
"assets": []
},
"v23.0.1": {
"id": 91964526,
"tag_name": "v23.0.1",
"html_url": "https://github.com/moby/moby/releases/tag/v23.0.1",
"assets": []
},
"v23.0.0": {
"id": 91109643,
"tag_name": "v23.0.0",
"html_url": "https://github.com/moby/moby/releases/tag/v23.0.0",
"assets": []
},
"v23.0.0-rc.4": {
"id": 91003797,
"tag_name": "v23.0.0-rc.4",
"html_url": "https://github.com/moby/moby/releases/tag/v23.0.0-rc.4",
"assets": []
},
"v23.0.0-rc.3": {
"id": 89780703,
"tag_name": "v23.0.0-rc.3",
"html_url": "https://github.com/moby/moby/releases/tag/v23.0.0-rc.3",
"assets": []
},
"v20.10.23": {
"id": 89647366,
"tag_name": "v20.10.23",
"html_url": "https://github.com/moby/moby/releases/tag/v20.10.23",
"assets": []
},
"v23.0.0-rc.2": {
"id": 88712255,
"tag_name": "v23.0.0-rc.2",
"html_url": "https://github.com/moby/moby/releases/tag/v23.0.0-rc.2",
"assets": []
},
"v23.0.0-rc.1": {
"id": 87299039,
"tag_name": "v23.0.0-rc.1",
"html_url": "https://github.com/moby/moby/releases/tag/v23.0.0-rc.1",
"assets": []
},
"v20.10.22": {
"id": 86325342,
"tag_name": "v20.10.22",
"html_url": "https://github.com/moby/moby/releases/tag/v20.10.22",
"assets": []
},
"v23.0.0-beta.1": {
"id": 85159482,
"tag_name": "v23.0.0-beta.1",
"html_url": "https://github.com/moby/moby/releases/tag/v23.0.0-beta.1",
"assets": []
},
"v20.10.21": {
"id": 80977884,
"tag_name": "v20.10.21",
"html_url": "https://github.com/moby/moby/releases/tag/v20.10.21",
"assets": []
},
"v20.10.20": {
"id": 80248420,
"tag_name": "v20.10.20",
"html_url": "https://github.com/moby/moby/releases/tag/v20.10.20",
"assets": []
},
"v20.10.19": {
"id": 79847378,
"tag_name": "v20.10.19",
"html_url": "https://github.com/moby/moby/releases/tag/v20.10.19",
"assets": []
},
"v20.10.18": {
"id": 76694729,
"tag_name": "v20.10.18",
"html_url": "https://github.com/moby/moby/releases/tag/v20.10.18",
"assets": []
},
"v20.10.17": {
"id": 68777665,
"tag_name": "v20.10.17",
"html_url": "https://github.com/moby/moby/releases/tag/v20.10.17",
"assets": []
},
"v22.06.0-beta.0": {
"id": 68600276,
"tag_name": "v22.06.0-beta.0",
"html_url": "https://github.com/moby/moby/releases/tag/v22.06.0-beta.0",
"assets": []
},
"v20.10.16": {
"id": 66708640,
"tag_name": "v20.10.16",
"html_url": "https://github.com/moby/moby/releases/tag/v20.10.16",
"assets": []
},
"v20.10.15": {
"id": 66170410,
"tag_name": "v20.10.15",
"html_url": "https://github.com/moby/moby/releases/tag/v20.10.15",
"assets": []
},
"v20.10.14": {
"id": 62642891,
"tag_name": "v20.10.14",
"html_url": "https://github.com/moby/moby/releases/tag/v20.10.14",
"assets": []
},
"v20.10.13": {
"id": 61523032,
"tag_name": "v20.10.13",
"html_url": "https://github.com/moby/moby/releases/tag/v20.10.13",
"assets": []
},
"v20.10.12": {
"id": 56724849,
"tag_name": "v20.10.12",
"html_url": "https://github.com/moby/moby/releases/tag/v20.10.12",
"assets": []
},
"v20.10.11": {
"id": 53604359,
"tag_name": "v20.10.11",
"html_url": "https://github.com/moby/moby/releases/tag/v20.10.11",
"assets": []
},
"v20.10.10": {
"id": 51991530,
"tag_name": "v20.10.10",
"html_url": "https://github.com/moby/moby/releases/tag/v20.10.10",
"assets": []
},
"v20.10.9": {
"id": 50763745,
"tag_name": "v20.10.9",
"html_url": "https://github.com/moby/moby/releases/tag/v20.10.9",
"assets": []
},
"v20.10.8": {
"id": 47261111,
"tag_name": "v20.10.8",
"html_url": "https://github.com/moby/moby/releases/tag/v20.10.8",
"assets": []
},
"v20.10.7": {
"id": 44002175,
"tag_name": "v20.10.7",
"html_url": "https://github.com/moby/moby/releases/tag/v20.10.7",
"assets": []
},
"v20.10.6": {
"id": 41439201,
"tag_name": "v20.10.6",
"html_url": "https://github.com/moby/moby/releases/tag/v20.10.6",
"assets": []
},
"v20.10.5": {
"id": 39216180,
"tag_name": "v20.10.5",
"html_url": "https://github.com/moby/moby/releases/tag/v20.10.5",
"assets": []
},
"v20.10.4": {
"id": 39014860,
"tag_name": "v20.10.4",
"html_url": "https://github.com/moby/moby/releases/tag/v20.10.4",
"assets": []
},
"v20.10.3": {
"id": 37231470,
"tag_name": "v20.10.3",
"html_url": "https://github.com/moby/moby/releases/tag/v20.10.3",
"assets": []
},
"v19.03.15": {
"id": 37231443,
"tag_name": "v19.03.15",
"html_url": "https://github.com/moby/moby/releases/tag/v19.03.15",
"assets": []
},
"v20.10.2": {
"id": 35990169,
"tag_name": "v20.10.2",
"html_url": "https://github.com/moby/moby/releases/tag/v20.10.2",
"assets": []
},
"v20.10.1": {
"id": 35281927,
"tag_name": "v20.10.1",
"html_url": "https://github.com/moby/moby/releases/tag/v20.10.1",
"assets": []
},
"v20.10.0": {
"id": 35069369,
"tag_name": "v20.10.0",
"html_url": "https://github.com/moby/moby/releases/tag/v20.10.0",
"assets": []
},
"v19.03.14": {
"id": 34677482,
"tag_name": "v19.03.14",
"html_url": "https://github.com/moby/moby/releases/tag/v19.03.14",
"assets": []
},
"v19.03.13": {
"id": 31493434,
"tag_name": "v19.03.13",
"html_url": "https://github.com/moby/moby/releases/tag/v19.03.13",
"assets": []
},
"v19.03.12": {
"id": 28065393,
"tag_name": "v19.03.12",
"html_url": "https://github.com/moby/moby/releases/tag/v19.03.12",
"assets": []
},
"v19.03.11": {
"id": 27237950,
"tag_name": "v19.03.11",
"html_url": "https://github.com/moby/moby/releases/tag/v19.03.11",
"assets": []
},
"v19.03.10": {
"id": 27043306,
"tag_name": "v19.03.10",
"html_url": "https://github.com/moby/moby/releases/tag/v19.03.10",
"assets": []
},
"v19.03.9": {
"id": 27002855,
"tag_name": "v19.03.9",
"html_url": "https://github.com/moby/moby/releases/tag/v19.03.9",
"assets": []
},
"v19.03.8": {
"id": 25372883,
"tag_name": "v19.03.8",
"html_url": "https://github.com/moby/moby/releases/tag/v19.03.8",
"assets": []
},
"v17.03.2-ce": {
"id": 6858533,
"tag_name": "v17.03.2-ce",
"html_url": "https://github.com/moby/moby/releases/tag/v17.03.2-ce",
"assets": []
},
"v17.03.2-ce-rc1": {
"id": 6547028,
"tag_name": "v17.03.2-ce-rc1",
"html_url": "https://github.com/moby/moby/releases/tag/v17.03.2-ce-rc1",
"assets": []
},
"v17.05.0-ce": {
"id": 6295254,
"tag_name": "v17.05.0-ce",
"html_url": "https://github.com/moby/moby/releases/tag/v17.05.0-ce",
"assets": []
},
"v17.05.0-ce-rc3": {
"id": 6259851,
"tag_name": "v17.05.0-ce-rc3",
"html_url": "https://github.com/moby/moby/releases/tag/v17.05.0-ce-rc3",
"assets": []
},
"v17.05.0-ce-rc2": {
"id": 6216216,
"tag_name": "v17.05.0-ce-rc2",
"html_url": "https://github.com/moby/moby/releases/tag/v17.05.0-ce-rc2",
"assets": []
},
"v17.05.0-ce-rc1": {
"id": 6066291,
"tag_name": "v17.05.0-ce-rc1",
"html_url": "https://github.com/moby/moby/releases/tag/v17.05.0-ce-rc1",
"assets": []
},
"v17.04.0-ce": {
"id": 5992837,
"tag_name": "v17.04.0-ce",
"html_url": "https://github.com/moby/moby/releases/tag/v17.04.0-ce",
"assets": []
},
"v17.04.0-ce-rc2": {
"id": 5930499,
"tag_name": "v17.04.0-ce-rc2",
"html_url": "https://github.com/moby/moby/releases/tag/v17.04.0-ce-rc2",
"assets": []
},
"v17.03.1-ce": {
"id": 5889333,
"tag_name": "v17.03.1-ce",
"html_url": "https://github.com/moby/moby/releases/tag/v17.03.1-ce",
"assets": []
},
"v17.04.0-ce-rc1": {
"id": 5821903,
"tag_name": "v17.04.0-ce-rc1",
"html_url": "https://github.com/moby/moby/releases/tag/v17.04.0-ce-rc1",
"assets": []
},
"v17.03.1-ce-rc1": {
"id": 5787909,
"tag_name": "v17.03.1-ce-rc1",
"html_url": "https://github.com/moby/moby/releases/tag/v17.03.1-ce-rc1",
"assets": []
},
"v17.03.0-ce": {
"id": 5616072,
"tag_name": "v17.03.0-ce",
"html_url": "https://github.com/moby/moby/releases/tag/v17.03.0-ce",
"assets": []
},
"v17.03.0-ce-rc1": {
"id": 5516127,
"tag_name": "v17.03.0-ce-rc1",
"html_url": "https://github.com/moby/moby/releases/tag/v17.03.0-ce-rc1",
"assets": []
},
"v1.13.1": {
"id": 5400129,
"tag_name": "v1.13.1",
"html_url": "https://github.com/moby/moby/releases/tag/v1.13.1",
"assets": []
},
"v1.13.1-rc2": {
"id": 5385634,
"tag_name": "v1.13.1-rc2",
"html_url": "https://github.com/moby/moby/releases/tag/v1.13.1-rc2",
"assets": []
},
"v1.13.1-rc1": {
"id": 5307652,
"tag_name": "v1.13.1-rc1",
"html_url": "https://github.com/moby/moby/releases/tag/v1.13.1-rc1",
"assets": []
},
"v1.13.0": {
"id": 5196571,
"tag_name": "v1.13.0",
"html_url": "https://github.com/moby/moby/releases/tag/v1.13.0",
"assets": []
},
"v1.13.0-rc7": {
"id": 5157693,
"tag_name": "v1.13.0-rc7",
"html_url": "https://github.com/moby/moby/releases/tag/v1.13.0-rc7",
"assets": []
},
"v1.13.0-rc6": {
"id": 5135134,
"tag_name": "v1.13.0-rc6",
"html_url": "https://github.com/moby/moby/releases/tag/v1.13.0-rc6",
"assets": []
},
"v1.12.6": {
"id": 5123890,
"tag_name": "v1.12.6",
"html_url": "https://github.com/moby/moby/releases/tag/v1.12.6",
"assets": []
},
"v1.13.0-rc5": {
"id": 5080578,
"tag_name": "v1.13.0-rc5",
"html_url": "https://github.com/moby/moby/releases/tag/v1.13.0-rc5",
"assets": []
},
"v1.13.0-rc4": {
"id": 4948866,
"tag_name": "v1.13.0-rc4",
"html_url": "https://github.com/moby/moby/releases/tag/v1.13.0-rc4",
"assets": []
},
"v1.12.5": {
"id": 4938198,
"tag_name": "v1.12.5",
"html_url": "https://github.com/moby/moby/releases/tag/v1.12.5",
"assets": []
},
"v1.12.5-rc1": {
"id": 4926422,
"tag_name": "v1.12.5-rc1",
"html_url": "https://github.com/moby/moby/releases/tag/v1.12.5-rc1",
"assets": []
},
"v1.12.4": {
"id": 4901878,
"tag_name": "v1.12.4",
"html_url": "https://github.com/moby/moby/releases/tag/v1.12.4",
"assets": []
},
"v1.12.4-rc1": {
"id": 4863914,
"tag_name": "v1.12.4-rc1",
"html_url": "https://github.com/moby/moby/releases/tag/v1.12.4-rc1",
"assets": []
},
"v1.13.0-rc3": {
"id": 4840704,
"tag_name": "v1.13.0-rc3",
"html_url": "https://github.com/moby/moby/releases/tag/v1.13.0-rc3",
"assets": []
},
"v1.13.0-rc2": {
"id": 4744761,
"tag_name": "v1.13.0-rc2",
"html_url": "https://github.com/moby/moby/releases/tag/v1.13.0-rc2",
"assets": []
},
"v1.13.0-rc1": {
"id": 4641203,
"tag_name": "v1.13.0-rc1",
"html_url": "https://github.com/moby/moby/releases/tag/v1.13.0-rc1",
"assets": []
},
"v1.12.3": {
"id": 4495222,
"tag_name": "v1.12.3",
"html_url": "https://github.com/moby/moby/releases/tag/v1.12.3",
"assets": []
},
"v1.12.3-rc1": {
"id": 4481016,
"tag_name": "v1.12.3-rc1",
"html_url": "https://github.com/moby/moby/releases/tag/v1.12.3-rc1",
"assets": []
},
"v1.12.2": {
"id": 4364345,
"tag_name": "v1.12.2",
"html_url": "https://github.com/moby/moby/releases/tag/v1.12.2",
"assets": []
},
"v1.12.2-rc3": {
"id": 4336430,
"tag_name": "v1.12.2-rc3",
"html_url": "https://github.com/moby/moby/releases/tag/v1.12.2-rc3",
"assets": []
},
"v1.12.2-rc2": {
"id": 4304701,
"tag_name": "v1.12.2-rc2",
"html_url": "https://github.com/moby/moby/releases/tag/v1.12.2-rc2",
"assets": []
},
"v1.12.2-rc1": {
"id": 4246481,
"tag_name": "v1.12.2-rc1",
"html_url": "https://github.com/moby/moby/releases/tag/v1.12.2-rc1",
"assets": []
},
"v1.12.1": {
"id": 3919520,
"tag_name": "v1.12.1",
"html_url": "https://github.com/moby/moby/releases/tag/v1.12.1",
"assets": []
},
"v1.12.1-rc2": {
"id": 3909470,
"tag_name": "v1.12.1-rc2",
"html_url": "https://github.com/moby/moby/releases/tag/v1.12.1-rc2",
"assets": []
},
"v1.12.1-rc1": {
"id": 3879305,
"tag_name": "v1.12.1-rc1",
"html_url": "https://github.com/moby/moby/releases/tag/v1.12.1-rc1",
"assets": []
},
"v1.12.0": {
"id": 3766135,
"tag_name": "v1.12.0",
"html_url": "https://github.com/moby/moby/releases/tag/v1.12.0",
"assets": []
},
"v1.12.0-rc5": {
"id": 3744904,
"tag_name": "v1.12.0-rc5",
"html_url": "https://github.com/moby/moby/releases/tag/v1.12.0-rc5",
"assets": []
},
"v1.12.0-rc4": {
"id": 3644623,
"tag_name": "v1.12.0-rc4",
"html_url": "https://github.com/moby/moby/releases/tag/v1.12.0-rc4",
"assets": []
},
"v1.12.0-rc3": {
"id": 3573896,
"tag_name": "v1.12.0-rc3",
"html_url": "https://github.com/moby/moby/releases/tag/v1.12.0-rc3",
"assets": []
},
"v1.12.0-rc2": {
"id": 3471944,
"tag_name": "v1.12.0-rc2",
"html_url": "https://github.com/moby/moby/releases/tag/v1.12.0-rc2",
"assets": []
},
"v1.12.0-rc1": {
"id": 3447699,
"tag_name": "v1.12.0-rc1",
"html_url": "https://github.com/moby/moby/releases/tag/v1.12.0-rc1",
"assets": []
},
"v1.11.2": {
"id": 3354503,
"tag_name": "v1.11.2",
"html_url": "https://github.com/moby/moby/releases/tag/v1.11.2",
"assets": []
},
"v1.11.2-rc1": {
"id": 3327300,
"tag_name": "v1.11.2-rc1",
"html_url": "https://github.com/moby/moby/releases/tag/v1.11.2-rc1",
"assets": []
},
"v1.11.1": {
"id": 3105125,
"tag_name": "v1.11.1",
"html_url": "https://github.com/moby/moby/releases/tag/v1.11.1",
"assets": []
},
"v1.11.1-rc1": {
"id": 3097597,
"tag_name": "v1.11.1-rc1",
"html_url": "https://github.com/moby/moby/releases/tag/v1.11.1-rc1",
"assets": []
},
"v1.11.0": {
"id": 3014278,
"tag_name": "v1.11.0",
"html_url": "https://github.com/moby/moby/releases/tag/v1.11.0",
"assets": []
},
"v1.11.0-rc5": {
"id": 2998258,
"tag_name": "v1.11.0-rc5",
"html_url": "https://github.com/moby/moby/releases/tag/v1.11.0-rc5",
"assets": []
},
"v1.11.0-rc4": {
"id": 2968912,
"tag_name": "v1.11.0-rc4",
"html_url": "https://github.com/moby/moby/releases/tag/v1.11.0-rc4",
"assets": []
},
"v1.11.0-rc3": {
"id": 2937939,
"tag_name": "v1.11.0-rc3",
"html_url": "https://github.com/moby/moby/releases/tag/v1.11.0-rc3",
"assets": []
},
"v1.11.0-rc2": {
"id": 2890861,
"tag_name": "v1.11.0-rc2",
"html_url": "https://github.com/moby/moby/releases/tag/v1.11.0-rc2",
"assets": []
},
"v1.11.0-rc1": {
"id": 2875983,
"tag_name": "v1.11.0-rc1",
"html_url": "https://github.com/moby/moby/releases/tag/v1.11.0-rc1",
"assets": []
},
"v1.10.3": {
"id": 2788494,
"tag_name": "v1.10.3",
"html_url": "https://github.com/moby/moby/releases/tag/v1.10.3",
"assets": []
},
"v1.10.3-rc2": {
"id": 2780060,
"tag_name": "v1.10.3-rc2",
"html_url": "https://github.com/moby/moby/releases/tag/v1.10.3-rc2",
"assets": []
},
"v1.10.3-rc1": {
"id": 2777835,
"tag_name": "v1.10.3-rc1",
"html_url": "https://github.com/moby/moby/releases/tag/v1.10.3-rc1",
"assets": []
},
"v1.10.2": {
"id": 2666504,
"tag_name": "v1.10.2",
"html_url": "https://github.com/moby/moby/releases/tag/v1.10.2",
"assets": []
},
"v1.10.2-rc1": {
"id": 2652399,
"tag_name": "v1.10.2-rc1",
"html_url": "https://github.com/moby/moby/releases/tag/v1.10.2-rc1",
"assets": []
},
"v1.10.1": {
"id": 2598018,
"tag_name": "v1.10.1",
"html_url": "https://github.com/moby/moby/releases/tag/v1.10.1",
"assets": []
},
"v1.10.1-rc1": {
"id": 2590708,
"tag_name": "v1.10.1-rc1",
"html_url": "https://github.com/moby/moby/releases/tag/v1.10.1-rc1",
"assets": []
},
"v1.10.0": {
"id": 2555659,
"tag_name": "v1.10.0",
"html_url": "https://github.com/moby/moby/releases/tag/v1.10.0",
"assets": []
},
"v1.10.0-rc4": {
"id": 2549294,
"tag_name": "v1.10.0-rc4",
"html_url": "https://github.com/moby/moby/releases/tag/v1.10.0-rc4",
"assets": []
},
"v1.10.0-rc3": {
"id": 2541607,
"tag_name": "v1.10.0-rc3",
"html_url": "https://github.com/moby/moby/releases/tag/v1.10.0-rc3",
"assets": []
},
"v1.10.0-rc2": {
"id": 2505382,
"tag_name": "v1.10.0-rc2",
"html_url": "https://github.com/moby/moby/releases/tag/v1.10.0-rc2",
"assets": []
},
"v1.10.0-rc1": {
"id": 2437435,
"tag_name": "v1.10.0-rc1",
"html_url": "https://github.com/moby/moby/releases/tag/v1.10.0-rc1",
"assets": []
},
"v1.9.1": {
"id": 2161885,
"tag_name": "v1.9.1",
"html_url": "https://github.com/moby/moby/releases/tag/v1.9.1",
"assets": []
},
"v1.9.1-rc1": {
"id": 2124307,
"tag_name": "v1.9.1-rc1",
"html_url": "https://github.com/moby/moby/releases/tag/v1.9.1-rc1",
"assets": []
},
"v1.9.0": {
"id": 2065556,
"tag_name": "v1.9.0",
"html_url": "https://github.com/moby/moby/releases/tag/v1.9.0",
"assets": []
},
"v1.9.0-rc5": {
"id": 2063038,
"tag_name": "v1.9.0-rc5",
"html_url": "https://github.com/moby/moby/releases/tag/v1.9.0-rc5",
"assets": []
},
"v1.9.0-rc4": {
"id": 2051407,
"tag_name": "v1.9.0-rc4",
"html_url": "https://github.com/moby/moby/releases/tag/v1.9.0-rc4",
"assets": []
},
"v1.9.0-rc3": {
"id": 2030176,
"tag_name": "v1.9.0-rc3",
"html_url": "https://github.com/moby/moby/releases/tag/v1.9.0-rc3",
"assets": []
},
"v1.9.0-rc2": {
"id": 2006252,
"tag_name": "v1.9.0-rc2",
"html_url": "https://github.com/moby/moby/releases/tag/v1.9.0-rc2",
"assets": []
},
"v1.9.0-rc1": {
"id": 1960642,
"tag_name": "v1.9.0-rc1",
"html_url": "https://github.com/moby/moby/releases/tag/v1.9.0-rc1",
"assets": []
},
"v1.8.3": {
"id": 1948004,
"tag_name": "v1.8.3",
"html_url": "https://github.com/moby/moby/releases/tag/v1.8.3",
"assets": []
},
"v1.8.2": {
"id": 1796575,
"tag_name": "v1.8.2",
"html_url": "https://github.com/moby/moby/releases/tag/v1.8.2",
"assets": []
},
"v1.8.2-rc1": {
"id": 1765231,
"tag_name": "v1.8.2-rc1",
"html_url": "https://github.com/moby/moby/releases/tag/v1.8.2-rc1",
"assets": []
},
"v1.8.1": {
"id": 1665370,
"tag_name": "v1.8.1",
"html_url": "https://github.com/moby/moby/releases/tag/v1.8.1",
"assets": []
},
"v1.8.0": {
"id": 1657439,
"tag_name": "v1.8.0",
"html_url": "https://github.com/moby/moby/releases/tag/v1.8.0",
"assets": []
},
"v1.8.0-rc3": {
"id": 1643499,
"tag_name": "v1.8.0-rc3",
"html_url": "https://github.com/moby/moby/releases/tag/v1.8.0-rc3",
"assets": []
}
}

View File

@@ -6,7 +6,7 @@ on:
- 'main'
pull_request:
paths-ignore:
- '.github/buildx-releases.json'
- '.github/*-releases.json'
jobs:
build:

View File

@@ -13,11 +13,11 @@ on:
- 'main'
pull_request:
paths-ignore:
- '.github/buildx-releases.json'
- '.github/*-releases.json'
jobs:
generate:
uses: crazy-max/.github/.github/workflows/releases-json.yml@2a596c917a8ad3e6203ae99b777148525a2e00d5
uses: crazy-max/.github/.github/workflows/releases-json.yml@6dc31870ca6c4f8489bf5a408ab38fae60f47eec
with:
repository: docker/buildx
artifact_name: buildx-releases-json

View File

@@ -0,0 +1,58 @@
name: docker-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-ignore:
- '.github/*-releases.json'
jobs:
generate:
uses: crazy-max/.github/.github/workflows/releases-json.yml@6dc31870ca6c4f8489bf5a408ab38fae60f47eec
with:
repository: moby/moby
artifact_name: docker-releases-json
filename: docker-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@v3
-
name: Download
uses: actions/download-artifact@v3
with:
name: docker-releases-json
path: .github
-
name: Commit changes
run: |
git add -A .
-
name: Create PR
uses: peter-evans/create-pull-request@2b011faafdcbc9ceb11414d64d0573f37c774b04
with:
base: main
branch: bot/docker-releases-json
commit-message: "github: update .github/docker-releases.json"
signoff: true
delete-branch: true
title: "Update `.github/docker-releases.json`"
body: |
Update `.github/docker-releases.json` to keep in sync with [https://github.com/moby/moby](https://github.com/moby/moby).
draft: false

View File

@@ -7,7 +7,7 @@ on:
- 'main'
pull_request:
paths-ignore:
- '.github/buildx-releases.json'
- '.github/*-releases.json'
jobs:
test:

View File

@@ -6,7 +6,7 @@ on:
- 'main'
pull_request:
paths-ignore:
- '.github/buildx-releases.json'
- '.github/*-releases.json'
jobs:
validate:

View File

@@ -0,0 +1,459 @@
/**
* 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 {beforeEach, describe, expect, jest, test} from '@jest/globals';
import * as path from 'path';
import {Bake} from '../../src/buildx/bake';
import {BakeDefinition} from '../../src/types/bake';
const fixturesDir = path.join(__dirname, '..', 'fixtures');
beforeEach(() => {
jest.clearAllMocks();
});
describe('parseDefinitions', () => {
// prettier-ignore
test.each([
[
[path.join(fixturesDir, 'bake.hcl')],
['validate'],
{
"group": {
"default": {
"targets": [
"validate"
]
},
"validate": {
"targets": [
"lint",
"validate-vendor",
"validate-docs"
]
}
},
"target": {
"lint": {
"context": ".",
"dockerfile": "./hack/dockerfiles/lint.Dockerfile",
"args": {
"BUILDKIT_CONTEXT_KEEP_GIT_DIR": "1",
"GO_VERSION": "1.20"
},
"output": [
"type=cacheonly"
]
},
"validate-docs": {
"context": ".",
"dockerfile": "./hack/dockerfiles/docs.Dockerfile",
"args": {
"BUILDKIT_CONTEXT_KEEP_GIT_DIR": "1",
"BUILDX_EXPERIMENTAL": "1",
"FORMATS": "md",
"GO_VERSION": "1.20"
},
"target": "validate",
"output": [
"type=cacheonly"
]
},
"validate-vendor": {
"context": ".",
"dockerfile": "./hack/dockerfiles/vendor.Dockerfile",
"args": {
"BUILDKIT_CONTEXT_KEEP_GIT_DIR": "1",
"GO_VERSION": "1.20"
},
"target": "validate",
"output": [
"type=cacheonly"
]
}
}
}
]
])('given %p', async (files, targets, expected: BakeDefinition) => {
const bake = new Bake();
expect(await bake.parseDefinitions(files, targets)).toEqual(expected);
});
});
describe('hasLocalExporter', () => {
// prettier-ignore
test.each([
[
{
"target": {
"build": {
"output": [
"type=docker"
]
},
}
},
false
],
[
{
"target": {
"local": {
"output": [
"type=local,dest=./release-out"
]
},
}
},
true
],
[
{
"target": {
"tar": {
"output": [
"type=tar,dest=/tmp/image.tar"
]
},
}
},
false
],
[
{
"target": {
"tar": {
"output": [
'"type=tar","dest=/tmp/image.tar"',
]
},
}
},
false
],
[
{
"target": {
"local": {
"output": [
'" type= local" , dest=./release-out',
]
},
}
},
true
],
[
{
"target": {
"local": {
"output": [
".",
]
},
}
},
true
]
])('given %o returns %p', async (def: BakeDefinition, expected: boolean) => {
expect(Bake.hasLocalExporter(def)).toEqual(expected);
});
});
describe('hasTarExporter', () => {
// prettier-ignore
test.each([
[
{
"target": {
"reg": {
"output": [
"type=registry,ref=user/app"
]
},
}
},
false
],
[
{
"target": {
"build": {
"output": [
"type=docker"
]
},
}
},
false
],
[
{
"target": {
"local": {
"output": [
"type=local,dest=./release-out"
]
},
}
},
false
],
[
{
"target": {
"tar": {
"output": [
"type=tar,dest=/tmp/image.tar"
]
},
}
},
true
],
[
{
"target": {
"multi": {
"output": [
"type=docker",
"type=tar,dest=/tmp/image.tar"
]
},
}
},
true
],
[
{
"target": {
"tar": {
"output": [
'"type=tar","dest=/tmp/image.tar"',
]
},
}
},
true
],
[
{
"target": {
"local": {
"output": [
'" type= local" , dest=./release-out',
]
},
}
},
false
],
[
{
"target": {
"local": {
"output": [
".",
]
},
}
},
false
],
])('given %o returns %p', async (def: BakeDefinition, expected: boolean) => {
expect(Bake.hasTarExporter(def)).toEqual(expected);
});
});
describe('hasDockerExporter', () => {
// prettier-ignore
test.each([
[
{
"target": {
"reg": {
"output": [
"type=registry,ref=user/app"
]
},
}
},
false,
undefined
],
[
{
"target": {
"build": {
"output": [
"type=docker"
]
},
}
},
true,
undefined
],
[
{
"target": {
"multi": {
"output": [
"type=docker",
"type=tar,dest=/tmp/image.tar"
]
},
}
},
true,
undefined
],
[
{
"target": {
"local": {
"output": [
'" type= local" , dest=./release-out'
]
},
}
},
false,
undefined
],
[
{
"target": {
"local": {
"output": [
"type=local,dest=./release-out"
]
},
}
},
false,
undefined
],
[
{
"target": {
"tar": {
"output": [
"type=tar,dest=/tmp/image.tar"
]
},
}
},
false,
undefined
],
[
{
"target": {
"multi": {
"output": [
"type=docker",
"type=tar,dest=/tmp/image.tar"
]
},
}
},
true,
undefined
],
[
{
"target": {
"tar": {
"output": [
'"type=tar","dest=/tmp/image.tar"'
]
},
}
},
false,
undefined
],
[
{
"target": {
"tar": {
"output": [
'"type=tar","dest=/tmp/image.tar"'
]
},
}
},
false,
undefined
],
[
{
"target": {
"local": {
"output": [
'" type= local" , dest=./release-out'
]
},
}
},
false,
undefined
],
[
{
"target": {
"build": {
"output": [
"type=docker"
]
},
}
},
true,
false
],
[
{
"target": {
"build": {
"output": [
"type=docker"
]
},
}
},
true,
true
],
[
{
"target": {
"build": {
"output": [
"."
]
},
}
},
true,
true
],
])('given %o and load:%p returns %p', async (def: BakeDefinition, expected: boolean, load: boolean) => {
expect(Bake.hasDockerExporter(def, load)).toEqual(expected);
});
});

View File

@@ -19,6 +19,7 @@ import * as fs from 'fs';
import * as path from 'path';
import {Builder} from '../../src/buildx/builder';
import {Exec} from '../../src/exec';
import {BuilderInfo} from '../../src/types/builder';
@@ -37,7 +38,7 @@ jest.spyOn(Builder.prototype, 'inspect').mockImplementation(async (): Promise<Bu
{
buildkit: 'v0.11.0',
'buildkitd-flags': '--debug --allow-insecure-entitlement security.insecure --allow-insecure-entitlement network.host',
'driver-opts': ['BUILDKIT_STEP_LOG_MAX_SIZE=10485760', 'BUILDKIT_STEP_LOG_MAX_SPEED=10485760', 'JAEGER_TRACE=localhost:6831', 'image=moby/buildkit:latest', 'network=host'],
'driver-opts': ['BUILDKIT_STEP_LOG_MAX_SIZE=10485760', 'BUILDKIT_STEP_LOG_MAX_SPEED=10485760', 'JAEGER_TRACE=localhost:6831', 'image=moby/buildkit:latest', 'network=host', 'qemu.install=true'],
endpoint: 'unix:///var/run/docker.sock',
name: 'builder20',
platforms: 'linux/amd64,linux/amd64/v2,linux/amd64/v3,linux/arm64,linux/riscv64,linux/ppc64le,linux/s390x,linux/386,linux/mips64le,linux/mips64,linux/arm/v7,linux/arm/v6',
@@ -47,6 +48,19 @@ jest.spyOn(Builder.prototype, 'inspect').mockImplementation(async (): Promise<Bu
};
});
describe('exists', () => {
it('valid', async () => {
const execSpy = jest.spyOn(Exec, 'getExecOutput');
const builder = new Builder();
await builder.exists('foo');
// eslint-disable-next-line jest/no-standalone-expect
expect(execSpy).toHaveBeenCalledWith(`docker`, ['buildx', 'inspect', 'foo'], {
silent: true,
ignoreReturnCode: true
});
});
});
describe('inspect', () => {
it('valid', async () => {
const builder = new Builder();
@@ -182,11 +196,12 @@ describe('parseInspect', () => {
"buildkit": "v0.11.0",
"buildkitd-flags": "--debug --allow-insecure-entitlement security.insecure --allow-insecure-entitlement network.host",
"driver-opts": [
"BUILDKIT_STEP_LOG_MAX_SIZE=10485760",
"BUILDKIT_STEP_LOG_MAX_SPEED=10485760",
"JAEGER_TRACE=localhost:6831",
"env.BUILDKIT_STEP_LOG_MAX_SIZE=10485760",
"env.BUILDKIT_STEP_LOG_MAX_SPEED=10485760",
"env.JAEGER_TRACE=localhost:6831",
"image=moby/buildkit:latest",
"network=host"
"network=host",
"qemu.install=true"
],
"endpoint": "unix:///var/run/docker.sock",
"name": "builder20",

View File

@@ -20,7 +20,6 @@ import * as path from 'path';
import * as rimraf from 'rimraf';
import {Context} from '../../src/context';
import {Buildx} from '../../src/buildx/buildx';
import {Inputs} from '../../src/buildx/inputs';
const fixturesDir = path.join(__dirname, '..', 'fixtures');
@@ -53,31 +52,28 @@ afterEach(() => {
describe('resolveBuildImageID', () => {
it('matches', async () => {
const buildx = new Buildx();
const imageID = 'sha256:bfb45ab72e46908183546477a08f8867fc40cebadd00af54b071b097aed127a9';
const imageIDFile = buildx.inputs.getBuildImageIDFilePath();
const imageIDFile = Inputs.getBuildImageIDFilePath();
await fs.writeFileSync(imageIDFile, imageID);
const expected = buildx.inputs.resolveBuildImageID();
const expected = Inputs.resolveBuildImageID();
expect(expected).toEqual(imageID);
});
});
describe('resolveBuildMetadata', () => {
it('matches', async () => {
const buildx = new Buildx();
const metadataFile = buildx.inputs.getBuildMetadataFilePath();
const metadataFile = Inputs.getBuildMetadataFilePath();
await fs.writeFileSync(metadataFile, metadata);
const expected = buildx.inputs.resolveBuildMetadata();
const expected = Inputs.resolveBuildMetadata();
expect(expected).toEqual(metadata);
});
});
describe('resolveDigest', () => {
it('matches', async () => {
const buildx = new Buildx();
const metadataFile = buildx.inputs.getBuildMetadataFilePath();
const metadataFile = Inputs.getBuildMetadataFilePath();
await fs.writeFileSync(metadataFile, metadata);
const expected = buildx.inputs.resolveDigest();
const expected = Inputs.resolveDigest();
expect(expected).toEqual('sha256:b09b9482c72371486bb2c1d2c2a2633ed1d0b8389e12c8d52b9e052725c0c83c');
});
});
@@ -124,8 +120,7 @@ describe('getProvenanceInput', () => {
],
])('given input %p', async (input: string, expected: string) => {
await setInput('provenance', input);
const buildx = new Buildx();
expect(buildx.inputs.getProvenanceInput('provenance')).toEqual(expected);
expect(Inputs.getProvenanceInput('provenance')).toEqual(expected);
});
});
@@ -153,8 +148,7 @@ describe('resolveProvenanceAttrs', () => {
'builder-id=https://github.com/docker/actions-toolkit/actions/runs/123'
],
])('given %p', async (input: string, expected: string) => {
const buildx = new Buildx();
expect(buildx.inputs.resolveProvenanceAttrs(input)).toEqual(expected);
expect(Inputs.resolveProvenanceAttrs(input)).toEqual(expected);
});
});
@@ -170,12 +164,11 @@ describe('resolveBuildSecret', () => {
[`notfound=secret`, true, '', '', new Error('secret file secret not found')]
])('given %p key and %p secret', async (kvp: string, file: boolean, exKey: string, exValue: string, error: Error) => {
try {
const buildx = new Buildx();
let secret: string;
if (file) {
secret = buildx.inputs.resolveBuildSecretFile(kvp);
secret = Inputs.resolveBuildSecretFile(kvp);
} else {
secret = buildx.inputs.resolveBuildSecretString(kvp);
secret = Inputs.resolveBuildSecretString(kvp);
}
expect(secret).toEqual(`id=${exKey},src=${tmpName}`);
expect(fs.readFileSync(tmpName, 'utf-8')).toEqual(exValue);

View File

@@ -21,19 +21,23 @@ import {Install} from '../../src/docker/install';
import {Docker} from '../../src/docker/docker';
// prettier-ignore
const tmpDir = path.join(process.env.TEMP || '/tmp', 'buildx-jest');
const tmpDir = path.join(process.env.TEMP || '/tmp', 'docker-install-jest');
describe('install', () => {
// prettier-ignore
test.each(['23.0.0'])(
test.each(['v23.0.0'])(
'install docker %s', async (version) => {
await expect((async () => {
const install = new Install();
const toolPath = await install.download(version);
await install.install(toolPath, tmpDir, version);
const install = new Install({
version: version,
runDir: tmpDir,
contextName: 'foo'
});
await install.download();
await install.install();
await Docker.printVersion();
await Docker.printInfo();
await install.tearDown(tmpDir);
await install.tearDown();
})()).resolves.not.toThrow();
});
});

View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/
import {describe, expect, jest, test, beforeEach, afterEach} from '@jest/globals';
import {describe, expect, jest, test, beforeEach, afterEach, it} from '@jest/globals';
import * as fs from 'fs';
import * as path from 'path';
import * as rimraf from 'rimraf';
@@ -23,7 +23,7 @@ import osm = require('os');
import {Install} from '../../src/docker/install';
// prettier-ignore
const tmpDir = path.join(process.env.TEMP || '/tmp', 'buildx-jest');
const tmpDir = path.join(process.env.TEMP || '/tmp', 'docker-install-jest');
beforeEach(() => {
jest.clearAllMocks();
@@ -36,15 +36,38 @@ afterEach(function () {
describe('download', () => {
// prettier-ignore
test.each([
['19.03.6', 'linux'],
['20.10.22', 'linux'],
['20.10.22', 'darwin'],
['20.10.22', 'win32'],
['v19.03.14', 'linux'],
['v20.10.22', 'linux'],
['v20.10.22', 'darwin'],
['v20.10.22', 'win32'],
])(
'acquires %p of docker (%s)', async (version, platformOS) => {
jest.spyOn(osm, 'platform').mockImplementation(() => platformOS);
const install = new Install();
const toolPath = await install.download(version);
const install = new Install({
version: version,
runDir: tmpDir,
});
const toolPath = await install.download();
expect(fs.existsSync(toolPath)).toBe(true);
}, 100000);
});
describe('getRelease', () => {
it('returns latest docker GitHub release', async () => {
const release = await Install.getRelease('latest');
expect(release).not.toBeNull();
expect(release?.tag_name).not.toEqual('');
});
it('returns v23.0.0 buildx GitHub release', async () => {
const release = await Install.getRelease('v23.0.0');
expect(release).not.toBeNull();
expect(release?.id).toEqual(91109643);
expect(release?.tag_name).toEqual('v23.0.0');
expect(release?.html_url).toEqual('https://github.com/moby/moby/releases/tag/v23.0.0');
});
it('unknown release', async () => {
await expect(Install.getRelease('foo')).rejects.toThrowError(new Error('Cannot find Docker release foo in https://raw.githubusercontent.com/docker/actions-toolkit/main/.github/docker-releases.json'));
});
});

172
__tests__/fixtures/bake.hcl Normal file
View File

@@ -0,0 +1,172 @@
// 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.
variable "GO_VERSION" {
default = "1.20"
}
variable "DOCS_FORMATS" {
default = "md"
}
variable "DESTDIR" {
default = "./bin"
}
# Special target: https://github.com/docker/metadata-action#bake-definition
target "meta-helper" {
tags = ["docker/buildx-bin:local"]
}
target "_common" {
args = {
GO_VERSION = GO_VERSION
BUILDKIT_CONTEXT_KEEP_GIT_DIR = 1
}
}
group "default" {
targets = ["binaries"]
}
group "validate" {
targets = ["lint", "validate-vendor", "validate-docs"]
}
target "lint" {
inherits = ["_common"]
dockerfile = "./hack/dockerfiles/lint.Dockerfile"
output = ["type=cacheonly"]
}
target "validate-vendor" {
inherits = ["_common"]
dockerfile = "./hack/dockerfiles/vendor.Dockerfile"
target = "validate"
output = ["type=cacheonly"]
}
target "validate-docs" {
inherits = ["_common"]
args = {
FORMATS = DOCS_FORMATS
BUILDX_EXPERIMENTAL = 1 // enables experimental cmds/flags for docs generation
}
dockerfile = "./hack/dockerfiles/docs.Dockerfile"
target = "validate"
output = ["type=cacheonly"]
}
target "validate-authors" {
inherits = ["_common"]
dockerfile = "./hack/dockerfiles/authors.Dockerfile"
target = "validate"
output = ["type=cacheonly"]
}
target "validate-generated-files" {
inherits = ["_common"]
dockerfile = "./hack/dockerfiles/generated-files.Dockerfile"
target = "validate"
output = ["type=cacheonly"]
}
target "update-vendor" {
inherits = ["_common"]
dockerfile = "./hack/dockerfiles/vendor.Dockerfile"
target = "update"
output = ["."]
}
target "update-docs" {
inherits = ["_common"]
args = {
FORMATS = DOCS_FORMATS
BUILDX_EXPERIMENTAL = 1 // enables experimental cmds/flags for docs generation
}
dockerfile = "./hack/dockerfiles/docs.Dockerfile"
target = "update"
output = ["./docs/reference"]
}
target "update-authors" {
inherits = ["_common"]
dockerfile = "./hack/dockerfiles/authors.Dockerfile"
target = "update"
output = ["."]
}
target "update-generated-files" {
inherits = ["_common"]
dockerfile = "./hack/dockerfiles/generated-files.Dockerfile"
target = "update"
output = ["."]
}
target "mod-outdated" {
inherits = ["_common"]
dockerfile = "./hack/dockerfiles/vendor.Dockerfile"
target = "outdated"
no-cache-filter = ["outdated"]
output = ["type=cacheonly"]
}
target "test" {
inherits = ["_common"]
target = "test-coverage"
output = ["${DESTDIR}/coverage"]
}
target "binaries" {
inherits = ["_common"]
target = "binaries"
output = ["${DESTDIR}/build"]
platforms = ["local"]
}
target "binaries-cross" {
inherits = ["binaries"]
platforms = [
"darwin/amd64",
"darwin/arm64",
"linux/amd64",
"linux/arm/v6",
"linux/arm/v7",
"linux/arm64",
"linux/ppc64le",
"linux/riscv64",
"linux/s390x",
"windows/amd64",
"windows/arm64"
]
}
target "release" {
inherits = ["binaries-cross"]
target = "release"
output = ["${DESTDIR}/release"]
}
target "image" {
inherits = ["meta-helper", "binaries"]
output = ["type=image"]
}
target "image-cross" {
inherits = ["meta-helper", "binaries-cross"]
output = ["type=image"]
}
target "image-local" {
inherits = ["image"]
output = ["type=docker"]
}

View File

@@ -5,7 +5,7 @@ Last Activity: 2023-01-16 09:45:23 +0000 UTC
Nodes:
Name: builder20
Endpoint: unix:///var/run/docker.sock
Driver Options: env.BUILDKIT_STEP_LOG_MAX_SIZE="10485760" env.BUILDKIT_STEP_LOG_MAX_SPEED="10485760" env.JAEGER_TRACE="localhost:6831" image="moby/buildkit:latest" network="host"
Driver Options: env.BUILDKIT_STEP_LOG_MAX_SIZE="10485760" env.BUILDKIT_STEP_LOG_MAX_SPEED="10485760" env.JAEGER_TRACE="localhost:6831" image="moby/buildkit:latest" network="host" qemu.install="true"
Status: running
Flags: --debug --allow-insecure-entitlement security.insecure --allow-insecure-entitlement network.host
Buildkit: v0.11.0

View File

@@ -51,7 +51,7 @@
"@actions/io": "^1.1.2",
"@actions/tool-cache": "^2.0.1",
"async-retry": "^1.3.3",
"csv-parse": "^5.3.5",
"csv-parse": "^5.3.6",
"handlebars": "^4.7.7",
"jwt-decode": "^3.1.2",
"semver": "^7.3.8",

74
src/buildx/bake.ts Normal file
View File

@@ -0,0 +1,74 @@
/**
* 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 {Buildx} from './buildx';
import {Exec} from '../exec';
import {Inputs} from './inputs';
import {BakeDefinition} from '../types/bake';
export interface BakeOpts {
buildx?: Buildx;
}
export class Bake {
private readonly buildx: Buildx;
constructor(opts?: BakeOpts) {
this.buildx = opts?.buildx || new Buildx();
}
public async parseDefinitions(files: Array<string>, targets: Array<string>): Promise<BakeDefinition> {
const args = ['bake'];
if (files) {
for (const file of files) {
args.push('--file', file);
}
}
const printCmd = await this.buildx.getCommand([...args, '--print', ...targets]);
return await Exec.getExecOutput(printCmd.command, printCmd.args, {
ignoreReturnCode: true,
silent: true
}).then(res => {
if (res.stderr.length > 0 && res.exitCode != 0) {
throw new Error(res.stderr);
}
return <BakeDefinition>JSON.parse(res.stdout.trim());
});
}
public static hasLocalExporter(def: BakeDefinition): boolean {
return Inputs.hasExporterType('local', Bake.exporters(def));
}
public static hasTarExporter(def: BakeDefinition): boolean {
return Inputs.hasExporterType('tar', Bake.exporters(def));
}
public static hasDockerExporter(def: BakeDefinition, load?: boolean): boolean {
return load || Inputs.hasExporterType('docker', Bake.exporters(def));
}
private static exporters(def: BakeDefinition): Array<string> {
const exporters = new Array<string>();
for (const key in def.target) {
const target = def.target[key];
exporters.push(...target.output);
}
return exporters;
}
}

View File

@@ -14,6 +14,8 @@
* limitations under the License.
*/
import * as core from '@actions/core';
import {Buildx} from './buildx';
import {Exec} from '../exec';
@@ -30,6 +32,29 @@ export class Builder {
this.buildx = opts?.buildx || new Buildx();
}
public async exists(name: string): Promise<boolean> {
const cmd = await this.buildx.getCommand(['inspect', name]);
const ok: boolean = await Exec.getExecOutput(cmd.command, cmd.args, {
ignoreReturnCode: true,
silent: true
})
.then(res => {
if (res.stderr.length > 0 && res.exitCode != 0) {
core.debug(`Builder.exists cmd err: ${res.stderr.trim()}`);
return false;
}
return res.exitCode == 0;
})
.catch(error => {
core.debug(`Builder.exists error: ${error}`);
return false;
});
core.debug(`Builder.exists: ${ok}`);
return ok;
}
public async inspect(name: string): Promise<BuilderInfo> {
const cmd = await this.buildx.getCommand(['inspect', name]);
return await Exec.getExecOutput(cmd.command, cmd.args, {
@@ -80,7 +105,7 @@ export class Builder {
break;
}
case 'driver options': {
node['driver-opts'] = (value.match(/(\w+)="([^"]*)"/g) || []).map(v => v.replace(/^(.*)="(.*)"$/g, '$1=$2'));
node['driver-opts'] = (value.match(/([a-zA-Z0-9_.]+)="([^"]*)"/g) || []).map(v => v.replace(/^(.*)="(.*)"$/g, '$1=$2'));
break;
}
case 'status': {

View File

@@ -21,7 +21,6 @@ import * as semver from 'semver';
import {Docker} from '../docker/docker';
import {Exec} from '../exec';
import {Inputs} from './inputs';
import {Cert} from '../types/buildx';
@@ -34,15 +33,12 @@ export class Buildx {
private _versionOnce: boolean;
private readonly _standalone: boolean | undefined;
public readonly inputs: Inputs;
public static readonly containerNamePrefix = 'buildx_buildkit_';
constructor(opts?: BuildxOpts) {
this._standalone = opts?.standalone;
this._version = '';
this._versionOnce = false;
this.inputs = new Inputs();
}
static get configDir(): string {
@@ -76,7 +72,7 @@ export class Buildx {
})
.then(res => {
if (res.stderr.length > 0 && res.exitCode != 0) {
core.debug(`Buildx.isAvailable cmd err: ${res.stderr}`);
core.debug(`Buildx.isAvailable cmd err: ${res.stderr.trim()}`);
return false;
}
return res.exitCode == 0;

View File

@@ -22,24 +22,24 @@ import {parse} from 'csv-parse/sync';
import {Context} from '../context';
export class Inputs {
public getBuildImageIDFilePath(): string {
public static getBuildImageIDFilePath(): string {
return path.join(Context.tmpDir(), 'iidfile');
}
public getBuildMetadataFilePath(): string {
public static getBuildMetadataFilePath(): string {
return path.join(Context.tmpDir(), 'metadata-file');
}
public resolveBuildImageID(): string | undefined {
const iidFile = this.getBuildImageIDFilePath();
public static resolveBuildImageID(): string | undefined {
const iidFile = Inputs.getBuildImageIDFilePath();
if (!fs.existsSync(iidFile)) {
return undefined;
}
return fs.readFileSync(iidFile, {encoding: 'utf-8'}).trim();
}
public resolveBuildMetadata(): string | undefined {
const metadataFile = this.getBuildMetadataFilePath();
public static resolveBuildMetadata(): string | undefined {
const metadataFile = Inputs.getBuildMetadataFilePath();
if (!fs.existsSync(metadataFile)) {
return undefined;
}
@@ -50,8 +50,8 @@ export class Inputs {
return content;
}
public resolveDigest(): string | undefined {
const metadata = this.resolveBuildMetadata();
public static resolveDigest(): string | undefined {
const metadata = Inputs.resolveBuildMetadata();
if (metadata === undefined) {
return undefined;
}
@@ -62,15 +62,15 @@ export class Inputs {
return undefined;
}
public resolveBuildSecretString(kvp: string): string {
return this.resolveBuildSecret(kvp, false);
public static resolveBuildSecretString(kvp: string): string {
return Inputs.resolveBuildSecret(kvp, false);
}
public resolveBuildSecretFile(kvp: string): string {
return this.resolveBuildSecret(kvp, true);
public static resolveBuildSecretFile(kvp: string): string {
return Inputs.resolveBuildSecret(kvp, true);
}
public resolveBuildSecret(kvp: string, file: boolean): string {
public static resolveBuildSecret(kvp: string, file: boolean): string {
const delimiterIndex = kvp.indexOf('=');
const key = kvp.substring(0, delimiterIndex);
let value = kvp.substring(delimiterIndex + 1);
@@ -88,7 +88,7 @@ export class Inputs {
return `id=${key},src=${secretFile}`;
}
public getProvenanceInput(name: string): string {
public static getProvenanceInput(name: string): string {
const input = core.getInput(name);
if (!input) {
// if input is not set returns empty string
@@ -98,11 +98,11 @@ export class Inputs {
return core.getBooleanInput(name) ? `builder-id=${Context.provenanceBuilderID()}` : 'false';
} catch (err) {
// not a valid boolean, so we assume it's a string
return this.resolveProvenanceAttrs(input);
return Inputs.resolveProvenanceAttrs(input);
}
}
public resolveProvenanceAttrs(input: string): string {
public static resolveProvenanceAttrs(input: string): string {
if (!input) {
return `builder-id=${Context.provenanceBuilderID()}`;
}

View File

@@ -22,19 +22,50 @@ import retry from 'async-retry';
import * as handlebars from 'handlebars';
import * as util from 'util';
import * as core from '@actions/core';
import * as httpm from '@actions/http-client';
import * as io from '@actions/io';
import * as tc from '@actions/tool-cache';
import {Context} from '../context';
import {Exec} from '../exec';
import {Util} from '../util';
import {colimaYamlData, dockerServiceLogsPs1, setupDockerLinuxSh, setupDockerWinPs1} from './assets';
import {GitHubRelease} from '../types/github';
export interface InstallOpts {
version?: string;
channel?: string;
runDir: string;
contextName?: string;
}
export class Install {
public async download(version: string, channel?: string): Promise<string> {
channel = channel || 'stable';
const downloadURL = this.downloadURL(version, channel);
private readonly runDir: string;
private readonly version: string;
private readonly channel: string;
private readonly contextName: string;
private _version: string | undefined;
private _toolDir: string | undefined;
constructor(opts: InstallOpts) {
this.runDir = opts.runDir;
this.version = opts.version || 'latest';
this.channel = opts.channel || 'stable';
this.contextName = opts.contextName || 'setup-docker-action';
}
get toolDir(): string {
return this._toolDir || Context.tmpDir();
}
public async download(): Promise<string> {
const release: GitHubRelease = await Install.getRelease(this.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);
core.info(`Downloading ${downloadURL}`);
const downloadPath = await tc.downloadTool(downloadURL);
core.debug(`docker.Install.download downloadPath: ${downloadPath}`);
@@ -60,31 +91,32 @@ export class Install {
});
});
const tooldir = await tc.cacheDir(extractFolder, `docker-${channel}`, version.replace(/(0+)([1-9]+)/, '$2'));
const tooldir = await tc.cacheDir(extractFolder, `docker-${this.channel}`, this._version.replace(/(0+)([1-9]+)/, '$2'));
core.addPath(tooldir);
core.info('Added Docker to PATH');
this._toolDir = tooldir;
return tooldir;
}
public async install(toolDir: string, runDir: string, version: string, channel?: string): Promise<void> {
if (toolDir.length == 0) {
throw new Error('toolDir must be set');
public async install(): Promise<void> {
if (!this.toolDir) {
throw new Error('toolDir must be set. Run download first.');
}
if (runDir.length == 0) {
if (!this.runDir) {
throw new Error('runDir must be set');
}
channel = channel || 'stable';
switch (os.platform()) {
case 'darwin': {
await this.installDarwin(toolDir, version, channel);
await this.installDarwin();
break;
}
case 'linux': {
await this.installLinux(toolDir, runDir);
await this.installLinux();
break;
}
case 'win32': {
await this.installWindows(toolDir, runDir);
await this.installWindows();
break;
}
default: {
@@ -93,7 +125,7 @@ export class Install {
}
}
private async installDarwin(toolDir: string, version: string, channel?: string): Promise<void> {
private async installDarwin(): Promise<void> {
const colimaDir = path.join(os.homedir(), '.colima', 'default'); // TODO: create a custom colima profile to avoid overlap with other actions
await io.mkdirP(colimaDir);
const dockerHost = `unix://${colimaDir}/docker.sock`;
@@ -107,8 +139,8 @@ export class Install {
await core.group('Creating colima config', async () => {
const colimaCfg = handlebars.compile(colimaYamlData)({
hostArch: Install.platformArch(),
dockerVersion: version,
dockerChannel: channel
dockerVersion: this._version,
dockerChannel: this.channel
});
core.info(`Writing colima config to ${path.join(colimaDir, 'colima.yaml')}`);
fs.writeFileSync(path.join(colimaDir, 'colima.yaml'), colimaCfg);
@@ -118,7 +150,7 @@ export class Install {
// colima is already started on the runner so env var added in download
// method is not expanded to the running process.
const envs = Object.assign({}, process.env, {
PATH: `${toolDir}:${process.env.PATH}`
PATH: `${this.toolDir}:${process.env.PATH}`
}) as {
[key: string]: string;
};
@@ -127,14 +159,14 @@ export class Install {
});
await core.group('Create Docker context', async () => {
await Exec.exec('docker', ['context', 'create', 'setup-docker-action', '--docker', `host=${dockerHost}`]);
await Exec.exec('docker', ['context', 'use', 'setup-docker-action']);
await Exec.exec('docker', ['context', 'create', this.contextName, '--docker', `host=${dockerHost}`]);
await Exec.exec('docker', ['context', 'use', this.contextName]);
});
}
private async installLinux(toolDir: string, runDir: string): Promise<void> {
const dockerHost = `unix://${path.join(runDir, 'docker.sock')}`;
await io.mkdirP(runDir);
private async installLinux(): Promise<void> {
const dockerHost = `unix://${path.join(this.runDir, 'docker.sock')}`;
await io.mkdirP(this.runDir);
await core.group('Start Docker daemon', async () => {
const bashPath: string = await io.which('bash', true);
@@ -143,8 +175,8 @@ export class Install {
shell: true,
stdio: ['ignore', process.stdout, process.stderr],
env: Object.assign({}, process.env, {
TOOLDIR: toolDir,
RUNDIR: runDir,
TOOLDIR: this.toolDir,
RUNDIR: this.runDir,
DOCKER_HOST: dockerHost
}) as {
[key: string]: string;
@@ -182,18 +214,18 @@ export class Install {
});
await core.group('Create Docker context', async () => {
await Exec.exec('docker', ['context', 'create', 'setup-docker-action', '--docker', `host=${dockerHost}`]);
await Exec.exec('docker', ['context', 'use', 'setup-docker-action']);
await Exec.exec('docker', ['context', 'create', this.contextName, '--docker', `host=${dockerHost}`]);
await Exec.exec('docker', ['context', 'use', this.contextName]);
});
}
private async installWindows(toolDir: string, runDir: string): Promise<void> {
private async installWindows(): Promise<void> {
const dockerHost = 'npipe:////./pipe/setup_docker_action';
await core.group('Install Docker daemon service', async () => {
const setupCmd = await Util.powershellCommand(setupDockerWinPs1(), {
ToolDir: toolDir,
RunDir: runDir,
ToolDir: this.toolDir,
RunDir: this.runDir,
DockerHost: dockerHost
});
await Exec.exec(setupCmd.command, setupCmd.args);
@@ -202,19 +234,22 @@ export class Install {
});
await core.group('Create Docker context', async () => {
await Exec.exec('docker', ['context', 'create', 'setup-docker-action', '--docker', `host=${dockerHost}`]);
await Exec.exec('docker', ['context', 'use', 'setup-docker-action']);
await Exec.exec('docker', ['context', 'create', this.contextName, '--docker', `host=${dockerHost}`]);
await Exec.exec('docker', ['context', 'use', this.contextName]);
});
}
public async tearDown(runDir: string): Promise<void> {
public async tearDown(): Promise<void> {
if (!this.runDir) {
throw new Error('runDir must be set');
}
switch (os.platform()) {
case 'darwin': {
await this.tearDownDarwin(runDir);
await this.tearDownDarwin();
break;
}
case 'linux': {
await this.tearDownLinux(runDir);
await this.tearDownLinux();
break;
}
case 'win32': {
@@ -227,7 +262,7 @@ export class Install {
}
}
private async tearDownDarwin(runDir: string): Promise<void> {
private async tearDownDarwin(): Promise<void> {
await core.group('Docker daemon logs', async () => {
await Exec.exec('colima', ['exec', '--', 'cat', '/var/log/docker.log']);
});
@@ -235,25 +270,25 @@ export class Install {
await Exec.exec('colima', ['stop', '--very-verbose']);
});
await core.group('Removing Docker context', async () => {
await Exec.exec('docker', ['context', 'rm', '-f', 'setup-docker-action']);
await Exec.exec('docker', ['context', 'rm', '-f', this.contextName]);
});
await core.group(`Cleaning up runDir`, async () => {
await Exec.exec('sudo', ['rm', '-rf', runDir]);
await Exec.exec('sudo', ['rm', '-rf', this.runDir]);
});
}
private async tearDownLinux(runDir: string): Promise<void> {
private async tearDownLinux(): Promise<void> {
await core.group('Docker daemon logs', async () => {
core.info(fs.readFileSync(path.join(runDir, 'dockerd.log'), {encoding: 'utf8'}));
core.info(fs.readFileSync(path.join(this.runDir, 'dockerd.log'), {encoding: 'utf8'}));
});
await core.group('Stopping Docker daemon', async () => {
await Exec.exec('sudo', ['kill', fs.readFileSync(path.join(runDir, 'docker.pid')).toString().trim()]);
await Exec.exec('sudo', ['kill', fs.readFileSync(path.join(this.runDir, 'docker.pid')).toString().trim()]);
});
await core.group('Removing Docker context', async () => {
await Exec.exec('docker', ['context', 'rm', '-f', 'setup-docker-action']);
await Exec.exec('docker', ['context', 'rm', '-f', this.contextName]);
});
await core.group(`Cleaning up runDir`, async () => {
await Exec.exec('sudo', ['rm', '-rf', runDir]);
await Exec.exec('sudo', ['rm', '-rf', this.runDir]);
});
}
@@ -263,7 +298,7 @@ export class Install {
await Exec.exec(logCmd.command, logCmd.args);
});
await core.group('Removing Docker context', async () => {
await Exec.exec('docker', ['context', 'rm', '-f', 'setup-docker-action']);
await Exec.exec('docker', ['context', 'rm', '-f', this.contextName]);
});
}
@@ -332,4 +367,20 @@ export class Install {
return false;
});
}
public static async getRelease(version: string): Promise<GitHubRelease> {
const url = `https://raw.githubusercontent.com/docker/actions-toolkit/main/.github/docker-releases.json`;
const http: httpm.HttpClient = new httpm.HttpClient('docker-actions-toolkit');
const resp: httpm.HttpClientResponse = await http.get(url);
const body = await resp.readBody();
const statusCode = resp.message.statusCode || 500;
if (statusCode >= 400) {
throw new Error(`Failed to get Docker release ${version} from ${url} with status code ${statusCode}: ${body}`);
}
const releases = <Record<string, GitHubRelease>>JSON.parse(body);
if (!releases[version]) {
throw new Error(`Cannot find Docker release ${version} in ${url}`);
}
return releases[version];
}
}

45
src/types/bake.ts Normal file
View File

@@ -0,0 +1,45 @@
/**
* 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 interface BakeDefinition {
group: Record<string, Group>;
target: Record<string, Target>;
}
export interface Group {
targets: Array<string>;
}
export interface Target {
args: Record<string, string>;
attest: Array<string>;
'cache-from': Array<string>;
'cache-to': Array<string>;
context: string;
contexts: Record<string, string>;
dockerfile: string;
'dockerfile-inline': string;
labels: Record<string, string>;
'no-cache': boolean;
'no-cache-filter': Array<string>;
output: Array<string>;
platforms: Array<string>;
pull: boolean;
secret: Array<string>;
ssh: Array<string>;
tags: Array<string>;
target: string;
}

View File

@@ -37,11 +37,11 @@ __metadata:
linkType: hard
"@actions/http-client@npm:^2.0.1":
version: 2.0.1
resolution: "@actions/http-client@npm:2.0.1"
version: 2.1.0
resolution: "@actions/http-client@npm:2.1.0"
dependencies:
tunnel: ^0.0.6
checksum: 799ec3df91e28a9da91ce6592e94f8b8923ccf6cc21a2f72c7429be5af5273f1625335411adc2a1bb222d56c852d5767214dfa6fa32a6da7e81dba8290e08f17
checksum: 25a72a952cc95fb4b3ab086da73a5754dd0957c206637cace69be2e16f018cc1b3d3c40d3bcf89ffd8a5929d5e8445594b498b50db306a50ad7536023f8e3800
languageName: node
linkType: hard
@@ -776,7 +776,7 @@ __metadata:
"@typescript-eslint/parser": ^5.49.0
async-retry: ^1.3.3
cpy-cli: ^4.2.0
csv-parse: ^5.3.5
csv-parse: ^5.3.6
dotenv: ^16.0.3
eslint: ^8.33.0
eslint-config-prettier: ^8.6.0
@@ -2573,17 +2573,10 @@ __metadata:
languageName: node
linkType: hard
"csv-parse@npm:*":
version: 5.3.3
resolution: "csv-parse@npm:5.3.3"
checksum: 9f16e2003ef47c901aab31d202e1c9edb70c00faa7777e17a50087314c9da6561233bc60542c15d71f7973c7a0e947c35515ea2689929881c9430a8af374089e
languageName: node
linkType: hard
"csv-parse@npm:^5.3.5":
version: 5.3.5
resolution: "csv-parse@npm:5.3.5"
checksum: 077e010db2ebbc9db708b719f2f650577c5ec8d176cd4363235d6644c36c642811d05ef1b6907390dd7466bde20a8dbb0f34994bc0e101521eb09e6691a02206
"csv-parse@npm:*, csv-parse@npm:^5.3.6":
version: 5.3.6
resolution: "csv-parse@npm:5.3.6"
checksum: a6dcb61a0676121e84a29cdee4978a0516d1412fbe8895057d17e1a95a2013e6283b253135465ad562222d095988a74587d92b2fa04192bef15090acce2a0433
languageName: node
linkType: hard