mirror of
https://github.com/docker/bake-action.git
synced 2026-06-05 17:48:40 +02:00
Compare commits
346 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| a66e1c87e2 | |||
| 316cfbbb0c | |||
| 1e84aebe91 | |||
| 69478a6181 | |||
| 9c521920c0 | |||
| b48ae068f7 | |||
| 07be208056 | |||
| b3f5862c07 | |||
| 561e713afb | |||
| cc339485f5 | |||
| 06f662d146 | |||
| 573e9342f7 | |||
| 0237695a63 | |||
| 0b1d05e37c | |||
| 9ee317add1 | |||
| 66d42d5fe2 | |||
| 5872f2d2b5 | |||
| 01bcd5c5c3 | |||
| 6c79f1f6ec | |||
| 4c1645a81a | |||
| 9e7a27e46b | |||
| 9c8c59b36d | |||
| f055ae898b | |||
| faa3991157 | |||
| 60e55bc65d | |||
| 0cf016cd20 | |||
| 2f8d900d05 | |||
| d24af26b64 | |||
| 50bd4b2564 | |||
| 933f827d94 | |||
| 04486f6562 | |||
| 99343ed6d3 | |||
| 2bdd544224 | |||
| bbc5ee32a4 | |||
| 6f063f5a2c | |||
| 5663537ea2 | |||
| 46894079a4 | |||
| e83250164d | |||
| 40614d05b3 | |||
| 53dc7d5b2e | |||
| 65461e5da4 | |||
| cb7799a153 | |||
| ed9fc89995 | |||
| 4c6643337d | |||
| f0fcce2f20 | |||
| f26ee67c8b | |||
| c1370d6be4 | |||
| 4380696821 | |||
| d5f0a11b02 | |||
| 80718bd717 | |||
| a2c53a0d11 | |||
| cbe08afc1d | |||
| a8f89f27f2 | |||
| 82490499d2 | |||
| 7017b891b1 | |||
| 8e8fbbb910 | |||
| 471133c110 | |||
| f4a2547f80 | |||
| 04d8281a0b | |||
| 8fdd4fbcfa | |||
| 549b4276f9 | |||
| a22e8b4359 | |||
| 325dda5cc1 | |||
| 124afc9b2a | |||
| 9716e42fa0 | |||
| df378f37f1 | |||
| a47bdde0c3 | |||
| f04bdcca6b | |||
| 80669dec4d | |||
| 7363f027e4 | |||
| 4cde8b2bc2 | |||
| f178d1d921 | |||
| d7926aae53 | |||
| 1e43cd9ec1 | |||
| 6495c30be7 | |||
| cc3dc856a7 | |||
| 261e2f7ede | |||
| 49c12c7536 | |||
| add429de5b | |||
| eeb3544b47 | |||
| e0aed8e67c | |||
| 7366777695 | |||
| a2cea6dea6 | |||
| c77b5b2a1b | |||
| bd4dc5e5a8 | |||
| 836d9ebf26 | |||
| 919640e006 | |||
| 14c7b57f99 | |||
| 7c5fb1ba46 | |||
| 8fb85661a4 | |||
| 0108d7fd26 | |||
| 1cf124c0da | |||
| 244d63bb6d | |||
| 6b5467d611 | |||
| 75c00e7961 | |||
| bf4ef44586 | |||
| a35ee0c096 | |||
| c9a0e8e297 | |||
| ed0758f217 | |||
| 7540d5c95e | |||
| 5be5f02ff8 | |||
| 4f25520e7a | |||
| eeacb3deff | |||
| cce027f633 | |||
| 53ce91f18b | |||
| 6b8437d2b5 | |||
| d14785b0cb | |||
| 597dc07998 | |||
| 8ba51ac4ee | |||
| 23c049fba9 | |||
| 41c10f2beb | |||
| 5b9bf92d49 | |||
| 3acf805d94 | |||
| f6376ff6a4 | |||
| 60b3af61bc | |||
| f08ef55f78 | |||
| c22b3482ed | |||
| 40bffc195e | |||
| d7a0b5eb51 | |||
| 3965f4baf4 | |||
| 3d864c34f9 | |||
| 3589b0c183 | |||
| 2215fae6ab | |||
| d0cb9774dc | |||
| a6c0a91e79 | |||
| 74cb41d332 | |||
| 8f035c08cd | |||
| a4c28defc8 | |||
| d260a27f75 | |||
| 5efdf4de8d | |||
| 1a42865db7 | |||
| ba406cd72e | |||
| 1d0c0ffa52 | |||
| 68cf998b48 | |||
| 7a78e75fa4 | |||
| 24d8c3471c | |||
| 6de75d5ad2 | |||
| 72003b9fac | |||
| a1257e6518 | |||
| 846dea0f3a | |||
| 1367d98caa | |||
| 88f3e5553b | |||
| d576212e5b | |||
| d4a3c3cc87 | |||
| 37816e7475 | |||
| f5304128f3 | |||
| 4318518141 | |||
| 0dc934281a | |||
| 64a5bce7a2 | |||
| 212c367396 | |||
| d1ecc3a41e | |||
| ae6e8fe892 | |||
| 57dcb4dec4 | |||
| 76f9fa3a75 | |||
| 1c2b73661c | |||
| c38fbc0209 | |||
| 9d4c4c70ed | |||
| ab9ee171b4 | |||
| f252d74606 | |||
| 656e858067 | |||
| fdcf61eb1a | |||
| a17047c36c | |||
| 1b9d00da59 | |||
| 8f9e95c9aa | |||
| f7a0604619 | |||
| 4ba453fbc2 | |||
| be887ed69b | |||
| c9725ed6bb | |||
| c1f157cf76 | |||
| 28af3ee8ff | |||
| 4f08b22a19 | |||
| 5c5be5f8ee | |||
| c48383c7fd | |||
| 7bff531c65 | |||
| 4eb699fd94 | |||
| 3310620efe | |||
| 60f5d53310 | |||
| cb84b96ea2 | |||
| 63a0b90c7c | |||
| 5dd4f8e2d6 | |||
| 8342e4814b | |||
| 4e1bb14d4e | |||
| 5a1b7c9786 | |||
| a23a0ceb07 | |||
| 932b78563b | |||
| ded8f8f101 | |||
| d0cc8f345a | |||
| 8afe15ffcc | |||
| 77f4fc97b7 | |||
| bf35764d1d | |||
| 309da7d154 | |||
| 23cff4f49a | |||
| 5ca506d06f | |||
| da6b67e5ed | |||
| 23b87ebfd8 | |||
| f26d1f2c48 | |||
| 3ba2682456 | |||
| d2bf1df12d | |||
| 1677316f88 | |||
| 3fc70e1131 | |||
| f4c177e5d8 | |||
| fb23aa081d | |||
| 4434628f52 | |||
| 289179a60f | |||
| 52e5f5611a | |||
| 95dd0c6749 | |||
| ef35aaaf8b | |||
| a6f037366a | |||
| b6652aadd5 | |||
| fa9f3f5ac7 | |||
| 4c0e3cda9d | |||
| 3883a2154a | |||
| b8df42cc60 | |||
| 9bc07af8a8 | |||
| aeaa6df54c | |||
| 63fc7d13b7 | |||
| fd17cd07cd | |||
| d2a866bfbd | |||
| 1417204e8d | |||
| ef43224233 | |||
| d38ec1b2d6 | |||
| 782be980da | |||
| 51e939be13 | |||
| d5f33222b6 | |||
| 2e3d19baed | |||
| 22815eb8f2 | |||
| c24ab5d426 | |||
| 64673bcfac | |||
| f05b0ee234 | |||
| 6161d12436 | |||
| e626c7390c | |||
| 7e8997e58f | |||
| 9a9d8805d1 | |||
| cdf7e1c5cb | |||
| 01036657a2 | |||
| 76cc8060bd | |||
| 4cfe868c6e | |||
| fa256f8a0c | |||
| 8cea75c238 | |||
| a7cc98928a | |||
| 1b8b2f2b02 | |||
| 955c005d87 | |||
| 4c694667c2 | |||
| bc6f04190c | |||
| 5c57af45fc | |||
| 28c6eb5bfc | |||
| d52034e958 | |||
| 108b34f686 | |||
| af918ef258 | |||
| 1fe547e208 | |||
| 3e6a9c6a82 | |||
| a4d7f0b5b9 | |||
| 1877a04777 | |||
| 6ebd058199 | |||
| eac74531aa | |||
| 4eefc485ba | |||
| b7875ab9fc | |||
| f28b24308f | |||
| ad6ed14e0e | |||
| 93ee8f4f3f | |||
| dbdf67d511 | |||
| 16551d969e | |||
| bfc525280a | |||
| 216ea56fab | |||
| eb0e46e01a | |||
| e14760bd9a | |||
| bc6d272b50 | |||
| c0fe07dad6 | |||
| 9a5de0e159 | |||
| b5bad96092 | |||
| 09e9b54ae9 | |||
| 03ad189f86 | |||
| 3934de3594 | |||
| 2b6f83c616 | |||
| 40a4ea9523 | |||
| b976ed0e11 | |||
| 5060c11b60 | |||
| b0a0aeab0e | |||
| 39fbf35758 | |||
| ff7b24e385 | |||
| fd05574f2b | |||
| 7b24a43e4b | |||
| 10abbd2569 | |||
| 332466b809 | |||
| 867da3c872 | |||
| a06e6ea6d8 | |||
| b4514235a2 | |||
| 455cb06a8b | |||
| 95d04aff03 | |||
| ec3e762834 | |||
| f6acc70fe0 | |||
| f38226533a | |||
| 7e3fb815c2 | |||
| 297b5d570e | |||
| 11ce049f92 | |||
| 47185531a6 | |||
| 1c5f18a523 | |||
| 24721f62e7 | |||
| 7e57eefa1c | |||
| f36da5f84f | |||
| f81e4c23c9 | |||
| 6460b33ba7 | |||
| bc3c21b237 | |||
| 93d1f86e62 | |||
| 00f0c171f7 | |||
| a29d7e9cb9 | |||
| f40a782c97 | |||
| bc96707098 | |||
| 84cc400131 | |||
| 0160c64311 | |||
| 25ba9228c1 | |||
| 69497d5717 | |||
| 2def0425f4 | |||
| 1f186e91c9 | |||
| 8473a36b83 | |||
| bd980ca3d9 | |||
| 1a92fbfaa9 | |||
| 670407c68a | |||
| 4f5d587adf | |||
| a99697dcb6 | |||
| 702752d616 | |||
| 79fe072114 | |||
| 1cc392619e | |||
| 334a1f6c42 | |||
| 5017dd3140 | |||
| 0815d964e4 | |||
| 5a89abed82 | |||
| fdc36b0336 | |||
| 2d78083701 | |||
| b38d33d426 | |||
| fc16f00415 | |||
| 1bc598cbb8 | |||
| 66ac74c2bc | |||
| ea5f9ae401 | |||
| 7361386105 | |||
| ae29a82e5c | |||
| 35800c73fa | |||
| bbeabc29a1 | |||
| c564bf0bb0 | |||
| 6281f4a902 | |||
| 7a5dfed355 | |||
| e2b72bb7a3 | |||
| 27749bcdf3 | |||
| 5f156eafc0 | |||
| b116023d12 | |||
| 2fd7073488 |
+11
-1
@@ -1,2 +1,12 @@
|
|||||||
/coverage
|
/coverage
|
||||||
/node_modules
|
|
||||||
|
# Dependency directories
|
||||||
|
node_modules/
|
||||||
|
jspm_packages/
|
||||||
|
|
||||||
|
# yarn v2
|
||||||
|
.yarn/cache
|
||||||
|
.yarn/unplugged
|
||||||
|
.yarn/build-state.yml
|
||||||
|
.yarn/install-state.gz
|
||||||
|
.pnp.*
|
||||||
|
|||||||
@@ -1,3 +0,0 @@
|
|||||||
/dist/**
|
|
||||||
/coverage/**
|
|
||||||
/node_modules/**
|
|
||||||
@@ -1,24 +0,0 @@
|
|||||||
{
|
|
||||||
"env": {
|
|
||||||
"node": true,
|
|
||||||
"es6": true,
|
|
||||||
"jest": true
|
|
||||||
},
|
|
||||||
"extends": [
|
|
||||||
"eslint:recommended",
|
|
||||||
"plugin:@typescript-eslint/eslint-recommended",
|
|
||||||
"plugin:@typescript-eslint/recommended",
|
|
||||||
"plugin:jest/recommended",
|
|
||||||
"plugin:prettier/recommended"
|
|
||||||
],
|
|
||||||
"parser": "@typescript-eslint/parser",
|
|
||||||
"parserOptions": {
|
|
||||||
"ecmaVersion": "latest",
|
|
||||||
"sourceType": "module"
|
|
||||||
},
|
|
||||||
"plugins": [
|
|
||||||
"@typescript-eslint",
|
|
||||||
"jest",
|
|
||||||
"prettier"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
@@ -1,2 +1,4 @@
|
|||||||
|
/.yarn/releases/** binary
|
||||||
|
/.yarn/plugins/** binary
|
||||||
/dist/** linguist-generated=true
|
/dist/** linguist-generated=true
|
||||||
/lib/** linguist-generated=true
|
/lib/** linguist-generated=true
|
||||||
|
|||||||
Binary file not shown.
|
After Width: | Height: | Size: 253 KiB |
@@ -4,6 +4,12 @@ updates:
|
|||||||
directory: "/"
|
directory: "/"
|
||||||
schedule:
|
schedule:
|
||||||
interval: "daily"
|
interval: "daily"
|
||||||
|
cooldown:
|
||||||
|
default-days: 2
|
||||||
|
groups:
|
||||||
|
crazy-max-dot-github:
|
||||||
|
patterns:
|
||||||
|
- "crazy-max/.github/*"
|
||||||
labels:
|
labels:
|
||||||
- "dependencies"
|
- "dependencies"
|
||||||
- "bot"
|
- "bot"
|
||||||
@@ -11,6 +17,8 @@ updates:
|
|||||||
directory: "/"
|
directory: "/"
|
||||||
schedule:
|
schedule:
|
||||||
interval: "daily"
|
interval: "daily"
|
||||||
|
cooldown:
|
||||||
|
default-days: 2
|
||||||
versioning-strategy: "increase"
|
versioning-strategy: "increase"
|
||||||
allow:
|
allow:
|
||||||
- dependency-type: "production"
|
- dependency-type: "production"
|
||||||
|
|||||||
Binary file not shown.
|
After Width: | Height: | Size: 12 KiB |
@@ -1,5 +1,8 @@
|
|||||||
name: ci-subaction
|
name: ci-subaction
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
|
||||||
concurrency:
|
concurrency:
|
||||||
group: ${{ github.workflow }}-${{ github.ref }}
|
group: ${{ github.workflow }}-${{ github.ref }}
|
||||||
cancel-in-progress: true
|
cancel-in-progress: true
|
||||||
@@ -25,37 +28,62 @@ on:
|
|||||||
- 'test/**'
|
- 'test/**'
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
list-targets-group:
|
matrix:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
include:
|
||||||
|
-
|
||||||
|
testdir: group
|
||||||
|
expected: >
|
||||||
|
[{"target":"t1"},{"target":"t2"}]
|
||||||
|
-
|
||||||
|
testdir: group-matrix
|
||||||
|
target: validate
|
||||||
|
expected: >
|
||||||
|
[{"target":"lint-default"},{"target":"lint-labs"},{"target":"lint-nydus"},{"target":"lint-proto"},{"target":"lint-yaml"},{"target":"validate-doctoc"},{"target":"validate-vendor"}]
|
||||||
|
-
|
||||||
|
testdir: group-with-platform
|
||||||
|
target: validate
|
||||||
|
expected: >
|
||||||
|
[{"target":"lint"},{"target":"lint-gopls"},{"target":"validate-docs"},{"target":"validate-vendor"}]
|
||||||
|
-
|
||||||
|
testdir: group-with-platform
|
||||||
|
target: validate
|
||||||
|
fields: platforms
|
||||||
|
expected: >
|
||||||
|
[{"target":"lint","platforms":"darwin/amd64"},{"target":"lint","platforms":"darwin/arm64"},{"target":"lint","platforms":"linux/amd64"},{"target":"lint","platforms":"linux/arm64"},{"target":"lint","platforms":"linux/s390x"},{"target":"lint","platforms":"linux/ppc64le"},{"target":"lint","platforms":"linux/riscv64"},{"target":"lint","platforms":"windows/amd64"},{"target":"lint","platforms":"windows/arm64"},{"target":"lint-gopls","platforms":"darwin/amd64"},{"target":"lint-gopls","platforms":"darwin/arm64"},{"target":"lint-gopls","platforms":"linux/amd64"},{"target":"lint-gopls","platforms":"linux/arm64"},{"target":"lint-gopls","platforms":"linux/s390x"},{"target":"lint-gopls","platforms":"linux/ppc64le"},{"target":"lint-gopls","platforms":"linux/riscv64"},{"target":"lint-gopls","platforms":"windows/amd64"},{"target":"lint-gopls","platforms":"windows/arm64"},{"target":"validate-docs"},{"target":"validate-vendor"}]
|
||||||
|
-
|
||||||
|
testdir: group-with-platform
|
||||||
|
target: validate
|
||||||
|
fields: platforms,dockerfile
|
||||||
|
expected: >
|
||||||
|
[{"target":"lint","dockerfile":"./hack/dockerfiles/lint.Dockerfile"},{"target":"lint","dockerfile":"./hack/dockerfiles/lint.Dockerfile","platforms":"darwin/amd64"},{"target":"lint","dockerfile":"./hack/dockerfiles/lint.Dockerfile","platforms":"darwin/arm64"},{"target":"lint","dockerfile":"./hack/dockerfiles/lint.Dockerfile","platforms":"linux/amd64"},{"target":"lint","dockerfile":"./hack/dockerfiles/lint.Dockerfile","platforms":"linux/arm64"},{"target":"lint","dockerfile":"./hack/dockerfiles/lint.Dockerfile","platforms":"linux/s390x"},{"target":"lint","dockerfile":"./hack/dockerfiles/lint.Dockerfile","platforms":"linux/ppc64le"},{"target":"lint","dockerfile":"./hack/dockerfiles/lint.Dockerfile","platforms":"linux/riscv64"},{"target":"lint","dockerfile":"./hack/dockerfiles/lint.Dockerfile","platforms":"windows/amd64"},{"target":"lint","dockerfile":"./hack/dockerfiles/lint.Dockerfile","platforms":"windows/arm64"},{"target":"lint-gopls","dockerfile":"./hack/dockerfiles/lint.Dockerfile"},{"target":"lint-gopls","dockerfile":"./hack/dockerfiles/lint.Dockerfile","platforms":"darwin/amd64"},{"target":"lint-gopls","dockerfile":"./hack/dockerfiles/lint.Dockerfile","platforms":"darwin/arm64"},{"target":"lint-gopls","dockerfile":"./hack/dockerfiles/lint.Dockerfile","platforms":"linux/amd64"},{"target":"lint-gopls","dockerfile":"./hack/dockerfiles/lint.Dockerfile","platforms":"linux/arm64"},{"target":"lint-gopls","dockerfile":"./hack/dockerfiles/lint.Dockerfile","platforms":"linux/s390x"},{"target":"lint-gopls","dockerfile":"./hack/dockerfiles/lint.Dockerfile","platforms":"linux/ppc64le"},{"target":"lint-gopls","dockerfile":"./hack/dockerfiles/lint.Dockerfile","platforms":"linux/riscv64"},{"target":"lint-gopls","dockerfile":"./hack/dockerfiles/lint.Dockerfile","platforms":"windows/amd64"},{"target":"lint-gopls","dockerfile":"./hack/dockerfiles/lint.Dockerfile","platforms":"windows/arm64"},{"target":"validate-docs","dockerfile":"./hack/dockerfiles/docs.Dockerfile"},{"target":"validate-vendor","dockerfile":"./hack/dockerfiles/vendor.Dockerfile"}]
|
||||||
steps:
|
steps:
|
||||||
-
|
-
|
||||||
name: Checkout
|
name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||||
-
|
-
|
||||||
name: Matrix gen
|
name: Matrix gen
|
||||||
id: gen
|
id: gen
|
||||||
uses: ./subaction/list-targets
|
uses: ./subaction/matrix
|
||||||
with:
|
with:
|
||||||
workdir: ./test/group
|
workdir: ./test/${{ matrix.testdir }}
|
||||||
|
target: ${{ matrix.target }}
|
||||||
|
fields: ${{ matrix.fields }}
|
||||||
-
|
-
|
||||||
name: Show matrix
|
name: Check output
|
||||||
run: |
|
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0
|
||||||
echo matrix=${{ steps.gen.outputs.matrix }}
|
env:
|
||||||
|
INPUT_MATRIX: ${{ steps.gen.outputs.matrix }}
|
||||||
list-targets-group-matrix:
|
INPUT_EXPECTED: ${{ matrix.expected }}
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
-
|
|
||||||
name: Checkout
|
|
||||||
uses: actions/checkout@v4
|
|
||||||
-
|
|
||||||
name: Matrix gen
|
|
||||||
id: gen
|
|
||||||
uses: ./subaction/list-targets
|
|
||||||
with:
|
with:
|
||||||
workdir: ./test/group-matrix
|
script: |
|
||||||
target: validate
|
const matrix = JSON.stringify(JSON.parse(core.getInput('matrix')));
|
||||||
-
|
const expected = JSON.stringify(JSON.parse(core.getInput('expected')));
|
||||||
name: Show matrix
|
if (matrix !== expected) {
|
||||||
run: |
|
throw new Error(`Matrix do not match expected values: ${matrix} != ${expected}`);
|
||||||
echo matrix=${{ steps.gen.outputs.matrix }}
|
} else {
|
||||||
|
core.info(`✅`);
|
||||||
|
}
|
||||||
|
|||||||
+400
-49
@@ -1,5 +1,8 @@
|
|||||||
name: ci
|
name: ci
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
|
||||||
concurrency:
|
concurrency:
|
||||||
group: ${{ github.workflow }}-${{ github.ref }}
|
group: ${{ github.workflow }}-${{ github.ref }}
|
||||||
cancel-in-progress: true
|
cancel-in-progress: true
|
||||||
@@ -32,8 +35,8 @@ on:
|
|||||||
- 'subaction/**'
|
- 'subaction/**'
|
||||||
|
|
||||||
env:
|
env:
|
||||||
BUILDX_VERSION: latest
|
BUILDX_VERSION: edge
|
||||||
BUILDKIT_IMAGE: moby/buildkit:buildx-stable-1
|
BUILDKIT_IMAGE: moby/buildkit:latest
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
bake:
|
bake:
|
||||||
@@ -46,20 +49,20 @@ jobs:
|
|||||||
- release
|
- release
|
||||||
services:
|
services:
|
||||||
registry:
|
registry:
|
||||||
image: registry:2
|
image: registry:2.8.3@sha256:a3d8aaa63ed8681a604f1dea0aa03f100d5895b6a58ace528858a7b332415373
|
||||||
ports:
|
ports:
|
||||||
- 5000:5000
|
- 5000:5000
|
||||||
steps:
|
steps:
|
||||||
-
|
-
|
||||||
name: Checkout
|
name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||||
-
|
-
|
||||||
name: Set up QEMU
|
name: Set up QEMU
|
||||||
uses: docker/setup-qemu-action@v3
|
uses: docker/setup-qemu-action@ce360397dd3f832beb865e1373c09c0e9f86d70a # v4.0.0
|
||||||
-
|
-
|
||||||
name: Set up Docker Buildx
|
name: Set up Docker Buildx
|
||||||
id: buildx
|
id: buildx
|
||||||
uses: docker/setup-buildx-action@v3
|
uses: docker/setup-buildx-action@4d04d5d9486b7bd6fa91e7baf45bbb4f8b9deedd # v4.0.0
|
||||||
with:
|
with:
|
||||||
version: ${{ inputs.buildx-version || env.BUILDX_VERSION }}
|
version: ${{ inputs.buildx-version || env.BUILDX_VERSION }}
|
||||||
driver-opts: |
|
driver-opts: |
|
||||||
@@ -69,6 +72,7 @@ jobs:
|
|||||||
name: Build and push
|
name: Build and push
|
||||||
uses: ./
|
uses: ./
|
||||||
with:
|
with:
|
||||||
|
source: .
|
||||||
builder: ${{ steps.buildx.outputs.name }}
|
builder: ${{ steps.buildx.outputs.name }}
|
||||||
files: |
|
files: |
|
||||||
./test/config.hcl
|
./test/config.hcl
|
||||||
@@ -81,12 +85,13 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
-
|
-
|
||||||
name: Checkout
|
name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||||
-
|
-
|
||||||
name: Build
|
name: Build
|
||||||
continue-on-error: true
|
continue-on-error: true
|
||||||
uses: ./
|
uses: ./
|
||||||
with:
|
with:
|
||||||
|
source: .
|
||||||
files: |
|
files: |
|
||||||
./test/config.hcl
|
./test/config.hcl
|
||||||
set: |
|
set: |
|
||||||
@@ -97,7 +102,7 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
-
|
-
|
||||||
name: Checkout
|
name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||||
-
|
-
|
||||||
name: Stop docker
|
name: Stop docker
|
||||||
run: |
|
run: |
|
||||||
@@ -108,12 +113,33 @@ jobs:
|
|||||||
continue-on-error: true
|
continue-on-error: true
|
||||||
uses: ./
|
uses: ./
|
||||||
with:
|
with:
|
||||||
|
source: .
|
||||||
files: |
|
files: |
|
||||||
./test/config.hcl
|
./test/config.hcl
|
||||||
-
|
-
|
||||||
name: Check
|
name: Check
|
||||||
run: |
|
run: |
|
||||||
echo "${{ toJson(steps.bake) }}"
|
if [ "${{ steps.bake.outcome }}" != "failure" ] || [ "${{ steps.bake.conclusion }}" != "success" ]; then
|
||||||
|
echo "::error::Should have failed"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
error-source:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
-
|
||||||
|
name: Checkout
|
||||||
|
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||||
|
-
|
||||||
|
name: Build
|
||||||
|
id: bake
|
||||||
|
continue-on-error: true
|
||||||
|
uses: ./
|
||||||
|
with:
|
||||||
|
source: ./does-not-exist
|
||||||
|
-
|
||||||
|
name: Check
|
||||||
|
run: |
|
||||||
if [ "${{ steps.bake.outcome }}" != "failure" ] || [ "${{ steps.bake.conclusion }}" != "success" ]; then
|
if [ "${{ steps.bake.outcome }}" != "failure" ] || [ "${{ steps.bake.conclusion }}" != "success" ]; then
|
||||||
echo "::error::Should have failed"
|
echo "::error::Should have failed"
|
||||||
exit 1
|
exit 1
|
||||||
@@ -124,7 +150,7 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
-
|
-
|
||||||
name: Checkout
|
name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||||
-
|
-
|
||||||
name: Uninstall docker cli
|
name: Uninstall docker cli
|
||||||
run: |
|
run: |
|
||||||
@@ -135,7 +161,7 @@ jobs:
|
|||||||
fi
|
fi
|
||||||
-
|
-
|
||||||
name: Set up Docker Buildx
|
name: Set up Docker Buildx
|
||||||
uses: docker/setup-buildx-action@v3
|
uses: docker/setup-buildx-action@4d04d5d9486b7bd6fa91e7baf45bbb4f8b9deedd # v4.0.0
|
||||||
with:
|
with:
|
||||||
version: ${{ inputs.buildx-version || env.BUILDX_VERSION }}
|
version: ${{ inputs.buildx-version || env.BUILDX_VERSION }}
|
||||||
driver-opts: |
|
driver-opts: |
|
||||||
@@ -144,15 +170,16 @@ jobs:
|
|||||||
name: Build
|
name: Build
|
||||||
uses: ./
|
uses: ./
|
||||||
with:
|
with:
|
||||||
|
source: .
|
||||||
files: |
|
files: |
|
||||||
./test/config.hcl
|
./test/config.hcl
|
||||||
|
|
||||||
source:
|
remote:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
-
|
-
|
||||||
name: Checkout
|
name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||||
-
|
-
|
||||||
name: Build
|
name: Build
|
||||||
uses: ./
|
uses: ./
|
||||||
@@ -174,10 +201,10 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
-
|
-
|
||||||
name: Checkout
|
name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||||
-
|
-
|
||||||
name: Set up Docker Buildx
|
name: Set up Docker Buildx
|
||||||
uses: docker/setup-buildx-action@v3
|
uses: docker/setup-buildx-action@4d04d5d9486b7bd6fa91e7baf45bbb4f8b9deedd # v4.0.0
|
||||||
with:
|
with:
|
||||||
version: ${{ inputs.buildx-version || env.BUILDX_VERSION }}
|
version: ${{ inputs.buildx-version || env.BUILDX_VERSION }}
|
||||||
driver-opts: |
|
driver-opts: |
|
||||||
@@ -187,7 +214,7 @@ jobs:
|
|||||||
name: Build
|
name: Build
|
||||||
uses: ./
|
uses: ./
|
||||||
with:
|
with:
|
||||||
workdir: ./test/go
|
source: ./test/go
|
||||||
targets: binary
|
targets: binary
|
||||||
provenance: ${{ matrix.attrs }}
|
provenance: ${{ matrix.attrs }}
|
||||||
set: |
|
set: |
|
||||||
@@ -209,16 +236,16 @@ jobs:
|
|||||||
output: /tmp/bake-build
|
output: /tmp/bake-build
|
||||||
services:
|
services:
|
||||||
registry:
|
registry:
|
||||||
image: registry:2
|
image: registry:2.8.3@sha256:a3d8aaa63ed8681a604f1dea0aa03f100d5895b6a58ace528858a7b332415373
|
||||||
ports:
|
ports:
|
||||||
- 5000:5000
|
- 5000:5000
|
||||||
steps:
|
steps:
|
||||||
-
|
-
|
||||||
name: Checkout
|
name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||||
-
|
-
|
||||||
name: Set up Docker Buildx
|
name: Set up Docker Buildx
|
||||||
uses: docker/setup-buildx-action@v3
|
uses: docker/setup-buildx-action@4d04d5d9486b7bd6fa91e7baf45bbb4f8b9deedd # v4.0.0
|
||||||
with:
|
with:
|
||||||
version: ${{ inputs.buildx-version || env.BUILDX_VERSION }}
|
version: ${{ inputs.buildx-version || env.BUILDX_VERSION }}
|
||||||
driver-opts: |
|
driver-opts: |
|
||||||
@@ -228,7 +255,7 @@ jobs:
|
|||||||
name: Build
|
name: Build
|
||||||
uses: ./
|
uses: ./
|
||||||
with:
|
with:
|
||||||
workdir: ./test/go
|
source: ./test/go
|
||||||
targets: ${{ matrix.target }}
|
targets: ${{ matrix.target }}
|
||||||
sbom: true
|
sbom: true
|
||||||
set: |
|
set: |
|
||||||
@@ -263,18 +290,18 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
services:
|
services:
|
||||||
registry:
|
registry:
|
||||||
image: registry:2
|
image: registry:2.8.3@sha256:a3d8aaa63ed8681a604f1dea0aa03f100d5895b6a58ace528858a7b332415373
|
||||||
ports:
|
ports:
|
||||||
- 5000:5000
|
- 5000:5000
|
||||||
steps:
|
steps:
|
||||||
-
|
-
|
||||||
name: Checkout
|
name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||||
-
|
-
|
||||||
name: Build
|
name: Build
|
||||||
uses: ./
|
uses: ./
|
||||||
with:
|
with:
|
||||||
workdir: ./test/go
|
source: ./test/go
|
||||||
set: |
|
set: |
|
||||||
*.platform=linux/amd64
|
*.platform=linux/amd64
|
||||||
*.output=type=image,"name=localhost:5000/name/app:v1.0.0,localhost:5000/name/app:latest",push=true
|
*.output=type=image,"name=localhost:5000/name/app:v1.0.0,localhost:5000/name/app:latest",push=true
|
||||||
@@ -284,16 +311,16 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
services:
|
services:
|
||||||
registry:
|
registry:
|
||||||
image: registry:2
|
image: registry:2.8.3@sha256:a3d8aaa63ed8681a604f1dea0aa03f100d5895b6a58ace528858a7b332415373
|
||||||
ports:
|
ports:
|
||||||
- 5000:5000
|
- 5000:5000
|
||||||
steps:
|
steps:
|
||||||
-
|
-
|
||||||
name: Checkout
|
name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||||
-
|
-
|
||||||
name: Set up Docker Buildx
|
name: Set up Docker Buildx
|
||||||
uses: docker/setup-buildx-action@v3
|
uses: docker/setup-buildx-action@4d04d5d9486b7bd6fa91e7baf45bbb4f8b9deedd # v4.0.0
|
||||||
with:
|
with:
|
||||||
version: ${{ inputs.buildx-version || env.BUILDX_VERSION }}
|
version: ${{ inputs.buildx-version || env.BUILDX_VERSION }}
|
||||||
driver-opts: |
|
driver-opts: |
|
||||||
@@ -303,7 +330,7 @@ jobs:
|
|||||||
name: Build and push
|
name: Build and push
|
||||||
uses: ./
|
uses: ./
|
||||||
with:
|
with:
|
||||||
workdir: ./test/group
|
source: ./test/group
|
||||||
push: true
|
push: true
|
||||||
set: |
|
set: |
|
||||||
t1.tags=localhost:5000/name/app:t1
|
t1.tags=localhost:5000/name/app:t1
|
||||||
@@ -314,7 +341,7 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
-
|
-
|
||||||
name: Checkout
|
name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||||
-
|
-
|
||||||
name: Set malformed docker config
|
name: Set malformed docker config
|
||||||
run: |
|
run: |
|
||||||
@@ -324,6 +351,7 @@ jobs:
|
|||||||
name: Build
|
name: Build
|
||||||
uses: ./
|
uses: ./
|
||||||
with:
|
with:
|
||||||
|
source: .
|
||||||
files: |
|
files: |
|
||||||
./test/config.hcl
|
./test/config.hcl
|
||||||
|
|
||||||
@@ -331,7 +359,7 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
services:
|
services:
|
||||||
squid-proxy:
|
squid-proxy:
|
||||||
image: ubuntu/squid:latest
|
image: ubuntu/squid:latest@sha256:6a097f68bae708cedbabd6188d68c7e2e7a38cedd05a176e1cc0ba29e3bbe029
|
||||||
ports:
|
ports:
|
||||||
- 3128:3128
|
- 3128:3128
|
||||||
steps:
|
steps:
|
||||||
@@ -342,7 +370,7 @@ jobs:
|
|||||||
curl --retry 5 --retry-all-errors --retry-delay 0 --connect-timeout 5 --proxy http://127.0.0.1:3128 -v --insecure --head https://www.google.com
|
curl --retry 5 --retry-all-errors --retry-delay 0 --connect-timeout 5 --proxy http://127.0.0.1:3128 -v --insecure --head https://www.google.com
|
||||||
-
|
-
|
||||||
name: Checkout
|
name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||||
-
|
-
|
||||||
name: Set proxy config
|
name: Set proxy config
|
||||||
run: |
|
run: |
|
||||||
@@ -350,7 +378,7 @@ jobs:
|
|||||||
echo '{"proxies":{"default":{"httpProxy":"http://127.0.0.1:3128","httpsProxy":"http://127.0.0.1:3128"}}}' > ~/.docker/config.json
|
echo '{"proxies":{"default":{"httpProxy":"http://127.0.0.1:3128","httpsProxy":"http://127.0.0.1:3128"}}}' > ~/.docker/config.json
|
||||||
-
|
-
|
||||||
name: Set up Docker Buildx
|
name: Set up Docker Buildx
|
||||||
uses: docker/setup-buildx-action@v3
|
uses: docker/setup-buildx-action@4d04d5d9486b7bd6fa91e7baf45bbb4f8b9deedd # v4.0.0
|
||||||
with:
|
with:
|
||||||
version: ${{ inputs.buildx-version || env.BUILDX_VERSION }}
|
version: ${{ inputs.buildx-version || env.BUILDX_VERSION }}
|
||||||
driver-opts: |
|
driver-opts: |
|
||||||
@@ -361,6 +389,7 @@ jobs:
|
|||||||
name: Build
|
name: Build
|
||||||
uses: ./
|
uses: ./
|
||||||
with:
|
with:
|
||||||
|
source: .
|
||||||
files: |
|
files: |
|
||||||
./test/config.hcl
|
./test/config.hcl
|
||||||
targets: app-proxy
|
targets: app-proxy
|
||||||
@@ -369,7 +398,7 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
services:
|
services:
|
||||||
squid-proxy:
|
squid-proxy:
|
||||||
image: ubuntu/squid:latest
|
image: ubuntu/squid:latest@sha256:6a097f68bae708cedbabd6188d68c7e2e7a38cedd05a176e1cc0ba29e3bbe029
|
||||||
ports:
|
ports:
|
||||||
- 3128:3128
|
- 3128:3128
|
||||||
steps:
|
steps:
|
||||||
@@ -380,10 +409,10 @@ jobs:
|
|||||||
curl --retry 5 --retry-all-errors --retry-delay 0 --connect-timeout 5 --proxy http://127.0.0.1:3128 -v --insecure --head https://www.google.com
|
curl --retry 5 --retry-all-errors --retry-delay 0 --connect-timeout 5 --proxy http://127.0.0.1:3128 -v --insecure --head https://www.google.com
|
||||||
-
|
-
|
||||||
name: Checkout
|
name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||||
-
|
-
|
||||||
name: Set up Docker Buildx
|
name: Set up Docker Buildx
|
||||||
uses: docker/setup-buildx-action@v3
|
uses: docker/setup-buildx-action@4d04d5d9486b7bd6fa91e7baf45bbb4f8b9deedd # v4.0.0
|
||||||
with:
|
with:
|
||||||
version: ${{ inputs.buildx-version || env.BUILDX_VERSION }}
|
version: ${{ inputs.buildx-version || env.BUILDX_VERSION }}
|
||||||
driver-opts: |
|
driver-opts: |
|
||||||
@@ -396,6 +425,7 @@ jobs:
|
|||||||
name: Build
|
name: Build
|
||||||
uses: ./
|
uses: ./
|
||||||
with:
|
with:
|
||||||
|
source: .
|
||||||
files: |
|
files: |
|
||||||
./test/config.hcl
|
./test/config.hcl
|
||||||
|
|
||||||
@@ -404,10 +434,10 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
-
|
-
|
||||||
name: Checkout
|
name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||||
-
|
-
|
||||||
name: Set up Docker Buildx
|
name: Set up Docker Buildx
|
||||||
uses: docker/setup-buildx-action@v3
|
uses: docker/setup-buildx-action@4d04d5d9486b7bd6fa91e7baf45bbb4f8b9deedd # v4.0.0
|
||||||
with:
|
with:
|
||||||
version: ${{ inputs.buildx-version || env.BUILDX_VERSION }}
|
version: ${{ inputs.buildx-version || env.BUILDX_VERSION }}
|
||||||
driver-opts: |
|
driver-opts: |
|
||||||
@@ -416,17 +446,40 @@ jobs:
|
|||||||
name: Build
|
name: Build
|
||||||
uses: ./
|
uses: ./
|
||||||
with:
|
with:
|
||||||
source: "{{defaultContext}}"
|
files: |
|
||||||
|
./test/config.hcl
|
||||||
|
|
||||||
|
git-context-query:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
-
|
||||||
|
name: Checkout
|
||||||
|
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||||
|
-
|
||||||
|
name: Set up Docker Buildx
|
||||||
|
uses: docker/setup-buildx-action@4d04d5d9486b7bd6fa91e7baf45bbb4f8b9deedd # v4.0.0
|
||||||
|
with:
|
||||||
|
version: v0.33.0
|
||||||
|
driver-opts: |
|
||||||
|
image=${{ inputs.buildkit-image || env.BUILDKIT_IMAGE }}
|
||||||
|
-
|
||||||
|
name: Build
|
||||||
|
uses: ./
|
||||||
|
with:
|
||||||
|
files: |
|
||||||
|
./test/config.hcl
|
||||||
|
env:
|
||||||
|
BUILDX_SEND_GIT_QUERY_AS_INPUT: true
|
||||||
|
|
||||||
git-context-and-local:
|
git-context-and-local:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
-
|
-
|
||||||
name: Checkout
|
name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||||
-
|
-
|
||||||
name: Set up Docker Buildx
|
name: Set up Docker Buildx
|
||||||
uses: docker/setup-buildx-action@v3
|
uses: docker/setup-buildx-action@4d04d5d9486b7bd6fa91e7baf45bbb4f8b9deedd # v4.0.0
|
||||||
with:
|
with:
|
||||||
version: ${{ inputs.buildx-version || env.BUILDX_VERSION }}
|
version: ${{ inputs.buildx-version || env.BUILDX_VERSION }}
|
||||||
driver-opts: |
|
driver-opts: |
|
||||||
@@ -434,29 +487,29 @@ jobs:
|
|||||||
-
|
-
|
||||||
name: Docker meta
|
name: Docker meta
|
||||||
id: meta
|
id: meta
|
||||||
uses: docker/metadata-action@v5
|
uses: docker/metadata-action@030e881283bb7a6894de51c315a6bfe6a94e05cf # v6.0.0
|
||||||
-
|
-
|
||||||
name: Build
|
name: Build
|
||||||
uses: ./
|
uses: ./
|
||||||
with:
|
with:
|
||||||
source: "{{defaultContext}}"
|
|
||||||
files: |
|
files: |
|
||||||
|
./test/config.hcl
|
||||||
cwd://${{ steps.meta.outputs.bake-file }}
|
cwd://${{ steps.meta.outputs.bake-file }}
|
||||||
|
|
||||||
multi-output:
|
multi-output:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
services:
|
services:
|
||||||
registry:
|
registry:
|
||||||
image: registry:2
|
image: registry:2.8.3@sha256:a3d8aaa63ed8681a604f1dea0aa03f100d5895b6a58ace528858a7b332415373
|
||||||
ports:
|
ports:
|
||||||
- 5000:5000
|
- 5000:5000
|
||||||
steps:
|
steps:
|
||||||
-
|
-
|
||||||
name: Checkout
|
name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||||
-
|
-
|
||||||
name: Set up Docker Buildx
|
name: Set up Docker Buildx
|
||||||
uses: docker/setup-buildx-action@v3
|
uses: docker/setup-buildx-action@4d04d5d9486b7bd6fa91e7baf45bbb4f8b9deedd # v4.0.0
|
||||||
with:
|
with:
|
||||||
version: ${{ inputs.buildx-version || env.BUILDX_VERSION }}
|
version: ${{ inputs.buildx-version || env.BUILDX_VERSION }}
|
||||||
driver-opts: |
|
driver-opts: |
|
||||||
@@ -465,7 +518,7 @@ jobs:
|
|||||||
name: Build and push
|
name: Build and push
|
||||||
uses: ./
|
uses: ./
|
||||||
with:
|
with:
|
||||||
workdir: ./test/go
|
source: ./test/go
|
||||||
set: |
|
set: |
|
||||||
*.output=type=image,name=localhost:5000/name/app:latest,push=true
|
*.output=type=image,name=localhost:5000/name/app:latest,push=true
|
||||||
*.output=type=docker,name=app:local
|
*.output=type=docker,name=app:local
|
||||||
@@ -490,16 +543,16 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
services:
|
services:
|
||||||
registry:
|
registry:
|
||||||
image: registry:2
|
image: registry:2.8.3@sha256:a3d8aaa63ed8681a604f1dea0aa03f100d5895b6a58ace528858a7b332415373
|
||||||
ports:
|
ports:
|
||||||
- 5000:5000
|
- 5000:5000
|
||||||
steps:
|
steps:
|
||||||
-
|
-
|
||||||
name: Checkout
|
name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||||
-
|
-
|
||||||
name: Set up Docker Buildx
|
name: Set up Docker Buildx
|
||||||
uses: docker/setup-buildx-action@v3
|
uses: docker/setup-buildx-action@4d04d5d9486b7bd6fa91e7baf45bbb4f8b9deedd # v4.0.0
|
||||||
with:
|
with:
|
||||||
version: ${{ inputs.buildx-version || env.BUILDX_VERSION }}
|
version: ${{ inputs.buildx-version || env.BUILDX_VERSION }}
|
||||||
driver-opts: |
|
driver-opts: |
|
||||||
@@ -508,7 +561,7 @@ jobs:
|
|||||||
name: Build and push
|
name: Build and push
|
||||||
uses: ./
|
uses: ./
|
||||||
with:
|
with:
|
||||||
workdir: ./test/go
|
source: ./test/go
|
||||||
targets: image
|
targets: image
|
||||||
load: true
|
load: true
|
||||||
push: true
|
push: true
|
||||||
@@ -522,3 +575,301 @@ jobs:
|
|||||||
name: Check docker
|
name: Check docker
|
||||||
run: |
|
run: |
|
||||||
docker image inspect localhost:5000/name/app:latest
|
docker image inspect localhost:5000/name/app:latest
|
||||||
|
|
||||||
|
summary-disable:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
-
|
||||||
|
name: Checkout
|
||||||
|
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||||
|
-
|
||||||
|
name: Set up Docker Buildx
|
||||||
|
uses: docker/setup-buildx-action@4d04d5d9486b7bd6fa91e7baf45bbb4f8b9deedd # v4.0.0
|
||||||
|
with:
|
||||||
|
version: ${{ inputs.buildx-version || env.BUILDX_VERSION }}
|
||||||
|
driver-opts: |
|
||||||
|
image=${{ inputs.buildkit-image || env.BUILDKIT_IMAGE }}
|
||||||
|
-
|
||||||
|
name: Build
|
||||||
|
uses: ./
|
||||||
|
with:
|
||||||
|
files: |
|
||||||
|
./test/config.hcl
|
||||||
|
targets: app
|
||||||
|
env:
|
||||||
|
DOCKER_BUILD_SUMMARY: false
|
||||||
|
|
||||||
|
summary-not-supported:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
-
|
||||||
|
name: Checkout
|
||||||
|
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||||
|
-
|
||||||
|
name: Set up Docker Buildx
|
||||||
|
uses: docker/setup-buildx-action@4d04d5d9486b7bd6fa91e7baf45bbb4f8b9deedd # v4.0.0
|
||||||
|
with:
|
||||||
|
version: v0.12.1
|
||||||
|
driver-opts: |
|
||||||
|
image=${{ inputs.buildkit-image || env.BUILDKIT_IMAGE }}
|
||||||
|
-
|
||||||
|
name: Build
|
||||||
|
uses: ./
|
||||||
|
with:
|
||||||
|
files: |
|
||||||
|
./test/config.hcl
|
||||||
|
targets: app
|
||||||
|
|
||||||
|
record-upload-disable:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
-
|
||||||
|
name: Checkout
|
||||||
|
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||||
|
-
|
||||||
|
name: Set up Docker Buildx
|
||||||
|
uses: docker/setup-buildx-action@4d04d5d9486b7bd6fa91e7baf45bbb4f8b9deedd # v4.0.0
|
||||||
|
with:
|
||||||
|
version: ${{ inputs.buildx-version || env.BUILDX_VERSION }}
|
||||||
|
driver-opts: |
|
||||||
|
image=${{ inputs.buildkit-image || env.BUILDKIT_IMAGE }}
|
||||||
|
-
|
||||||
|
name: Build
|
||||||
|
uses: ./
|
||||||
|
with:
|
||||||
|
files: |
|
||||||
|
./test/config.hcl
|
||||||
|
targets: app
|
||||||
|
env:
|
||||||
|
DOCKER_BUILD_RECORD_UPLOAD: false
|
||||||
|
|
||||||
|
record-retention-days:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
days:
|
||||||
|
- 2
|
||||||
|
- 0
|
||||||
|
steps:
|
||||||
|
-
|
||||||
|
name: Checkout
|
||||||
|
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||||
|
-
|
||||||
|
name: Set up Docker Buildx
|
||||||
|
uses: docker/setup-buildx-action@4d04d5d9486b7bd6fa91e7baf45bbb4f8b9deedd # v4.0.0
|
||||||
|
with:
|
||||||
|
version: ${{ inputs.buildx-version || env.BUILDX_VERSION }}
|
||||||
|
driver-opts: |
|
||||||
|
image=${{ inputs.buildkit-image || env.BUILDKIT_IMAGE }}
|
||||||
|
-
|
||||||
|
name: Build
|
||||||
|
uses: ./
|
||||||
|
with:
|
||||||
|
files: |
|
||||||
|
./test/config.hcl
|
||||||
|
targets: app
|
||||||
|
env:
|
||||||
|
DOCKER_BUILD_RECORD_RETENTION_DAYS: ${{ matrix.days }}
|
||||||
|
|
||||||
|
checks:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
buildx-version:
|
||||||
|
- edge
|
||||||
|
- v0.14.1
|
||||||
|
steps:
|
||||||
|
-
|
||||||
|
name: Checkout
|
||||||
|
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||||
|
-
|
||||||
|
name: Set up Docker Buildx
|
||||||
|
uses: docker/setup-buildx-action@4d04d5d9486b7bd6fa91e7baf45bbb4f8b9deedd # v4.0.0
|
||||||
|
with:
|
||||||
|
version: ${{ matrix.buildx-version }}
|
||||||
|
driver-opts: |
|
||||||
|
image=${{ inputs.buildkit-image || env.BUILDKIT_IMAGE }}
|
||||||
|
-
|
||||||
|
name: Build
|
||||||
|
uses: ./
|
||||||
|
with:
|
||||||
|
source: ./test
|
||||||
|
files: |
|
||||||
|
./lint.hcl
|
||||||
|
|
||||||
|
annotations-disabled:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
-
|
||||||
|
name: Checkout
|
||||||
|
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||||
|
-
|
||||||
|
name: Set up Docker Buildx
|
||||||
|
uses: docker/setup-buildx-action@4d04d5d9486b7bd6fa91e7baf45bbb4f8b9deedd # v4.0.0
|
||||||
|
with:
|
||||||
|
version: ${{ inputs.buildx-version || env.BUILDX_VERSION }}
|
||||||
|
driver-opts: |
|
||||||
|
image=${{ inputs.buildkit-image || env.BUILDKIT_IMAGE }}
|
||||||
|
-
|
||||||
|
name: Build
|
||||||
|
uses: ./
|
||||||
|
with:
|
||||||
|
source: ./test
|
||||||
|
files: |
|
||||||
|
./lint.hcl
|
||||||
|
env:
|
||||||
|
DOCKER_BUILD_CHECKS_ANNOTATIONS: false
|
||||||
|
|
||||||
|
allow:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
buildx-version:
|
||||||
|
- edge
|
||||||
|
- v0.19.0
|
||||||
|
- v0.18.0
|
||||||
|
- v0.17.1
|
||||||
|
steps:
|
||||||
|
-
|
||||||
|
name: Checkout
|
||||||
|
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||||
|
-
|
||||||
|
name: Set up Docker Buildx
|
||||||
|
uses: docker/setup-buildx-action@4d04d5d9486b7bd6fa91e7baf45bbb4f8b9deedd # v4.0.0
|
||||||
|
with:
|
||||||
|
version: ${{ matrix.buildx-version }}
|
||||||
|
driver-opts: |
|
||||||
|
image=${{ inputs.buildkit-image || env.BUILDKIT_IMAGE }}
|
||||||
|
-
|
||||||
|
name: Build
|
||||||
|
uses: ./
|
||||||
|
with:
|
||||||
|
files: |
|
||||||
|
./test/config.hcl
|
||||||
|
allow: network.host
|
||||||
|
targets: app-entitlements
|
||||||
|
|
||||||
|
no-default-attestations:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
-
|
||||||
|
name: Checkout
|
||||||
|
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||||
|
-
|
||||||
|
name: Build
|
||||||
|
uses: ./
|
||||||
|
with:
|
||||||
|
source: .
|
||||||
|
files: |
|
||||||
|
./test/config.hcl
|
||||||
|
env:
|
||||||
|
BUILDX_NO_DEFAULT_ATTESTATIONS: 1
|
||||||
|
|
||||||
|
call-check:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
-
|
||||||
|
name: Checkout
|
||||||
|
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||||
|
-
|
||||||
|
name: Set up Docker Buildx
|
||||||
|
uses: docker/setup-buildx-action@4d04d5d9486b7bd6fa91e7baf45bbb4f8b9deedd # v4.0.0
|
||||||
|
with:
|
||||||
|
version: ${{ inputs.buildx-version || env.BUILDX_VERSION }}
|
||||||
|
driver-opts: |
|
||||||
|
image=${{ inputs.buildkit-image || env.BUILDKIT_IMAGE }}
|
||||||
|
-
|
||||||
|
name: Build
|
||||||
|
id: bake
|
||||||
|
continue-on-error: true
|
||||||
|
uses: ./
|
||||||
|
with:
|
||||||
|
source: ./test
|
||||||
|
files: |
|
||||||
|
./lint.hcl
|
||||||
|
call: check
|
||||||
|
targets: lint
|
||||||
|
-
|
||||||
|
name: Check
|
||||||
|
run: |
|
||||||
|
if [ "${{ steps.bake.outcome }}" != "failure" ] || [ "${{ steps.bake.conclusion }}" != "success" ]; then
|
||||||
|
echo "::error::Should have failed"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
call-check-multi:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
-
|
||||||
|
name: Checkout
|
||||||
|
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||||
|
-
|
||||||
|
name: Set up Docker Buildx
|
||||||
|
uses: docker/setup-buildx-action@4d04d5d9486b7bd6fa91e7baf45bbb4f8b9deedd # v4.0.0
|
||||||
|
with:
|
||||||
|
version: ${{ inputs.buildx-version || env.BUILDX_VERSION }}
|
||||||
|
driver-opts: |
|
||||||
|
image=${{ inputs.buildkit-image || env.BUILDKIT_IMAGE }}
|
||||||
|
-
|
||||||
|
name: Build
|
||||||
|
id: bake
|
||||||
|
continue-on-error: true
|
||||||
|
uses: ./
|
||||||
|
with:
|
||||||
|
source: ./test
|
||||||
|
files: |
|
||||||
|
./lint.hcl
|
||||||
|
call: check
|
||||||
|
-
|
||||||
|
name: Check
|
||||||
|
run: |
|
||||||
|
if [ "${{ steps.bake.outcome }}" != "failure" ] || [ "${{ steps.bake.conclusion }}" != "success" ]; then
|
||||||
|
echo "::error::Should have failed"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
call-check-nowarning:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
-
|
||||||
|
name: Checkout
|
||||||
|
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||||
|
-
|
||||||
|
name: Set up Docker Buildx
|
||||||
|
uses: docker/setup-buildx-action@4d04d5d9486b7bd6fa91e7baf45bbb4f8b9deedd # v4.0.0
|
||||||
|
with:
|
||||||
|
version: ${{ inputs.buildx-version || env.BUILDX_VERSION }}
|
||||||
|
driver-opts: |
|
||||||
|
image=${{ inputs.buildkit-image || env.BUILDKIT_IMAGE }}
|
||||||
|
-
|
||||||
|
name: Build
|
||||||
|
id: bake
|
||||||
|
continue-on-error: true
|
||||||
|
uses: ./
|
||||||
|
with:
|
||||||
|
source: .
|
||||||
|
files: |
|
||||||
|
./test/config.hcl
|
||||||
|
call: check
|
||||||
|
|
||||||
|
attest-override:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
-
|
||||||
|
name: Checkout
|
||||||
|
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||||
|
-
|
||||||
|
name: Set up Docker Buildx
|
||||||
|
uses: docker/setup-buildx-action@4d04d5d9486b7bd6fa91e7baf45bbb4f8b9deedd # v4.0.0
|
||||||
|
with:
|
||||||
|
version: ${{ inputs.buildx-version || env.BUILDX_VERSION }}
|
||||||
|
driver-opts: |
|
||||||
|
image=${{ inputs.buildkit-image || env.BUILDKIT_IMAGE }}
|
||||||
|
-
|
||||||
|
name: Build and push
|
||||||
|
uses: ./
|
||||||
|
with:
|
||||||
|
source: ./test/attest
|
||||||
|
|||||||
@@ -0,0 +1,46 @@
|
|||||||
|
name: codeql
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- 'master'
|
||||||
|
- 'releases/v*'
|
||||||
|
pull_request:
|
||||||
|
|
||||||
|
env:
|
||||||
|
NODE_VERSION: "24"
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
analyze:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
security-events: write
|
||||||
|
steps:
|
||||||
|
-
|
||||||
|
name: Checkout
|
||||||
|
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||||
|
-
|
||||||
|
name: Enable corepack
|
||||||
|
run: |
|
||||||
|
corepack enable
|
||||||
|
yarn --version
|
||||||
|
-
|
||||||
|
name: Set up Node
|
||||||
|
uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0
|
||||||
|
with:
|
||||||
|
node-version: ${{ env.NODE_VERSION }}
|
||||||
|
-
|
||||||
|
name: Initialize CodeQL
|
||||||
|
uses: github/codeql-action/init@c10b8064de6f491fea524254123dbe5e09572f13 # v4.35.1
|
||||||
|
with:
|
||||||
|
languages: javascript-typescript
|
||||||
|
build-mode: none
|
||||||
|
-
|
||||||
|
name: Perform CodeQL Analysis
|
||||||
|
uses: github/codeql-action/analyze@c10b8064de6f491fea524254123dbe5e09572f13 # v4.35.1
|
||||||
|
with:
|
||||||
|
category: "/language:javascript-typescript"
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
name: pr-assign-author
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
|
||||||
|
on:
|
||||||
|
pull_request_target: # zizmor: ignore[dangerous-triggers] safe to use without checkout
|
||||||
|
types:
|
||||||
|
- opened
|
||||||
|
- reopened
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
run:
|
||||||
|
uses: crazy-max/.github/.github/workflows/pr-assign-author.yml@d89fe92d808a15e2b2ed5cdb62db7c172c31410d # v1.6.0
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
pull-requests: write
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
name: publish
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
|
||||||
|
concurrency:
|
||||||
|
group: ${{ github.workflow }}-${{ github.ref }}
|
||||||
|
cancel-in-progress: true
|
||||||
|
|
||||||
|
on:
|
||||||
|
release:
|
||||||
|
types:
|
||||||
|
- published
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
publish:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
id-token: write
|
||||||
|
packages: write
|
||||||
|
steps:
|
||||||
|
-
|
||||||
|
name: Checkout
|
||||||
|
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||||
|
-
|
||||||
|
name: Publish
|
||||||
|
uses: actions/publish-immutable-action@4bc8754ffc40f27910afb20287dbbbb675a4e978 # v0.0.4
|
||||||
@@ -1,5 +1,8 @@
|
|||||||
name: test
|
name: test
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
|
||||||
concurrency:
|
concurrency:
|
||||||
group: ${{ github.workflow }}-${{ github.ref }}
|
group: ${{ github.workflow }}-${{ github.ref }}
|
||||||
cancel-in-progress: true
|
cancel-in-progress: true
|
||||||
@@ -23,15 +26,16 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
-
|
-
|
||||||
name: Checkout
|
name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||||
-
|
-
|
||||||
name: Test
|
name: Test
|
||||||
uses: docker/bake-action@v4
|
uses: docker/bake-action@82490499d2e5613fcead7e128237ef0b0ea210f7 # v7.0.0
|
||||||
with:
|
with:
|
||||||
|
source: .
|
||||||
targets: test
|
targets: test
|
||||||
-
|
-
|
||||||
name: Upload coverage
|
name: Upload coverage
|
||||||
uses: codecov/codecov-action@v4
|
uses: codecov/codecov-action@57e3a136b779b570ffcdbf80b3bdc90e7fab3de2 # v6.0.0
|
||||||
with:
|
with:
|
||||||
file: ./coverage/clover.xml
|
files: ./coverage/clover.xml
|
||||||
token: ${{ secrets.CODECOV_TOKEN }}
|
token: ${{ secrets.CODECOV_TOKEN }}
|
||||||
|
|||||||
@@ -0,0 +1,56 @@
|
|||||||
|
name: update-dist
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
|
||||||
|
concurrency:
|
||||||
|
group: ${{ github.workflow }}-${{ github.ref }}
|
||||||
|
cancel-in-progress: true
|
||||||
|
|
||||||
|
on:
|
||||||
|
pull_request:
|
||||||
|
types:
|
||||||
|
- opened
|
||||||
|
- synchronize
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
update-dist:
|
||||||
|
if: github.actor == 'dependabot[bot]' && github.event.pull_request.user.login == 'dependabot[bot]' && github.repository == github.event.pull_request.head.repo.full_name
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
-
|
||||||
|
name: GitHub auth token from GitHub App
|
||||||
|
id: docker-read-app
|
||||||
|
uses: actions/create-github-app-token@f8d387b68d61c58ab83c6c016672934102569859 # v3.0.0
|
||||||
|
with:
|
||||||
|
app-id: ${{ secrets.GHACTIONS_REPO_WRITE_APP_ID }}
|
||||||
|
private-key: ${{ secrets.GHACTIONS_REPO_WRITE_APP_PRIVATE_KEY }}
|
||||||
|
owner: docker
|
||||||
|
-
|
||||||
|
name: Checkout
|
||||||
|
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||||
|
with:
|
||||||
|
ref: ${{ github.event.pull_request.head.ref }}
|
||||||
|
fetch-depth: 0
|
||||||
|
token: ${{ steps.docker-read-app.outputs.token }}
|
||||||
|
-
|
||||||
|
name: Build
|
||||||
|
uses: docker/bake-action@82490499d2e5613fcead7e128237ef0b0ea210f7 # v7.0.0
|
||||||
|
with:
|
||||||
|
source: .
|
||||||
|
targets: build
|
||||||
|
-
|
||||||
|
name: Commit and push dist
|
||||||
|
run: |
|
||||||
|
if [ -n "$(git status --porcelain -- dist)" ]; then
|
||||||
|
(
|
||||||
|
set -x
|
||||||
|
git config user.name "github-actions[bot]"
|
||||||
|
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
|
||||||
|
git add dist
|
||||||
|
git commit -m "chore: update generated content"
|
||||||
|
git push
|
||||||
|
)
|
||||||
|
else
|
||||||
|
echo "No changes in dist"
|
||||||
|
fi
|
||||||
@@ -1,5 +1,8 @@
|
|||||||
name: validate
|
name: validate
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
|
||||||
concurrency:
|
concurrency:
|
||||||
group: ${{ github.workflow }}-${{ github.ref }}
|
group: ${{ github.workflow }}-${{ github.ref }}
|
||||||
cancel-in-progress: true
|
cancel-in-progress: true
|
||||||
@@ -15,15 +18,15 @@ jobs:
|
|||||||
prepare:
|
prepare:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
outputs:
|
outputs:
|
||||||
targets: ${{ steps.generate.outputs.targets }}
|
matrix: ${{ steps.generate.outputs.matrix }}
|
||||||
steps:
|
steps:
|
||||||
-
|
-
|
||||||
name: Checkout
|
name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||||
-
|
-
|
||||||
name: List targets
|
name: List targets
|
||||||
id: generate
|
id: generate
|
||||||
uses: ./subaction/list-targets
|
uses: ./subaction/matrix
|
||||||
with:
|
with:
|
||||||
target: validate
|
target: validate
|
||||||
|
|
||||||
@@ -34,13 +37,10 @@ jobs:
|
|||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
target: ${{ fromJson(needs.prepare.outputs.targets) }}
|
include: ${{ fromJson(needs.prepare.outputs.matrix) }}
|
||||||
steps:
|
steps:
|
||||||
-
|
|
||||||
name: Checkout
|
|
||||||
uses: actions/checkout@v4
|
|
||||||
-
|
-
|
||||||
name: Validate
|
name: Validate
|
||||||
uses: docker/bake-action@v4
|
uses: docker/bake-action@82490499d2e5613fcead7e128237ef0b0ea210f7 # v7.0.0
|
||||||
with:
|
with:
|
||||||
targets: ${{ matrix.target }}
|
targets: ${{ matrix.target }}
|
||||||
|
|||||||
@@ -0,0 +1,29 @@
|
|||||||
|
name: zizmor
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
|
||||||
|
concurrency:
|
||||||
|
group: ${{ github.workflow }}-${{ github.ref }}
|
||||||
|
cancel-in-progress: true
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_dispatch:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- 'master'
|
||||||
|
- 'releases/v*'
|
||||||
|
tags:
|
||||||
|
- 'v*'
|
||||||
|
pull_request:
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
zizmor:
|
||||||
|
uses: crazy-max/.github/.github/workflows/zizmor.yml@d89fe92d808a15e2b2ed5cdb62db7c172c31410d # v1.6.0
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
security-events: write
|
||||||
|
with:
|
||||||
|
min-severity: medium
|
||||||
|
min-confidence: medium
|
||||||
|
persona: pedantic
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
rules:
|
||||||
|
secrets-outside-env: # FIXME: remove this rule when zizmor 1.24.0 is released, fixing the right persona attached to this rule: https://github.com/zizmorcore/zizmor/pull/1783
|
||||||
|
disable: true
|
||||||
+14
-57
@@ -1,12 +1,5 @@
|
|||||||
/.dev
|
# https://raw.githubusercontent.com/github/gitignore/main/Node.gitignore
|
||||||
node_modules
|
|
||||||
lib
|
|
||||||
|
|
||||||
# Jetbrains
|
|
||||||
/.idea
|
|
||||||
/*.iml
|
|
||||||
|
|
||||||
# Rest of the file pulled from https://github.com/github/gitignore/blob/master/Node.gitignore
|
|
||||||
# Logs
|
# Logs
|
||||||
logs
|
logs
|
||||||
*.log
|
*.log
|
||||||
@@ -14,6 +7,7 @@ npm-debug.log*
|
|||||||
yarn-debug.log*
|
yarn-debug.log*
|
||||||
yarn-error.log*
|
yarn-error.log*
|
||||||
lerna-debug.log*
|
lerna-debug.log*
|
||||||
|
.pnpm-debug.log*
|
||||||
|
|
||||||
# Diagnostic reports (https://nodejs.org/api/report.html)
|
# Diagnostic reports (https://nodejs.org/api/report.html)
|
||||||
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
|
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
|
||||||
@@ -24,34 +18,14 @@ pids
|
|||||||
*.seed
|
*.seed
|
||||||
*.pid.lock
|
*.pid.lock
|
||||||
|
|
||||||
# Directory for instrumented libs generated by jscoverage/JSCover
|
|
||||||
lib-cov
|
|
||||||
|
|
||||||
# Coverage directory used by tools like istanbul
|
# Coverage directory used by tools like istanbul
|
||||||
coverage
|
coverage
|
||||||
*.lcov
|
*.lcov
|
||||||
|
|
||||||
# nyc test coverage
|
|
||||||
.nyc_output
|
|
||||||
|
|
||||||
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
|
|
||||||
.grunt
|
|
||||||
|
|
||||||
# Bower dependency directory (https://bower.io/)
|
|
||||||
bower_components
|
|
||||||
|
|
||||||
# node-waf configuration
|
|
||||||
.lock-wscript
|
|
||||||
|
|
||||||
# Compiled binary addons (https://nodejs.org/api/addons.html)
|
|
||||||
build/Release
|
|
||||||
|
|
||||||
# Dependency directories
|
# Dependency directories
|
||||||
|
node_modules/
|
||||||
jspm_packages/
|
jspm_packages/
|
||||||
|
|
||||||
# TypeScript v1 declaration files
|
|
||||||
typings/
|
|
||||||
|
|
||||||
# TypeScript cache
|
# TypeScript cache
|
||||||
*.tsbuildinfo
|
*.tsbuildinfo
|
||||||
|
|
||||||
@@ -61,36 +35,19 @@ typings/
|
|||||||
# Optional eslint cache
|
# Optional eslint cache
|
||||||
.eslintcache
|
.eslintcache
|
||||||
|
|
||||||
# Optional REPL history
|
|
||||||
.node_repl_history
|
|
||||||
|
|
||||||
# Output of 'npm pack'
|
|
||||||
*.tgz
|
|
||||||
|
|
||||||
# Yarn Integrity file
|
# Yarn Integrity file
|
||||||
.yarn-integrity
|
.yarn-integrity
|
||||||
|
|
||||||
# dotenv environment variables file
|
# dotenv environment variable files
|
||||||
.env
|
.env
|
||||||
.env.test
|
.env.development.local
|
||||||
|
.env.test.local
|
||||||
|
.env.production.local
|
||||||
|
.env.local
|
||||||
|
|
||||||
# parcel-bundler cache (https://parceljs.org/)
|
# yarn v2
|
||||||
.cache
|
.yarn/cache
|
||||||
|
.yarn/unplugged
|
||||||
# next.js build output
|
.yarn/build-state.yml
|
||||||
.next
|
.yarn/install-state.gz
|
||||||
|
.pnp.*
|
||||||
# nuxt.js build output
|
|
||||||
.nuxt
|
|
||||||
|
|
||||||
# vuepress build output
|
|
||||||
.vuepress/dist
|
|
||||||
|
|
||||||
# Serverless directories
|
|
||||||
.serverless/
|
|
||||||
|
|
||||||
# FuseBox cache
|
|
||||||
.fusebox/
|
|
||||||
|
|
||||||
# DynamoDB Local files
|
|
||||||
.dynamodb/
|
|
||||||
|
|||||||
@@ -0,0 +1,6 @@
|
|||||||
|
# Dependency directories
|
||||||
|
node_modules/
|
||||||
|
jspm_packages/
|
||||||
|
|
||||||
|
# yarn v2
|
||||||
|
.yarn/
|
||||||
+1
-2
@@ -6,6 +6,5 @@
|
|||||||
"singleQuote": true,
|
"singleQuote": true,
|
||||||
"trailingComma": "none",
|
"trailingComma": "none",
|
||||||
"bracketSpacing": false,
|
"bracketSpacing": false,
|
||||||
"arrowParens": "avoid",
|
"arrowParens": "avoid"
|
||||||
"parser": "typescript"
|
|
||||||
}
|
}
|
||||||
|
|||||||
+17
@@ -0,0 +1,17 @@
|
|||||||
|
# https://yarnpkg.com/configuration/yarnrc
|
||||||
|
|
||||||
|
compressionLevel: mixed
|
||||||
|
enableGlobalCache: false
|
||||||
|
enableHardenedMode: true
|
||||||
|
|
||||||
|
logFilters:
|
||||||
|
- code: YN0013
|
||||||
|
level: discard
|
||||||
|
- code: YN0019
|
||||||
|
level: discard
|
||||||
|
- code: YN0076
|
||||||
|
level: discard
|
||||||
|
- code: YN0086
|
||||||
|
level: discard
|
||||||
|
|
||||||
|
nodeLinker: node-modules
|
||||||
@@ -14,95 +14,66 @@ as a high-level build command.
|
|||||||
___
|
___
|
||||||
|
|
||||||
* [Usage](#usage)
|
* [Usage](#usage)
|
||||||
* [Path context](#path-context)
|
|
||||||
* [Git context](#git-context)
|
* [Git context](#git-context)
|
||||||
|
* [Path context](#path-context)
|
||||||
|
* [Summaries](#summaries)
|
||||||
* [Customizing](#customizing)
|
* [Customizing](#customizing)
|
||||||
* [inputs](#inputs)
|
* [inputs](#inputs)
|
||||||
* [outputs](#outputs)
|
* [outputs](#outputs)
|
||||||
|
* [environment variables](#environment-variables)
|
||||||
* [Subactions](#subactions)
|
* [Subactions](#subactions)
|
||||||
* [`list-targets`](#list-targets)
|
* [`matrix`](subaction/matrix)
|
||||||
|
* [Notes](#notes)
|
||||||
|
* [Source semantics](#source-semantics)
|
||||||
* [Contributing](#contributing)
|
* [Contributing](#contributing)
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
### Path context
|
|
||||||
|
|
||||||
By default, this action will use the local bake definition (`source: .`), so
|
|
||||||
you need to use the [`actions/checkout`](https://github.com/actions/checkout/)
|
|
||||||
action to check out the repository.
|
|
||||||
|
|
||||||
```yaml
|
|
||||||
name: ci
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches:
|
|
||||||
- 'master'
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
bake:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
-
|
|
||||||
name: Checkout
|
|
||||||
uses: actions/checkout@v4
|
|
||||||
-
|
|
||||||
name: Set up Docker Buildx
|
|
||||||
uses: docker/setup-buildx-action@v3
|
|
||||||
-
|
|
||||||
name: Login to DockerHub
|
|
||||||
uses: docker/login-action@v3
|
|
||||||
with:
|
|
||||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
|
||||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
|
||||||
-
|
|
||||||
name: Build and push
|
|
||||||
uses: docker/bake-action@v4
|
|
||||||
with:
|
|
||||||
push: true
|
|
||||||
```
|
|
||||||
|
|
||||||
### Git context
|
### Git context
|
||||||
|
|
||||||
Git context can be provided using the [`source` input](#inputs). This means
|
Since `v6` this action uses the [Git context](https://docs.docker.com/build/bake/remote-definition/)
|
||||||
that you don't need to use the [`actions/checkout`](https://github.com/actions/checkout/)
|
to build from a remote bake definition by default like the [build-push-action](https://github.com/docker/build-push-action)
|
||||||
|
does. This means that you don't need to use the [`actions/checkout`](https://github.com/actions/checkout/)
|
||||||
action to check out the repository as [BuildKit](https://docs.docker.com/build/buildkit/)
|
action to check out the repository as [BuildKit](https://docs.docker.com/build/buildkit/)
|
||||||
will do this directly.
|
will do this directly.
|
||||||
|
|
||||||
|
The git reference will be based on the [event that triggered your workflow](https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows)
|
||||||
|
and will result in the following context: `https://github.com/<owner>/<repo>.git#<ref>`.
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
name: ci
|
name: ci
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches:
|
|
||||||
- 'master'
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
bake:
|
bake:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
-
|
|
||||||
name: Set up Docker Buildx
|
|
||||||
uses: docker/setup-buildx-action@v3
|
|
||||||
-
|
-
|
||||||
name: Login to DockerHub
|
name: Login to DockerHub
|
||||||
uses: docker/login-action@v3
|
uses: docker/login-action@v4
|
||||||
with:
|
with:
|
||||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
username: ${{ vars.DOCKERHUB_USERNAME }}
|
||||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||||
|
-
|
||||||
|
name: Set up Docker Buildx
|
||||||
|
uses: docker/setup-buildx-action@v4
|
||||||
-
|
-
|
||||||
name: Build and push
|
name: Build and push
|
||||||
uses: docker/bake-action@v4
|
uses: docker/bake-action@v7
|
||||||
with:
|
with:
|
||||||
source: "${{ github.server_url }}/${{ github.repository }}.git#${{ github.ref }}"
|
|
||||||
push: true
|
push: true
|
||||||
|
set: |
|
||||||
|
*.tags=user/app:latest
|
||||||
```
|
```
|
||||||
|
|
||||||
Be careful because **any file mutation in the steps that precede the build step
|
Be careful because **any file mutation in the steps that precede the build step
|
||||||
will be ignored, including processing of the `.dockerignore` file** since
|
will be ignored, including processing of the `.dockerignore` file** since
|
||||||
the context is based on the Git reference. However, you can use the
|
the context is based on the Git reference. However, you can use the
|
||||||
[Path context](#path-context) alongside the [`actions/checkout`](https://github.com/actions/checkout/)
|
[Path context](#path-context) using the [`source` input](#inputs) alongside
|
||||||
action to remove this restriction.
|
the [`actions/checkout`](https://github.com/actions/checkout/) action to remove
|
||||||
|
this restriction.
|
||||||
|
|
||||||
Default Git context can also be provided using the [Handlebars template](https://handlebarsjs.com/guide/)
|
Default Git context can also be provided using the [Handlebars template](https://handlebarsjs.com/guide/)
|
||||||
expression `{{defaultContext}}`. Here we can use it to provide a subdirectory
|
expression `{{defaultContext}}`. Here we can use it to provide a subdirectory
|
||||||
@@ -111,10 +82,12 @@ to the default Git context:
|
|||||||
```yaml
|
```yaml
|
||||||
-
|
-
|
||||||
name: Build and push
|
name: Build and push
|
||||||
uses: docker/bake-action@v4
|
uses: docker/bake-action@v7
|
||||||
with:
|
with:
|
||||||
source: "{{defaultContext}}:mysubdir"
|
source: "{{defaultContext}}:mysubdir"
|
||||||
push: true
|
push: true
|
||||||
|
set: |
|
||||||
|
*.tags=user/app:latest
|
||||||
```
|
```
|
||||||
|
|
||||||
Building from the current repository automatically uses the `GITHUB_TOKEN`
|
Building from the current repository automatically uses the `GITHUB_TOKEN`
|
||||||
@@ -129,14 +102,107 @@ another private repository for remote definitions, you can set the
|
|||||||
```yaml
|
```yaml
|
||||||
-
|
-
|
||||||
name: Build and push
|
name: Build and push
|
||||||
uses: docker/bake-action@v4
|
uses: docker/bake-action@v7
|
||||||
with:
|
with:
|
||||||
source: "${{ github.server_url }}/${{ github.repository }}.git#${{ github.ref }}"
|
|
||||||
push: true
|
push: true
|
||||||
|
set: |
|
||||||
|
*.tags=user/app:latest
|
||||||
env:
|
env:
|
||||||
BUILDX_BAKE_GIT_AUTH_TOKEN: ${{ secrets.MYTOKEN }}
|
BUILDX_BAKE_GIT_AUTH_TOKEN: ${{ secrets.MYTOKEN }}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### Path context
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
name: ci
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
bake:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
-
|
||||||
|
name: Checkout
|
||||||
|
uses: actions/checkout@v6
|
||||||
|
-
|
||||||
|
name: Login to DockerHub
|
||||||
|
uses: docker/login-action@v4
|
||||||
|
with:
|
||||||
|
username: ${{ vars.DOCKERHUB_USERNAME }}
|
||||||
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||||
|
-
|
||||||
|
name: Set up Docker Buildx
|
||||||
|
uses: docker/setup-buildx-action@v4
|
||||||
|
-
|
||||||
|
name: Build and push
|
||||||
|
uses: docker/bake-action@v7
|
||||||
|
with:
|
||||||
|
source: .
|
||||||
|
push: true
|
||||||
|
set: |
|
||||||
|
*.tags=user/app:latest
|
||||||
|
```
|
||||||
|
|
||||||
|
If you point `source` to a subdirectory, relative paths are resolved from that
|
||||||
|
subdirectory:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
-
|
||||||
|
name: Build and push
|
||||||
|
uses: docker/bake-action@v7
|
||||||
|
with:
|
||||||
|
source: ./subdir
|
||||||
|
files: ./docker-bake.hcl
|
||||||
|
```
|
||||||
|
|
||||||
|
For example, if `./subdir/docker-bake.hcl` contains:
|
||||||
|
|
||||||
|
```hcl
|
||||||
|
target "default" {
|
||||||
|
output = ["type=local,dest=./artifacts"]
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
The output will be written to `./subdir/artifacts` in the workspace.
|
||||||
|
|
||||||
|
> [!NOTE]
|
||||||
|
> More info about `source` semantics in the [Source semantics](#source-semantics) section.
|
||||||
|
|
||||||
|
## Summaries
|
||||||
|
|
||||||
|
This action generates a [job summary](https://github.blog/2022-05-09-supercharging-github-actions-with-job-summaries/)
|
||||||
|
that provides a detailed overview of the build execution. The summary shows an
|
||||||
|
overview of all the steps executed during the build, including the build
|
||||||
|
inputs, bake definition, and eventual errors.
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
The summary also includes a link for downloading a build record archive with
|
||||||
|
additional details about the build execution for all the bake targets,
|
||||||
|
including build stats, logs, outputs, and more. The build record can be
|
||||||
|
imported to Docker Desktop for inspecting the build in greater detail.
|
||||||
|
|
||||||
|
> [!WARNING]
|
||||||
|
>
|
||||||
|
> If you're using the [`actions/download-artifact`](https://github.com/actions/download-artifact)
|
||||||
|
> action in your workflow, you need to ignore the build record artifacts
|
||||||
|
> if `name` and `pattern` inputs are not specified ([defaults to download all artifacts](https://github.com/actions/download-artifact?tab=readme-ov-file#download-all-artifacts) of the workflow),
|
||||||
|
> otherwise the action will fail:
|
||||||
|
> ```yaml
|
||||||
|
> - uses: actions/download-artifact@v4
|
||||||
|
> with:
|
||||||
|
> pattern: "!*.dockerbuild"
|
||||||
|
> ```
|
||||||
|
> More info: https://github.com/actions/toolkit/pull/1874
|
||||||
|
|
||||||
|
Summaries are enabled by default, but can be disabled with the
|
||||||
|
`DOCKER_BUILD_SUMMARY` [environment variable](#environment-variables).
|
||||||
|
|
||||||
|
For more information about summaries, refer to the
|
||||||
|
[documentation](https://docs.docker.com/go/build-summary/).
|
||||||
|
|
||||||
## Customizing
|
## Customizing
|
||||||
|
|
||||||
### inputs
|
### inputs
|
||||||
@@ -158,21 +224,22 @@ The following inputs can be used as `step.with` keys
|
|||||||
> targets: default,release
|
> targets: default,release
|
||||||
> ```
|
> ```
|
||||||
|
|
||||||
| Name | Type | Description |
|
| Name | Type | Description |
|
||||||
|----------------|-------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
|----------------|-------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
||||||
| `builder` | String | Builder instance (see [setup-buildx](https://github.com/docker/setup-buildx-action) action) |
|
| `builder` | String | Builder instance (see [setup-buildx](https://github.com/docker/setup-buildx-action) action) |
|
||||||
| `source` | String | Context to build from. Can be either local (`.`) or a [remote bake definition](https://docs.docker.com/build/customize/bake/file-definition/#remote-definition) |
|
| `allow` | List/CSV | Allow build to access specified resources (e.g., `network.host`) |
|
||||||
| `files` | List/CSV | List of [bake definition files](https://docs.docker.com/build/customize/bake/file-definition/) |
|
| `call` | String | Set method for evaluating build (e.g., check) |
|
||||||
| `workdir` | String | Working directory of execution |
|
| `files` | List/CSV | List of [bake definition files](https://docs.docker.com/build/customize/bake/file-definition/) |
|
||||||
| `targets` | List/CSV | List of bake targets (`default` target used if empty) |
|
| `no-cache` | Bool | Do not use cache when building the image (default `false`) |
|
||||||
| `no-cache` | Bool | Do not use cache when building the image (default `false`) |
|
| `pull` | Bool | Always attempt to pull a newer version of the image (default `false`) |
|
||||||
| `pull` | Bool | Always attempt to pull a newer version of the image (default `false`) |
|
| `load` | Bool | Load is a shorthand for `--set=*.output=type=docker` (default `false`) |
|
||||||
| `load` | Bool | Load is a shorthand for `--set=*.output=type=docker` (default `false`) |
|
| `provenance` | Bool/String | [Provenance](https://docs.docker.com/build/attestations/slsa-provenance/) is a shorthand for `--set=*.attest=type=provenance` |
|
||||||
| `provenance` | Bool/String | [Provenance](https://docs.docker.com/build/attestations/slsa-provenance/) is a shorthand for `--set=*.attest=type=provenance` |
|
| `push` | Bool | Push is a shorthand for `--set=*.output=type=registry` (default `false`) |
|
||||||
| `push` | Bool | Push is a shorthand for `--set=*.output=type=registry` (default `false`) |
|
| `sbom` | Bool/String | [SBOM](https://docs.docker.com/build/attestations/sbom/) is a shorthand for `--set=*.attest=type=sbom` |
|
||||||
| `sbom` | Bool/String | [SBOM](https://docs.docker.com/build/attestations/sbom/) is a shorthand for `--set=*.attest=type=sbom` |
|
| `set` | List | List of [targets values to override](https://docs.docker.com/engine/reference/commandline/buildx_bake/#set) (e.g., `targetpattern.key=value`) |
|
||||||
| `set` | List | List of [targets values to override](https://docs.docker.com/engine/reference/commandline/buildx_bake/#set) (eg: `targetpattern.key=value`) |
|
| `source` | String | Build source to use. Supports local path and [remote bake definition](https://docs.docker.com/build/bake/remote-definition/). With a local path, Bake runs from that directory, so all relative paths are resolved from it. See [Source semantics](#source-semantics). |
|
||||||
| `github-token` | String | API token used to authenticate to a Git repository for [remote definitions](https://docs.docker.com/build/bake/remote-definition/) (default `${{ github.token }}`) |
|
| `targets` | List/CSV | List of bake targets (`default` target used if empty) |
|
||||||
|
| `github-token` | String | API token used to authenticate to a Git repository for [remote definitions](https://docs.docker.com/build/bake/remote-definition/) (default `${{ github.token }}`) |
|
||||||
|
|
||||||
### outputs
|
### outputs
|
||||||
|
|
||||||
@@ -182,78 +249,35 @@ The following outputs are available
|
|||||||
|------------|------|-----------------------|
|
|------------|------|-----------------------|
|
||||||
| `metadata` | JSON | Build result metadata |
|
| `metadata` | JSON | Build result metadata |
|
||||||
|
|
||||||
|
### environment variables
|
||||||
|
|
||||||
|
| Name | Type | Default | Description |
|
||||||
|
|--------------------------------------|--------|---------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
||||||
|
| `DOCKER_BUILD_CHECKS_ANNOTATIONS` | Bool | `true` | If `false`, GitHub annotations are not generated for [build checks](https://docs.docker.com/build/checks/) |
|
||||||
|
| `DOCKER_BUILD_SUMMARY` | Bool | `true` | If `false`, [build summary](https://docs.docker.com/build/ci/github-actions/build-summary/) generation is disabled |
|
||||||
|
| `DOCKER_BUILD_RECORD_UPLOAD` | Bool | `true` | If `false`, build record upload as [GitHub artifact](https://docs.github.com/en/actions/using-workflows/storing-workflow-data-as-artifacts) is disabled |
|
||||||
|
| `DOCKER_BUILD_RECORD_RETENTION_DAYS` | Number | | Duration after which build record artifact will expire in days. Defaults to repository/org [retention settings](https://docs.github.com/en/actions/learn-github-actions/usage-limits-billing-and-administration#artifact-and-log-retention-policy) if unset or `0` |
|
||||||
|
|
||||||
## Subactions
|
## Subactions
|
||||||
|
|
||||||
### `list-targets`
|
* [`matrix`](subaction/matrix)
|
||||||
|
|
||||||
This subaction generates a list of Bake targets that can be used in a [GitHub matrix](https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstrategymatrix),
|
## Notes
|
||||||
so you can distribute your builds across multiple runners.
|
|
||||||
|
|
||||||
```hcl
|
### Source semantics
|
||||||
# docker-bake.hcl
|
|
||||||
group "validate" {
|
|
||||||
targets = ["lint", "doctoc"]
|
|
||||||
}
|
|
||||||
|
|
||||||
target "lint" {
|
`source` accepts either a Git/remote bake definition (for example `{{defaultContext}}` or `{{defaultContext}}:subdir`)
|
||||||
target = "lint"
|
or a local path (for example `.` or `./subdir`). When `source` is a local path,
|
||||||
}
|
the action runs Bake from that directory (equivalent to `cd <path> && docker buildx bake`).
|
||||||
|
|
||||||
target "doctoc" {
|
This local path mode affects all relative paths resolved by Bake, not only
|
||||||
target = "doctoc"
|
target `context` fields. This includes paths used by local outputs, cache
|
||||||
}
|
import/export, and `cwd://` references.
|
||||||
```
|
|
||||||
|
|
||||||
```yaml
|
| `source` | Behavior |
|
||||||
jobs:
|
|-----------------------------------------------------------------------|------------------------------------------------------------------------------------------------|
|
||||||
prepare:
|
| Git/remote (`{{defaultContext}}`, `https://...git#ref`, `...:subdir`) | Uses [remote bake definition](https://docs.docker.com/build/bake/remote-definition/) behavior. |
|
||||||
runs-on: ubuntu-latest
|
| Local path (`.`, `./subdir`) | Changes Bake working directory to that path before invoking Bake. |
|
||||||
outputs:
|
|
||||||
targets: ${{ steps.generate.outputs.targets }}
|
|
||||||
steps:
|
|
||||||
-
|
|
||||||
name: Checkout
|
|
||||||
uses: actions/checkout@v4
|
|
||||||
-
|
|
||||||
name: List targets
|
|
||||||
id: generate
|
|
||||||
uses: docker/bake-action/subaction/list-targets@v4
|
|
||||||
with:
|
|
||||||
target: validate
|
|
||||||
|
|
||||||
validate:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
needs:
|
|
||||||
- prepare
|
|
||||||
strategy:
|
|
||||||
fail-fast: false
|
|
||||||
matrix:
|
|
||||||
target: ${{ fromJson(needs.prepare.outputs.targets) }}
|
|
||||||
steps:
|
|
||||||
-
|
|
||||||
name: Checkout
|
|
||||||
uses: actions/checkout@v4
|
|
||||||
-
|
|
||||||
name: Validate
|
|
||||||
uses: docker/bake-action@v4
|
|
||||||
with:
|
|
||||||
targets: ${{ matrix.target }}
|
|
||||||
```
|
|
||||||
#### inputs
|
|
||||||
|
|
||||||
| Name | Type | Description |
|
|
||||||
|--------------|-------------|---------------------------------------------------------------------------------------------------------------------------------------------|
|
|
||||||
| `workdir` | String | Working directory to use (defaults to `.`) |
|
|
||||||
| `files` | List/CSV | List of [bake definition files](https://docs.docker.com/build/customize/bake/file-definition/) |
|
|
||||||
| `target` | String | The target to use within the bake file |
|
|
||||||
|
|
||||||
#### outputs
|
|
||||||
|
|
||||||
The following outputs are available
|
|
||||||
|
|
||||||
| Name | Type | Description |
|
|
||||||
|------------|----------|----------------------------|
|
|
||||||
| `targets` | List/CSV | List of extracted targest |
|
|
||||||
|
|
||||||
## Contributing
|
## Contributing
|
||||||
|
|
||||||
|
|||||||
@@ -1,207 +0,0 @@
|
|||||||
import {jest} from '@jest/globals';
|
|
||||||
|
|
||||||
export const context = {
|
|
||||||
repo: {
|
|
||||||
owner: 'docker',
|
|
||||||
repo: 'build-push-action'
|
|
||||||
},
|
|
||||||
ref: 'refs/heads/master',
|
|
||||||
runId: 123456789,
|
|
||||||
payload: {
|
|
||||||
after: '860c1904a1ce19322e91ac35af1ab07466440c37',
|
|
||||||
base_ref: null,
|
|
||||||
before: '5f3331d7f7044c18ca9f12c77d961c4d7cf3276a',
|
|
||||||
commits: [
|
|
||||||
{
|
|
||||||
author: {
|
|
||||||
email: 'crazy-max@users.noreply.github.com',
|
|
||||||
name: 'CrazyMax',
|
|
||||||
username: 'crazy-max'
|
|
||||||
},
|
|
||||||
committer: {
|
|
||||||
email: 'crazy-max@users.noreply.github.com',
|
|
||||||
name: 'CrazyMax',
|
|
||||||
username: 'crazy-max'
|
|
||||||
},
|
|
||||||
distinct: true,
|
|
||||||
id: '860c1904a1ce19322e91ac35af1ab07466440c37',
|
|
||||||
message: 'hello dev',
|
|
||||||
timestamp: '2022-04-19T11:27:24+02:00',
|
|
||||||
tree_id: 'd2c60af597e863787d2d27f569e30495b0b92820',
|
|
||||||
url: 'https://github.com/docker/test-docker-action/commit/860c1904a1ce19322e91ac35af1ab07466440c37'
|
|
||||||
}
|
|
||||||
],
|
|
||||||
compare: 'https://github.com/docker/test-docker-action/compare/5f3331d7f704...860c1904a1ce',
|
|
||||||
created: false,
|
|
||||||
deleted: false,
|
|
||||||
forced: false,
|
|
||||||
head_commit: {
|
|
||||||
author: {
|
|
||||||
email: 'crazy-max@users.noreply.github.com',
|
|
||||||
name: 'CrazyMax',
|
|
||||||
username: 'crazy-max'
|
|
||||||
},
|
|
||||||
committer: {
|
|
||||||
email: 'crazy-max@users.noreply.github.com',
|
|
||||||
name: 'CrazyMax',
|
|
||||||
username: 'crazy-max'
|
|
||||||
},
|
|
||||||
distinct: true,
|
|
||||||
id: '860c1904a1ce19322e91ac35af1ab07466440c37',
|
|
||||||
message: 'hello dev',
|
|
||||||
timestamp: '2022-04-19T11:27:24+02:00',
|
|
||||||
tree_id: 'd2c60af597e863787d2d27f569e30495b0b92820',
|
|
||||||
url: 'https://github.com/docker/test-docker-action/commit/860c1904a1ce19322e91ac35af1ab07466440c37'
|
|
||||||
},
|
|
||||||
organization: {
|
|
||||||
avatar_url: 'https://avatars.githubusercontent.com/u/5429470?v=4',
|
|
||||||
description: 'Docker helps developers bring their ideas to life by conquering the complexity of app development.',
|
|
||||||
events_url: 'https://api.github.com/orgs/docker/events',
|
|
||||||
hooks_url: 'https://api.github.com/orgs/docker/hooks',
|
|
||||||
id: 5429470,
|
|
||||||
issues_url: 'https://api.github.com/orgs/docker/issues',
|
|
||||||
login: 'docker',
|
|
||||||
members_url: 'https://api.github.com/orgs/docker/members{/member}',
|
|
||||||
node_id: 'MDEyOk9yZ2FuaXphdGlvbjU0Mjk0NzA=',
|
|
||||||
public_members_url: 'https://api.github.com/orgs/docker/public_members{/member}',
|
|
||||||
repos_url: 'https://api.github.com/orgs/docker/repos',
|
|
||||||
url: 'https://api.github.com/orgs/docker'
|
|
||||||
},
|
|
||||||
pusher: {
|
|
||||||
email: 'github@crazymax.dev',
|
|
||||||
name: 'crazy-max'
|
|
||||||
},
|
|
||||||
ref: 'refs/heads/dev',
|
|
||||||
repository: {
|
|
||||||
allow_forking: true,
|
|
||||||
archive_url: 'https://api.github.com/repos/docker/test-docker-action/{archive_format}{/ref}',
|
|
||||||
archived: false,
|
|
||||||
assignees_url: 'https://api.github.com/repos/docker/test-docker-action/assignees{/user}',
|
|
||||||
blobs_url: 'https://api.github.com/repos/docker/test-docker-action/git/blobs{/sha}',
|
|
||||||
branches_url: 'https://api.github.com/repos/docker/test-docker-action/branches{/branch}',
|
|
||||||
clone_url: 'https://github.com/docker/test-docker-action.git',
|
|
||||||
collaborators_url: 'https://api.github.com/repos/docker/test-docker-action/collaborators{/collaborator}',
|
|
||||||
comments_url: 'https://api.github.com/repos/docker/test-docker-action/comments{/number}',
|
|
||||||
commits_url: 'https://api.github.com/repos/docker/test-docker-action/commits{/sha}',
|
|
||||||
compare_url: 'https://api.github.com/repos/docker/test-docker-action/compare/{base}...{head}',
|
|
||||||
contents_url: 'https://api.github.com/repos/docker/test-docker-action/contents/{+path}',
|
|
||||||
contributors_url: 'https://api.github.com/repos/docker/test-docker-action/contributors',
|
|
||||||
created_at: 1596792180,
|
|
||||||
default_branch: 'master',
|
|
||||||
deployments_url: 'https://api.github.com/repos/docker/test-docker-action/deployments',
|
|
||||||
description: 'Test "Docker" Actions',
|
|
||||||
disabled: false,
|
|
||||||
downloads_url: 'https://api.github.com/repos/docker/test-docker-action/downloads',
|
|
||||||
events_url: 'https://api.github.com/repos/docker/test-docker-action/events',
|
|
||||||
fork: false,
|
|
||||||
forks: 1,
|
|
||||||
forks_count: 1,
|
|
||||||
forks_url: 'https://api.github.com/repos/docker/test-docker-action/forks',
|
|
||||||
full_name: 'docker/test-docker-action',
|
|
||||||
git_commits_url: 'https://api.github.com/repos/docker/test-docker-action/git/commits{/sha}',
|
|
||||||
git_refs_url: 'https://api.github.com/repos/docker/test-docker-action/git/refs{/sha}',
|
|
||||||
git_tags_url: 'https://api.github.com/repos/docker/test-docker-action/git/tags{/sha}',
|
|
||||||
git_url: 'git://github.com/docker/test-docker-action.git',
|
|
||||||
has_downloads: true,
|
|
||||||
has_issues: true,
|
|
||||||
has_pages: false,
|
|
||||||
has_projects: true,
|
|
||||||
has_wiki: true,
|
|
||||||
homepage: '',
|
|
||||||
hooks_url: 'https://api.github.com/repos/docker/test-docker-action/hooks',
|
|
||||||
html_url: 'https://github.com/docker/test-docker-action',
|
|
||||||
id: 285789493,
|
|
||||||
is_template: false,
|
|
||||||
issue_comment_url: 'https://api.github.com/repos/docker/test-docker-action/issues/comments{/number}',
|
|
||||||
issue_events_url: 'https://api.github.com/repos/docker/test-docker-action/issues/events{/number}',
|
|
||||||
issues_url: 'https://api.github.com/repos/docker/test-docker-action/issues{/number}',
|
|
||||||
keys_url: 'https://api.github.com/repos/docker/test-docker-action/keys{/key_id}',
|
|
||||||
labels_url: 'https://api.github.com/repos/docker/test-docker-action/labels{/name}',
|
|
||||||
language: 'JavaScript',
|
|
||||||
languages_url: 'https://api.github.com/repos/docker/test-docker-action/languages',
|
|
||||||
license: {
|
|
||||||
key: 'mit',
|
|
||||||
name: 'MIT License',
|
|
||||||
node_id: 'MDc6TGljZW5zZTEz',
|
|
||||||
spdx_id: 'MIT',
|
|
||||||
url: 'https://api.github.com/licenses/mit'
|
|
||||||
},
|
|
||||||
master_branch: 'master',
|
|
||||||
merges_url: 'https://api.github.com/repos/docker/test-docker-action/merges',
|
|
||||||
milestones_url: 'https://api.github.com/repos/docker/test-docker-action/milestones{/number}',
|
|
||||||
mirror_url: null,
|
|
||||||
name: 'test-docker-action',
|
|
||||||
node_id: 'MDEwOlJlcG9zaXRvcnkyODU3ODk0OTM=',
|
|
||||||
notifications_url: 'https://api.github.com/repos/docker/test-docker-action/notifications{?since,all,participating}',
|
|
||||||
open_issues: 6,
|
|
||||||
open_issues_count: 6,
|
|
||||||
organization: 'docker',
|
|
||||||
owner: {
|
|
||||||
avatar_url: 'https://avatars.githubusercontent.com/u/5429470?v=4',
|
|
||||||
email: 'info@docker.com',
|
|
||||||
events_url: 'https://api.github.com/users/docker/events{/privacy}',
|
|
||||||
followers_url: 'https://api.github.com/users/docker/followers',
|
|
||||||
following_url: 'https://api.github.com/users/docker/following{/other_user}',
|
|
||||||
gists_url: 'https://api.github.com/users/docker/gists{/gist_id}',
|
|
||||||
gravatar_id: '',
|
|
||||||
html_url: 'https://github.com/docker',
|
|
||||||
id: 5429470,
|
|
||||||
login: 'docker',
|
|
||||||
name: 'docker',
|
|
||||||
node_id: 'MDEyOk9yZ2FuaXphdGlvbjU0Mjk0NzA=',
|
|
||||||
organizations_url: 'https://api.github.com/users/docker/orgs',
|
|
||||||
received_events_url: 'https://api.github.com/users/docker/received_events',
|
|
||||||
repos_url: 'https://api.github.com/users/docker/repos',
|
|
||||||
site_admin: false,
|
|
||||||
starred_url: 'https://api.github.com/users/docker/starred{/owner}{/repo}',
|
|
||||||
subscriptions_url: 'https://api.github.com/users/docker/subscriptions',
|
|
||||||
type: 'Organization',
|
|
||||||
url: 'https://api.github.com/users/docker'
|
|
||||||
},
|
|
||||||
private: true,
|
|
||||||
pulls_url: 'https://api.github.com/repos/docker/test-docker-action/pulls{/number}',
|
|
||||||
pushed_at: 1650360446,
|
|
||||||
releases_url: 'https://api.github.com/repos/docker/test-docker-action/releases{/id}',
|
|
||||||
size: 796,
|
|
||||||
ssh_url: 'git@github.com:docker/test-docker-action.git',
|
|
||||||
stargazers: 0,
|
|
||||||
stargazers_count: 0,
|
|
||||||
stargazers_url: 'https://api.github.com/repos/docker/test-docker-action/stargazers',
|
|
||||||
statuses_url: 'https://api.github.com/repos/docker/test-docker-action/statuses/{sha}',
|
|
||||||
subscribers_url: 'https://api.github.com/repos/docker/test-docker-action/subscribers',
|
|
||||||
subscription_url: 'https://api.github.com/repos/docker/test-docker-action/subscription',
|
|
||||||
svn_url: 'https://github.com/docker/test-docker-action',
|
|
||||||
tags_url: 'https://api.github.com/repos/docker/test-docker-action/tags',
|
|
||||||
teams_url: 'https://api.github.com/repos/docker/test-docker-action/teams',
|
|
||||||
topics: [],
|
|
||||||
trees_url: 'https://api.github.com/repos/docker/test-docker-action/git/trees{/sha}',
|
|
||||||
updated_at: '2022-04-19T09:05:09Z',
|
|
||||||
url: 'https://github.com/docker/test-docker-action',
|
|
||||||
visibility: 'private',
|
|
||||||
watchers: 0,
|
|
||||||
watchers_count: 0
|
|
||||||
},
|
|
||||||
sender: {
|
|
||||||
avatar_url: 'https://avatars.githubusercontent.com/u/1951866?v=4',
|
|
||||||
events_url: 'https://api.github.com/users/crazy-max/events{/privacy}',
|
|
||||||
followers_url: 'https://api.github.com/users/crazy-max/followers',
|
|
||||||
following_url: 'https://api.github.com/users/crazy-max/following{/other_user}',
|
|
||||||
gists_url: 'https://api.github.com/users/crazy-max/gists{/gist_id}',
|
|
||||||
gravatar_id: '',
|
|
||||||
html_url: 'https://github.com/crazy-max',
|
|
||||||
id: 1951866,
|
|
||||||
login: 'crazy-max',
|
|
||||||
node_id: 'MDQ6VXNlcjE5NTE4NjY=',
|
|
||||||
organizations_url: 'https://api.github.com/users/crazy-max/orgs',
|
|
||||||
received_events_url: 'https://api.github.com/users/crazy-max/received_events',
|
|
||||||
repos_url: 'https://api.github.com/users/crazy-max/repos',
|
|
||||||
site_admin: false,
|
|
||||||
starred_url: 'https://api.github.com/users/crazy-max/starred{/owner}{/repo}',
|
|
||||||
subscriptions_url: 'https://api.github.com/users/crazy-max/subscriptions',
|
|
||||||
type: 'User',
|
|
||||||
url: 'https://api.github.com/users/crazy-max'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
export const getOctokit = jest.fn();
|
|
||||||
+262
-139
@@ -1,120 +1,48 @@
|
|||||||
import {beforeEach, describe, expect, jest, test} from '@jest/globals';
|
import {afterEach, beforeEach, describe, expect, test, vi} from 'vitest';
|
||||||
import * as fs from 'fs';
|
import * as fs from 'fs';
|
||||||
|
import * as os from 'os';
|
||||||
import * as path from 'path';
|
import * as path from 'path';
|
||||||
import {Bake} from '@docker/actions-toolkit/lib/buildx/bake';
|
|
||||||
import {Builder} from '@docker/actions-toolkit/lib/buildx/builder';
|
|
||||||
import {Buildx} from '@docker/actions-toolkit/lib/buildx/buildx';
|
|
||||||
import {Context} from '@docker/actions-toolkit/lib/context';
|
|
||||||
import {Docker} from '@docker/actions-toolkit/lib/docker/docker';
|
|
||||||
import {GitHub} from '@docker/actions-toolkit/lib/github';
|
|
||||||
import {Toolkit} from '@docker/actions-toolkit/lib/toolkit';
|
|
||||||
import {BakeDefinition} from '@docker/actions-toolkit/lib/types/bake';
|
|
||||||
import {BuilderInfo} from '@docker/actions-toolkit/lib/types/builder';
|
|
||||||
import {GitHubRepo} from '@docker/actions-toolkit/lib/types/github';
|
|
||||||
|
|
||||||
import * as context from '../src/context';
|
import {Bake} from '@docker/actions-toolkit/lib/buildx/bake.js';
|
||||||
|
import {Build} from '@docker/actions-toolkit/lib/buildx/build.js';
|
||||||
|
import {Builder} from '@docker/actions-toolkit/lib/buildx/builder.js';
|
||||||
|
import {Buildx} from '@docker/actions-toolkit/lib/buildx/buildx.js';
|
||||||
|
import {Docker} from '@docker/actions-toolkit/lib/docker/docker.js';
|
||||||
|
import {Toolkit} from '@docker/actions-toolkit/lib/toolkit.js';
|
||||||
|
|
||||||
const tmpDir = path.join('/tmp', '.docker-bake-action-jest');
|
import {BakeDefinition} from '@docker/actions-toolkit/lib/types/buildx/bake.js';
|
||||||
const tmpName = path.join(tmpDir, '.tmpname-jest');
|
import {BuilderInfo} from '@docker/actions-toolkit/lib/types/buildx/builder.js';
|
||||||
|
|
||||||
import repoFixture from './fixtures/github-repo.json';
|
import * as context from '../src/context.js';
|
||||||
jest.spyOn(GitHub.prototype, 'repoData').mockImplementation((): Promise<GitHubRepo> => {
|
|
||||||
return <Promise<GitHubRepo>>(repoFixture as unknown);
|
|
||||||
});
|
|
||||||
|
|
||||||
jest.spyOn(Context, 'tmpDir').mockImplementation((): string => {
|
const tmpDir = fs.mkdtempSync(path.join(process.env.TEMP || os.tmpdir(), 'context-'));
|
||||||
if (!fs.existsSync(tmpDir)) {
|
const fixturesDir = path.join(__dirname, 'fixtures');
|
||||||
fs.mkdirSync(tmpDir, {recursive: true});
|
|
||||||
}
|
|
||||||
return tmpDir;
|
|
||||||
});
|
|
||||||
|
|
||||||
jest.spyOn(Context, 'tmpName').mockImplementation((): string => {
|
vi.spyOn(Docker, 'isAvailable').mockImplementation(async (): Promise<boolean> => {
|
||||||
return tmpName;
|
|
||||||
});
|
|
||||||
|
|
||||||
jest.spyOn(Docker, 'isAvailable').mockImplementation(async (): Promise<boolean> => {
|
|
||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
|
|
||||||
jest.spyOn(Builder.prototype, 'inspect').mockImplementation(async (): Promise<BuilderInfo> => {
|
const metadataJson = path.join(tmpDir, 'metadata.json');
|
||||||
|
vi.spyOn(Bake.prototype, 'getMetadataFilePath').mockImplementation((): string => {
|
||||||
|
return metadataJson;
|
||||||
|
});
|
||||||
|
|
||||||
|
type BuilderInfoFixture = Omit<BuilderInfo, 'lastActivity'> & {lastActivity: string};
|
||||||
|
const builderInfoFixture = <BuilderInfoFixture>JSON.parse(fs.readFileSync(path.join(fixturesDir, 'builder-info.json'), {encoding: 'utf-8'}).trim());
|
||||||
|
vi.spyOn(Builder.prototype, 'inspect').mockImplementation(async (): Promise<BuilderInfo> => {
|
||||||
return {
|
return {
|
||||||
name: 'builder2',
|
...builderInfoFixture,
|
||||||
driver: 'docker-container',
|
lastActivity: new Date(builderInfoFixture.lastActivity)
|
||||||
lastActivity: new Date('2023-01-16 09:45:23 +0000 UTC'),
|
|
||||||
nodes: [
|
|
||||||
{
|
|
||||||
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'],
|
|
||||||
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',
|
|
||||||
status: 'running'
|
|
||||||
}
|
|
||||||
]
|
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
jest.spyOn(Bake.prototype, 'getDefinition').mockImplementation(async (): Promise<BakeDefinition> => {
|
vi.spyOn(Bake.prototype, 'getDefinition').mockImplementation(async (): Promise<BakeDefinition> => {
|
||||||
return JSON.parse(`{
|
return <BakeDefinition>JSON.parse(fs.readFileSync(path.join(fixturesDir, 'bake-def.json'), {encoding: 'utf-8'}).trim());
|
||||||
"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"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}`) as BakeDefinition;
|
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('getArgs', () => {
|
describe('getInputs', () => {
|
||||||
|
const originalEnv = process.env;
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
process.env = Object.keys(process.env).reduce((object, key) => {
|
process.env = Object.keys(process.env).reduce((object, key) => {
|
||||||
if (!key.startsWith('INPUT_')) {
|
if (!key.startsWith('INPUT_')) {
|
||||||
@@ -124,12 +52,64 @@ describe('getArgs', () => {
|
|||||||
}, {});
|
}, {});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
afterEach(() => {
|
||||||
|
process.env = originalEnv;
|
||||||
|
});
|
||||||
|
|
||||||
|
function setRequiredBooleanInputs(): void {
|
||||||
|
setInput('no-cache', 'false');
|
||||||
|
setInput('pull', 'false');
|
||||||
|
setInput('load', 'false');
|
||||||
|
setInput('push', 'false');
|
||||||
|
}
|
||||||
|
|
||||||
|
test('uses Build git context when source input is empty', async () => {
|
||||||
|
const gitContext = 'https://github.com/docker/bake-action.git?ref=refs/heads/master&checksum=0123456789abcdef';
|
||||||
|
const gitContextSpy = vi.spyOn(Build.prototype, 'gitContext').mockResolvedValue(gitContext);
|
||||||
|
setRequiredBooleanInputs();
|
||||||
|
const inputs = await context.getInputs();
|
||||||
|
expect(inputs.source).toEqual({
|
||||||
|
remoteRef: gitContext
|
||||||
|
});
|
||||||
|
expect(gitContextSpy).toHaveBeenCalledTimes(1);
|
||||||
|
gitContextSpy.mockRestore();
|
||||||
|
});
|
||||||
|
|
||||||
|
test('renders defaultContext source templates from Build git context', async () => {
|
||||||
|
const gitContext = 'https://github.com/docker/bake-action.git#refs/heads/master';
|
||||||
|
const gitContextSpy = vi.spyOn(Build.prototype, 'gitContext').mockResolvedValue(gitContext);
|
||||||
|
setRequiredBooleanInputs();
|
||||||
|
setInput('source', '{{defaultContext}}:subdir');
|
||||||
|
const inputs = await context.getInputs();
|
||||||
|
expect(inputs.source).toEqual({
|
||||||
|
remoteRef: `${gitContext}:subdir`
|
||||||
|
});
|
||||||
|
expect(gitContextSpy).toHaveBeenCalledTimes(1);
|
||||||
|
gitContextSpy.mockRestore();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('getArgs', () => {
|
||||||
|
const originalEnv = process.env;
|
||||||
|
beforeEach(() => {
|
||||||
|
process.env = Object.keys(process.env).reduce((object, key) => {
|
||||||
|
if (!key.startsWith('INPUT_')) {
|
||||||
|
object[key] = process.env[key];
|
||||||
|
}
|
||||||
|
return object;
|
||||||
|
}, {});
|
||||||
|
});
|
||||||
|
afterEach(() => {
|
||||||
|
process.env = originalEnv;
|
||||||
|
});
|
||||||
|
|
||||||
// prettier-ignore
|
// prettier-ignore
|
||||||
test.each([
|
test.each([
|
||||||
[
|
[
|
||||||
0,
|
0,
|
||||||
'0.4.1',
|
'0.4.1',
|
||||||
new Map<string, string>([
|
new Map<string, string>([
|
||||||
|
['source', '.'],
|
||||||
['load', 'false'],
|
['load', 'false'],
|
||||||
['no-cache', 'false'],
|
['no-cache', 'false'],
|
||||||
['push', 'false'],
|
['push', 'false'],
|
||||||
@@ -137,12 +117,14 @@ describe('getArgs', () => {
|
|||||||
]),
|
]),
|
||||||
[
|
[
|
||||||
'bake',
|
'bake',
|
||||||
]
|
],
|
||||||
|
undefined
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
1,
|
1,
|
||||||
'0.8.2',
|
'0.8.2',
|
||||||
new Map<string, string>([
|
new Map<string, string>([
|
||||||
|
['source', '.'],
|
||||||
['load', 'false'],
|
['load', 'false'],
|
||||||
['no-cache', 'false'],
|
['no-cache', 'false'],
|
||||||
['push', 'false'],
|
['push', 'false'],
|
||||||
@@ -150,13 +132,15 @@ describe('getArgs', () => {
|
|||||||
]),
|
]),
|
||||||
[
|
[
|
||||||
'bake',
|
'bake',
|
||||||
'--metadata-file', path.join(tmpDir, 'metadata-file')
|
'--metadata-file', metadataJson
|
||||||
]
|
],
|
||||||
|
undefined
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
2,
|
2,
|
||||||
'0.8.2',
|
'0.8.2',
|
||||||
new Map<string, string>([
|
new Map<string, string>([
|
||||||
|
['source', '.'],
|
||||||
['targets', 'webapp\nvalidate'],
|
['targets', 'webapp\nvalidate'],
|
||||||
['load', 'false'],
|
['load', 'false'],
|
||||||
['no-cache', 'false'],
|
['no-cache', 'false'],
|
||||||
@@ -165,14 +149,16 @@ describe('getArgs', () => {
|
|||||||
]),
|
]),
|
||||||
[
|
[
|
||||||
'bake',
|
'bake',
|
||||||
'--metadata-file', path.join(tmpDir, 'metadata-file'),
|
'--metadata-file', metadataJson,
|
||||||
'webapp', 'validate'
|
'webapp', 'validate'
|
||||||
]
|
],
|
||||||
|
undefined
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
3,
|
3,
|
||||||
'0.8.2',
|
'0.8.2',
|
||||||
new Map<string, string>([
|
new Map<string, string>([
|
||||||
|
['source', '.'],
|
||||||
['set', '*.cache-from=type=gha\n*.cache-to=type=gha'],
|
['set', '*.cache-from=type=gha\n*.cache-to=type=gha'],
|
||||||
['load', 'false'],
|
['load', 'false'],
|
||||||
['no-cache', 'false'],
|
['no-cache', 'false'],
|
||||||
@@ -183,13 +169,15 @@ describe('getArgs', () => {
|
|||||||
'bake',
|
'bake',
|
||||||
'--set', '*.cache-from=type=gha',
|
'--set', '*.cache-from=type=gha',
|
||||||
'--set', '*.cache-to=type=gha',
|
'--set', '*.cache-to=type=gha',
|
||||||
'--metadata-file', path.join(tmpDir, 'metadata-file')
|
'--metadata-file', metadataJson
|
||||||
]
|
],
|
||||||
|
undefined
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
4,
|
4,
|
||||||
'0.10.0',
|
'0.10.0',
|
||||||
new Map<string, string>([
|
new Map<string, string>([
|
||||||
|
['source', '.'],
|
||||||
['load', 'false'],
|
['load', 'false'],
|
||||||
['no-cache', 'false'],
|
['no-cache', 'false'],
|
||||||
['push', 'false'],
|
['push', 'false'],
|
||||||
@@ -197,14 +185,18 @@ describe('getArgs', () => {
|
|||||||
]),
|
]),
|
||||||
[
|
[
|
||||||
'bake',
|
'bake',
|
||||||
'--metadata-file', path.join(tmpDir, 'metadata-file'),
|
'--metadata-file', metadataJson,
|
||||||
"--provenance", `mode=min,inline-only=true,builder-id=https://github.com/docker/build-push-action/actions/runs/123456789`,
|
'--set', `lint.attest=type=provenance,mode=min,inline-only=true,builder-id=https://github.com/docker/bake-action/actions/runs/123456789/attempts/1`,
|
||||||
]
|
'--set', `validate-docs.attest=type=provenance,mode=min,inline-only=true,builder-id=https://github.com/docker/bake-action/actions/runs/123456789/attempts/1`,
|
||||||
|
'--set', `validate-vendor.attest=type=provenance,mode=min,inline-only=true,builder-id=https://github.com/docker/bake-action/actions/runs/123456789/attempts/1`,
|
||||||
|
],
|
||||||
|
undefined
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
5,
|
5,
|
||||||
'0.10.0',
|
'0.10.0',
|
||||||
new Map<string, string>([
|
new Map<string, string>([
|
||||||
|
['source', '.'],
|
||||||
['load', 'false'],
|
['load', 'false'],
|
||||||
['no-cache', 'false'],
|
['no-cache', 'false'],
|
||||||
['push', 'false'],
|
['push', 'false'],
|
||||||
@@ -213,14 +205,16 @@ describe('getArgs', () => {
|
|||||||
]),
|
]),
|
||||||
[
|
[
|
||||||
'bake',
|
'bake',
|
||||||
'--metadata-file', path.join(tmpDir, 'metadata-file'),
|
'--metadata-file', metadataJson,
|
||||||
"--provenance", `builder-id=https://github.com/docker/build-push-action/actions/runs/123456789`
|
"--provenance", `builder-id=https://github.com/docker/bake-action/actions/runs/123456789/attempts/1`
|
||||||
]
|
],
|
||||||
|
undefined
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
6,
|
6,
|
||||||
'0.10.0',
|
'0.10.0',
|
||||||
new Map<string, string>([
|
new Map<string, string>([
|
||||||
|
['source', '.'],
|
||||||
['load', 'false'],
|
['load', 'false'],
|
||||||
['no-cache', 'false'],
|
['no-cache', 'false'],
|
||||||
['push', 'false'],
|
['push', 'false'],
|
||||||
@@ -229,14 +223,16 @@ describe('getArgs', () => {
|
|||||||
]),
|
]),
|
||||||
[
|
[
|
||||||
'bake',
|
'bake',
|
||||||
'--metadata-file', path.join(tmpDir, 'metadata-file'),
|
'--metadata-file', metadataJson,
|
||||||
"--provenance", `mode=max,builder-id=https://github.com/docker/build-push-action/actions/runs/123456789`
|
"--provenance", `mode=max,builder-id=https://github.com/docker/bake-action/actions/runs/123456789/attempts/1`
|
||||||
]
|
],
|
||||||
|
undefined
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
7,
|
7,
|
||||||
'0.10.0',
|
'0.10.0',
|
||||||
new Map<string, string>([
|
new Map<string, string>([
|
||||||
|
['source', '.'],
|
||||||
['load', 'false'],
|
['load', 'false'],
|
||||||
['no-cache', 'false'],
|
['no-cache', 'false'],
|
||||||
['push', 'false'],
|
['push', 'false'],
|
||||||
@@ -245,14 +241,16 @@ describe('getArgs', () => {
|
|||||||
]),
|
]),
|
||||||
[
|
[
|
||||||
'bake',
|
'bake',
|
||||||
'--metadata-file', path.join(tmpDir, 'metadata-file'),
|
'--metadata-file', metadataJson,
|
||||||
"--provenance", 'false'
|
"--provenance", 'false'
|
||||||
]
|
],
|
||||||
|
undefined
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
8,
|
8,
|
||||||
'0.10.0',
|
'0.10.0',
|
||||||
new Map<string, string>([
|
new Map<string, string>([
|
||||||
|
['source', '.'],
|
||||||
['load', 'false'],
|
['load', 'false'],
|
||||||
['no-cache', 'false'],
|
['no-cache', 'false'],
|
||||||
['push', 'false'],
|
['push', 'false'],
|
||||||
@@ -261,14 +259,16 @@ describe('getArgs', () => {
|
|||||||
]),
|
]),
|
||||||
[
|
[
|
||||||
'bake',
|
'bake',
|
||||||
'--metadata-file', path.join(tmpDir, 'metadata-file'),
|
'--metadata-file', metadataJson,
|
||||||
"--provenance", 'builder-id=foo'
|
"--provenance", 'builder-id=foo'
|
||||||
]
|
],
|
||||||
|
undefined
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
9,
|
9,
|
||||||
'0.10.0',
|
'0.10.0',
|
||||||
new Map<string, string>([
|
new Map<string, string>([
|
||||||
|
['source', '.'],
|
||||||
['load', 'false'],
|
['load', 'false'],
|
||||||
['no-cache', 'false'],
|
['no-cache', 'false'],
|
||||||
['push', 'false'],
|
['push', 'false'],
|
||||||
@@ -280,15 +280,19 @@ describe('getArgs', () => {
|
|||||||
'bake',
|
'bake',
|
||||||
'--set', '*.platform=linux/amd64,linux/ppc64le,linux/s390x',
|
'--set', '*.platform=linux/amd64,linux/ppc64le,linux/s390x',
|
||||||
'--set', `*.output=type=image,"name=moby/buildkit:v0.11.0,moby/buildkit:latest",push=true`,
|
'--set', `*.output=type=image,"name=moby/buildkit:v0.11.0,moby/buildkit:latest",push=true`,
|
||||||
'--metadata-file', path.join(tmpDir, 'metadata-file'),
|
'--metadata-file', metadataJson,
|
||||||
'--provenance', `mode=min,inline-only=true,builder-id=https://github.com/docker/build-push-action/actions/runs/123456789`,
|
'--set', `lint.attest=type=provenance,mode=min,inline-only=true,builder-id=https://github.com/docker/bake-action/actions/runs/123456789/attempts/1`,
|
||||||
|
'--set', `validate-docs.attest=type=provenance,mode=min,inline-only=true,builder-id=https://github.com/docker/bake-action/actions/runs/123456789/attempts/1`,
|
||||||
|
'--set', `validate-vendor.attest=type=provenance,mode=min,inline-only=true,builder-id=https://github.com/docker/bake-action/actions/runs/123456789/attempts/1`,
|
||||||
'image-all'
|
'image-all'
|
||||||
]
|
],
|
||||||
|
undefined
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
10,
|
10,
|
||||||
'0.10.0',
|
'0.10.0',
|
||||||
new Map<string, string>([
|
new Map<string, string>([
|
||||||
|
['source', '.'],
|
||||||
['load', 'false'],
|
['load', 'false'],
|
||||||
['no-cache', 'false'],
|
['no-cache', 'false'],
|
||||||
['push', 'false'],
|
['push', 'false'],
|
||||||
@@ -299,16 +303,18 @@ describe('getArgs', () => {
|
|||||||
[
|
[
|
||||||
'bake',
|
'bake',
|
||||||
'--set', `*.labels.foo=bar=#baz`,
|
'--set', `*.labels.foo=bar=#baz`,
|
||||||
'--metadata-file', path.join(tmpDir, 'metadata-file'),
|
'--metadata-file', metadataJson,
|
||||||
'--provenance', `mode=min,inline-only=true,builder-id=https://github.com/docker/build-push-action/actions/runs/123456789`,
|
'--set', `lint.attest=type=provenance,mode=min,inline-only=true,builder-id=https://github.com/docker/bake-action/actions/runs/123456789/attempts/1`,
|
||||||
|
'--set', `validate-docs.attest=type=provenance,mode=min,inline-only=true,builder-id=https://github.com/docker/bake-action/actions/runs/123456789/attempts/1`,
|
||||||
|
'--set', `validate-vendor.attest=type=provenance,mode=min,inline-only=true,builder-id=https://github.com/docker/bake-action/actions/runs/123456789/attempts/1`,
|
||||||
'image-all'
|
'image-all'
|
||||||
]
|
],
|
||||||
|
undefined
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
11,
|
11,
|
||||||
'0.10.0',
|
'0.10.0',
|
||||||
new Map<string, string>([
|
new Map<string, string>([
|
||||||
['source', '{{defaultContext}}'],
|
|
||||||
['load', 'false'],
|
['load', 'false'],
|
||||||
['no-cache', 'false'],
|
['no-cache', 'false'],
|
||||||
['push', 'false'],
|
['push', 'false'],
|
||||||
@@ -317,37 +323,154 @@ describe('getArgs', () => {
|
|||||||
]),
|
]),
|
||||||
[
|
[
|
||||||
'bake',
|
'bake',
|
||||||
'https://github.com/docker/build-push-action.git#refs/heads/master',
|
'https://github.com/docker/bake-action.git#refs/heads/master',
|
||||||
'--file', './foo.hcl',
|
'--file', './foo.hcl',
|
||||||
'--metadata-file', path.join(tmpDir, 'metadata-file'),
|
'--metadata-file', metadataJson,
|
||||||
'--provenance', `mode=min,inline-only=true,builder-id=https://github.com/docker/build-push-action/actions/runs/123456789`,
|
'--set', `lint.attest=type=provenance,mode=min,inline-only=true,builder-id=https://github.com/docker/bake-action/actions/runs/123456789/attempts/1`,
|
||||||
]
|
'--set', `validate-docs.attest=type=provenance,mode=min,inline-only=true,builder-id=https://github.com/docker/bake-action/actions/runs/123456789/attempts/1`,
|
||||||
|
'--set', `validate-vendor.attest=type=provenance,mode=min,inline-only=true,builder-id=https://github.com/docker/bake-action/actions/runs/123456789/attempts/1`
|
||||||
|
],
|
||||||
|
undefined
|
||||||
|
],
|
||||||
|
[
|
||||||
|
12,
|
||||||
|
'0.17.0',
|
||||||
|
new Map<string, string>([
|
||||||
|
['source', '.'],
|
||||||
|
['allow', 'network.host'],
|
||||||
|
['load', 'false'],
|
||||||
|
['no-cache', 'false'],
|
||||||
|
['push', 'false'],
|
||||||
|
['pull', 'false'],
|
||||||
|
]),
|
||||||
|
[
|
||||||
|
'bake',
|
||||||
|
'--allow', 'network.host',
|
||||||
|
'--metadata-file', metadataJson,
|
||||||
|
'--set', `lint.attest=type=provenance,mode=min,inline-only=true,builder-id=https://github.com/docker/bake-action/actions/runs/123456789/attempts/1`,
|
||||||
|
'--set', `validate-docs.attest=type=provenance,mode=min,inline-only=true,builder-id=https://github.com/docker/bake-action/actions/runs/123456789/attempts/1`,
|
||||||
|
'--set', `validate-vendor.attest=type=provenance,mode=min,inline-only=true,builder-id=https://github.com/docker/bake-action/actions/runs/123456789/attempts/1`
|
||||||
|
],
|
||||||
|
undefined
|
||||||
|
],
|
||||||
|
[
|
||||||
|
13,
|
||||||
|
'0.15.0',
|
||||||
|
new Map<string, string>([
|
||||||
|
['source', '{{defaultContext}}:subdir'],
|
||||||
|
['load', 'false'],
|
||||||
|
['no-cache', 'false'],
|
||||||
|
['push', 'false'],
|
||||||
|
['pull', 'false'],
|
||||||
|
['files', './foo.hcl'],
|
||||||
|
]),
|
||||||
|
[
|
||||||
|
'bake',
|
||||||
|
'https://github.com/docker/bake-action.git#refs/heads/master:subdir',
|
||||||
|
'--file', './foo.hcl',
|
||||||
|
'--metadata-file', metadataJson,
|
||||||
|
'--set', `lint.attest=type=provenance,mode=min,inline-only=true,builder-id=https://github.com/docker/bake-action/actions/runs/123456789/attempts/1`,
|
||||||
|
'--set', `validate-docs.attest=type=provenance,mode=min,inline-only=true,builder-id=https://github.com/docker/bake-action/actions/runs/123456789/attempts/1`,
|
||||||
|
'--set', `validate-vendor.attest=type=provenance,mode=min,inline-only=true,builder-id=https://github.com/docker/bake-action/actions/runs/123456789/attempts/1`
|
||||||
|
],
|
||||||
|
undefined
|
||||||
|
],
|
||||||
|
[
|
||||||
|
14,
|
||||||
|
'0.15.0',
|
||||||
|
new Map<string, string>([
|
||||||
|
['source', '.'],
|
||||||
|
['load', 'false'],
|
||||||
|
['no-cache', 'false'],
|
||||||
|
['push', 'false'],
|
||||||
|
['pull', 'false']
|
||||||
|
]),
|
||||||
|
[
|
||||||
|
'bake',
|
||||||
|
'--metadata-file', metadataJson
|
||||||
|
],
|
||||||
|
new Map<string, string>([
|
||||||
|
['BUILDX_NO_DEFAULT_ATTESTATIONS', '1']
|
||||||
|
])
|
||||||
|
],
|
||||||
|
[
|
||||||
|
15,
|
||||||
|
'0.29.0',
|
||||||
|
new Map<string, string>([
|
||||||
|
['load', 'false'],
|
||||||
|
['no-cache', 'false'],
|
||||||
|
['push', 'false'],
|
||||||
|
['pull', 'false'],
|
||||||
|
['files', './foo.hcl'],
|
||||||
|
]),
|
||||||
|
[
|
||||||
|
'bake',
|
||||||
|
'https://github.com/docker/bake-action.git?ref=refs/heads/master',
|
||||||
|
'--allow', 'fs=*',
|
||||||
|
'--file', './foo.hcl',
|
||||||
|
'--metadata-file', metadataJson,
|
||||||
|
'--set', `lint.attest=type=provenance,mode=min,inline-only=true,builder-id=https://github.com/docker/bake-action/actions/runs/123456789/attempts/1`,
|
||||||
|
'--set', `validate-docs.attest=type=provenance,mode=min,inline-only=true,builder-id=https://github.com/docker/bake-action/actions/runs/123456789/attempts/1`,
|
||||||
|
'--set', `validate-vendor.attest=type=provenance,mode=min,inline-only=true,builder-id=https://github.com/docker/bake-action/actions/runs/123456789/attempts/1`
|
||||||
|
],
|
||||||
|
new Map<string, string>([
|
||||||
|
['BUILDX_SEND_GIT_QUERY_AS_INPUT', 'true']
|
||||||
|
])
|
||||||
|
],
|
||||||
|
[
|
||||||
|
16,
|
||||||
|
'0.28.0',
|
||||||
|
new Map<string, string>([
|
||||||
|
['load', 'false'],
|
||||||
|
['no-cache', 'false'],
|
||||||
|
['push', 'false'],
|
||||||
|
['pull', 'false'],
|
||||||
|
['files', './foo.hcl'],
|
||||||
|
]),
|
||||||
|
[
|
||||||
|
'bake',
|
||||||
|
'https://github.com/docker/bake-action.git#refs/heads/master',
|
||||||
|
'--allow', 'fs=*',
|
||||||
|
'--file', './foo.hcl',
|
||||||
|
'--metadata-file', metadataJson,
|
||||||
|
'--set', `lint.attest=type=provenance,mode=min,inline-only=true,builder-id=https://github.com/docker/bake-action/actions/runs/123456789/attempts/1`,
|
||||||
|
'--set', `validate-docs.attest=type=provenance,mode=min,inline-only=true,builder-id=https://github.com/docker/bake-action/actions/runs/123456789/attempts/1`,
|
||||||
|
'--set', `validate-vendor.attest=type=provenance,mode=min,inline-only=true,builder-id=https://github.com/docker/bake-action/actions/runs/123456789/attempts/1`
|
||||||
|
],
|
||||||
|
new Map<string, string>([
|
||||||
|
['BUILDX_SEND_GIT_QUERY_AS_INPUT', 'true']
|
||||||
|
])
|
||||||
],
|
],
|
||||||
])(
|
])(
|
||||||
'[%d] given %p with %p as inputs, returns %p',
|
'[%d] given %o with %o as inputs, returns %o',
|
||||||
async (num: number, buildxVersion: string, inputs: Map<string, string>, expected: Array<string>) => {
|
async (num: number, buildxVersion: string, inputs: Map<string, string>, expected: Array<string>, envs: Map<string, string> | undefined) => {
|
||||||
|
if (envs) {
|
||||||
|
envs.forEach((value: string, name: string) => {
|
||||||
|
process.env[name] = value;
|
||||||
|
});
|
||||||
|
}
|
||||||
inputs.forEach((value: string, name: string) => {
|
inputs.forEach((value: string, name: string) => {
|
||||||
setInput(name, value);
|
setInput(name, value);
|
||||||
});
|
});
|
||||||
const toolkit = new Toolkit();
|
const toolkit = new Toolkit();
|
||||||
jest.spyOn(Buildx.prototype, 'version').mockImplementation(async (): Promise<string> => {
|
vi.spyOn(Buildx.prototype, 'version').mockImplementation(async (): Promise<string> => {
|
||||||
return buildxVersion;
|
return buildxVersion;
|
||||||
});
|
});
|
||||||
const inp = await context.getInputs();
|
const inp = await context.getInputs();
|
||||||
const definition = await toolkit.bake.getDefinition(
|
const definition = await toolkit.buildxBake.getDefinition(
|
||||||
{
|
{
|
||||||
files: inp.files,
|
files: inp.files,
|
||||||
load: inp.load,
|
load: inp.load,
|
||||||
noCache: inp.noCache,
|
noCache: inp['no-cache'],
|
||||||
overrides: inp.set,
|
overrides: inp.set,
|
||||||
provenance: inp.provenance,
|
provenance: inp.provenance,
|
||||||
push: inp.push,
|
push: inp.push,
|
||||||
sbom: inp.sbom,
|
sbom: inp.sbom,
|
||||||
source: inp.source,
|
source: inp.source.remoteRef,
|
||||||
targets: inp.targets
|
targets: inp.targets
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
cwd: inp.workdir
|
cwd: inp.source.workdir,
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
const res = await context.getArgs(inp, definition, toolkit);
|
const res = await context.getArgs(inp, definition, toolkit);
|
||||||
|
|||||||
@@ -0,0 +1,55 @@
|
|||||||
|
{
|
||||||
|
"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"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
{
|
||||||
|
"name": "builder2",
|
||||||
|
"driver": "docker-container",
|
||||||
|
"lastActivity": "2023-01-16 09:45:23 +0000 UTC",
|
||||||
|
"nodes": [
|
||||||
|
{
|
||||||
|
"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"
|
||||||
|
],
|
||||||
|
"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",
|
||||||
|
"status": "running"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
@@ -1,362 +0,0 @@
|
|||||||
{
|
|
||||||
"id": 1296269,
|
|
||||||
"node_id": "MDEwOlJlcG9zaXRvcnkxMjk2MjY5",
|
|
||||||
"name": "Hello-World",
|
|
||||||
"full_name": "octocat/Hello-World",
|
|
||||||
"owner": {
|
|
||||||
"login": "octocat",
|
|
||||||
"id": 1,
|
|
||||||
"node_id": "MDQ6VXNlcjE=",
|
|
||||||
"avatar_url": "https://github.com/images/error/octocat_happy.gif",
|
|
||||||
"gravatar_id": "",
|
|
||||||
"url": "https://api.github.com/users/octocat",
|
|
||||||
"html_url": "https://github.com/octocat",
|
|
||||||
"followers_url": "https://api.github.com/users/octocat/followers",
|
|
||||||
"following_url": "https://api.github.com/users/octocat/following{/other_user}",
|
|
||||||
"gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
|
|
||||||
"starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
|
|
||||||
"subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
|
|
||||||
"organizations_url": "https://api.github.com/users/octocat/orgs",
|
|
||||||
"repos_url": "https://api.github.com/users/octocat/repos",
|
|
||||||
"events_url": "https://api.github.com/users/octocat/events{/privacy}",
|
|
||||||
"received_events_url": "https://api.github.com/users/octocat/received_events",
|
|
||||||
"type": "User",
|
|
||||||
"site_admin": false
|
|
||||||
},
|
|
||||||
"private": false,
|
|
||||||
"html_url": "https://github.com/octocat/Hello-World",
|
|
||||||
"description": "This your first repo!",
|
|
||||||
"fork": false,
|
|
||||||
"url": "https://api.github.com/repos/octocat/Hello-World",
|
|
||||||
"archive_url": "http://api.github.com/repos/octocat/Hello-World/{archive_format}{/ref}",
|
|
||||||
"assignees_url": "http://api.github.com/repos/octocat/Hello-World/assignees{/user}",
|
|
||||||
"blobs_url": "http://api.github.com/repos/octocat/Hello-World/git/blobs{/sha}",
|
|
||||||
"branches_url": "http://api.github.com/repos/octocat/Hello-World/branches{/branch}",
|
|
||||||
"collaborators_url": "http://api.github.com/repos/octocat/Hello-World/collaborators{/collaborator}",
|
|
||||||
"comments_url": "http://api.github.com/repos/octocat/Hello-World/comments{/number}",
|
|
||||||
"commits_url": "http://api.github.com/repos/octocat/Hello-World/commits{/sha}",
|
|
||||||
"compare_url": "http://api.github.com/repos/octocat/Hello-World/compare/{base}...{head}",
|
|
||||||
"contents_url": "http://api.github.com/repos/octocat/Hello-World/contents/{+path}",
|
|
||||||
"contributors_url": "http://api.github.com/repos/octocat/Hello-World/contributors",
|
|
||||||
"deployments_url": "http://api.github.com/repos/octocat/Hello-World/deployments",
|
|
||||||
"downloads_url": "http://api.github.com/repos/octocat/Hello-World/downloads",
|
|
||||||
"events_url": "http://api.github.com/repos/octocat/Hello-World/events",
|
|
||||||
"forks_url": "http://api.github.com/repos/octocat/Hello-World/forks",
|
|
||||||
"git_commits_url": "http://api.github.com/repos/octocat/Hello-World/git/commits{/sha}",
|
|
||||||
"git_refs_url": "http://api.github.com/repos/octocat/Hello-World/git/refs{/sha}",
|
|
||||||
"git_tags_url": "http://api.github.com/repos/octocat/Hello-World/git/tags{/sha}",
|
|
||||||
"git_url": "git:github.com/octocat/Hello-World.git",
|
|
||||||
"issue_comment_url": "http://api.github.com/repos/octocat/Hello-World/issues/comments{/number}",
|
|
||||||
"issue_events_url": "http://api.github.com/repos/octocat/Hello-World/issues/events{/number}",
|
|
||||||
"issues_url": "http://api.github.com/repos/octocat/Hello-World/issues{/number}",
|
|
||||||
"keys_url": "http://api.github.com/repos/octocat/Hello-World/keys{/key_id}",
|
|
||||||
"labels_url": "http://api.github.com/repos/octocat/Hello-World/labels{/name}",
|
|
||||||
"languages_url": "http://api.github.com/repos/octocat/Hello-World/languages",
|
|
||||||
"merges_url": "http://api.github.com/repos/octocat/Hello-World/merges",
|
|
||||||
"milestones_url": "http://api.github.com/repos/octocat/Hello-World/milestones{/number}",
|
|
||||||
"notifications_url": "http://api.github.com/repos/octocat/Hello-World/notifications{?since,all,participating}",
|
|
||||||
"pulls_url": "http://api.github.com/repos/octocat/Hello-World/pulls{/number}",
|
|
||||||
"releases_url": "http://api.github.com/repos/octocat/Hello-World/releases{/id}",
|
|
||||||
"ssh_url": "git@github.com:octocat/Hello-World.git",
|
|
||||||
"stargazers_url": "http://api.github.com/repos/octocat/Hello-World/stargazers",
|
|
||||||
"statuses_url": "http://api.github.com/repos/octocat/Hello-World/statuses/{sha}",
|
|
||||||
"subscribers_url": "http://api.github.com/repos/octocat/Hello-World/subscribers",
|
|
||||||
"subscription_url": "http://api.github.com/repos/octocat/Hello-World/subscription",
|
|
||||||
"tags_url": "http://api.github.com/repos/octocat/Hello-World/tags",
|
|
||||||
"teams_url": "http://api.github.com/repos/octocat/Hello-World/teams",
|
|
||||||
"trees_url": "http://api.github.com/repos/octocat/Hello-World/git/trees{/sha}",
|
|
||||||
"clone_url": "https://github.com/octocat/Hello-World.git",
|
|
||||||
"mirror_url": "git:git.example.com/octocat/Hello-World",
|
|
||||||
"hooks_url": "http://api.github.com/repos/octocat/Hello-World/hooks",
|
|
||||||
"svn_url": "https://svn.github.com/octocat/Hello-World",
|
|
||||||
"homepage": "https://github.com",
|
|
||||||
"language": null,
|
|
||||||
"forks_count": 9,
|
|
||||||
"stargazers_count": 80,
|
|
||||||
"watchers_count": 80,
|
|
||||||
"size": 108,
|
|
||||||
"default_branch": "master",
|
|
||||||
"open_issues_count": 0,
|
|
||||||
"is_template": true,
|
|
||||||
"topics": [
|
|
||||||
"octocat",
|
|
||||||
"atom",
|
|
||||||
"electron",
|
|
||||||
"api"
|
|
||||||
],
|
|
||||||
"has_issues": true,
|
|
||||||
"has_projects": true,
|
|
||||||
"has_wiki": true,
|
|
||||||
"has_pages": false,
|
|
||||||
"has_downloads": true,
|
|
||||||
"archived": false,
|
|
||||||
"disabled": false,
|
|
||||||
"visibility": "public",
|
|
||||||
"pushed_at": "2011-01-26T19:06:43Z",
|
|
||||||
"created_at": "2011-01-26T19:01:12Z",
|
|
||||||
"updated_at": "2011-01-26T19:14:43Z",
|
|
||||||
"permissions": {
|
|
||||||
"pull": true,
|
|
||||||
"triage": true,
|
|
||||||
"push": false,
|
|
||||||
"maintain": false,
|
|
||||||
"admin": false
|
|
||||||
},
|
|
||||||
"allow_rebase_merge": true,
|
|
||||||
"template_repository": null,
|
|
||||||
"temp_clone_token": "ABTLWHOULUVAXGTRYU7OC2876QJ2O",
|
|
||||||
"allow_squash_merge": true,
|
|
||||||
"delete_branch_on_merge": true,
|
|
||||||
"allow_merge_commit": true,
|
|
||||||
"subscribers_count": 42,
|
|
||||||
"network_count": 0,
|
|
||||||
"license": {
|
|
||||||
"key": "mit",
|
|
||||||
"name": "MIT License",
|
|
||||||
"spdx_id": "MIT",
|
|
||||||
"url": "https://api.github.com/licenses/mit",
|
|
||||||
"node_id": "MDc6TGljZW5zZW1pdA=="
|
|
||||||
},
|
|
||||||
"organization": {
|
|
||||||
"login": "octocat",
|
|
||||||
"id": 1,
|
|
||||||
"node_id": "MDQ6VXNlcjE=",
|
|
||||||
"avatar_url": "https://github.com/images/error/octocat_happy.gif",
|
|
||||||
"gravatar_id": "",
|
|
||||||
"url": "https://api.github.com/users/octocat",
|
|
||||||
"html_url": "https://github.com/octocat",
|
|
||||||
"followers_url": "https://api.github.com/users/octocat/followers",
|
|
||||||
"following_url": "https://api.github.com/users/octocat/following{/other_user}",
|
|
||||||
"gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
|
|
||||||
"starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
|
|
||||||
"subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
|
|
||||||
"organizations_url": "https://api.github.com/users/octocat/orgs",
|
|
||||||
"repos_url": "https://api.github.com/users/octocat/repos",
|
|
||||||
"events_url": "https://api.github.com/users/octocat/events{/privacy}",
|
|
||||||
"received_events_url": "https://api.github.com/users/octocat/received_events",
|
|
||||||
"type": "Organization",
|
|
||||||
"site_admin": false
|
|
||||||
},
|
|
||||||
"parent": {
|
|
||||||
"id": 1296269,
|
|
||||||
"node_id": "MDEwOlJlcG9zaXRvcnkxMjk2MjY5",
|
|
||||||
"name": "Hello-World",
|
|
||||||
"full_name": "octocat/Hello-World",
|
|
||||||
"owner": {
|
|
||||||
"login": "octocat",
|
|
||||||
"id": 1,
|
|
||||||
"node_id": "MDQ6VXNlcjE=",
|
|
||||||
"avatar_url": "https://github.com/images/error/octocat_happy.gif",
|
|
||||||
"gravatar_id": "",
|
|
||||||
"url": "https://api.github.com/users/octocat",
|
|
||||||
"html_url": "https://github.com/octocat",
|
|
||||||
"followers_url": "https://api.github.com/users/octocat/followers",
|
|
||||||
"following_url": "https://api.github.com/users/octocat/following{/other_user}",
|
|
||||||
"gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
|
|
||||||
"starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
|
|
||||||
"subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
|
|
||||||
"organizations_url": "https://api.github.com/users/octocat/orgs",
|
|
||||||
"repos_url": "https://api.github.com/users/octocat/repos",
|
|
||||||
"events_url": "https://api.github.com/users/octocat/events{/privacy}",
|
|
||||||
"received_events_url": "https://api.github.com/users/octocat/received_events",
|
|
||||||
"type": "User",
|
|
||||||
"site_admin": false
|
|
||||||
},
|
|
||||||
"private": false,
|
|
||||||
"html_url": "https://github.com/octocat/Hello-World",
|
|
||||||
"description": "This your first repo!",
|
|
||||||
"fork": false,
|
|
||||||
"url": "https://api.github.com/repos/octocat/Hello-World",
|
|
||||||
"archive_url": "http://api.github.com/repos/octocat/Hello-World/{archive_format}{/ref}",
|
|
||||||
"assignees_url": "http://api.github.com/repos/octocat/Hello-World/assignees{/user}",
|
|
||||||
"blobs_url": "http://api.github.com/repos/octocat/Hello-World/git/blobs{/sha}",
|
|
||||||
"branches_url": "http://api.github.com/repos/octocat/Hello-World/branches{/branch}",
|
|
||||||
"collaborators_url": "http://api.github.com/repos/octocat/Hello-World/collaborators{/collaborator}",
|
|
||||||
"comments_url": "http://api.github.com/repos/octocat/Hello-World/comments{/number}",
|
|
||||||
"commits_url": "http://api.github.com/repos/octocat/Hello-World/commits{/sha}",
|
|
||||||
"compare_url": "http://api.github.com/repos/octocat/Hello-World/compare/{base}...{head}",
|
|
||||||
"contents_url": "http://api.github.com/repos/octocat/Hello-World/contents/{+path}",
|
|
||||||
"contributors_url": "http://api.github.com/repos/octocat/Hello-World/contributors",
|
|
||||||
"deployments_url": "http://api.github.com/repos/octocat/Hello-World/deployments",
|
|
||||||
"downloads_url": "http://api.github.com/repos/octocat/Hello-World/downloads",
|
|
||||||
"events_url": "http://api.github.com/repos/octocat/Hello-World/events",
|
|
||||||
"forks_url": "http://api.github.com/repos/octocat/Hello-World/forks",
|
|
||||||
"git_commits_url": "http://api.github.com/repos/octocat/Hello-World/git/commits{/sha}",
|
|
||||||
"git_refs_url": "http://api.github.com/repos/octocat/Hello-World/git/refs{/sha}",
|
|
||||||
"git_tags_url": "http://api.github.com/repos/octocat/Hello-World/git/tags{/sha}",
|
|
||||||
"git_url": "git:github.com/octocat/Hello-World.git",
|
|
||||||
"issue_comment_url": "http://api.github.com/repos/octocat/Hello-World/issues/comments{/number}",
|
|
||||||
"issue_events_url": "http://api.github.com/repos/octocat/Hello-World/issues/events{/number}",
|
|
||||||
"issues_url": "http://api.github.com/repos/octocat/Hello-World/issues{/number}",
|
|
||||||
"keys_url": "http://api.github.com/repos/octocat/Hello-World/keys{/key_id}",
|
|
||||||
"labels_url": "http://api.github.com/repos/octocat/Hello-World/labels{/name}",
|
|
||||||
"languages_url": "http://api.github.com/repos/octocat/Hello-World/languages",
|
|
||||||
"merges_url": "http://api.github.com/repos/octocat/Hello-World/merges",
|
|
||||||
"milestones_url": "http://api.github.com/repos/octocat/Hello-World/milestones{/number}",
|
|
||||||
"notifications_url": "http://api.github.com/repos/octocat/Hello-World/notifications{?since,all,participating}",
|
|
||||||
"pulls_url": "http://api.github.com/repos/octocat/Hello-World/pulls{/number}",
|
|
||||||
"releases_url": "http://api.github.com/repos/octocat/Hello-World/releases{/id}",
|
|
||||||
"ssh_url": "git@github.com:octocat/Hello-World.git",
|
|
||||||
"stargazers_url": "http://api.github.com/repos/octocat/Hello-World/stargazers",
|
|
||||||
"statuses_url": "http://api.github.com/repos/octocat/Hello-World/statuses/{sha}",
|
|
||||||
"subscribers_url": "http://api.github.com/repos/octocat/Hello-World/subscribers",
|
|
||||||
"subscription_url": "http://api.github.com/repos/octocat/Hello-World/subscription",
|
|
||||||
"tags_url": "http://api.github.com/repos/octocat/Hello-World/tags",
|
|
||||||
"teams_url": "http://api.github.com/repos/octocat/Hello-World/teams",
|
|
||||||
"trees_url": "http://api.github.com/repos/octocat/Hello-World/git/trees{/sha}",
|
|
||||||
"clone_url": "https://github.com/octocat/Hello-World.git",
|
|
||||||
"mirror_url": "git:git.example.com/octocat/Hello-World",
|
|
||||||
"hooks_url": "http://api.github.com/repos/octocat/Hello-World/hooks",
|
|
||||||
"svn_url": "https://svn.github.com/octocat/Hello-World",
|
|
||||||
"homepage": "https://github.com",
|
|
||||||
"language": null,
|
|
||||||
"forks_count": 9,
|
|
||||||
"stargazers_count": 80,
|
|
||||||
"watchers_count": 80,
|
|
||||||
"size": 108,
|
|
||||||
"default_branch": "master",
|
|
||||||
"open_issues_count": 0,
|
|
||||||
"is_template": true,
|
|
||||||
"topics": [
|
|
||||||
"octocat",
|
|
||||||
"atom",
|
|
||||||
"electron",
|
|
||||||
"api"
|
|
||||||
],
|
|
||||||
"has_issues": true,
|
|
||||||
"has_projects": true,
|
|
||||||
"has_wiki": true,
|
|
||||||
"has_pages": false,
|
|
||||||
"has_downloads": true,
|
|
||||||
"archived": false,
|
|
||||||
"disabled": false,
|
|
||||||
"visibility": "public",
|
|
||||||
"pushed_at": "2011-01-26T19:06:43Z",
|
|
||||||
"created_at": "2011-01-26T19:01:12Z",
|
|
||||||
"updated_at": "2011-01-26T19:14:43Z",
|
|
||||||
"permissions": {
|
|
||||||
"admin": false,
|
|
||||||
"push": false,
|
|
||||||
"pull": true
|
|
||||||
},
|
|
||||||
"allow_rebase_merge": true,
|
|
||||||
"template_repository": null,
|
|
||||||
"temp_clone_token": "ABTLWHOULUVAXGTRYU7OC2876QJ2O",
|
|
||||||
"allow_squash_merge": true,
|
|
||||||
"delete_branch_on_merge": true,
|
|
||||||
"allow_merge_commit": true,
|
|
||||||
"subscribers_count": 42,
|
|
||||||
"network_count": 0
|
|
||||||
},
|
|
||||||
"source": {
|
|
||||||
"id": 1296269,
|
|
||||||
"node_id": "MDEwOlJlcG9zaXRvcnkxMjk2MjY5",
|
|
||||||
"name": "Hello-World",
|
|
||||||
"full_name": "octocat/Hello-World",
|
|
||||||
"owner": {
|
|
||||||
"login": "octocat",
|
|
||||||
"id": 1,
|
|
||||||
"node_id": "MDQ6VXNlcjE=",
|
|
||||||
"avatar_url": "https://github.com/images/error/octocat_happy.gif",
|
|
||||||
"gravatar_id": "",
|
|
||||||
"url": "https://api.github.com/users/octocat",
|
|
||||||
"html_url": "https://github.com/octocat",
|
|
||||||
"followers_url": "https://api.github.com/users/octocat/followers",
|
|
||||||
"following_url": "https://api.github.com/users/octocat/following{/other_user}",
|
|
||||||
"gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
|
|
||||||
"starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
|
|
||||||
"subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
|
|
||||||
"organizations_url": "https://api.github.com/users/octocat/orgs",
|
|
||||||
"repos_url": "https://api.github.com/users/octocat/repos",
|
|
||||||
"events_url": "https://api.github.com/users/octocat/events{/privacy}",
|
|
||||||
"received_events_url": "https://api.github.com/users/octocat/received_events",
|
|
||||||
"type": "User",
|
|
||||||
"site_admin": false
|
|
||||||
},
|
|
||||||
"private": false,
|
|
||||||
"html_url": "https://github.com/octocat/Hello-World",
|
|
||||||
"description": "This your first repo!",
|
|
||||||
"fork": false,
|
|
||||||
"url": "https://api.github.com/repos/octocat/Hello-World",
|
|
||||||
"archive_url": "http://api.github.com/repos/octocat/Hello-World/{archive_format}{/ref}",
|
|
||||||
"assignees_url": "http://api.github.com/repos/octocat/Hello-World/assignees{/user}",
|
|
||||||
"blobs_url": "http://api.github.com/repos/octocat/Hello-World/git/blobs{/sha}",
|
|
||||||
"branches_url": "http://api.github.com/repos/octocat/Hello-World/branches{/branch}",
|
|
||||||
"collaborators_url": "http://api.github.com/repos/octocat/Hello-World/collaborators{/collaborator}",
|
|
||||||
"comments_url": "http://api.github.com/repos/octocat/Hello-World/comments{/number}",
|
|
||||||
"commits_url": "http://api.github.com/repos/octocat/Hello-World/commits{/sha}",
|
|
||||||
"compare_url": "http://api.github.com/repos/octocat/Hello-World/compare/{base}...{head}",
|
|
||||||
"contents_url": "http://api.github.com/repos/octocat/Hello-World/contents/{+path}",
|
|
||||||
"contributors_url": "http://api.github.com/repos/octocat/Hello-World/contributors",
|
|
||||||
"deployments_url": "http://api.github.com/repos/octocat/Hello-World/deployments",
|
|
||||||
"downloads_url": "http://api.github.com/repos/octocat/Hello-World/downloads",
|
|
||||||
"events_url": "http://api.github.com/repos/octocat/Hello-World/events",
|
|
||||||
"forks_url": "http://api.github.com/repos/octocat/Hello-World/forks",
|
|
||||||
"git_commits_url": "http://api.github.com/repos/octocat/Hello-World/git/commits{/sha}",
|
|
||||||
"git_refs_url": "http://api.github.com/repos/octocat/Hello-World/git/refs{/sha}",
|
|
||||||
"git_tags_url": "http://api.github.com/repos/octocat/Hello-World/git/tags{/sha}",
|
|
||||||
"git_url": "git:github.com/octocat/Hello-World.git",
|
|
||||||
"issue_comment_url": "http://api.github.com/repos/octocat/Hello-World/issues/comments{/number}",
|
|
||||||
"issue_events_url": "http://api.github.com/repos/octocat/Hello-World/issues/events{/number}",
|
|
||||||
"issues_url": "http://api.github.com/repos/octocat/Hello-World/issues{/number}",
|
|
||||||
"keys_url": "http://api.github.com/repos/octocat/Hello-World/keys{/key_id}",
|
|
||||||
"labels_url": "http://api.github.com/repos/octocat/Hello-World/labels{/name}",
|
|
||||||
"languages_url": "http://api.github.com/repos/octocat/Hello-World/languages",
|
|
||||||
"merges_url": "http://api.github.com/repos/octocat/Hello-World/merges",
|
|
||||||
"milestones_url": "http://api.github.com/repos/octocat/Hello-World/milestones{/number}",
|
|
||||||
"notifications_url": "http://api.github.com/repos/octocat/Hello-World/notifications{?since,all,participating}",
|
|
||||||
"pulls_url": "http://api.github.com/repos/octocat/Hello-World/pulls{/number}",
|
|
||||||
"releases_url": "http://api.github.com/repos/octocat/Hello-World/releases{/id}",
|
|
||||||
"ssh_url": "git@github.com:octocat/Hello-World.git",
|
|
||||||
"stargazers_url": "http://api.github.com/repos/octocat/Hello-World/stargazers",
|
|
||||||
"statuses_url": "http://api.github.com/repos/octocat/Hello-World/statuses/{sha}",
|
|
||||||
"subscribers_url": "http://api.github.com/repos/octocat/Hello-World/subscribers",
|
|
||||||
"subscription_url": "http://api.github.com/repos/octocat/Hello-World/subscription",
|
|
||||||
"tags_url": "http://api.github.com/repos/octocat/Hello-World/tags",
|
|
||||||
"teams_url": "http://api.github.com/repos/octocat/Hello-World/teams",
|
|
||||||
"trees_url": "http://api.github.com/repos/octocat/Hello-World/git/trees{/sha}",
|
|
||||||
"clone_url": "https://github.com/octocat/Hello-World.git",
|
|
||||||
"mirror_url": "git:git.example.com/octocat/Hello-World",
|
|
||||||
"hooks_url": "http://api.github.com/repos/octocat/Hello-World/hooks",
|
|
||||||
"svn_url": "https://svn.github.com/octocat/Hello-World",
|
|
||||||
"homepage": "https://github.com",
|
|
||||||
"language": null,
|
|
||||||
"forks_count": 9,
|
|
||||||
"stargazers_count": 80,
|
|
||||||
"watchers_count": 80,
|
|
||||||
"size": 108,
|
|
||||||
"default_branch": "master",
|
|
||||||
"open_issues_count": 0,
|
|
||||||
"is_template": true,
|
|
||||||
"topics": [
|
|
||||||
"octocat",
|
|
||||||
"atom",
|
|
||||||
"electron",
|
|
||||||
"api"
|
|
||||||
],
|
|
||||||
"has_issues": true,
|
|
||||||
"has_projects": true,
|
|
||||||
"has_wiki": true,
|
|
||||||
"has_pages": false,
|
|
||||||
"has_downloads": true,
|
|
||||||
"archived": false,
|
|
||||||
"disabled": false,
|
|
||||||
"visibility": "public",
|
|
||||||
"pushed_at": "2011-01-26T19:06:43Z",
|
|
||||||
"created_at": "2011-01-26T19:01:12Z",
|
|
||||||
"updated_at": "2011-01-26T19:14:43Z",
|
|
||||||
"permissions": {
|
|
||||||
"admin": false,
|
|
||||||
"push": false,
|
|
||||||
"pull": true
|
|
||||||
},
|
|
||||||
"allow_rebase_merge": true,
|
|
||||||
"template_repository": null,
|
|
||||||
"temp_clone_token": "ABTLWHOULUVAXGTRYU7OC2876QJ2O",
|
|
||||||
"allow_squash_merge": true,
|
|
||||||
"delete_branch_on_merge": true,
|
|
||||||
"allow_merge_commit": true,
|
|
||||||
"subscribers_count": 42,
|
|
||||||
"network_count": 0
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,39 @@
|
|||||||
|
import fs from 'node:fs';
|
||||||
|
import os from 'node:os';
|
||||||
|
import path from 'node:path';
|
||||||
|
import {vi} from 'vitest';
|
||||||
|
|
||||||
|
const tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), 'docker-bake-action-'));
|
||||||
|
|
||||||
|
const githubPayload = {
|
||||||
|
repository: {
|
||||||
|
private: true
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const githubEventPath = path.join(tmpDir, 'github-event.json');
|
||||||
|
fs.writeFileSync(githubEventPath, JSON.stringify(githubPayload));
|
||||||
|
|
||||||
|
process.env = Object.assign({}, process.env, {
|
||||||
|
TEMP: tmpDir,
|
||||||
|
GITHUB_REPOSITORY: 'docker/bake-action',
|
||||||
|
GITHUB_REF: 'refs/heads/master',
|
||||||
|
GITHUB_RUN_ID: '123456789',
|
||||||
|
GITHUB_RUN_ATTEMPT: '1',
|
||||||
|
GITHUB_EVENT_PATH: githubEventPath,
|
||||||
|
RUNNER_TEMP: path.join(tmpDir, 'runner-temp'),
|
||||||
|
RUNNER_TOOL_CACHE: path.join(tmpDir, 'runner-tool-cache')
|
||||||
|
});
|
||||||
|
|
||||||
|
vi.mock('@actions/github', () => ({
|
||||||
|
context: {
|
||||||
|
repo: {
|
||||||
|
owner: 'docker',
|
||||||
|
repo: 'bake-action'
|
||||||
|
},
|
||||||
|
ref: 'refs/heads/master',
|
||||||
|
runId: 123456789,
|
||||||
|
payload: githubPayload
|
||||||
|
},
|
||||||
|
getOctokit: vi.fn()
|
||||||
|
}));
|
||||||
+13
-10
@@ -10,19 +10,15 @@ inputs:
|
|||||||
builder:
|
builder:
|
||||||
description: "Builder instance"
|
description: "Builder instance"
|
||||||
required: false
|
required: false
|
||||||
source:
|
allow:
|
||||||
description: "Context to build from. Can be either local or a remote bake definition"
|
description: "Allow build to access specified resources (e.g., network.host)"
|
||||||
|
required: false
|
||||||
|
call:
|
||||||
|
description: "Set method for evaluating build (e.g., check)"
|
||||||
required: false
|
required: false
|
||||||
files:
|
files:
|
||||||
description: "List of bake definition files"
|
description: "List of bake definition files"
|
||||||
required: false
|
required: false
|
||||||
workdir:
|
|
||||||
description: "Working directory of bake execution"
|
|
||||||
required: false
|
|
||||||
default: '.'
|
|
||||||
targets:
|
|
||||||
description: "List of bake targets"
|
|
||||||
required: false
|
|
||||||
no-cache:
|
no-cache:
|
||||||
description: "Do not use cache when building the image"
|
description: "Do not use cache when building the image"
|
||||||
required: false
|
required: false
|
||||||
@@ -48,6 +44,12 @@ inputs:
|
|||||||
set:
|
set:
|
||||||
description: "List of targets values to override (eg. targetpattern.key=value)"
|
description: "List of targets values to override (eg. targetpattern.key=value)"
|
||||||
required: false
|
required: false
|
||||||
|
source:
|
||||||
|
description: "Context to build from. Can be either local to specify the working directory or a remote bake definition"
|
||||||
|
required: false
|
||||||
|
targets:
|
||||||
|
description: "List of bake targets"
|
||||||
|
required: false
|
||||||
github-token:
|
github-token:
|
||||||
description: "API token used to authenticate to a Git repository for remote definitions"
|
description: "API token used to authenticate to a Git repository for remote definitions"
|
||||||
default: ${{ github.token }}
|
default: ${{ github.token }}
|
||||||
@@ -58,5 +60,6 @@ outputs:
|
|||||||
description: 'Build result metadata'
|
description: 'Build result metadata'
|
||||||
|
|
||||||
runs:
|
runs:
|
||||||
using: 'node20'
|
using: 'node24'
|
||||||
main: 'dist/index.js'
|
main: 'dist/index.js'
|
||||||
|
post: 'dist/index.js'
|
||||||
|
|||||||
+30
-10
@@ -1,13 +1,21 @@
|
|||||||
# syntax=docker/dockerfile:1
|
# syntax=docker/dockerfile:1
|
||||||
|
|
||||||
ARG NODE_VERSION=20
|
ARG NODE_VERSION=24
|
||||||
|
|
||||||
FROM node:${NODE_VERSION}-alpine AS base
|
FROM node:${NODE_VERSION}-alpine AS base
|
||||||
RUN apk add --no-cache cpio findutils git
|
RUN apk add --no-cache cpio findutils git rsync
|
||||||
WORKDIR /src
|
WORKDIR /src
|
||||||
|
RUN --mount=type=bind,target=.,rw \
|
||||||
|
--mount=type=cache,target=/src/.yarn/cache <<EOT
|
||||||
|
set -e
|
||||||
|
corepack enable
|
||||||
|
yarn --version
|
||||||
|
yarn config set --home enableTelemetry 0
|
||||||
|
EOT
|
||||||
|
|
||||||
FROM base AS deps
|
FROM base AS deps
|
||||||
RUN --mount=type=bind,target=.,rw \
|
RUN --mount=type=bind,target=.,rw \
|
||||||
|
--mount=type=cache,target=/src/.yarn/cache \
|
||||||
--mount=type=cache,target=/src/node_modules \
|
--mount=type=cache,target=/src/node_modules \
|
||||||
yarn install && mkdir /vendor && cp yarn.lock /vendor
|
yarn install && mkdir /vendor && cp yarn.lock /vendor
|
||||||
|
|
||||||
@@ -20,24 +28,34 @@ RUN --mount=type=bind,target=.,rw <<EOT
|
|||||||
git add -A
|
git add -A
|
||||||
cp -rf /vendor/* .
|
cp -rf /vendor/* .
|
||||||
if [ -n "$(git status --porcelain -- yarn.lock)" ]; then
|
if [ -n "$(git status --porcelain -- yarn.lock)" ]; then
|
||||||
echo >&2 'ERROR: Vendor result differs. Please vendor your package with "docker buildx bake vendor-update"'
|
echo >&2 'ERROR: Vendor result differs. Please vendor your package with "docker buildx bake vendor"'
|
||||||
git status --porcelain -- yarn.lock
|
git status --porcelain -- yarn.lock
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
EOT
|
EOT
|
||||||
|
|
||||||
FROM deps AS build
|
FROM deps AS build
|
||||||
RUN --mount=type=bind,target=.,rw \
|
RUN --mount=target=/context \
|
||||||
--mount=type=cache,target=/src/node_modules \
|
--mount=type=cache,target=/src/.yarn/cache \
|
||||||
yarn run build && mkdir /out && cp -Rf dist /out/
|
--mount=type=cache,target=/src/node_modules <<EOT
|
||||||
|
set -e
|
||||||
|
rsync -a /context/. .
|
||||||
|
rm -rf dist
|
||||||
|
yarn run build
|
||||||
|
mkdir /out
|
||||||
|
cp -r dist /out
|
||||||
|
EOT
|
||||||
|
|
||||||
FROM scratch AS build-update
|
FROM scratch AS build-update
|
||||||
COPY --from=build /out /
|
COPY --from=build /out /
|
||||||
|
|
||||||
FROM build AS build-validate
|
FROM build AS build-validate
|
||||||
RUN --mount=type=bind,target=.,rw <<EOT
|
RUN --mount=target=/context \
|
||||||
|
--mount=target=.,type=tmpfs <<EOT
|
||||||
set -e
|
set -e
|
||||||
|
rsync -a /context/. .
|
||||||
git add -A
|
git add -A
|
||||||
|
rm -rf dist
|
||||||
cp -rf /out/* .
|
cp -rf /out/* .
|
||||||
if [ -n "$(git status --porcelain -- dist)" ]; then
|
if [ -n "$(git status --porcelain -- dist)" ]; then
|
||||||
echo >&2 'ERROR: Build result differs. Please build first with "docker buildx bake build"'
|
echo >&2 'ERROR: Build result differs. Please build first with "docker buildx bake build"'
|
||||||
@@ -48,22 +66,24 @@ EOT
|
|||||||
|
|
||||||
FROM deps AS format
|
FROM deps AS format
|
||||||
RUN --mount=type=bind,target=.,rw \
|
RUN --mount=type=bind,target=.,rw \
|
||||||
|
--mount=type=cache,target=/src/.yarn/cache \
|
||||||
--mount=type=cache,target=/src/node_modules \
|
--mount=type=cache,target=/src/node_modules \
|
||||||
yarn run format \
|
yarn run format && mkdir /out && find . -name '*.ts' -not -path './node_modules/*' -not -path './.yarn/*' | cpio -pdm /out
|
||||||
&& mkdir /out && find . -name '*.ts' -not -path './node_modules/*' | cpio -pdm /out
|
|
||||||
|
|
||||||
FROM scratch AS format-update
|
FROM scratch AS format-update
|
||||||
COPY --from=format /out /
|
COPY --from=format /out /
|
||||||
|
|
||||||
FROM deps AS lint
|
FROM deps AS lint
|
||||||
RUN --mount=type=bind,target=.,rw \
|
RUN --mount=type=bind,target=.,rw \
|
||||||
|
--mount=type=cache,target=/src/.yarn/cache \
|
||||||
--mount=type=cache,target=/src/node_modules \
|
--mount=type=cache,target=/src/node_modules \
|
||||||
yarn run lint
|
yarn run lint
|
||||||
|
|
||||||
FROM deps AS test
|
FROM deps AS test
|
||||||
RUN --mount=type=bind,target=.,rw \
|
RUN --mount=type=bind,target=.,rw \
|
||||||
|
--mount=type=cache,target=/src/.yarn/cache \
|
||||||
--mount=type=cache,target=/src/node_modules \
|
--mount=type=cache,target=/src/node_modules \
|
||||||
yarn run test --coverage --coverageDirectory=/tmp/coverage
|
yarn run test --coverage --coverage.reportsDirectory=/tmp/coverage
|
||||||
|
|
||||||
FROM scratch AS test-coverage
|
FROM scratch AS test-coverage
|
||||||
COPY --from=test /tmp/coverage /
|
COPY --from=test /tmp/coverage /
|
||||||
|
|||||||
+301
@@ -0,0 +1,301 @@
|
|||||||
|
export const id = 606;
|
||||||
|
export const ids = [606];
|
||||||
|
export const modules = {
|
||||||
|
|
||||||
|
/***/ 606:
|
||||||
|
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||||||
|
|
||||||
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
||||||
|
/* harmony export */ "default": () => (/* binding */ pMap)
|
||||||
|
/* harmony export */ });
|
||||||
|
/* unused harmony exports pMapIterable, pMapSkip */
|
||||||
|
async function pMap(
|
||||||
|
iterable,
|
||||||
|
mapper,
|
||||||
|
{
|
||||||
|
concurrency = Number.POSITIVE_INFINITY,
|
||||||
|
stopOnError = true,
|
||||||
|
signal,
|
||||||
|
} = {},
|
||||||
|
) {
|
||||||
|
return new Promise((resolve_, reject_) => {
|
||||||
|
if (iterable[Symbol.iterator] === undefined && iterable[Symbol.asyncIterator] === undefined) {
|
||||||
|
throw new TypeError(`Expected \`input\` to be either an \`Iterable\` or \`AsyncIterable\`, got (${typeof iterable})`);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (typeof mapper !== 'function') {
|
||||||
|
throw new TypeError('Mapper function is required');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!((Number.isSafeInteger(concurrency) && concurrency >= 1) || concurrency === Number.POSITIVE_INFINITY)) {
|
||||||
|
throw new TypeError(`Expected \`concurrency\` to be an integer from 1 and up or \`Infinity\`, got \`${concurrency}\` (${typeof concurrency})`);
|
||||||
|
}
|
||||||
|
|
||||||
|
const result = [];
|
||||||
|
const errors = [];
|
||||||
|
const skippedIndexesMap = new Map();
|
||||||
|
let isRejected = false;
|
||||||
|
let isResolved = false;
|
||||||
|
let isIterableDone = false;
|
||||||
|
let resolvingCount = 0;
|
||||||
|
let currentIndex = 0;
|
||||||
|
const iterator = iterable[Symbol.iterator] === undefined ? iterable[Symbol.asyncIterator]() : iterable[Symbol.iterator]();
|
||||||
|
|
||||||
|
const signalListener = () => {
|
||||||
|
reject(signal.reason);
|
||||||
|
};
|
||||||
|
|
||||||
|
const cleanup = () => {
|
||||||
|
signal?.removeEventListener('abort', signalListener);
|
||||||
|
};
|
||||||
|
|
||||||
|
const resolve = value => {
|
||||||
|
resolve_(value);
|
||||||
|
cleanup();
|
||||||
|
};
|
||||||
|
|
||||||
|
const reject = reason => {
|
||||||
|
isRejected = true;
|
||||||
|
isResolved = true;
|
||||||
|
reject_(reason);
|
||||||
|
cleanup();
|
||||||
|
};
|
||||||
|
|
||||||
|
if (signal) {
|
||||||
|
if (signal.aborted) {
|
||||||
|
reject(signal.reason);
|
||||||
|
}
|
||||||
|
|
||||||
|
signal.addEventListener('abort', signalListener, {once: true});
|
||||||
|
}
|
||||||
|
|
||||||
|
const next = async () => {
|
||||||
|
if (isResolved) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const nextItem = await iterator.next();
|
||||||
|
|
||||||
|
const index = currentIndex;
|
||||||
|
currentIndex++;
|
||||||
|
|
||||||
|
// Note: `iterator.next()` can be called many times in parallel.
|
||||||
|
// This can cause multiple calls to this `next()` function to
|
||||||
|
// receive a `nextItem` with `done === true`.
|
||||||
|
// The shutdown logic that rejects/resolves must be protected
|
||||||
|
// so it runs only one time as the `skippedIndex` logic is
|
||||||
|
// non-idempotent.
|
||||||
|
if (nextItem.done) {
|
||||||
|
isIterableDone = true;
|
||||||
|
|
||||||
|
if (resolvingCount === 0 && !isResolved) {
|
||||||
|
if (!stopOnError && errors.length > 0) {
|
||||||
|
reject(new AggregateError(errors)); // eslint-disable-line unicorn/error-message
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
isResolved = true;
|
||||||
|
|
||||||
|
if (skippedIndexesMap.size === 0) {
|
||||||
|
resolve(result);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const pureResult = [];
|
||||||
|
|
||||||
|
// Support multiple `pMapSkip`'s.
|
||||||
|
for (const [index, value] of result.entries()) {
|
||||||
|
if (skippedIndexesMap.get(index) === pMapSkip) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
pureResult.push(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
resolve(pureResult);
|
||||||
|
}
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
resolvingCount++;
|
||||||
|
|
||||||
|
// Intentionally detached
|
||||||
|
(async () => {
|
||||||
|
try {
|
||||||
|
const element = await nextItem.value;
|
||||||
|
|
||||||
|
if (isResolved) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const value = await mapper(element, index);
|
||||||
|
|
||||||
|
// Use Map to stage the index of the element.
|
||||||
|
if (value === pMapSkip) {
|
||||||
|
skippedIndexesMap.set(index, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
result[index] = value;
|
||||||
|
|
||||||
|
resolvingCount--;
|
||||||
|
await next();
|
||||||
|
} catch (error) {
|
||||||
|
if (stopOnError) {
|
||||||
|
reject(error);
|
||||||
|
} else {
|
||||||
|
errors.push(error);
|
||||||
|
resolvingCount--;
|
||||||
|
|
||||||
|
// In that case we can't really continue regardless of `stopOnError` state
|
||||||
|
// since an iterable is likely to continue throwing after it throws once.
|
||||||
|
// If we continue calling `next()` indefinitely we will likely end up
|
||||||
|
// in an infinite loop of failed iteration.
|
||||||
|
try {
|
||||||
|
await next();
|
||||||
|
} catch (error) {
|
||||||
|
reject(error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})();
|
||||||
|
};
|
||||||
|
|
||||||
|
// Create the concurrent runners in a detached (non-awaited)
|
||||||
|
// promise. We need this so we can await the `next()` calls
|
||||||
|
// to stop creating runners before hitting the concurrency limit
|
||||||
|
// if the iterable has already been marked as done.
|
||||||
|
// NOTE: We *must* do this for async iterators otherwise we'll spin up
|
||||||
|
// infinite `next()` calls by default and never start the event loop.
|
||||||
|
(async () => {
|
||||||
|
for (let index = 0; index < concurrency; index++) {
|
||||||
|
try {
|
||||||
|
// eslint-disable-next-line no-await-in-loop
|
||||||
|
await next();
|
||||||
|
} catch (error) {
|
||||||
|
reject(error);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isIterableDone || isRejected) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function pMapIterable(
|
||||||
|
iterable,
|
||||||
|
mapper,
|
||||||
|
{
|
||||||
|
concurrency = Number.POSITIVE_INFINITY,
|
||||||
|
backpressure = concurrency,
|
||||||
|
} = {},
|
||||||
|
) {
|
||||||
|
if (iterable[Symbol.iterator] === undefined && iterable[Symbol.asyncIterator] === undefined) {
|
||||||
|
throw new TypeError(`Expected \`input\` to be either an \`Iterable\` or \`AsyncIterable\`, got (${typeof iterable})`);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (typeof mapper !== 'function') {
|
||||||
|
throw new TypeError('Mapper function is required');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!((Number.isSafeInteger(concurrency) && concurrency >= 1) || concurrency === Number.POSITIVE_INFINITY)) {
|
||||||
|
throw new TypeError(`Expected \`concurrency\` to be an integer from 1 and up or \`Infinity\`, got \`${concurrency}\` (${typeof concurrency})`);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!((Number.isSafeInteger(backpressure) && backpressure >= concurrency) || backpressure === Number.POSITIVE_INFINITY)) {
|
||||||
|
throw new TypeError(`Expected \`backpressure\` to be an integer from \`concurrency\` (${concurrency}) and up or \`Infinity\`, got \`${backpressure}\` (${typeof backpressure})`);
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
async * [Symbol.asyncIterator]() {
|
||||||
|
const iterator = iterable[Symbol.asyncIterator] === undefined ? iterable[Symbol.iterator]() : iterable[Symbol.asyncIterator]();
|
||||||
|
|
||||||
|
const promises = [];
|
||||||
|
let pendingPromisesCount = 0;
|
||||||
|
let isDone = false;
|
||||||
|
let index = 0;
|
||||||
|
|
||||||
|
function trySpawn() {
|
||||||
|
if (isDone || !(pendingPromisesCount < concurrency && promises.length < backpressure)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
pendingPromisesCount++;
|
||||||
|
|
||||||
|
const promise = (async () => {
|
||||||
|
const {done, value} = await iterator.next();
|
||||||
|
|
||||||
|
if (done) {
|
||||||
|
pendingPromisesCount--;
|
||||||
|
return {done: true};
|
||||||
|
}
|
||||||
|
|
||||||
|
// Spawn if still below concurrency and backpressure limit
|
||||||
|
trySpawn();
|
||||||
|
|
||||||
|
try {
|
||||||
|
const returnValue = await mapper(await value, index++);
|
||||||
|
|
||||||
|
pendingPromisesCount--;
|
||||||
|
|
||||||
|
if (returnValue === pMapSkip) {
|
||||||
|
const index = promises.indexOf(promise);
|
||||||
|
|
||||||
|
if (index > 0) {
|
||||||
|
promises.splice(index, 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Spawn if still below backpressure limit and just dropped below concurrency limit
|
||||||
|
trySpawn();
|
||||||
|
|
||||||
|
return {done: false, value: returnValue};
|
||||||
|
} catch (error) {
|
||||||
|
pendingPromisesCount--;
|
||||||
|
isDone = true;
|
||||||
|
return {error};
|
||||||
|
}
|
||||||
|
})();
|
||||||
|
|
||||||
|
promises.push(promise);
|
||||||
|
}
|
||||||
|
|
||||||
|
trySpawn();
|
||||||
|
|
||||||
|
while (promises.length > 0) {
|
||||||
|
const {error, done, value} = await promises[0]; // eslint-disable-line no-await-in-loop
|
||||||
|
|
||||||
|
promises.shift();
|
||||||
|
|
||||||
|
if (error) {
|
||||||
|
throw error;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (done) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Spawn if just dropped below backpressure limit and below the concurrency limit
|
||||||
|
trySpawn();
|
||||||
|
|
||||||
|
if (value === pMapSkip) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
yield value;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
const pMapSkip = Symbol('skip');
|
||||||
|
|
||||||
|
|
||||||
|
/***/ })
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
//# sourceMappingURL=606.index.js.map
|
||||||
+1
File diff suppressed because one or more lines are too long
+123
-19
File diff suppressed because one or more lines are too long
+1
-1
File diff suppressed because one or more lines are too long
+2
-1892
File diff suppressed because it is too large
Load Diff
+3
@@ -0,0 +1,3 @@
|
|||||||
|
{
|
||||||
|
"type": "module"
|
||||||
|
}
|
||||||
+1
File diff suppressed because one or more lines are too long
-1
File diff suppressed because one or more lines are too long
+15
-2
@@ -1,9 +1,15 @@
|
|||||||
|
target "_common" {
|
||||||
|
args = {
|
||||||
|
BUILDKIT_CONTEXT_KEEP_GIT_DIR = 1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
group "default" {
|
group "default" {
|
||||||
targets = ["build"]
|
targets = ["build"]
|
||||||
}
|
}
|
||||||
|
|
||||||
group "pre-checkin" {
|
group "pre-checkin" {
|
||||||
targets = ["vendor-update", "format", "build"]
|
targets = ["vendor", "format", "build"]
|
||||||
}
|
}
|
||||||
|
|
||||||
group "validate" {
|
group "validate" {
|
||||||
@@ -11,42 +17,49 @@ group "validate" {
|
|||||||
}
|
}
|
||||||
|
|
||||||
target "build" {
|
target "build" {
|
||||||
|
inherits = ["_common"]
|
||||||
dockerfile = "dev.Dockerfile"
|
dockerfile = "dev.Dockerfile"
|
||||||
target = "build-update"
|
target = "build-update"
|
||||||
output = ["."]
|
output = ["."]
|
||||||
}
|
}
|
||||||
|
|
||||||
target "build-validate" {
|
target "build-validate" {
|
||||||
|
inherits = ["_common"]
|
||||||
dockerfile = "dev.Dockerfile"
|
dockerfile = "dev.Dockerfile"
|
||||||
target = "build-validate"
|
target = "build-validate"
|
||||||
output = ["type=cacheonly"]
|
output = ["type=cacheonly"]
|
||||||
}
|
}
|
||||||
|
|
||||||
target "format" {
|
target "format" {
|
||||||
|
inherits = ["_common"]
|
||||||
dockerfile = "dev.Dockerfile"
|
dockerfile = "dev.Dockerfile"
|
||||||
target = "format-update"
|
target = "format-update"
|
||||||
output = ["."]
|
output = ["."]
|
||||||
}
|
}
|
||||||
|
|
||||||
target "lint" {
|
target "lint" {
|
||||||
|
inherits = ["_common"]
|
||||||
dockerfile = "dev.Dockerfile"
|
dockerfile = "dev.Dockerfile"
|
||||||
target = "lint"
|
target = "lint"
|
||||||
output = ["type=cacheonly"]
|
output = ["type=cacheonly"]
|
||||||
}
|
}
|
||||||
|
|
||||||
target "vendor-update" {
|
target "vendor" {
|
||||||
|
inherits = ["_common"]
|
||||||
dockerfile = "dev.Dockerfile"
|
dockerfile = "dev.Dockerfile"
|
||||||
target = "vendor-update"
|
target = "vendor-update"
|
||||||
output = ["."]
|
output = ["."]
|
||||||
}
|
}
|
||||||
|
|
||||||
target "vendor-validate" {
|
target "vendor-validate" {
|
||||||
|
inherits = ["_common"]
|
||||||
dockerfile = "dev.Dockerfile"
|
dockerfile = "dev.Dockerfile"
|
||||||
target = "vendor-validate"
|
target = "vendor-validate"
|
||||||
output = ["type=cacheonly"]
|
output = ["type=cacheonly"]
|
||||||
}
|
}
|
||||||
|
|
||||||
target "test" {
|
target "test" {
|
||||||
|
inherits = ["_common"]
|
||||||
dockerfile = "dev.Dockerfile"
|
dockerfile = "dev.Dockerfile"
|
||||||
target = "test-coverage"
|
target = "test-coverage"
|
||||||
output = ["./coverage"]
|
output = ["./coverage"]
|
||||||
|
|||||||
@@ -0,0 +1,52 @@
|
|||||||
|
import {defineConfig} from 'eslint/config';
|
||||||
|
import js from '@eslint/js';
|
||||||
|
import tseslint from '@typescript-eslint/eslint-plugin';
|
||||||
|
import vitest from '@vitest/eslint-plugin';
|
||||||
|
import globals from 'globals';
|
||||||
|
import eslintConfigPrettier from 'eslint-config-prettier/flat';
|
||||||
|
import eslintPluginPrettier from 'eslint-plugin-prettier';
|
||||||
|
|
||||||
|
export default defineConfig([
|
||||||
|
{
|
||||||
|
ignores: ['.yarn/**/*', 'coverage/**/*', 'dist/**/*']
|
||||||
|
},
|
||||||
|
js.configs.recommended,
|
||||||
|
...tseslint.configs['flat/recommended'],
|
||||||
|
eslintConfigPrettier,
|
||||||
|
{
|
||||||
|
languageOptions: {
|
||||||
|
globals: {
|
||||||
|
...globals.node
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
files: ['__tests__/**'],
|
||||||
|
...vitest.configs.recommended,
|
||||||
|
languageOptions: {
|
||||||
|
globals: {
|
||||||
|
...globals.node,
|
||||||
|
...vitest.environments.env.globals
|
||||||
|
}
|
||||||
|
},
|
||||||
|
rules: {
|
||||||
|
...vitest.configs.recommended.rules,
|
||||||
|
'vitest/no-conditional-expect': 'error',
|
||||||
|
'vitest/no-disabled-tests': 0
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
plugins: {
|
||||||
|
prettier: eslintPluginPrettier
|
||||||
|
},
|
||||||
|
rules: {
|
||||||
|
'prettier/prettier': 'error',
|
||||||
|
'@typescript-eslint/no-require-imports': [
|
||||||
|
'error',
|
||||||
|
{
|
||||||
|
allowAsImport: true
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]);
|
||||||
@@ -1,30 +0,0 @@
|
|||||||
import fs from 'fs';
|
|
||||||
import os from 'os';
|
|
||||||
import path from 'path';
|
|
||||||
|
|
||||||
const tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), 'docker-bake-action-'));
|
|
||||||
|
|
||||||
process.env = Object.assign({}, process.env, {
|
|
||||||
TEMP: tmpDir,
|
|
||||||
GITHUB_REPOSITORY: 'docker/bake-action',
|
|
||||||
RUNNER_TEMP: path.join(tmpDir, 'runner-temp'),
|
|
||||||
RUNNER_TOOL_CACHE: path.join(tmpDir, 'runner-tool-cache')
|
|
||||||
}) as {
|
|
||||||
[key: string]: string;
|
|
||||||
};
|
|
||||||
|
|
||||||
module.exports = {
|
|
||||||
clearMocks: true,
|
|
||||||
testEnvironment: 'node',
|
|
||||||
moduleFileExtensions: ['js', 'ts'],
|
|
||||||
testMatch: ['**/*.test.ts'],
|
|
||||||
transform: {
|
|
||||||
'^.+\\.ts$': 'ts-jest'
|
|
||||||
},
|
|
||||||
moduleNameMapper: {
|
|
||||||
'^csv-parse/sync': '<rootDir>/node_modules/csv-parse/dist/cjs/sync.cjs'
|
|
||||||
},
|
|
||||||
collectCoverageFrom: ['src/**/{!(main.ts),}.ts'],
|
|
||||||
coveragePathIgnorePatterns: ['lib/', 'node_modules/', '__mocks__/', '__tests__/'],
|
|
||||||
verbose: true
|
|
||||||
};
|
|
||||||
+24
-26
@@ -1,17 +1,13 @@
|
|||||||
{
|
{
|
||||||
"name": "docker-buildx-bake",
|
"name": "docker-buildx-bake",
|
||||||
"description": "GitHub Action to use Docker Buildx Bake as a high-level build command",
|
"description": "GitHub Action to use Docker Buildx Bake as a high-level build command",
|
||||||
"main": "lib/main.js",
|
"type": "module",
|
||||||
|
"main": "src/main.ts",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "ncc build src/main.ts --source-map --minify --license licenses.txt",
|
"build": "ncc build --source-map --minify --license licenses.txt",
|
||||||
"lint": "yarn run prettier && yarn run eslint",
|
"lint": "eslint --max-warnings=0 .",
|
||||||
"format": "yarn run prettier:fix && yarn run eslint:fix",
|
"format": "eslint --fix .",
|
||||||
"eslint": "eslint --max-warnings=0 .",
|
"test": "vitest run"
|
||||||
"eslint:fix": "eslint --fix .",
|
|
||||||
"prettier": "prettier --check \"./**/*.ts\"",
|
|
||||||
"prettier:fix": "prettier --write \"./**/*.ts\"",
|
|
||||||
"test": "jest",
|
|
||||||
"all": "yarn run build && yarn run format && yarn test"
|
|
||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
@@ -25,24 +21,26 @@
|
|||||||
],
|
],
|
||||||
"author": "Docker Inc.",
|
"author": "Docker Inc.",
|
||||||
"license": "Apache-2.0",
|
"license": "Apache-2.0",
|
||||||
|
"packageManager": "yarn@4.9.2",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@actions/core": "^1.10.1",
|
"@actions/core": "^3.0.0",
|
||||||
"@docker/actions-toolkit": "^0.21.1",
|
"@docker/actions-toolkit": "^0.87.0",
|
||||||
"handlebars": "^4.7.8"
|
"handlebars": "^4.7.9"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/node": "^20.5.9",
|
"@eslint/js": "^9.39.3",
|
||||||
"@typescript-eslint/eslint-plugin": "^6.6.0",
|
"@types/node": "^24.11.0",
|
||||||
"@typescript-eslint/parser": "^6.6.0",
|
"@typescript-eslint/eslint-plugin": "^8.56.1",
|
||||||
"@vercel/ncc": "^0.38.0",
|
"@typescript-eslint/parser": "^8.56.1",
|
||||||
"eslint": "^8.48.0",
|
"@vercel/ncc": "^0.38.4",
|
||||||
"eslint-config-prettier": "^9.0.0",
|
"@vitest/coverage-v8": "^4.0.18",
|
||||||
"eslint-plugin-jest": "^27.2.3",
|
"@vitest/eslint-plugin": "^1.6.9",
|
||||||
"eslint-plugin-prettier": "^5.0.0",
|
"eslint": "^9.39.3",
|
||||||
"jest": "^29.6.4",
|
"eslint-config-prettier": "^10.1.8",
|
||||||
"prettier": "^3.0.3",
|
"eslint-plugin-prettier": "^5.5.5",
|
||||||
"ts-jest": "^29.1.1",
|
"globals": "^17.3.0",
|
||||||
"ts-node": "^10.9.1",
|
"prettier": "^3.8.1",
|
||||||
"typescript": "^5.2.2"
|
"typescript": "^5.9.3",
|
||||||
|
"vitest": "^4.0.18"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+87
-37
@@ -1,44 +1,53 @@
|
|||||||
|
import * as fs from 'fs';
|
||||||
import * as core from '@actions/core';
|
import * as core from '@actions/core';
|
||||||
import * as handlebars from 'handlebars';
|
import * as handlebars from 'handlebars';
|
||||||
import {Bake} from '@docker/actions-toolkit/lib/buildx/bake';
|
|
||||||
import {Context} from '@docker/actions-toolkit/lib/context';
|
import {Bake} from '@docker/actions-toolkit/lib/buildx/bake.js';
|
||||||
import {Inputs as BuildxInputs} from '@docker/actions-toolkit/lib/buildx/inputs';
|
import {Build} from '@docker/actions-toolkit/lib/buildx/build.js';
|
||||||
import {GitHub} from '@docker/actions-toolkit/lib/github';
|
import {GitHub} from '@docker/actions-toolkit/lib/github/github.js';
|
||||||
import {Toolkit} from '@docker/actions-toolkit/lib/toolkit';
|
import {Toolkit} from '@docker/actions-toolkit/lib/toolkit.js';
|
||||||
import {Util} from '@docker/actions-toolkit/lib/util';
|
import {Util} from '@docker/actions-toolkit/lib/util.js';
|
||||||
import {BakeDefinition} from '@docker/actions-toolkit/lib/types/bake';
|
|
||||||
|
import {BakeDefinition} from '@docker/actions-toolkit/lib/types/buildx/bake.js';
|
||||||
|
|
||||||
|
export interface BakeContext {
|
||||||
|
remoteRef?: string;
|
||||||
|
workdir?: string;
|
||||||
|
}
|
||||||
|
|
||||||
export interface Inputs {
|
export interface Inputs {
|
||||||
builder: string;
|
builder: string;
|
||||||
|
allow: string[];
|
||||||
|
call: string;
|
||||||
files: string[];
|
files: string[];
|
||||||
workdir: string;
|
'no-cache': boolean;
|
||||||
targets: string[];
|
|
||||||
noCache: boolean;
|
|
||||||
pull: boolean;
|
pull: boolean;
|
||||||
load: boolean;
|
load: boolean;
|
||||||
provenance: string;
|
provenance: string;
|
||||||
push: boolean;
|
push: boolean;
|
||||||
sbom: string;
|
sbom: string;
|
||||||
set: string[];
|
set: string[];
|
||||||
source: string;
|
source: BakeContext;
|
||||||
githubToken: string;
|
targets: string[];
|
||||||
|
'github-token': string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function getInputs(): Promise<Inputs> {
|
export async function getInputs(): Promise<Inputs> {
|
||||||
return {
|
return {
|
||||||
builder: core.getInput('builder'),
|
builder: core.getInput('builder'),
|
||||||
|
allow: Util.getInputList('allow'),
|
||||||
|
call: core.getInput('call'),
|
||||||
files: Util.getInputList('files'),
|
files: Util.getInputList('files'),
|
||||||
workdir: core.getInput('workdir') || '.',
|
'no-cache': core.getBooleanInput('no-cache'),
|
||||||
targets: Util.getInputList('targets'),
|
|
||||||
noCache: core.getBooleanInput('no-cache'),
|
|
||||||
pull: core.getBooleanInput('pull'),
|
pull: core.getBooleanInput('pull'),
|
||||||
load: core.getBooleanInput('load'),
|
load: core.getBooleanInput('load'),
|
||||||
provenance: BuildxInputs.getProvenanceInput('provenance'),
|
provenance: Build.getProvenanceInput('provenance'),
|
||||||
push: core.getBooleanInput('push'),
|
push: core.getBooleanInput('push'),
|
||||||
sbom: core.getInput('sbom'),
|
sbom: core.getInput('sbom'),
|
||||||
set: Util.getInputList('set', {ignoreComma: true, quote: false}),
|
set: Util.getInputList('set', {ignoreComma: true, quote: false}),
|
||||||
source: getSourceInput('source'),
|
source: await getBakeContext(core.getInput('source')),
|
||||||
githubToken: core.getInput('github-token')
|
targets: Util.getInputList('targets'),
|
||||||
|
'github-token': core.getInput('github-token')
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -53,8 +62,23 @@ export async function getArgs(inputs: Inputs, definition: BakeDefinition, toolki
|
|||||||
|
|
||||||
async function getBakeArgs(inputs: Inputs, definition: BakeDefinition, toolkit: Toolkit): Promise<Array<string>> {
|
async function getBakeArgs(inputs: Inputs, definition: BakeDefinition, toolkit: Toolkit): Promise<Array<string>> {
|
||||||
const args: Array<string> = ['bake'];
|
const args: Array<string> = ['bake'];
|
||||||
if (inputs.source) {
|
if (inputs.source.remoteRef) {
|
||||||
args.push(inputs.source);
|
args.push(inputs.source.remoteRef);
|
||||||
|
}
|
||||||
|
if (await toolkit.buildx.versionSatisfies('>=0.17.0')) {
|
||||||
|
if (await toolkit.buildx.versionSatisfies('>=0.18.0')) {
|
||||||
|
// allow filesystem entitlements by default
|
||||||
|
inputs.allow.push('fs=*');
|
||||||
|
}
|
||||||
|
await Util.asyncForEach(inputs.allow, async allow => {
|
||||||
|
args.push('--allow', allow);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
if (inputs.call) {
|
||||||
|
if (!(await toolkit.buildx.versionSatisfies('>=0.16.0'))) {
|
||||||
|
throw new Error(`Buildx >= 0.16.0 is required to use the call flag.`);
|
||||||
|
}
|
||||||
|
args.push('--call', inputs.call);
|
||||||
}
|
}
|
||||||
await Util.asyncForEach(inputs.files, async file => {
|
await Util.asyncForEach(inputs.files, async file => {
|
||||||
args.push('--file', file);
|
args.push('--file', file);
|
||||||
@@ -63,22 +87,28 @@ async function getBakeArgs(inputs: Inputs, definition: BakeDefinition, toolkit:
|
|||||||
args.push('--set', set);
|
args.push('--set', set);
|
||||||
});
|
});
|
||||||
if (await toolkit.buildx.versionSatisfies('>=0.6.0')) {
|
if (await toolkit.buildx.versionSatisfies('>=0.6.0')) {
|
||||||
args.push('--metadata-file', BuildxInputs.getBuildMetadataFilePath());
|
args.push('--metadata-file', toolkit.buildxBake.getMetadataFilePath());
|
||||||
}
|
}
|
||||||
if (await toolkit.buildx.versionSatisfies('>=0.10.0')) {
|
if (await toolkit.buildx.versionSatisfies('>=0.10.0')) {
|
||||||
if (inputs.provenance) {
|
if (inputs.provenance) {
|
||||||
args.push('--provenance', inputs.provenance);
|
args.push('--provenance', inputs.provenance);
|
||||||
} else if ((await toolkit.buildkit.versionSatisfies(inputs.builder, '>=0.11.0')) && !Bake.hasDockerExporter(definition, inputs.load)) {
|
} else if (!noDefaultAttestations() && (await toolkit.buildkit.versionSatisfies(inputs.builder, '>=0.11.0')) && !Bake.hasDockerExporter(definition, inputs.load)) {
|
||||||
// if provenance not specified and BuildKit version compatible for
|
// check if provenance attestation is already specified in the bake
|
||||||
|
// definition and if not specified and BuildKit version compatible for
|
||||||
// attestation, set default provenance. Also needs to make sure user
|
// attestation, set default provenance. Also needs to make sure user
|
||||||
// doesn't want to explicitly load the image to docker.
|
// doesn't want to explicitly load the image to docker.
|
||||||
if (GitHub.context.payload.repository?.private ?? false) {
|
for (const targetName in definition.target) {
|
||||||
// if this is a private repository, we set the default provenance
|
const target = definition.target[targetName];
|
||||||
// attributes being set in buildx: https://github.com/docker/buildx/blob/fb27e3f919dcbf614d7126b10c2bc2d0b1927eb6/build/build.go#L603
|
if (!Array.isArray(target.attest) || !target.attest.some(attest => attest?.type === 'provenance')) {
|
||||||
args.push('--provenance', BuildxInputs.resolveProvenanceAttrs(`mode=min,inline-only=true`));
|
if (GitHub.context.payload.repository?.private ?? false) {
|
||||||
} else {
|
// if this is a private repository, we set the default provenance
|
||||||
// for a public repository, we set max provenance mode.
|
// attributes being set in buildx: https://github.com/docker/buildx/blob/fb27e3f919dcbf614d7126b10c2bc2d0b1927eb6/build/build.go#L603
|
||||||
args.push('--provenance', BuildxInputs.resolveProvenanceAttrs(`mode=max`));
|
args.push('--set', `${targetName}.attest=type=provenance,${Build.resolveProvenanceAttrs(`mode=min,inline-only=true`)}`);
|
||||||
|
} else {
|
||||||
|
// for a public repository, we set max provenance mode.
|
||||||
|
args.push('--set', `${targetName}.attest=type=provenance,${Build.resolveProvenanceAttrs(`mode=max`)}`);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (inputs.sbom) {
|
if (inputs.sbom) {
|
||||||
@@ -90,7 +120,7 @@ async function getBakeArgs(inputs: Inputs, definition: BakeDefinition, toolkit:
|
|||||||
|
|
||||||
async function getCommonArgs(inputs: Inputs): Promise<Array<string>> {
|
async function getCommonArgs(inputs: Inputs): Promise<Array<string>> {
|
||||||
const args: Array<string> = [];
|
const args: Array<string> = [];
|
||||||
if (inputs.noCache) {
|
if (inputs['no-cache']) {
|
||||||
args.push('--no-cache');
|
args.push('--no-cache');
|
||||||
}
|
}
|
||||||
if (inputs.builder) {
|
if (inputs.builder) {
|
||||||
@@ -108,12 +138,32 @@ async function getCommonArgs(inputs: Inputs): Promise<Array<string>> {
|
|||||||
return args;
|
return args;
|
||||||
}
|
}
|
||||||
|
|
||||||
function getSourceInput(name: string): string {
|
async function getBakeContext(sourceInput: string): Promise<BakeContext> {
|
||||||
let source = handlebars.compile(core.getInput(name))({
|
const defaultContext = await new Build().gitContext();
|
||||||
defaultContext: Context.gitContext()
|
let bakeContext = handlebars.compile(sourceInput)({
|
||||||
|
defaultContext: defaultContext
|
||||||
});
|
});
|
||||||
if (source === '.') {
|
if (!bakeContext) {
|
||||||
source = '';
|
bakeContext = defaultContext;
|
||||||
}
|
}
|
||||||
return source;
|
if (Util.isValidRef(bakeContext)) {
|
||||||
|
return {
|
||||||
|
remoteRef: bakeContext
|
||||||
|
};
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
fs.statSync(sourceInput).isDirectory();
|
||||||
|
} catch {
|
||||||
|
throw new Error(`Invalid source: ${sourceInput} does not exist or is not a directory.`);
|
||||||
|
}
|
||||||
|
return {
|
||||||
|
workdir: bakeContext
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
function noDefaultAttestations(): boolean {
|
||||||
|
if (process.env.BUILDX_NO_DEFAULT_ATTESTATIONS) {
|
||||||
|
return Util.parseBool(process.env.BUILDX_NO_DEFAULT_ATTESTATIONS);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
+216
-25
@@ -2,24 +2,37 @@ import * as fs from 'fs';
|
|||||||
import * as path from 'path';
|
import * as path from 'path';
|
||||||
import * as core from '@actions/core';
|
import * as core from '@actions/core';
|
||||||
import * as actionsToolkit from '@docker/actions-toolkit';
|
import * as actionsToolkit from '@docker/actions-toolkit';
|
||||||
import {Inputs as BuildxInputs} from '@docker/actions-toolkit/lib/buildx/inputs';
|
|
||||||
import {Context} from '@docker/actions-toolkit/lib/context';
|
|
||||||
import {Docker} from '@docker/actions-toolkit/lib/docker/docker';
|
|
||||||
import {Exec} from '@docker/actions-toolkit/lib/exec';
|
|
||||||
import {GitHub} from '@docker/actions-toolkit/lib/github';
|
|
||||||
import {Toolkit} from '@docker/actions-toolkit/lib/toolkit';
|
|
||||||
import {BakeDefinition} from '@docker/actions-toolkit/lib/types/bake';
|
|
||||||
import {ConfigFile} from '@docker/actions-toolkit/lib/types/docker';
|
|
||||||
|
|
||||||
import * as context from './context';
|
import {Buildx} from '@docker/actions-toolkit/lib/buildx/buildx.js';
|
||||||
import * as stateHelper from './state-helper';
|
import {History as BuildxHistory} from '@docker/actions-toolkit/lib/buildx/history.js';
|
||||||
|
import {Context} from '@docker/actions-toolkit/lib/context.js';
|
||||||
|
import {Docker} from '@docker/actions-toolkit/lib/docker/docker.js';
|
||||||
|
import {Exec} from '@docker/actions-toolkit/lib/exec.js';
|
||||||
|
import {GitHub} from '@docker/actions-toolkit/lib/github/github.js';
|
||||||
|
import {GitHubArtifact} from '@docker/actions-toolkit/lib/github/artifact.js';
|
||||||
|
import {GitHubSummary} from '@docker/actions-toolkit/lib/github/summary.js';
|
||||||
|
import {Toolkit} from '@docker/actions-toolkit/lib/toolkit.js';
|
||||||
|
import {Util} from '@docker/actions-toolkit/lib/util.js';
|
||||||
|
|
||||||
|
import {BakeDefinition} from '@docker/actions-toolkit/lib/types/buildx/bake.js';
|
||||||
|
import {BuilderInfo} from '@docker/actions-toolkit/lib/types/buildx/builder.js';
|
||||||
|
import {ConfigFile} from '@docker/actions-toolkit/lib/types/docker/docker.js';
|
||||||
|
import {UploadResponse as UploadArtifactResponse} from '@docker/actions-toolkit/lib/types/github/artifact.js';
|
||||||
|
|
||||||
|
import * as context from './context.js';
|
||||||
|
import * as stateHelper from './state-helper.js';
|
||||||
|
|
||||||
actionsToolkit.run(
|
actionsToolkit.run(
|
||||||
// main
|
// main
|
||||||
async () => {
|
async () => {
|
||||||
|
const startedTime = new Date();
|
||||||
|
|
||||||
const inputs: context.Inputs = await context.getInputs();
|
const inputs: context.Inputs = await context.getInputs();
|
||||||
|
stateHelper.setSummaryInputs(inputs);
|
||||||
|
core.debug(`inputs: ${JSON.stringify(inputs)}`);
|
||||||
|
|
||||||
const toolkit = new Toolkit();
|
const toolkit = new Toolkit();
|
||||||
const gitAuthToken = process.env.BUILDX_BAKE_GIT_AUTH_TOKEN ?? inputs.githubToken;
|
const gitAuthToken = process.env.BUILDX_BAKE_GIT_AUTH_TOKEN ?? inputs['github-token'];
|
||||||
|
|
||||||
await core.group(`GitHub Actions runtime token ACs`, async () => {
|
await core.group(`GitHub Actions runtime token ACs`, async () => {
|
||||||
try {
|
try {
|
||||||
@@ -74,65 +87,186 @@ actionsToolkit.run(
|
|||||||
await toolkit.buildx.printVersion();
|
await toolkit.buildx.printVersion();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
let builder: BuilderInfo;
|
||||||
|
await core.group(`Builder info`, async () => {
|
||||||
|
builder = await toolkit.builder.inspect(inputs.builder);
|
||||||
|
stateHelper.setBuilderDriver(builder.driver ?? '');
|
||||||
|
stateHelper.setBuilderEndpoint(builder.nodes?.[0]?.endpoint ?? '');
|
||||||
|
core.info(JSON.stringify(builder, null, 2));
|
||||||
|
});
|
||||||
|
|
||||||
let definition: BakeDefinition | undefined;
|
let definition: BakeDefinition | undefined;
|
||||||
await core.group(`Parsing raw definition`, async () => {
|
await core.group(`Parsing raw definition`, async () => {
|
||||||
definition = await toolkit.bake.getDefinition(
|
definition = await toolkit.buildxBake.getDefinition(
|
||||||
{
|
{
|
||||||
|
allow: inputs.allow,
|
||||||
files: inputs.files,
|
files: inputs.files,
|
||||||
load: inputs.load,
|
load: inputs.load,
|
||||||
noCache: inputs.noCache,
|
noCache: inputs['no-cache'],
|
||||||
overrides: inputs.set,
|
overrides: inputs.set,
|
||||||
provenance: inputs.provenance,
|
provenance: inputs.provenance,
|
||||||
push: inputs.push,
|
push: inputs.push,
|
||||||
sbom: inputs.sbom,
|
sbom: inputs.sbom,
|
||||||
source: inputs.source,
|
source: inputs.source.remoteRef,
|
||||||
targets: inputs.targets,
|
targets: inputs.targets,
|
||||||
githubToken: gitAuthToken
|
githubToken: gitAuthToken
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
cwd: inputs.workdir
|
cwd: inputs.source.workdir
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
if (!definition) {
|
if (!definition) {
|
||||||
throw new Error('Bake definition not set');
|
throw new Error('Bake definition not set');
|
||||||
}
|
}
|
||||||
|
stateHelper.setBakeDefinition(definition);
|
||||||
|
|
||||||
const args: string[] = await context.getArgs(inputs, definition, toolkit);
|
const args: string[] = await context.getArgs(inputs, definition, toolkit);
|
||||||
const buildCmd = await toolkit.buildx.getCommand(args);
|
const buildCmd = await toolkit.buildx.getCommand(args);
|
||||||
const buildEnv = Object.assign({}, process.env, {
|
const buildEnv = Object.assign({}, process.env, {
|
||||||
BUILDX_BAKE_GIT_AUTH_TOKEN: gitAuthToken
|
BUILDX_BAKE_GIT_AUTH_TOKEN: gitAuthToken,
|
||||||
|
BUILDX_METADATA_WARNINGS: 'true'
|
||||||
}) as {
|
}) as {
|
||||||
[key: string]: string;
|
[key: string]: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
await core.group(`Bake definition`, async () => {
|
await core.group(`Bake definition`, async () => {
|
||||||
await Exec.exec(buildCmd.command, [...buildCmd.args, '--print'], {
|
await Exec.getExecOutput(buildCmd.command, [...buildCmd.args, '--print'], {
|
||||||
cwd: inputs.workdir,
|
cwd: inputs.source.workdir,
|
||||||
env: buildEnv
|
env: buildEnv,
|
||||||
|
ignoreReturnCode: true
|
||||||
|
}).then(res => {
|
||||||
|
if (res.stderr.length > 0 && res.exitCode != 0) {
|
||||||
|
throw Error(res.stderr);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
let err: Error | undefined;
|
||||||
await Exec.getExecOutput(buildCmd.command, buildCmd.args, {
|
await Exec.getExecOutput(buildCmd.command, buildCmd.args, {
|
||||||
cwd: inputs.workdir,
|
cwd: inputs.source.workdir,
|
||||||
env: buildEnv,
|
env: buildEnv,
|
||||||
ignoreReturnCode: true
|
ignoreReturnCode: true
|
||||||
}).then(res => {
|
}).then(res => {
|
||||||
if (res.stderr.length > 0 && res.exitCode != 0) {
|
if (res.exitCode != 0) {
|
||||||
throw new Error(`buildx bake failed with: ${res.stderr.match(/(.*)\s*$/)?.[0]?.trim() ?? 'unknown error'}`);
|
if (inputs.call && inputs.call === 'check' && res.stdout.length > 0) {
|
||||||
|
// checks warnings are printed to stdout: https://github.com/docker/buildx/pull/2647
|
||||||
|
// with bake we can have multiple targets being checked so we need to
|
||||||
|
// count the total number of warnings
|
||||||
|
const totalWarnings = [...res.stdout.matchAll(/^Check complete, (\d+) warnings? (?:has|have) been found!/gm)].reduce((sum, m) => sum + parseInt(m[1], 10), 0);
|
||||||
|
if (totalWarnings > 0) {
|
||||||
|
// https://github.com/docker/buildx/blob/1e50e8ddabe108f009b9925e13a321d7c8f99f26/commands/build.go#L797-L803
|
||||||
|
if (totalWarnings === 1) {
|
||||||
|
err = Error(`Check complete, ${totalWarnings} warning has been found!`);
|
||||||
|
} else {
|
||||||
|
err = Error(`Check complete, ${totalWarnings} warnings have been found!`);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// if there are no warnings found, return the first line of stdout
|
||||||
|
err = Error(res.stdout.split('\n')[0]?.trim());
|
||||||
|
}
|
||||||
|
} else if (res.stderr.length > 0) {
|
||||||
|
err = Error(`buildx bake failed with: ${res.stderr.match(/(.*)\s*$/)?.[0]?.trim() ?? 'unknown error'}`);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
const metadata = await BuildxInputs.resolveBuildMetadata();
|
const metadata = toolkit.buildxBake.resolveMetadata();
|
||||||
if (metadata) {
|
if (metadata) {
|
||||||
await core.group(`Metadata`, async () => {
|
await core.group(`Metadata`, async () => {
|
||||||
core.info(metadata);
|
const metadatadt = JSON.stringify(metadata, null, 2);
|
||||||
core.setOutput('metadata', metadata);
|
core.info(metadatadt);
|
||||||
|
core.setOutput('metadata', metadatadt);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let refs: Array<string> = [];
|
||||||
|
await core.group(`Build references`, async () => {
|
||||||
|
refs = await buildRefs(toolkit, startedTime, inputs.builder);
|
||||||
|
if (refs.length > 0) {
|
||||||
|
for (const ref of refs) {
|
||||||
|
core.info(ref);
|
||||||
|
}
|
||||||
|
stateHelper.setBuildRefs(refs);
|
||||||
|
} else {
|
||||||
|
core.info('No build references found');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
if (buildChecksAnnotationsEnabled()) {
|
||||||
|
const warnings = toolkit.buildxBake.resolveWarnings(metadata);
|
||||||
|
if (refs.length > 0 && warnings && warnings.length > 0) {
|
||||||
|
const annotations = await Buildx.convertWarningsToGitHubAnnotations(warnings, refs);
|
||||||
|
core.debug(`annotations: ${JSON.stringify(annotations, null, 2)}`);
|
||||||
|
if (annotations && annotations.length > 0) {
|
||||||
|
await core.group(`Generating GitHub annotations (${annotations.length} build checks found)`, async () => {
|
||||||
|
for (const annotation of annotations) {
|
||||||
|
core.warning(annotation.message, annotation);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
await core.group(`Check build summary support`, async () => {
|
||||||
|
if (!buildSummaryEnabled()) {
|
||||||
|
core.info('Build summary disabled');
|
||||||
|
} else if (inputs.call && inputs.call !== 'build') {
|
||||||
|
core.info(`Build summary skipped for ${inputs.call} subrequest`);
|
||||||
|
} else if (GitHub.isGHES) {
|
||||||
|
core.info('Build summary is not yet supported on GHES');
|
||||||
|
} else if (!(await toolkit.buildx.versionSatisfies('>=0.23.0'))) {
|
||||||
|
core.info('Build summary requires Buildx >= 0.23.0');
|
||||||
|
} else if (refs.length == 0) {
|
||||||
|
core.info('Build summary requires at least one build reference');
|
||||||
|
} else {
|
||||||
|
core.info('Build summary supported!');
|
||||||
|
stateHelper.setSummarySupported();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
if (err) {
|
||||||
|
throw err;
|
||||||
|
}
|
||||||
},
|
},
|
||||||
// post
|
// post
|
||||||
async () => {
|
async () => {
|
||||||
|
if (stateHelper.isSummarySupported) {
|
||||||
|
await core.group(`Generating build summary`, async () => {
|
||||||
|
try {
|
||||||
|
const recordUploadEnabled = buildRecordUploadEnabled();
|
||||||
|
let recordRetentionDays: number | undefined;
|
||||||
|
if (recordUploadEnabled) {
|
||||||
|
recordRetentionDays = buildRecordRetentionDays();
|
||||||
|
}
|
||||||
|
|
||||||
|
const buildxHistory = new BuildxHistory();
|
||||||
|
const exportRes = await buildxHistory.export({
|
||||||
|
refs: stateHelper.buildRefs
|
||||||
|
});
|
||||||
|
core.info(`Build records written to ${exportRes.dockerbuildFilename} (${Util.formatFileSize(exportRes.dockerbuildSize)})`);
|
||||||
|
|
||||||
|
let uploadRes: UploadArtifactResponse | undefined;
|
||||||
|
if (recordUploadEnabled) {
|
||||||
|
uploadRes = await GitHubArtifact.upload({
|
||||||
|
filename: exportRes.dockerbuildFilename,
|
||||||
|
retentionDays: recordRetentionDays
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
await GitHubSummary.writeBuildSummary({
|
||||||
|
exportRes: exportRes,
|
||||||
|
uploadRes: uploadRes,
|
||||||
|
inputs: stateHelper.summaryInputs,
|
||||||
|
bakeDefinition: stateHelper.bakeDefinition,
|
||||||
|
driver: stateHelper.builderDriver,
|
||||||
|
endpoint: stateHelper.builderEndpoint
|
||||||
|
});
|
||||||
|
} catch (e) {
|
||||||
|
core.warning(e.message);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
if (stateHelper.tmpDir.length > 0) {
|
if (stateHelper.tmpDir.length > 0) {
|
||||||
await core.group(`Removing temp folder ${stateHelper.tmpDir}`, async () => {
|
await core.group(`Removing temp folder ${stateHelper.tmpDir}`, async () => {
|
||||||
fs.rmSync(stateHelper.tmpDir, {recursive: true});
|
fs.rmSync(stateHelper.tmpDir, {recursive: true});
|
||||||
@@ -140,3 +274,60 @@ actionsToolkit.run(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
async function buildRefs(toolkit: Toolkit, since: Date, builder?: string): Promise<Array<string>> {
|
||||||
|
// get refs from metadata file
|
||||||
|
const metaRefs = toolkit.buildxBake.resolveRefs();
|
||||||
|
if (metaRefs) {
|
||||||
|
return metaRefs;
|
||||||
|
}
|
||||||
|
// otherwise, look for the very first build ref since the build has started
|
||||||
|
if (!builder) {
|
||||||
|
const currentBuilder = await toolkit.builder.inspect();
|
||||||
|
builder = currentBuilder.name;
|
||||||
|
}
|
||||||
|
const res = Buildx.refs({
|
||||||
|
dir: Buildx.refsDir,
|
||||||
|
builderName: builder,
|
||||||
|
since: since
|
||||||
|
});
|
||||||
|
const refs: Array<string> = [];
|
||||||
|
for (const ref in res) {
|
||||||
|
if (Object.prototype.hasOwnProperty.call(res, ref)) {
|
||||||
|
refs.push(ref);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return refs;
|
||||||
|
}
|
||||||
|
|
||||||
|
function buildChecksAnnotationsEnabled(): boolean {
|
||||||
|
if (process.env.DOCKER_BUILD_CHECKS_ANNOTATIONS) {
|
||||||
|
return Util.parseBool(process.env.DOCKER_BUILD_CHECKS_ANNOTATIONS);
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
function buildSummaryEnabled(): boolean {
|
||||||
|
if (process.env.DOCKER_BUILD_SUMMARY) {
|
||||||
|
return Util.parseBool(process.env.DOCKER_BUILD_SUMMARY);
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
function buildRecordUploadEnabled(): boolean {
|
||||||
|
if (process.env.DOCKER_BUILD_RECORD_UPLOAD) {
|
||||||
|
return Util.parseBool(process.env.DOCKER_BUILD_RECORD_UPLOAD);
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
function buildRecordRetentionDays(): number | undefined {
|
||||||
|
const val = process.env.DOCKER_BUILD_RECORD_RETENTION_DAYS;
|
||||||
|
if (val) {
|
||||||
|
const res = parseInt(val);
|
||||||
|
if (isNaN(res)) {
|
||||||
|
throw Error(`Invalid build record retention days: ${val}`);
|
||||||
|
}
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,7 +1,61 @@
|
|||||||
import * as core from '@actions/core';
|
import * as core from '@actions/core';
|
||||||
|
|
||||||
|
import {BakeDefinition} from '@docker/actions-toolkit/lib/types/buildx/bake.js';
|
||||||
|
|
||||||
|
import {Inputs} from './context.js';
|
||||||
|
|
||||||
export const tmpDir = process.env['STATE_tmpDir'] || '';
|
export const tmpDir = process.env['STATE_tmpDir'] || '';
|
||||||
|
|
||||||
|
export const builderDriver = process.env['STATE_builderDriver'] || '';
|
||||||
|
export const builderEndpoint = process.env['STATE_builderEndpoint'] || '';
|
||||||
|
export const summaryInputs = process.env['STATE_summaryInputs'] ? JSON.parse(process.env['STATE_summaryInputs']) : undefined;
|
||||||
|
export const bakeDefinition = process.env['STATE_bakeDefinition'] ? <BakeDefinition>JSON.parse(process.env['STATE_bakeDefinition']) : undefined;
|
||||||
|
|
||||||
|
export const buildRefs = process.env['STATE_buildRefs'] ? process.env['STATE_buildRefs'].split(',') : [];
|
||||||
|
export const isSummarySupported = !!process.env['STATE_isSummarySupported'];
|
||||||
|
|
||||||
export function setTmpDir(tmpDir: string) {
|
export function setTmpDir(tmpDir: string) {
|
||||||
core.saveState('tmpDir', tmpDir);
|
core.saveState('tmpDir', tmpDir);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function setBuilderDriver(builderDriver: string) {
|
||||||
|
core.saveState('builderDriver', builderDriver);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function setBuilderEndpoint(builderEndpoint: string) {
|
||||||
|
core.saveState('builderEndpoint', builderEndpoint);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function setBakeDefinition(bakeDefinition: BakeDefinition) {
|
||||||
|
core.saveState('bakeDefinition', JSON.stringify(bakeDefinition));
|
||||||
|
}
|
||||||
|
|
||||||
|
export function setBuildRefs(buildRefs: Array<string>) {
|
||||||
|
core.saveState('buildRefs', buildRefs.join(','));
|
||||||
|
}
|
||||||
|
|
||||||
|
export function setSummarySupported() {
|
||||||
|
core.saveState('isSummarySupported', 'true');
|
||||||
|
}
|
||||||
|
|
||||||
|
export function setSummaryInputs(inputs: Inputs) {
|
||||||
|
const res = {};
|
||||||
|
if (inputs.source.remoteRef || inputs.source.workdir) {
|
||||||
|
res['source'] = inputs.source.remoteRef || inputs.source.workdir;
|
||||||
|
}
|
||||||
|
for (const key of Object.keys(inputs)) {
|
||||||
|
if (key === 'source' || key === 'github-token') {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
const value: string | string[] | boolean = inputs[key];
|
||||||
|
if (typeof value === 'boolean' && !value) {
|
||||||
|
continue;
|
||||||
|
} else if (Array.isArray(value) && value.length === 0) {
|
||||||
|
continue;
|
||||||
|
} else if (!value) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
res[key] = value;
|
||||||
|
}
|
||||||
|
core.saveState('summaryInputs', JSON.stringify(res));
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,61 +0,0 @@
|
|||||||
# https://docs.github.com/en/actions/creating-actions/metadata-syntax-for-github-actions
|
|
||||||
name: 'List Bake targets'
|
|
||||||
description: 'Generate a list of Bake targets to help distributing builds in your workflow'
|
|
||||||
|
|
||||||
inputs:
|
|
||||||
workdir:
|
|
||||||
description: Working directory
|
|
||||||
default: '.'
|
|
||||||
required: false
|
|
||||||
files:
|
|
||||||
description: Comma separated list of Bake files
|
|
||||||
required: false
|
|
||||||
target:
|
|
||||||
description: Bake target
|
|
||||||
required: false
|
|
||||||
|
|
||||||
outputs:
|
|
||||||
targets:
|
|
||||||
description: List of targets
|
|
||||||
value: ${{ steps.generate.outputs.targets }}
|
|
||||||
|
|
||||||
runs:
|
|
||||||
using: composite
|
|
||||||
steps:
|
|
||||||
-
|
|
||||||
name: Generate
|
|
||||||
id: generate
|
|
||||||
uses: actions/github-script@v7
|
|
||||||
with:
|
|
||||||
script: |
|
|
||||||
let def;
|
|
||||||
const files = `${{ inputs.files }}` ? `${{ inputs.files }}`.split(',') : [];
|
|
||||||
const target = `${{ inputs.target }}`;
|
|
||||||
|
|
||||||
await core.group(`Validating definition`, async () => {
|
|
||||||
let args = ['buildx', 'bake'];
|
|
||||||
for (const file of files) {
|
|
||||||
args.push('--file', file);
|
|
||||||
}
|
|
||||||
if (target) {
|
|
||||||
args.push(target);
|
|
||||||
}
|
|
||||||
args.push('--print');
|
|
||||||
|
|
||||||
const res = await exec.getExecOutput('docker', args, {
|
|
||||||
ignoreReturnCode: true,
|
|
||||||
silent: true,
|
|
||||||
cwd: `${{ inputs.workdir }}`
|
|
||||||
});
|
|
||||||
if (res.stderr.length > 0 && res.exitCode != 0) {
|
|
||||||
throw new Error(res.stderr);
|
|
||||||
}
|
|
||||||
def = JSON.parse(res.stdout.trim());
|
|
||||||
core.info(JSON.stringify(def, null, 2));
|
|
||||||
});
|
|
||||||
|
|
||||||
await core.group(`Set output`, async () => {
|
|
||||||
const targets = Object.keys(def.target);
|
|
||||||
core.info(`targets: ${JSON.stringify(targets)}`);
|
|
||||||
core.setOutput('targets', JSON.stringify(targets));
|
|
||||||
});
|
|
||||||
@@ -0,0 +1,140 @@
|
|||||||
|
## About
|
||||||
|
|
||||||
|
This subaction generates a multi-dimension matrix that can be used in a [GitHub matrix](https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstrategymatrix)
|
||||||
|
through the [`include` property](https://docs.github.com/en/actions/how-tos/writing-workflows/choosing-what-your-workflow-does/running-variations-of-jobs-in-a-workflow#expanding-or-adding-matrix-configurations)
|
||||||
|
so you can distribute your builds across multiple runners.
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
___
|
||||||
|
|
||||||
|
* [Usage](#usage)
|
||||||
|
* [Customizing](#customizing)
|
||||||
|
* [inputs](#inputs)
|
||||||
|
* [outputs](#outputs)
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
### List targets
|
||||||
|
|
||||||
|
```hcl
|
||||||
|
# docker-bake.hcl
|
||||||
|
group "validate" {
|
||||||
|
targets = ["lint", "doctoc"]
|
||||||
|
}
|
||||||
|
|
||||||
|
target "lint" {
|
||||||
|
target = "lint"
|
||||||
|
}
|
||||||
|
|
||||||
|
target "doctoc" {
|
||||||
|
target = "doctoc"
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
jobs:
|
||||||
|
prepare:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
outputs:
|
||||||
|
matrix: ${{ steps.generate.outputs.matrix }}
|
||||||
|
steps:
|
||||||
|
-
|
||||||
|
name: Checkout
|
||||||
|
uses: actions/checkout@v6
|
||||||
|
-
|
||||||
|
name: Generate matrix
|
||||||
|
id: generate
|
||||||
|
uses: docker/bake-action/subaction/matrix@v7
|
||||||
|
with:
|
||||||
|
target: validate
|
||||||
|
|
||||||
|
validate:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
needs:
|
||||||
|
- prepare
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
include: ${{ fromJson(needs.prepare.outputs.matrix) }}
|
||||||
|
steps:
|
||||||
|
-
|
||||||
|
name: Validate
|
||||||
|
uses: docker/bake-action@v7
|
||||||
|
with:
|
||||||
|
targets: ${{ matrix.target }}
|
||||||
|
```
|
||||||
|
|
||||||
|
### Platforms split
|
||||||
|
|
||||||
|
```hcl
|
||||||
|
# docker-bake.hcl
|
||||||
|
target "lint" {
|
||||||
|
dockerfile = "./hack/dockerfiles/lint.Dockerfile"
|
||||||
|
output = ["type=cacheonly"]
|
||||||
|
platforms = [
|
||||||
|
"darwin/amd64",
|
||||||
|
"darwin/arm64",
|
||||||
|
"linux/amd64",
|
||||||
|
"linux/arm64",
|
||||||
|
"linux/s390x",
|
||||||
|
"linux/ppc64le",
|
||||||
|
"linux/riscv64",
|
||||||
|
"windows/amd64",
|
||||||
|
"windows/arm64"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
jobs:
|
||||||
|
prepare:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
outputs:
|
||||||
|
matrix: ${{ steps.generate.outputs.matrix }}
|
||||||
|
steps:
|
||||||
|
-
|
||||||
|
name: Checkout
|
||||||
|
uses: actions/checkout@v6
|
||||||
|
-
|
||||||
|
name: Generate matrix
|
||||||
|
id: generate
|
||||||
|
uses: docker/bake-action/subaction/matrix@v7
|
||||||
|
with:
|
||||||
|
target: lint
|
||||||
|
fields: platforms
|
||||||
|
|
||||||
|
lint:
|
||||||
|
runs-on: ${{ startsWith(matrix.platforms, 'linux/arm') && 'ubuntu-24.04-arm' || 'ubuntu-latest' }}
|
||||||
|
needs:
|
||||||
|
- prepare
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
include: ${{ fromJson(needs.prepare.outputs.matrix) }}
|
||||||
|
steps:
|
||||||
|
-
|
||||||
|
name: Lint
|
||||||
|
uses: docker/bake-action@v7
|
||||||
|
with:
|
||||||
|
targets: ${{ matrix.target }}
|
||||||
|
set: |
|
||||||
|
*.platform=${{ matrix.platforms }}
|
||||||
|
```
|
||||||
|
|
||||||
|
## Customizing
|
||||||
|
|
||||||
|
### inputs
|
||||||
|
|
||||||
|
| Name | Type | Description |
|
||||||
|
|-----------|----------|------------------------------------------------------------------------------------------------|
|
||||||
|
| `workdir` | String | Working directory to use (defaults to `.`) |
|
||||||
|
| `files` | List/CSV | List of [bake definition files](https://docs.docker.com/build/customize/bake/file-definition/) |
|
||||||
|
| `target` | String | The target to use within the bake file |
|
||||||
|
| `fields` | String | List of extra fields to include in the matrix |
|
||||||
|
|
||||||
|
### outputs
|
||||||
|
|
||||||
|
| Name | Type | Description |
|
||||||
|
|----------|------|----------------------|
|
||||||
|
| `matrix` | JSON | Matrix configuration |
|
||||||
@@ -0,0 +1,101 @@
|
|||||||
|
# https://docs.github.com/en/actions/creating-actions/metadata-syntax-for-github-actions
|
||||||
|
name: 'Matrix'
|
||||||
|
description: 'Generate a matrix from a Bake definition to help distributing builds in your workflow'
|
||||||
|
|
||||||
|
inputs:
|
||||||
|
workdir:
|
||||||
|
description: Working directory
|
||||||
|
default: '.'
|
||||||
|
required: false
|
||||||
|
files:
|
||||||
|
description: List of Bake files
|
||||||
|
required: false
|
||||||
|
target:
|
||||||
|
description: Bake target
|
||||||
|
required: false
|
||||||
|
fields:
|
||||||
|
description: List of extra fields to include in the matrix
|
||||||
|
required: false
|
||||||
|
|
||||||
|
outputs:
|
||||||
|
matrix:
|
||||||
|
description: Matrix configuration
|
||||||
|
value: ${{ steps.generate.outputs.includes }}
|
||||||
|
|
||||||
|
runs:
|
||||||
|
using: composite
|
||||||
|
steps:
|
||||||
|
-
|
||||||
|
name: Generate
|
||||||
|
id: generate
|
||||||
|
uses: actions/github-script@v8
|
||||||
|
env:
|
||||||
|
INPUT_WORKDIR: ${{ inputs.workdir }}
|
||||||
|
INPUT_FILES: ${{ inputs.files }}
|
||||||
|
INPUT_TARGET: ${{ inputs.target }}
|
||||||
|
INPUT_FIELDS: ${{ inputs.fields }}
|
||||||
|
with:
|
||||||
|
script: |
|
||||||
|
function getInputList(name) {
|
||||||
|
return core.getInput(name) ? core.getInput(name).split(/[\r?\n,]+/).filter(x => x !== '') : [];
|
||||||
|
}
|
||||||
|
|
||||||
|
const workdir = core.getInput('workdir');
|
||||||
|
const files = getInputList('files');
|
||||||
|
const target = core.getInput('target');
|
||||||
|
const fields = getInputList('fields');
|
||||||
|
|
||||||
|
let def = {};
|
||||||
|
await core.group(`Parsing definition`, async () => {
|
||||||
|
let args = ['buildx', 'bake'];
|
||||||
|
for (const file of files) {
|
||||||
|
args.push('--file', file);
|
||||||
|
}
|
||||||
|
if (target) {
|
||||||
|
args.push(target);
|
||||||
|
}
|
||||||
|
args.push('--print');
|
||||||
|
const res = await exec.getExecOutput('docker', args, {
|
||||||
|
ignoreReturnCode: true,
|
||||||
|
silent: true,
|
||||||
|
cwd: workdir
|
||||||
|
});
|
||||||
|
if (res.stderr.length > 0 && res.exitCode != 0) {
|
||||||
|
throw new Error(res.stderr);
|
||||||
|
}
|
||||||
|
def = JSON.parse(res.stdout.trim());
|
||||||
|
core.info(JSON.stringify(def, null, 2));
|
||||||
|
});
|
||||||
|
|
||||||
|
await core.group(`Generating matrix`, async () => {
|
||||||
|
const result = [];
|
||||||
|
for (const targetName of Object.keys(def.target)) {
|
||||||
|
const target = def.target[targetName];
|
||||||
|
const entry = { target: targetName };
|
||||||
|
if (fields.length === 0) {
|
||||||
|
result.push({ ...entry });
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
let fieldFound = false;
|
||||||
|
Object.keys(target).forEach(field => {
|
||||||
|
if (fields.includes(field)) {
|
||||||
|
fieldFound = true;
|
||||||
|
const value = target[field];
|
||||||
|
if (Array.isArray(value)) {
|
||||||
|
value.forEach((v) => {
|
||||||
|
entry[field] = v;
|
||||||
|
result.push({ ...entry });
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
entry[field] = value;
|
||||||
|
result.push({ ...entry });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
if (!fieldFound) {
|
||||||
|
result.push({ ...entry });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
core.info(JSON.stringify(result, null, 2));
|
||||||
|
core.setOutput('includes', JSON.stringify(result));
|
||||||
|
});
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
# syntax=docker/dockerfile:1
|
||||||
|
|
||||||
|
FROM busybox AS t1
|
||||||
|
RUN echo "Hello t1"
|
||||||
|
|
||||||
|
FROM busybox AS t2
|
||||||
|
RUN echo "Hello t2"
|
||||||
|
|
||||||
|
FROM busybox AS t3
|
||||||
|
RUN echo "Hello t3"
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
group "default" {
|
||||||
|
targets = ["t1", "t2", "t3"]
|
||||||
|
}
|
||||||
|
|
||||||
|
target "t1" {
|
||||||
|
target = "t1"
|
||||||
|
}
|
||||||
|
|
||||||
|
target "t2" {
|
||||||
|
target = "t2"
|
||||||
|
attest = ["type=provenance,mode=min"]
|
||||||
|
}
|
||||||
|
|
||||||
|
target "t3" {
|
||||||
|
target = "t3"
|
||||||
|
attest = ["type=sbom"]
|
||||||
|
}
|
||||||
+14
-4
@@ -6,21 +6,26 @@ group "release" {
|
|||||||
targets = ["db", "app-plus"]
|
targets = ["db", "app-plus"]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Special target: https://github.com/docker/metadata-action#bake-definition
|
||||||
|
target "docker-metadata-action" {
|
||||||
|
tags = [
|
||||||
|
"localhost:5000/name/app:latest",
|
||||||
|
"localhost:5000/name/app:1.0.0"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
target "db" {
|
target "db" {
|
||||||
context = "./test"
|
context = "./test"
|
||||||
tags = ["docker.io/tonistiigi/db"]
|
tags = ["docker.io/tonistiigi/db"]
|
||||||
}
|
}
|
||||||
|
|
||||||
target "app" {
|
target "app" {
|
||||||
|
inherits = ["docker-metadata-action"]
|
||||||
context = "./test"
|
context = "./test"
|
||||||
dockerfile = "Dockerfile"
|
dockerfile = "Dockerfile"
|
||||||
args = {
|
args = {
|
||||||
name = "foo"
|
name = "foo"
|
||||||
}
|
}
|
||||||
tags = [
|
|
||||||
"localhost:5000/name/app:latest",
|
|
||||||
"localhost:5000/name/app:1.0.0"
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
|
|
||||||
target "cross" {
|
target "cross" {
|
||||||
@@ -42,3 +47,8 @@ target "app-proxy" {
|
|||||||
inherits = ["app"]
|
inherits = ["app"]
|
||||||
dockerfile = "proxy.Dockerfile"
|
dockerfile = "proxy.Dockerfile"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
target "app-entitlements" {
|
||||||
|
inherits = ["app"]
|
||||||
|
entitlements = ["network.host"]
|
||||||
|
}
|
||||||
|
|||||||
@@ -0,0 +1,36 @@
|
|||||||
|
group "validate" {
|
||||||
|
targets = ["lint", "lint-gopls", "validate-vendor", "validate-docs"]
|
||||||
|
}
|
||||||
|
|
||||||
|
target "lint" {
|
||||||
|
dockerfile = "./hack/dockerfiles/lint.Dockerfile"
|
||||||
|
output = ["type=cacheonly"]
|
||||||
|
platforms = [
|
||||||
|
"darwin/amd64",
|
||||||
|
"darwin/arm64",
|
||||||
|
"linux/amd64",
|
||||||
|
"linux/arm64",
|
||||||
|
"linux/s390x",
|
||||||
|
"linux/ppc64le",
|
||||||
|
"linux/riscv64",
|
||||||
|
"windows/amd64",
|
||||||
|
"windows/arm64"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
|
target "lint-gopls" {
|
||||||
|
inherits = ["lint"]
|
||||||
|
target = "gopls-analyze"
|
||||||
|
}
|
||||||
|
|
||||||
|
target "validate-vendor" {
|
||||||
|
dockerfile = "./hack/dockerfiles/vendor.Dockerfile"
|
||||||
|
target = "validate"
|
||||||
|
output = ["type=cacheonly"]
|
||||||
|
}
|
||||||
|
|
||||||
|
target "validate-docs" {
|
||||||
|
dockerfile = "./hack/dockerfiles/docs.Dockerfile"
|
||||||
|
target = "validate"
|
||||||
|
output = ["type=cacheonly"]
|
||||||
|
}
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
frOM busybox as base
|
||||||
|
cOpy lint-other.Dockerfile .
|
||||||
|
|
||||||
|
froM busybox aS notused
|
||||||
|
COPY lint-other.Dockerfile .
|
||||||
|
|
||||||
|
from scratch
|
||||||
|
COPy --from=base \
|
||||||
|
/lint-other.Dockerfile \
|
||||||
|
/
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
frOM busybox as base
|
||||||
|
cOpy lint.Dockerfile .
|
||||||
|
|
||||||
|
from scratch
|
||||||
|
MAINTAINER moby@example.com
|
||||||
|
COPy --from=base \
|
||||||
|
/lint.Dockerfile \
|
||||||
|
/
|
||||||
|
|
||||||
|
CMD [ "echo", "Hello, Norway!" ]
|
||||||
|
CMD [ "echo", "Hello, Sweden!" ]
|
||||||
|
ENTRYPOINT my-program start
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
group "default" {
|
||||||
|
targets = ["lint", "lint-other", "lint-inline"]
|
||||||
|
}
|
||||||
|
target "lint" {
|
||||||
|
dockerfile = "lint.Dockerfile"
|
||||||
|
}
|
||||||
|
target "lint-other" {
|
||||||
|
dockerfile = "lint-other.Dockerfile"
|
||||||
|
}
|
||||||
|
target "lint-inline" {
|
||||||
|
dockerfile-inline = "FRoM alpine\nENTRYPOINT [\"echo\", \"hello\"]"
|
||||||
|
}
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
group "default" {
|
||||||
|
targets = ["t3"]
|
||||||
|
}
|
||||||
|
|
||||||
|
target "t3" {
|
||||||
|
name = "${item.tag}"
|
||||||
|
matrix = {
|
||||||
|
item = t3
|
||||||
|
}
|
||||||
|
args = {
|
||||||
|
VERSION = "${item.version}"
|
||||||
|
DUMMY_ARG = "${item.arg}"
|
||||||
|
}
|
||||||
|
tags = ["${item.tag}"]
|
||||||
|
}
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
{
|
||||||
|
"t3": [
|
||||||
|
{
|
||||||
|
"version": "v1",
|
||||||
|
"arg": "v1-value",
|
||||||
|
"tag": "v1-tag"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"version": "v2",
|
||||||
|
"arg": "v2-value",
|
||||||
|
"tag": "v2-tag"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
+4
-9
@@ -1,9 +1,8 @@
|
|||||||
{
|
{
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
|
"module": "nodenext",
|
||||||
|
"moduleResolution": "nodenext",
|
||||||
"esModuleInterop": true,
|
"esModuleInterop": true,
|
||||||
"target": "es6",
|
|
||||||
"module": "commonjs",
|
|
||||||
"strict": true,
|
|
||||||
"newLine": "lf",
|
"newLine": "lf",
|
||||||
"outDir": "./lib",
|
"outDir": "./lib",
|
||||||
"rootDir": "./src",
|
"rootDir": "./src",
|
||||||
@@ -12,11 +11,7 @@
|
|||||||
"resolveJsonModule": true,
|
"resolveJsonModule": true,
|
||||||
"useUnknownInCatchVariables": false,
|
"useUnknownInCatchVariables": false,
|
||||||
},
|
},
|
||||||
"exclude": [
|
"include": [
|
||||||
"./__mocks__/**/*",
|
"src/**/*.ts"
|
||||||
"./__tests__/**/*",
|
|
||||||
"./lib/**/*",
|
|
||||||
"node_modules",
|
|
||||||
"jest.config.ts"
|
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,16 @@
|
|||||||
|
import {defineConfig} from 'vitest/config';
|
||||||
|
|
||||||
|
export default defineConfig({
|
||||||
|
test: {
|
||||||
|
clearMocks: true,
|
||||||
|
environment: 'node',
|
||||||
|
setupFiles: ['./__tests__/setup.unit.ts'],
|
||||||
|
include: ['**/*.test.ts'],
|
||||||
|
coverage: {
|
||||||
|
provider: 'v8',
|
||||||
|
reporter: ['clover'],
|
||||||
|
include: ['src/**/*.ts'],
|
||||||
|
exclude: ['src/**/main.ts']
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
Reference in New Issue
Block a user