Merge pull request #746 from crazy-max/attests-sbom-provenance-inputs

add attests, provenance and sbom inputs
This commit is contained in:
CrazyMax authored and GitHub committed 2023-01-12 19:27:54 +01:00
commit c40bf0fdf6
14 files changed
+473 -88

No files matched your search

+100 -48
View File
@@ -84,7 +84,7 @@ jobs:
-
name: Inspect
run: |
docker buildx imagetools inspect localhost:5000/name/app:1.0.0
docker buildx imagetools inspect localhost:5000/name/app:1.0.0 --format '{{json .}}'
-
name: Check digest
run: |
@@ -143,7 +143,7 @@ jobs:
-
name: Inspect
run: |
docker buildx imagetools inspect localhost:5000/name/app:1.0.0
docker buildx imagetools inspect localhost:5000/name/app:1.0.0 --format '{{json .}}'
-
name: Check digest
run: |
@@ -190,7 +190,7 @@ jobs:
-
name: Inspect
run: |
docker buildx imagetools inspect localhost:5000/name/app:1.0.0
docker buildx imagetools inspect localhost:5000/name/app:1.0.0 --format '{{json .}}'
-
name: Check digest
run: |
@@ -491,6 +491,97 @@ jobs:
cache-from: type=gha,scope=nocachefilter
cache-to: type=gha,scope=nocachefilter,mode=max
attests-compat:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- buildx: latest
buildkit: moby/buildkit:buildx-stable-1
- buildx: latest
buildkit: moby/buildkit:v0.10.6
- buildx: v0.9.1
buildkit: moby/buildkit:buildx-stable-1
steps:
-
name: Checkout
uses: actions/checkout@v3
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
with:
version: ${{ matrix.buildx }}
driver-opts: |
network=host
image=${{ matrix.buildkit }}
-
name: Build
uses: ./
with:
context: ./test/go
file: ./test/go/Dockerfile
outputs: type=cacheonly
sbom:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- target: image
output: type=image,name=localhost:5000/name/app:latest,push=true
- target: binary
output: /tmp/buildx-build
services:
registry:
image: registry:2
ports:
- 5000:5000
steps:
-
name: Checkout
uses: actions/checkout@v3
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
with:
version: ${{ inputs.buildx-version || env.BUILDX_VERSION }}
driver-opts: |
network=host
image=${{ inputs.buildkit-image || env.BUILDKIT_IMAGE }}
-
name: Build
uses: ./
with:
context: ./test/go
file: ./test/go/Dockerfile
target: ${{ matrix.target }}
outputs: ${{ matrix.output }}
sbom: true
cache-from: type=gha,scope=attests-${{ matrix.target }}
cache-to: type=gha,scope=attests-${{ matrix.target }},mode=max
-
name: Inspect image
if: matrix.target == 'image'
run: |
docker buildx imagetools inspect localhost:5000/name/app:latest --format '{{json .}}'
-
name: Check output folder
if: matrix.target == 'binary'
run: |
tree /tmp/buildx-build
-
name: Print provenance
if: matrix.target == 'binary'
run: |
cat /tmp/buildx-build/provenance.json | jq
-
name: Print SBOM
if: matrix.target == 'binary'
run: |
cat /tmp/buildx-build/sbom.spdx.json | jq
multi:
runs-on: ubuntu-latest
strategy:
@@ -536,7 +627,7 @@ jobs:
-
name: Inspect
run: |
docker buildx imagetools inspect localhost:5000/name/app:1.0.0
docker buildx imagetools inspect localhost:5000/name/app:1.0.0 --format '{{json .}}'
-
name: Check digest
run: |
@@ -649,7 +740,6 @@ jobs:
uses: docker/setup-qemu-action@v2
-
name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v2
with:
version: ${{ inputs.buildx-version || env.BUILDX_VERSION }}
@@ -657,7 +747,7 @@ jobs:
network=host
image=${{ inputs.buildkit-image || env.BUILDKIT_IMAGE }}
-
name: Build and push (1)
name: Build and push
id: docker_build
uses: ./
with:
@@ -672,54 +762,16 @@ jobs:
cache-from: type=registry,ref=localhost:5000/name/app
cache-to: type=inline
-
name: Inspect (1)
name: Inspect
run: |
docker buildx imagetools inspect localhost:5000/name/app:latest
docker buildx imagetools inspect localhost:5000/name/app:latest --format '{{json .}}'
-
name: Check digest (1)
name: Check digest
run: |
if [ -z "${{ steps.docker_build.outputs.digest }}" ]; then
echo "::error::Digest should not be empty"
exit 1
fi
-
name: Prune
run: |
docker buildx prune -a -f --verbose
-
name: Build and push (2)
id: docker_build2
uses: ./
with:
context: ./test
file: ./test/multi.Dockerfile
builder: ${{ steps.buildx.outputs.name }}
platforms: linux/amd64,linux/arm64
push: true
tags: |
localhost:5000/name/app:latest
localhost:5000/name/app:1.0.0
cache-from: type=registry,ref=localhost:5000/name/app
cache-to: type=inline
-
name: Inspect (2)
run: |
docker buildx imagetools inspect localhost:5000/name/app:latest
-
name: Check digest (2)
run: |
if [ -z "${{ steps.docker_build2.outputs.digest }}" ]; then
echo "::error::Digest should not be empty"
exit 1
fi
-
name: Compare digests
run: |
echo Compare "${{ steps.docker_build.outputs.digest }}" with "${{ steps.docker_build2.outputs.digest }}"
if [ "${{ steps.docker_build.outputs.digest }}" != "${{ steps.docker_build2.outputs.digest }}" ]; then
echo "::error::Digests should be identical"
exit 1
fi
github-cache:
runs-on: ubuntu-latest
@@ -760,7 +812,7 @@ jobs:
-
name: Inspect
run: |
docker buildx imagetools inspect localhost:5000/name/app:1.0.0
docker buildx imagetools inspect localhost:5000/name/app:1.0.0 --format '{{json .}}'
standalone:
runs-on: ubuntu-latest
+1 -1
View File
@@ -120,4 +120,4 @@ jobs:
name: Check manifest
if: github.event_name != 'pull_request'
run: |
docker buildx imagetools inspect ${{ matrix.slug }}:${{ steps.meta.outputs.version }}
docker buildx imagetools inspect ${{ matrix.slug }}:${{ steps.meta.outputs.version }} --format '{{json .}}'
+1 -1
View File
@@ -71,4 +71,4 @@ jobs:
name: Check manifest
if: github.event_name != 'pull_request'
run: |
docker buildx imagetools inspect ${{ env.DOCKER_IMAGE }}:${{ steps.meta.outputs.version }}
docker buildx imagetools inspect ${{ env.DOCKER_IMAGE }}:${{ steps.meta.outputs.version }} --format '{{json .}}'
+32 -29
View File
@@ -190,35 +190,38 @@ Following inputs can be used as `step.with` keys
> tags: name/app:latest,name/app:1.0.0
> ```
| Name | Type | Description |
|--------------------|----------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `add-hosts` | List/CSV | List of [customs host-to-IP mapping](https://docs.docker.com/engine/reference/commandline/build/#add-entries-to-container-hosts-file---add-host) (e.g., `docker:10.180.0.1`) |
| `allow` | List/CSV | List of [extra privileged entitlement](https://docs.docker.com/engine/reference/commandline/buildx_build/#allow) (e.g., `network.host,security.insecure`) |
| `builder` | String | Builder instance (see [setup-buildx](https://github.com/docker/setup-buildx-action) action) |
| `build-args` | List | List of [build-time variables](https://docs.docker.com/engine/reference/commandline/buildx_build/#build-arg) |
| `build-contexts` | List | List of additional [build contexts](https://docs.docker.com/engine/reference/commandline/buildx_build/#build-context) (e.g., `name=path`) |
| `cache-from` | List | List of [external cache sources](https://docs.docker.com/engine/reference/commandline/buildx_build/#cache-from) (e.g., `type=local,src=path/to/dir`) |
| `cache-to` | List | List of [cache export destinations](https://docs.docker.com/engine/reference/commandline/buildx_build/#cache-to) (e.g., `type=local,dest=path/to/dir`) |
| `cgroup-parent` | String | Optional [parent cgroup](https://docs.docker.com/engine/reference/commandline/build/#use-a-custom-parent-cgroup---cgroup-parent) for the container used in the build |
| `context` | String | Build's context is the set of files located in the specified [`PATH` or `URL`](https://docs.docker.com/engine/reference/commandline/build/) (default [Git context](#git-context)) |
| `file` | String | Path to the Dockerfile. (default `{context}/Dockerfile`) |
| `labels` | List | List of metadata for an image |
| `load` | Bool | [Load](https://docs.docker.com/engine/reference/commandline/buildx_build/#load) is a shorthand for `--output=type=docker` (default `false`) |
| `network` | String | Set the networking mode for the `RUN` instructions during build |
| `no-cache` | Bool | Do not use cache when building the image (default `false`) |
| `no-cache-filters` | List/CSV | Do not cache specified stages |
| `outputs`¹ | List | List of [output destinations](https://docs.docker.com/engine/reference/commandline/buildx_build/#output) (format: `type=local,dest=path`) |
| `platforms` | List/CSV | List of [target platforms](https://docs.docker.com/engine/reference/commandline/buildx_build/#platform) for build |
| `pull` | Bool | Always attempt to pull all referenced images (default `false`) |
| `push` | Bool | [Push](https://docs.docker.com/engine/reference/commandline/buildx_build/#push) is a shorthand for `--output=type=registry` (default `false`) |
| `secrets` | List | List of [secrets](https://docs.docker.com/engine/reference/commandline/buildx_build/#secret) to expose to the build (e.g., `key=string`, `GIT_AUTH_TOKEN=mytoken`) |
| `secret-files` | List | List of [secret files](https://docs.docker.com/engine/reference/commandline/buildx_build/#secret) to expose to the build (e.g., `key=filename`, `MY_SECRET=./secret.txt`) |
| `shm-size` | String | Size of [`/dev/shm`](https://docs.docker.com/engine/reference/commandline/buildx_build/#shm-size) (e.g., `2g`) |
| `ssh` | List | List of [SSH agent socket or keys](https://docs.docker.com/engine/reference/commandline/buildx_build/#ssh) to expose to the build |
| `tags` | List/CSV | List of tags |
| `target` | String | Sets the target stage to build |
| `ulimit` | List | [Ulimit](https://docs.docker.com/engine/reference/commandline/buildx_build/#ulimit) options (e.g., `nofile=1024:1024`) |
| `github-token` | String | GitHub Token used to authenticate against a repository for [Git context](#git-context) (default `${{ github.token }}`) |
| Name | Type | Description |
|--------------------|-------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `add-hosts` | List/CSV | List of [customs host-to-IP mapping](https://docs.docker.com/engine/reference/commandline/build/#add-entries-to-container-hosts-file---add-host) (e.g., `docker:10.180.0.1`) |
| `allow` | List/CSV | List of [extra privileged entitlement](https://docs.docker.com/engine/reference/commandline/buildx_build/#allow) (e.g., `network.host,security.insecure`) |
| `attests` | List | List of [attestation](https://docs.docker.com/build/attestations/) parameters (e.g., `type=sbom,generator=image`) |
| `builder` | String | Builder instance (see [setup-buildx](https://github.com/docker/setup-buildx-action) action) |
| `build-args` | List | List of [build-time variables](https://docs.docker.com/engine/reference/commandline/buildx_build/#build-arg) |
| `build-contexts` | List | List of additional [build contexts](https://docs.docker.com/engine/reference/commandline/buildx_build/#build-context) (e.g., `name=path`) |
| `cache-from` | List | List of [external cache sources](https://docs.docker.com/engine/reference/commandline/buildx_build/#cache-from) (e.g., `type=local,src=path/to/dir`) |
| `cache-to` | List | List of [cache export destinations](https://docs.docker.com/engine/reference/commandline/buildx_build/#cache-to) (e.g., `type=local,dest=path/to/dir`) |
| `cgroup-parent` | String | Optional [parent cgroup](https://docs.docker.com/engine/reference/commandline/build/#use-a-custom-parent-cgroup---cgroup-parent) for the container used in the build |
| `context` | String | Build's context is the set of files located in the specified [`PATH` or `URL`](https://docs.docker.com/engine/reference/commandline/build/) (default [Git context](#git-context)) |
| `file` | String | Path to the Dockerfile. (default `{context}/Dockerfile`) |
| `labels` | List | List of metadata for an image |
| `load` | Bool | [Load](https://docs.docker.com/engine/reference/commandline/buildx_build/#load) is a shorthand for `--output=type=docker` (default `false`) |
| `network` | String | Set the networking mode for the `RUN` instructions during build |
| `no-cache` | Bool | Do not use cache when building the image (default `false`) |
| `no-cache-filters` | List/CSV | Do not cache specified stages |
| `outputs`¹ | List | List of [output destinations](https://docs.docker.com/engine/reference/commandline/buildx_build/#output) (format: `type=local,dest=path`) |
| `platforms` | List/CSV | List of [target platforms](https://docs.docker.com/engine/reference/commandline/buildx_build/#platform) for build |
| `provenance` | Bool/String | Generate [provenance](https://docs.docker.com/build/attestations/slsa-provenance/) attestation for the build (shorthand for `--attest=type=provenance`) |
| `pull` | Bool | Always attempt to pull all referenced images (default `false`) |
| `push` | Bool | [Push](https://docs.docker.com/engine/reference/commandline/buildx_build/#push) is a shorthand for `--output=type=registry` (default `false`) |
| `sbom` | Bool/String | Generate [SBOM](https://docs.docker.com/build/attestations/sbom/) attestation for the build (shorthand for `--attest=type=sbom`) |
| `secrets` | List | List of [secrets](https://docs.docker.com/engine/reference/commandline/buildx_build/#secret) to expose to the build (e.g., `key=string`, `GIT_AUTH_TOKEN=mytoken`) |
| `secret-files` | List | List of [secret files](https://docs.docker.com/engine/reference/commandline/buildx_build/#secret) to expose to the build (e.g., `key=filename`, `MY_SECRET=./secret.txt`) |
| `shm-size` | String | Size of [`/dev/shm`](https://docs.docker.com/engine/reference/commandline/buildx_build/#shm-size) (e.g., `2g`) |
| `ssh` | List | List of [SSH agent socket or keys](https://docs.docker.com/engine/reference/commandline/buildx_build/#ssh) to expose to the build |
| `tags` | List/CSV | List of tags |
| `target` | String | Sets the target stage to build |
| `ulimit` | List | [Ulimit](https://docs.docker.com/engine/reference/commandline/buildx_build/#ulimit) options (e.g., `nofile=1024:1024`) |
| `github-token` | String | GitHub Token used to authenticate against a repository for [Git context](#git-context) (default `${{ github.token }}`) |
> **Note**
>
+9
View File
@@ -13,6 +13,9 @@ inputs:
allow:
description: "List of extra privileged entitlement (e.g., network.host,security.insecure)"
required: false
attests:
description: "List of attestation parameters (e.g., type=sbom,generator=image)"
required: false
build-args:
description: "List of build-time variables"
required: false
@@ -60,6 +63,9 @@ inputs:
platforms:
description: "List of target platforms for build"
required: false
provenance:
description: "Generate provenance attestation for the build (shorthand for --attest=type=provenance)"
required: false
pull:
description: "Always attempt to pull all referenced images"
required: false
@@ -68,6 +74,9 @@ inputs:
description: "Push is a shorthand for --output=type=registry"
required: false
default: 'false'
sbom:
description: "Generate SBOM attestation for the build (shorthand for --attest=type=sbom)"
required: false
secrets:
description: "List of secrets to expose to the build (e.g., key=string, GIT_AUTH_TOKEN=mytoken)"
required: false
Generated Vendored
+3 -3
View File
@@ -4,13 +4,13 @@ require('./sourcemap-register.js');(()=>{var __webpack_modules__={5241:function(
*
* Copyright (c) 2014-2017, Jon Schlinkert.
* Released under the MIT License.
*/function isObject(e){return Object.prototype.toString.call(e)==="[object Object]"}function isPlainObject(e){var t,r;if(isObject(e)===false)return false;t=e.constructor;if(t===undefined)return true;r=t.prototype;if(isObject(r)===false)return false;if(r.hasOwnProperty("isPrototypeOf")===false){return false}return true}t.isPlainObject=isPlainObject},9417:e=>{"use strict";e.exports=balanced;function balanced(e,t,r){if(e instanceof RegExp)e=maybeMatch(e,r);if(t instanceof RegExp)t=maybeMatch(t,r);var a=range(e,t,r);return a&&{start:a[0],end:a[1],pre:r.slice(0,a[0]),body:r.slice(a[0]+e.length,a[1]),post:r.slice(a[1]+t.length)}}function maybeMatch(e,t){var r=t.match(e);return r?r[0]:null}balanced.range=range;function range(e,t,r){var a,i,s,p,o;var n=r.indexOf(e);var d=r.indexOf(t,n+1);var l=n;if(n>=0&&d>0){if(e===t){return[n,d]}a=[];s=r.length;while(l>=0&&!o){if(l==n){a.push(l);n=r.indexOf(e,l+1)}else if(a.length==1){o=[a.pop(),d]}else{i=a.pop();if(i<s){s=i;p=d}d=r.indexOf(t,l+1)}l=n<d&&n>=0?n:d}if(a.length){o=[s,p]}}return o}},3682:(e,t,r)=>{var a=r(4670);var i=r(5549);var s=r(6819);var p=Function.bind;var o=p.bind(p);function bindApi(e,t,r){var a=o(s,null).apply(null,r?[t,r]:[t]);e.api={remove:a};e.remove=a;["before","error","after","wrap"].forEach((function(a){var s=r?[t,a,r]:[t,a];e[a]=e.api[a]=o(i,null).apply(null,s)}))}function HookSingular(){var e="h";var t={registry:{}};var r=a.bind(null,t,e);bindApi(r,t,e);return r}function HookCollection(){var e={registry:{}};var t=a.bind(null,e);bindApi(t,e);return t}var n=false;function Hook(){if(!n){console.warn('[before-after-hook]: "Hook()" repurposing warning, use "Hook.Collection()". Read more: https://git.io/upgrade-before-after-hook-to-1.4');n=true}return HookCollection()}Hook.Singular=HookSingular.bind();Hook.Collection=HookCollection.bind();e.exports=Hook;e.exports.Hook=Hook;e.exports.Singular=Hook.Singular;e.exports.Collection=Hook.Collection},5549:e=>{e.exports=addHook;function addHook(e,t,r,a){var i=a;if(!e.registry[r]){e.registry[r]=[]}if(t==="before"){a=function(e,t){return Promise.resolve().then(i.bind(null,t)).then(e.bind(null,t))}}if(t==="after"){a=function(e,t){var r;return Promise.resolve().then(e.bind(null,t)).then((function(e){r=e;return i(r,t)})).then((function(){return r}))}}if(t==="error"){a=function(e,t){return Promise.resolve().then(e.bind(null,t)).catch((function(e){return i(e,t)}))}}e.registry[r].push({hook:a,orig:i})}},4670:e=>{e.exports=register;function register(e,t,r,a){if(typeof r!=="function"){throw new Error("method for before hook must be a function")}if(!a){a={}}if(Array.isArray(t)){return t.reverse().reduce((function(t,r){return register.bind(null,e,r,t,a)}),r)()}return Promise.resolve().then((function(){if(!e.registry[t]){return r(a)}return e.registry[t].reduce((function(e,t){return t.hook.bind(null,e,a)}),r)()}))}},6819:e=>{e.exports=removeHook;function removeHook(e,t,r){if(!e.registry[t]){return}var a=e.registry[t].map((function(e){return e.orig})).indexOf(r);if(a===-1){return}e.registry[t].splice(a,1)}},3717:(e,t,r)=>{var a=r(6891);var i=r(9417);e.exports=expandTop;var s="\0SLASH"+Math.random()+"\0";var p="\0OPEN"+Math.random()+"\0";var o="\0CLOSE"+Math.random()+"\0";var n="\0COMMA"+Math.random()+"\0";var d="\0PERIOD"+Math.random()+"\0";function numeric(e){return parseInt(e,10)==e?parseInt(e,10):e.charCodeAt(0)}function escapeBraces(e){return e.split("\\\\").join(s).split("\\{").join(p).split("\\}").join(o).split("\\,").join(n).split("\\.").join(d)}function unescapeBraces(e){return e.split(s).join("\\").split(p).join("{").split(o).join("}").split(n).join(",").split(d).join(".")}function parseCommaParts(e){if(!e)return[""];var t=[];var r=i("{","}",e);if(!r)return e.split(",");var a=r.pre;var s=r.body;var p=r.post;var o=a.split(",");o[o.length-1]+="{"+s+"}";var n=parseCommaParts(p);if(p.length){o[o.length-1]+=n.shift();o.push.apply(o,n)}t.push.apply(t,o);return t}function expandTop(e){if(!e)return[];if(e.substr(0,2)==="{}"){e="\\{\\}"+e.substr(2)}return expand(escapeBraces(e),true).map(unescapeBraces)}function identity(e){return e}function embrace(e){return"{"+e+"}"}function isPadded(e){return/^-?0\d/.test(e)}function lte(e,t){return e<=t}function gte(e,t){return e>=t}function expand(e,t){var r=[];var s=i("{","}",e);if(!s||/\$$/.test(s.pre))return[e];var p=/^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(s.body);var n=/^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(s.body);var d=p||n;var l=s.body.indexOf(",")>=0;if(!d&&!l){if(s.post.match(/,.*\}/)){e=s.pre+"{"+s.body+o+s.post;return expand(e)}return[e]}var u;if(d){u=s.body.split(/\.\./)}else{u=parseCommaParts(s.body);if(u.length===1){u=expand(u[0],false).map(embrace);if(u.length===1){var m=s.post.length?expand(s.post,false):[""];return m.map((function(e){return s.pre+u[0]+e}))}}}var c=s.pre;var m=s.post.length?expand(s.post,false):[""];var h;if(d){var v=numeric(u[0]);var g=numeric(u[1]);var _=Math.max(u[0].length,u[1].length);var w=u.length==3?Math.abs(numeric(u[2])):1;var b=lte;var y=g<v;iLine truncated
*/function isObject(e){return Object.prototype.toString.call(e)==="[object Object]"}function isPlainObject(e){var t,r;if(isObject(e)===false)return false;t=e.constructor;if(t===undefined)return true;r=t.prototype;if(isObject(r)===false)return false;if(r.hasOwnProperty("isPrototypeOf")===false){return false}return true}t.isPlainObject=isPlainObject},9417:e=>{"use strict";e.exports=balanced;function balanced(e,t,r){if(e instanceof RegExp)e=maybeMatch(e,r);if(t instanceof RegExp)t=maybeMatch(t,r);var a=range(e,t,r);return a&&{start:a[0],end:a[1],pre:r.slice(0,a[0]),body:r.slice(a[0]+e.length,a[1]),post:r.slice(a[1]+t.length)}}function maybeMatch(e,t){var r=t.match(e);return r?r[0]:null}balanced.range=range;function range(e,t,r){var a,i,s,p,o;var n=r.indexOf(e);var d=r.indexOf(t,n+1);var l=n;if(n>=0&&d>0){if(e===t){return[n,d]}a=[];s=r.length;while(l>=0&&!o){if(l==n){a.push(l);n=r.indexOf(e,l+1)}else if(a.length==1){o=[a.pop(),d]}else{i=a.pop();if(i<s){s=i;p=d}d=r.indexOf(t,l+1)}l=n<d&&n>=0?n:d}if(a.length){o=[s,p]}}return o}},3682:(e,t,r)=>{var a=r(4670);var i=r(5549);var s=r(6819);var p=Function.bind;var o=p.bind(p);function bindApi(e,t,r){var a=o(s,null).apply(null,r?[t,r]:[t]);e.api={remove:a};e.remove=a;["before","error","after","wrap"].forEach((function(a){var s=r?[t,a,r]:[t,a];e[a]=e.api[a]=o(i,null).apply(null,s)}))}function HookSingular(){var e="h";var t={registry:{}};var r=a.bind(null,t,e);bindApi(r,t,e);return r}function HookCollection(){var e={registry:{}};var t=a.bind(null,e);bindApi(t,e);return t}var n=false;function Hook(){if(!n){console.warn('[before-after-hook]: "Hook()" repurposing warning, use "Hook.Collection()". Read more: https://git.io/upgrade-before-after-hook-to-1.4');n=true}return HookCollection()}Hook.Singular=HookSingular.bind();Hook.Collection=HookCollection.bind();e.exports=Hook;e.exports.Hook=Hook;e.exports.Singular=Hook.Singular;e.exports.Collection=Hook.Collection},5549:e=>{e.exports=addHook;function addHook(e,t,r,a){var i=a;if(!e.registry[r]){e.registry[r]=[]}if(t==="before"){a=function(e,t){return Promise.resolve().then(i.bind(null,t)).then(e.bind(null,t))}}if(t==="after"){a=function(e,t){var r;return Promise.resolve().then(e.bind(null,t)).then((function(e){r=e;return i(r,t)})).then((function(){return r}))}}if(t==="error"){a=function(e,t){return Promise.resolve().then(e.bind(null,t)).catch((function(e){return i(e,t)}))}}e.registry[r].push({hook:a,orig:i})}},4670:e=>{e.exports=register;function register(e,t,r,a){if(typeof r!=="function"){throw new Error("method for before hook must be a function")}if(!a){a={}}if(Array.isArray(t)){return t.reverse().reduce((function(t,r){return register.bind(null,e,r,t,a)}),r)()}return Promise.resolve().then((function(){if(!e.registry[t]){return r(a)}return e.registry[t].reduce((function(e,t){return t.hook.bind(null,e,a)}),r)()}))}},6819:e=>{e.exports=removeHook;function removeHook(e,t,r){if(!e.registry[t]){return}var a=e.registry[t].map((function(e){return e.orig})).indexOf(r);if(a===-1){return}e.registry[t].splice(a,1)}},3717:(e,t,r)=>{var a=r(6891);var i=r(9417);e.exports=expandTop;var s="\0SLASH"+Math.random()+"\0";var p="\0OPEN"+Math.random()+"\0";var o="\0CLOSE"+Math.random()+"\0";var n="\0COMMA"+Math.random()+"\0";var d="\0PERIOD"+Math.random()+"\0";function numeric(e){return parseInt(e,10)==e?parseInt(e,10):e.charCodeAt(0)}function escapeBraces(e){return e.split("\\\\").join(s).split("\\{").join(p).split("\\}").join(o).split("\\,").join(n).split("\\.").join(d)}function unescapeBraces(e){return e.split(s).join("\\").split(p).join("{").split(o).join("}").split(n).join(",").split(d).join(".")}function parseCommaParts(e){if(!e)return[""];var t=[];var r=i("{","}",e);if(!r)return e.split(",");var a=r.pre;var s=r.body;var p=r.post;var o=a.split(",");o[o.length-1]+="{"+s+"}";var n=parseCommaParts(p);if(p.length){o[o.length-1]+=n.shift();o.push.apply(o,n)}t.push.apply(t,o);return t}function expandTop(e){if(!e)return[];if(e.substr(0,2)==="{}"){e="\\{\\}"+e.substr(2)}return expand(escapeBraces(e),true).map(unescapeBraces)}function identity(e){return e}function embrace(e){return"{"+e+"}"}function isPadded(e){return/^-?0\d/.test(e)}function lte(e,t){return e<=t}function gte(e,t){return e>=t}function expand(e,t){var r=[];var s=i("{","}",e);if(!s||/\$$/.test(s.pre))return[e];var p=/^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(s.body);var n=/^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(s.body);var d=p||n;var l=s.body.indexOf(",")>=0;if(!d&&!l){if(s.post.match(/,.*\}/)){e=s.pre+"{"+s.body+o+s.post;return expand(e)}return[e]}var u;if(d){u=s.body.split(/\.\./)}else{u=parseCommaParts(s.body);if(u.length===1){u=expand(u[0],false).map(embrace);if(u.length===1){var m=s.post.length?expand(s.post,false):[""];return m.map((function(e){return s.pre+u[0]+e}))}}}var c=s.pre;var m=s.post.length?expand(s.post,false):[""];var h;if(d){var v=numeric(u[0]);var g=numeric(u[1]);var _=Math.max(u[0].length,u[1].length);var w=u.length==3?Math.abs(numeric(u[2])):1;var b=lte;var y=g<v;iLine truncated
/*!
* is-plain-object <https://github.com/jonschlinkert/is-plain-object>
*
* Copyright (c) 2014-2017, Jon Schlinkert.
* Released under the MIT License.
*/function isObject(e){return Object.prototype.toString.call(e)==="[object Object]"}function isPlainObject(e){var t,r;if(isObject(e)===false)return false;t=e.constructor;if(t===undefined)return true;r=t.prototype;if(isObject(r)===false)return false;if(r.hasOwnProperty("isPrototypeOf")===false){return false}return true}e.exports=isPlainObject},7129:(e,t,r)=>{"use strict";const a=r(665);const i=Symbol("max");const s=Symbol("length");const p=Symbol("lengthCalculator");const o=Symbol("allowStale");const n=Symbol("maxAge");const d=Symbol("dispose");const l=Symbol("noDisposeOnSet");const u=Symbol("lruList");const m=Symbol("cache");const c=Symbol("updateAgeOnGet");const naiveLength=()=>1;class LRUCache{constructor(e){if(typeof e==="number")e={max:e};if(!e)e={};if(e.max&&(typeof e.max!=="number"||e.max<0))throw new TypeError("max must be a non-negative number");const t=this[i]=e.max||Infinity;const r=e.length||naiveLength;this[p]=typeof r!=="function"?naiveLength:r;this[o]=e.stale||false;if(e.maxAge&&typeof e.maxAge!=="number")throw new TypeError("maxAge must be a number");this[n]=e.maxAge||0;this[d]=e.dispose;this[l]=e.noDisposeOnSet||false;this[c]=e.updateAgeOnGet||false;this.reset()}set max(e){if(typeof e!=="number"||e<0)throw new TypeError("max must be a non-negative number");this[i]=e||Infinity;trim(this)}get max(){return this[i]}set allowStale(e){this[o]=!!e}get allowStale(){return this[o]}set maxAge(e){if(typeof e!=="number")throw new TypeError("maxAge must be a non-negative number");this[n]=e;trim(this)}get maxAge(){return this[n]}set lengthCalculator(e){if(typeof e!=="function")e=naiveLength;if(e!==this[p]){this[p]=e;this[s]=0;this[u].forEach((e=>{e.length=this[p](e.value,e.key);this[s]+=e.length}))}trim(this)}get lengthCalculator(){return this[p]}get length(){return this[s]}get itemCount(){return this[u].length}rforEach(e,t){t=t||this;for(let r=this[u].tail;r!==null;){const a=r.prev;forEachStep(this,e,r,t);r=a}}forEach(e,t){t=t||this;for(let r=this[u].head;r!==null;){const a=r.next;forEachStep(this,e,r,t);r=a}}keys(){return this[u].toArray().map((e=>e.key))}values(){return this[u].toArray().map((e=>e.value))}reset(){if(this[d]&&this[u]&&this[u].length){this[u].forEach((e=>this[d](e.key,e.value)))}this[m]=new Map;this[u]=new a;this[s]=0}dump(){return this[u].map((e=>isStale(this,e)?false:{k:e.key,v:e.value,e:e.now+(e.maxAge||0)})).toArray().filter((e=>e))}dumpLru(){return this[u]}set(e,t,r){r=r||this[n];if(r&&typeof r!=="number")throw new TypeError("maxAge must be a number");const a=r?Date.now():0;const o=this[p](t,e);if(this[m].has(e)){if(o>this[i]){del(this,this[m].get(e));return false}const p=this[m].get(e);const n=p.value;if(this[d]){if(!this[l])this[d](e,n.value)}n.now=a;n.maxAge=r;n.value=t;this[s]+=o-n.length;n.length=o;this.get(e);trim(this);return true}const c=new Entry(e,t,o,a,r);if(c.length>this[i]){if(this[d])this[d](e,t);return false}this[s]+=c.length;this[u].unshift(c);this[m].set(e,this[u].head);trim(this);return true}has(e){if(!this[m].has(e))return false;const t=this[m].get(e).value;return!isStale(this,t)}get(e){return get(this,e,true)}peek(e){return get(this,e,false)}pop(){const e=this[u].tail;if(!e)return null;del(this,e);return e.value}del(e){del(this,this[m].get(e))}load(e){this.reset();const t=Date.now();for(let r=e.length-1;r>=0;r--){const a=e[r];const i=a.e||0;if(i===0)this.set(a.k,a.v);else{const e=i-t;if(e>0){this.set(a.k,a.v,e)}}}}prune(){this[m].forEach(((e,t)=>get(this,t,false)))}}const get=(e,t,r)=>{const a=e[m].get(t);if(a){const t=a.value;if(isStale(e,t)){del(e,a);if(!e[o])return undefined}else{if(r){if(e[c])a.value.now=Date.now();e[u].unshiftNode(a)}}return t.value}};const isStale=(e,t)=>{if(!t||!t.maxAge&&!e[n])return false;const r=Date.now()-t.now;return t.maxAge?r>t.maxAge:e[n]&&r>e[n]};const trim=e=>{if(e[s]>e[i]){for(let t=e[u].tail;e[s]>e[i]&&t!==null;){const r=t.prev;del(e,t);t=r}}};const del=(e,t)=>{if(t){const r=t.value;if(e[d])e[d](r.key,r.value);e[s]-=r.length;e[m].delete(r.key);e[u].removeNode(t)}};class Entry{constructor(e,t,r,a,i){this.key=e;this.value=t;this.length=r;this.now=a;this.maxAge=i||0}}const forEachStep=(e,t,r,a)=>{let i=r.value;if(isStale(e,i)){del(e,r);if(!e[o])i=undefined}if(i)t.call(a,i.value,i.key,e)};e.exports=LRUCache},3973:(e,t,r)=>{e.exports=minimatch;minimatch.Minimatch=Minimatch;var a=function(){try{return r(1017)}catch(e){}}()||{sep:"/"};minimatch.sep=a.sep;var i=minimatch.GLOBSTAR=Minimatch.GLOBSTAR={};var s=r(3717);var p={"!":{open:"(?:(?!(?:",close:"))[^/]*?)"},"?":{open:"(?:",close:")?"},"+":{open:"(?:",close:")+"},"*":{open:"(?:",close:")*"},"@":{open:"(?:",close:")"}};var o="[^/]";var n=o+"*?";var d="(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?";var l="(?:(?!(?:\\/|^)\\.).)*?";var u=charSet("().*{}+?[]^$\\!");function charSet(e){return e.split("").reduce((function(e,t){e[t]=true;return e}),{})}var m=/\/+/;minimatch.filter=filter;function filter(e,t){t=t||{};return function(r,a,i){return minimatch(r,e,t)}}function ext(e,t){t=t||{};var Line truncated
*/function isObject(e){return Object.prototype.toString.call(e)==="[object Object]"}function isPlainObject(e){var t,r;if(isObject(e)===false)return false;t=e.constructor;if(t===undefined)return true;r=t.prototype;if(isObject(r)===false)return false;if(r.hasOwnProperty("isPrototypeOf")===false){return false}return true}e.exports=isPlainObject},7129:(e,t,r)=>{"use strict";const a=r(665);const i=Symbol("max");const s=Symbol("length");const p=Symbol("lengthCalculator");const o=Symbol("allowStale");const n=Symbol("maxAge");const d=Symbol("dispose");const l=Symbol("noDisposeOnSet");const u=Symbol("lruList");const m=Symbol("cache");const c=Symbol("updateAgeOnGet");const naiveLength=()=>1;class LRUCache{constructor(e){if(typeof e==="number")e={max:e};if(!e)e={};if(e.max&&(typeof e.max!=="number"||e.max<0))throw new TypeError("max must be a non-negative number");const t=this[i]=e.max||Infinity;const r=e.length||naiveLength;this[p]=typeof r!=="function"?naiveLength:r;this[o]=e.stale||false;if(e.maxAge&&typeof e.maxAge!=="number")throw new TypeError("maxAge must be a number");this[n]=e.maxAge||0;this[d]=e.dispose;this[l]=e.noDisposeOnSet||false;this[c]=e.updateAgeOnGet||false;this.reset()}set max(e){if(typeof e!=="number"||e<0)throw new TypeError("max must be a non-negative number");this[i]=e||Infinity;trim(this)}get max(){return this[i]}set allowStale(e){this[o]=!!e}get allowStale(){return this[o]}set maxAge(e){if(typeof e!=="number")throw new TypeError("maxAge must be a non-negative number");this[n]=e;trim(this)}get maxAge(){return this[n]}set lengthCalculator(e){if(typeof e!=="function")e=naiveLength;if(e!==this[p]){this[p]=e;this[s]=0;this[u].forEach((e=>{e.length=this[p](e.value,e.key);this[s]+=e.length}))}trim(this)}get lengthCalculator(){return this[p]}get length(){return this[s]}get itemCount(){return this[u].length}rforEach(e,t){t=t||this;for(let r=this[u].tail;r!==null;){const a=r.prev;forEachStep(this,e,r,t);r=a}}forEach(e,t){t=t||this;for(let r=this[u].head;r!==null;){const a=r.next;forEachStep(this,e,r,t);r=a}}keys(){return this[u].toArray().map((e=>e.key))}values(){return this[u].toArray().map((e=>e.value))}reset(){if(this[d]&&this[u]&&this[u].length){this[u].forEach((e=>this[d](e.key,e.value)))}this[m]=new Map;this[u]=new a;this[s]=0}dump(){return this[u].map((e=>isStale(this,e)?false:{k:e.key,v:e.value,e:e.now+(e.maxAge||0)})).toArray().filter((e=>e))}dumpLru(){return this[u]}set(e,t,r){r=r||this[n];if(r&&typeof r!=="number")throw new TypeError("maxAge must be a number");const a=r?Date.now():0;const o=this[p](t,e);if(this[m].has(e)){if(o>this[i]){del(this,this[m].get(e));return false}const p=this[m].get(e);const n=p.value;if(this[d]){if(!this[l])this[d](e,n.value)}n.now=a;n.maxAge=r;n.value=t;this[s]+=o-n.length;n.length=o;this.get(e);trim(this);return true}const c=new Entry(e,t,o,a,r);if(c.length>this[i]){if(this[d])this[d](e,t);return false}this[s]+=c.length;this[u].unshift(c);this[m].set(e,this[u].head);trim(this);return true}has(e){if(!this[m].has(e))return false;const t=this[m].get(e).value;return!isStale(this,t)}get(e){return get(this,e,true)}peek(e){return get(this,e,false)}pop(){const e=this[u].tail;if(!e)return null;del(this,e);return e.value}del(e){del(this,this[m].get(e))}load(e){this.reset();const t=Date.now();for(let r=e.length-1;r>=0;r--){const a=e[r];const i=a.e||0;if(i===0)this.set(a.k,a.v);else{const e=i-t;if(e>0){this.set(a.k,a.v,e)}}}}prune(){this[m].forEach(((e,t)=>get(this,t,false)))}}const get=(e,t,r)=>{const a=e[m].get(t);if(a){const t=a.value;if(isStale(e,t)){del(e,a);if(!e[o])return undefined}else{if(r){if(e[c])a.value.now=Date.now();e[u].unshiftNode(a)}}return t.value}};const isStale=(e,t)=>{if(!t||!t.maxAge&&!e[n])return false;const r=Date.now()-t.now;return t.maxAge?r>t.maxAge:e[n]&&r>e[n]};const trim=e=>{if(e[s]>e[i]){for(let t=e[u].tail;e[s]>e[i]&&t!==null;){const r=t.prev;del(e,t);t=r}}};const del=(e,t)=>{if(t){const r=t.value;if(e[d])e[d](r.key,r.value);e[s]-=r.length;e[m].delete(r.key);e[u].removeNode(t)}};class Entry{constructor(e,t,r,a,i){this.key=e;this.value=t;this.length=r;this.now=a;this.maxAge=i||0}}const forEachStep=(e,t,r,a)=>{let i=r.value;if(isStale(e,i)){del(e,r);if(!e[o])i=undefined}if(i)t.call(a,i.value,i.key,e)};e.exports=LRUCache},3973:(e,t,r)=>{e.exports=minimatch;minimatch.Minimatch=Minimatch;var a=function(){try{return r(1017)}catch(e){}}()||{sep:"/"};minimatch.sep=a.sep;var i=minimatch.GLOBSTAR=Minimatch.GLOBSTAR={};var s=r(3717);var p={"!":{open:"(?:(?!(?:",close:"))[^/]*?)"},"?":{open:"(?:",close:")?"},"+":{open:"(?:",close:")+"},"*":{open:"(?:",close:")*"},"@":{open:"(?:",close:")"}};var o="[^/]";var n=o+"*?";var d="(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?";var l="(?:(?!(?:\\/|^)\\.).)*?";var u=charSet("().*{}+?[]^$\\!");function charSet(e){return e.split("").reduce((function(e,t){e[t]=true;return e}),{})}var m=/\/+/;minimatch.filter=filter;function filter(e,t){t=t||{};return function(r,a,i){return minimatch(r,e,t)}}function ext(e,t){t=t||{};var Line truncated
/*!
* Tmp
*
@@ -18,5 +18,5 @@ require('./sourcemap-register.js');(()=>{var __webpack_modules__={5241:function(
*
* MIT Licensed
*/
const a=r(7147);const i=r(2037);const s=r(1017);const p=r(6113);const o={fs:a.constants,os:i.constants};const n=r(4959);const d="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",l=/XXXXXX/,u=3,m=(o.O_CREAT||o.fs.O_CREAT)|(o.O_EXCL||o.fs.O_EXCL)|(o.O_RDWR||o.fs.O_RDWR),c=i.platform()==="win32",h=o.EBADF||o.os.errno.EBADF,v=o.ENOENT||o.os.errno.ENOENT,g=448,_=384,w="exit",b=[],y=a.rmdirSync.bind(a),E=n.sync;let S=false;function tmpName(e,t){const r=_parseArguments(e,t),i=r[0],s=r[1];try{_assertAndSanitizeOptions(i)}catch(e){return s(e)}let p=i.tries;(function _getUniqueName(){try{const e=_generateTmpName(i);a.stat(e,(function(t){if(!t){if(p-- >0)return _getUniqueName();return s(new Error("Could not get a unique tmp filename, max tries reached "+e))}s(null,e)}))}catch(e){s(e)}})()}function tmpNameSync(e){const t=_parseArguments(e),r=t[0];_assertAndSanitizeOptions(r);let i=r.tries;do{const e=_generateTmpName(r);try{a.statSync(e)}catch(t){return e}}while(i-- >0);throw new Error("Could not get a unique tmp filename, max tries reached")}function file(e,t){const r=_parseArguments(e,t),i=r[0],s=r[1];tmpName(i,(function _tmpNameCreated(e,t){if(e)return s(e);a.open(t,m,i.mode||_,(function _fileCreated(e,r){if(e)return s(e);if(i.discardDescriptor){return a.close(r,(function _discardCallback(e){return s(e,t,undefined,_prepareTmpFileRemoveCallback(t,-1,i,false))}))}else{const e=i.discardDescriptor||i.detachDescriptor;s(null,t,r,_prepareTmpFileRemoveCallback(t,e?-1:r,i,false))}}))}))}function fileSync(e){const t=_parseArguments(e),r=t[0];const i=r.discardDescriptor||r.detachDescriptor;const s=tmpNameSync(r);var p=a.openSync(s,m,r.mode||_);if(r.discardDescriptor){a.closeSync(p);p=undefined}return{name:s,fd:p,removeCallback:_prepareTmpFileRemoveCallback(s,i?-1:p,r,true)}}function dir(e,t){const r=_parseArguments(e,t),i=r[0],s=r[1];tmpName(i,(function _tmpNameCreated(e,t){if(e)return s(e);a.mkdir(t,i.mode||g,(function _dirCreated(e){if(e)return s(e);s(null,t,_prepareTmpDirRemoveCallback(t,i,false))}))}))}function dirSync(e){const t=_parseArguments(e),r=t[0];const i=tmpNameSync(r);a.mkdirSync(i,r.mode||g);return{name:i,removeCallback:_prepareTmpDirRemoveCallback(i,r,true)}}function _removeFileAsync(e,t){const _handler=function(e){if(e&&!_isENOENT(e)){return t(e)}t()};if(0<=e[0])a.close(e[0],(function(){a.unlink(e[1],_handler)}));else a.unlink(e[1],_handler)}function _removeFileSync(e){let t=null;try{if(0<=e[0])a.closeSync(e[0])}catch(e){if(!_isEBADF(e)&&!_isENOENT(e))throw e}finally{try{a.unlinkSync(e[1])}catch(e){if(!_isENOENT(e))t=e}}if(t!==null){throw t}}function _prepareTmpFileRemoveCallback(e,t,r,a){const i=_prepareRemoveCallback(_removeFileSync,[t,e],a);const s=_prepareRemoveCallback(_removeFileAsync,[t,e],a,i);if(!r.keep)b.unshift(i);return a?i:s}function _prepareTmpDirRemoveCallback(e,t,r){const i=t.unsafeCleanup?n:a.rmdir.bind(a);const s=t.unsafeCleanup?E:y;const p=_prepareRemoveCallback(s,e,r);const o=_prepareRemoveCallback(i,e,r,p);if(!t.keep)b.unshift(p);return r?p:o}function _prepareRemoveCallback(e,t,r,a){let i=false;return function _cleanupCallback(s){if(!i){const p=a||_cleanupCallback;const o=b.indexOf(p);if(o>=0)b.splice(o,1);i=true;if(r||e===y||e===E){return e(t)}else{return e(t,s||function(){})}}}}function _garbageCollector(){if(!S)return;while(b.length){try{b[0]()}catch(e){}}}function _randomChars(e){let t=[],r=null;try{r=p.randomBytes(e)}catch(t){r=p.pseudoRandomBytes(e)}for(var a=0;a<e;a++){t.push(d[r[a]%d.length])}return t.join("")}function _isBlank(e){return e===null||_isUndefined(e)||!e.trim()}function _isUndefined(e){return typeof e==="undefined"}function _parseArguments(e,t){if(typeof e==="function"){return[{},e]}if(_isUndefined(e)){return[{},t]}const r={};for(const t of Object.getOwnPropertyNames(e)){r[t]=e[t]}return[r,t]}function _generateTmpName(e){const t=e.tmpdir;if(!_isUndefined(e.name))return s.join(t,e.dir,e.name);if(!_isUndefined(e.template))return s.join(t,e.dir,e.template).replace(l,_randomChars(6));const r=[e.prefix?e.prefix:"tmp","-",process.pid,"-",_randomChars(12),e.postfix?"-"+e.postfix:""].join("");return s.join(t,e.dir,r)}function _assertAndSanitizeOptions(e){e.tmpdir=_getTmpDir(e);const t=e.tmpdir;if(!_isUndefined(e.name))_assertIsRelative(e.name,"name",t);if(!_isUndefined(e.dir))_assertIsRelative(e.dir,"dir",t);if(!_isUndefined(e.template)){_assertIsRelative(e.template,"template",t);if(!e.template.match(l))throw new Error(`Invalid template, found "${e.template}".`)}if(!_isUndefined(e.tries)&&isNaN(e.tries)||e.tries<0)throw new Error(`Invalid tries, found "${e.tries}".`);e.tries=_isUndefined(e.name)?e.tries||u:1;e.keep=!!e.keep;e.detachDescriptor=!!e.detachDescriptor;e.discardDescriptor=!!e.discardDescriptor;e.unsafeCleanup=!!e.unsafeCleanup;e.dir=_isUndefined(e.dir)?"":s.relative(t,_resolvePath(e.dir,t));e.template=_isUndefined(e.template)?undefined:s.relative(t,_resolvePath(e.template,t));e.template=_isBlank(e.template)?undefined:s.relative(e.dir,e.template);e.naLine truncated
const a=r(7147);const i=r(2037);const s=r(1017);const p=r(6113);const o={fs:a.constants,os:i.constants};const n=r(4959);const d="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",l=/XXXXXX/,u=3,m=(o.O_CREAT||o.fs.O_CREAT)|(o.O_EXCL||o.fs.O_EXCL)|(o.O_RDWR||o.fs.O_RDWR),c=i.platform()==="win32",h=o.EBADF||o.os.errno.EBADF,v=o.ENOENT||o.os.errno.ENOENT,g=448,_=384,w="exit",b=[],y=a.rmdirSync.bind(a),E=n.sync;let S=false;function tmpName(e,t){const r=_parseArguments(e,t),i=r[0],s=r[1];try{_assertAndSanitizeOptions(i)}catch(e){return s(e)}let p=i.tries;(function _getUniqueName(){try{const e=_generateTmpName(i);a.stat(e,(function(t){if(!t){if(p-- >0)return _getUniqueName();return s(new Error("Could not get a unique tmp filename, max tries reached "+e))}s(null,e)}))}catch(e){s(e)}})()}function tmpNameSync(e){const t=_parseArguments(e),r=t[0];_assertAndSanitizeOptions(r);let i=r.tries;do{const e=_generateTmpName(r);try{a.statSync(e)}catch(t){return e}}while(i-- >0);throw new Error("Could not get a unique tmp filename, max tries reached")}function file(e,t){const r=_parseArguments(e,t),i=r[0],s=r[1];tmpName(i,(function _tmpNameCreated(e,t){if(e)return s(e);a.open(t,m,i.mode||_,(function _fileCreated(e,r){if(e)return s(e);if(i.discardDescriptor){return a.close(r,(function _discardCallback(e){return s(e,t,undefined,_prepareTmpFileRemoveCallback(t,-1,i,false))}))}else{const e=i.discardDescriptor||i.detachDescriptor;s(null,t,r,_prepareTmpFileRemoveCallback(t,e?-1:r,i,false))}}))}))}function fileSync(e){const t=_parseArguments(e),r=t[0];const i=r.discardDescriptor||r.detachDescriptor;const s=tmpNameSync(r);var p=a.openSync(s,m,r.mode||_);if(r.discardDescriptor){a.closeSync(p);p=undefined}return{name:s,fd:p,removeCallback:_prepareTmpFileRemoveCallback(s,i?-1:p,r,true)}}function dir(e,t){const r=_parseArguments(e,t),i=r[0],s=r[1];tmpName(i,(function _tmpNameCreated(e,t){if(e)return s(e);a.mkdir(t,i.mode||g,(function _dirCreated(e){if(e)return s(e);s(null,t,_prepareTmpDirRemoveCallback(t,i,false))}))}))}function dirSync(e){const t=_parseArguments(e),r=t[0];const i=tmpNameSync(r);a.mkdirSync(i,r.mode||g);return{name:i,removeCallback:_prepareTmpDirRemoveCallback(i,r,true)}}function _removeFileAsync(e,t){const _handler=function(e){if(e&&!_isENOENT(e)){return t(e)}t()};if(0<=e[0])a.close(e[0],(function(){a.unlink(e[1],_handler)}));else a.unlink(e[1],_handler)}function _removeFileSync(e){let t=null;try{if(0<=e[0])a.closeSync(e[0])}catch(e){if(!_isEBADF(e)&&!_isENOENT(e))throw e}finally{try{a.unlinkSync(e[1])}catch(e){if(!_isENOENT(e))t=e}}if(t!==null){throw t}}function _prepareTmpFileRemoveCallback(e,t,r,a){const i=_prepareRemoveCallback(_removeFileSync,[t,e],a);const s=_prepareRemoveCallback(_removeFileAsync,[t,e],a,i);if(!r.keep)b.unshift(i);return a?i:s}function _prepareTmpDirRemoveCallback(e,t,r){const i=t.unsafeCleanup?n:a.rmdir.bind(a);const s=t.unsafeCleanup?E:y;const p=_prepareRemoveCallback(s,e,r);const o=_prepareRemoveCallback(i,e,r,p);if(!t.keep)b.unshift(p);return r?p:o}function _prepareRemoveCallback(e,t,r,a){let i=false;return function _cleanupCallback(s){if(!i){const p=a||_cleanupCallback;const o=b.indexOf(p);if(o>=0)b.splice(o,1);i=true;if(r||e===y||e===E){return e(t)}else{return e(t,s||function(){})}}}}function _garbageCollector(){if(!S)return;while(b.length){try{b[0]()}catch(e){}}}function _randomChars(e){let t=[],r=null;try{r=p.randomBytes(e)}catch(t){r=p.pseudoRandomBytes(e)}for(var a=0;a<e;a++){t.push(d[r[a]%d.length])}return t.join("")}function _isBlank(e){return e===null||_isUndefined(e)||!e.trim()}function _isUndefined(e){return typeof e==="undefined"}function _parseArguments(e,t){if(typeof e==="function"){return[{},e]}if(_isUndefined(e)){return[{},t]}const r={};for(const t of Object.getOwnPropertyNames(e)){r[t]=e[t]}return[r,t]}function _generateTmpName(e){const t=e.tmpdir;if(!_isUndefined(e.name))return s.join(t,e.dir,e.name);if(!_isUndefined(e.template))return s.join(t,e.dir,e.template).replace(l,_randomChars(6));const r=[e.prefix?e.prefix:"tmp","-",process.pid,"-",_randomChars(12),e.postfix?"-"+e.postfix:""].join("");return s.join(t,e.dir,r)}function _assertAndSanitizeOptions(e){e.tmpdir=_getTmpDir(e);const t=e.tmpdir;if(!_isUndefined(e.name))_assertIsRelative(e.name,"name",t);if(!_isUndefined(e.dir))_assertIsRelative(e.dir,"dir",t);if(!_isUndefined(e.template)){_assertIsRelative(e.template,"template",t);if(!e.template.match(l))throw new Error(`Invalid template, found "${e.template}".`)}if(!_isUndefined(e.tries)&&isNaN(e.tries)||e.tries<0)throw new Error(`Invalid tries, found "${e.tries}".`);e.tries=_isUndefined(e.name)?e.tries||u:1;e.keep=!!e.keep;e.detachDescriptor=!!e.detachDescriptor;e.discardDescriptor=!!e.discardDescriptor;e.unsafeCleanup=!!e.unsafeCleanup;e.dir=_isUndefined(e.dir)?"":s.relative(t,_resolvePath(e.dir,t));e.template=_isUndefined(e.template)?undefined:s.relative(t,_resolvePath(e.template,t));e.template=_isBlank(e.template)?undefined:s.relative(e.dir,e.template);e.naLine truncated
//# sourceMappingURL=index.js.map
Generated Vendored
+1 -1
View File
@@ -1 +1 @@
{"version":3,"sources":["../webpack:/docker-build-push/node_modules/@actions/core/lib/command.js","../webpack:/docker-build-push/node_modules/@actions/core/lib/core.js","../webpack:/docker-build-push/node_modules/@actions/core/lib/file-command.js","../webpack:/docker-build-push/node_modules/@actions/core/lib/oidc-utils.js","../webpack:/docker-build-push/node_modules/@actions/core/lib/path-utils.js","../webpack:/docker-build-push/node_modules/@actions/core/lib/summary.js","../webpack:/docker-build-push/node_modules/@actions/core/lib/utils.js","../webpack:/docker-build-push/node_modules/@actions/exec/lib/exec.js","../webpack:/docker-build-push/node_modules/@actions/exec/lib/toolrunner.js","../webpack:/docker-build-push/node_modules/@actions/github/lib/context.js","../webpack:/docker-build-push/node_modules/@actions/github/lib/github.js","../webpack:/docker-build-push/node_modules/@actions/github/lib/internal/utils.js","../webpack:/docker-build-push/node_modules/@actions/github/lib/utils.js","../webpack:/docker-build-push/node_modules/@actions/http-client/lib/auth.js","../webpack:/docker-build-push/node_modules/@actions/http-client/lib/index.js","../webpack:/docker-build-push/node_modules/@actions/http-client/lib/proxy.js","../webpack:/docker-build-push/node_modules/@actions/io/lib/io-util.js","../webpack:/docker-build-push/node_modules/@actions/io/lib/io.js","../webpack:/docker-build-push/node_modules/@octokit/auth-token/dist-node/index.js","../webpack:/docker-build-push/node_modules/@octokit/core/dist-node/index.js","../webpack:/docker-build-push/node_modules/@octokit/endpoint/dist-node/index.js","../webpack:/docker-build-push/node_modules/@octokit/graphql/dist-node/index.js","../webpack:/docker-build-push/node_modules/@octokit/graphql/node_modules/@octokit/request-error/dist-node/index.js","../webpack:/docker-build-push/node_modules/@octokit/graphql/node_modules/@octokit/request/dist-node/index.js","../webpack:/docker-build-push/node_modules/@octokit/plugin-paginate-rest/dist-node/index.js","../webpack:/docker-build-push/node_modules/@octokit/plugin-rest-endpoint-methods/dist-node/index.js","../webpack:/docker-build-push/node_modules/@octokit/request/dist-node/index.js","../webpack:/docker-build-push/node_modules/@octokit/request/node_modules/@octokit/request-error/dist-node/index.js","../webpack:/docker-build-push/node_modules/@octokit/request/node_modules/is-plain-object/dist/is-plain-object.js","../webpack:/docker-build-push/node_modules/balanced-match/index.js","../webpack:/docker-build-push/node_modules/before-after-hook/index.js","../webpack:/docker-build-push/node_modules/before-after-hook/lib/add.js","../webpack:/docker-build-push/node_modules/before-after-hook/lib/register.js","../webpack:/docker-build-push/node_modules/before-after-hook/lib/remove.js","../webpack:/docker-build-push/node_modules/brace-expansion/index.js","../webpack:/docker-build-push/node_modules/concat-map/index.js","../webpack:/docker-build-push/node_modules/deprecation/dist-node/index.js","../webpack:/docker-build-push/node_modules/fs.realpath/index.js","../webpack:/docker-build-push/node_modules/fs.realpath/old.js","../webpack:/docker-build-push/node_modules/glob/common.js","../webpack:/docker-build-push/node_modules/glob/glob.js","../webpack:/docker-build-push/node_modules/glob/sync.js","../webpack:/docker-build-push/node_modules/handlebars/dist/cjs/handlebars.js","../webpack:/docker-build-push/node_modules/handlebars/dist/cjs/handlebars.runtime.js","../webpack:/docker-build-push/node_modules/handlebars/dist/cjs/handlebars/base.js","../webpack:/docker-build-push/node_modules/handlebars/dist/cjs/handlebars/compiler/ast.js","../webpack:/docker-build-push/node_modules/handlebars/dist/cjs/handlebars/compiler/base.js","../webpack:/docker-build-push/node_modules/handlebars/dist/cjs/handlebars/compiler/code-gen.js","../webpack:/docker-build-push/node_modules/handlebars/dist/cjs/handlebars/compiler/compiler.js","../webpack:/docker-build-push/node_modules/handlebars/dist/cjs/handlebars/compiler/helpers.js","../webpack:/docker-build-push/node_modules/handlebars/dist/cjs/handlebars/compiler/javascript-compiler.js","../webpack:/docker-build-push/node_modules/handlebars/dist/cjs/handlebars/compiler/parser.js","../webpack:/docker-build-push/node_modules/handlebars/dist/cjs/handlebars/compiler/printer.js","../webpack:/docker-build-push/node_modules/handlebars/dist/cjs/handlebars/compiler/visitor.js","../webpack:/docker-build-push/node_modules/handlebars/dist/cjs/handlebars/compiler/whitespace-control.js","../webpack:/docker-build-push/node_modules/handlebars/dist/cjs/handlebars/decorators.js","../webpack:/docker-build-push/node_modules/handlebars/dist/cjs/handlebars/decorators/inline.js","../webpack:/docker-build-push/node_modules/handlebars/dist/cjs/handlebars/exception.js","../webpack:/docker-build-push/node_modules/handlebars/dist/cjs/handlebars/helpers.js","../webpack:/docker-build-push/node_modules/handlebars/dist/cjs/handlebars/helpeLine truncated
{"version":3,"sources":["../webpack:/docker-build-push/node_modules/@actions/core/lib/command.js","../webpack:/docker-build-push/node_modules/@actions/core/lib/core.js","../webpack:/docker-build-push/node_modules/@actions/core/lib/file-command.js","../webpack:/docker-build-push/node_modules/@actions/core/lib/oidc-utils.js","../webpack:/docker-build-push/node_modules/@actions/core/lib/path-utils.js","../webpack:/docker-build-push/node_modules/@actions/core/lib/summary.js","../webpack:/docker-build-push/node_modules/@actions/core/lib/utils.js","../webpack:/docker-build-push/node_modules/@actions/exec/lib/exec.js","../webpack:/docker-build-push/node_modules/@actions/exec/lib/toolrunner.js","../webpack:/docker-build-push/node_modules/@actions/github/lib/context.js","../webpack:/docker-build-push/node_modules/@actions/github/lib/github.js","../webpack:/docker-build-push/node_modules/@actions/github/lib/internal/utils.js","../webpack:/docker-build-push/node_modules/@actions/github/lib/utils.js","../webpack:/docker-build-push/node_modules/@actions/http-client/lib/auth.js","../webpack:/docker-build-push/node_modules/@actions/http-client/lib/index.js","../webpack:/docker-build-push/node_modules/@actions/http-client/lib/proxy.js","../webpack:/docker-build-push/node_modules/@actions/io/lib/io-util.js","../webpack:/docker-build-push/node_modules/@actions/io/lib/io.js","../webpack:/docker-build-push/node_modules/@octokit/auth-token/dist-node/index.js","../webpack:/docker-build-push/node_modules/@octokit/core/dist-node/index.js","../webpack:/docker-build-push/node_modules/@octokit/endpoint/dist-node/index.js","../webpack:/docker-build-push/node_modules/@octokit/graphql/dist-node/index.js","../webpack:/docker-build-push/node_modules/@octokit/graphql/node_modules/@octokit/request-error/dist-node/index.js","../webpack:/docker-build-push/node_modules/@octokit/graphql/node_modules/@octokit/request/dist-node/index.js","../webpack:/docker-build-push/node_modules/@octokit/plugin-paginate-rest/dist-node/index.js","../webpack:/docker-build-push/node_modules/@octokit/plugin-rest-endpoint-methods/dist-node/index.js","../webpack:/docker-build-push/node_modules/@octokit/request/dist-node/index.js","../webpack:/docker-build-push/node_modules/@octokit/request/node_modules/@octokit/request-error/dist-node/index.js","../webpack:/docker-build-push/node_modules/@octokit/request/node_modules/is-plain-object/dist/is-plain-object.js","../webpack:/docker-build-push/node_modules/balanced-match/index.js","../webpack:/docker-build-push/node_modules/before-after-hook/index.js","../webpack:/docker-build-push/node_modules/before-after-hook/lib/add.js","../webpack:/docker-build-push/node_modules/before-after-hook/lib/register.js","../webpack:/docker-build-push/node_modules/before-after-hook/lib/remove.js","../webpack:/docker-build-push/node_modules/brace-expansion/index.js","../webpack:/docker-build-push/node_modules/concat-map/index.js","../webpack:/docker-build-push/node_modules/deprecation/dist-node/index.js","../webpack:/docker-build-push/node_modules/fs.realpath/index.js","../webpack:/docker-build-push/node_modules/fs.realpath/old.js","../webpack:/docker-build-push/node_modules/glob/common.js","../webpack:/docker-build-push/node_modules/glob/glob.js","../webpack:/docker-build-push/node_modules/glob/sync.js","../webpack:/docker-build-push/node_modules/handlebars/dist/cjs/handlebars.js","../webpack:/docker-build-push/node_modules/handlebars/dist/cjs/handlebars.runtime.js","../webpack:/docker-build-push/node_modules/handlebars/dist/cjs/handlebars/base.js","../webpack:/docker-build-push/node_modules/handlebars/dist/cjs/handlebars/compiler/ast.js","../webpack:/docker-build-push/node_modules/handlebars/dist/cjs/handlebars/compiler/base.js","../webpack:/docker-build-push/node_modules/handlebars/dist/cjs/handlebars/compiler/code-gen.js","../webpack:/docker-build-push/node_modules/handlebars/dist/cjs/handlebars/compiler/compiler.js","../webpack:/docker-build-push/node_modules/handlebars/dist/cjs/handlebars/compiler/helpers.js","../webpack:/docker-build-push/node_modules/handlebars/dist/cjs/handlebars/compiler/javascript-compiler.js","../webpack:/docker-build-push/node_modules/handlebars/dist/cjs/handlebars/compiler/parser.js","../webpack:/docker-build-push/node_modules/handlebars/dist/cjs/handlebars/compiler/printer.js","../webpack:/docker-build-push/node_modules/handlebars/dist/cjs/handlebars/compiler/visitor.js","../webpack:/docker-build-push/node_modules/handlebars/dist/cjs/handlebars/compiler/whitespace-control.js","../webpack:/docker-build-push/node_modules/handlebars/dist/cjs/handlebars/decorators.js","../webpack:/docker-build-push/node_modules/handlebars/dist/cjs/handlebars/decorators/inline.js","../webpack:/docker-build-push/node_modules/handlebars/dist/cjs/handlebars/exception.js","../webpack:/docker-build-push/node_modules/handlebars/dist/cjs/handlebars/helpers.js","../webpack:/docker-build-push/node_modules/handlebars/dist/cjs/handlebars/helpeLine truncated
+122 -1
View File
@@ -3,9 +3,24 @@ import fs from 'fs';
import path from 'path';
import * as semver from 'semver';
import * as exec from '@actions/exec';
import * as context from './context';
export type Builder = {
name?: string;
driver?: string;
nodes: Node[];
};
export type Node = {
name?: string;
endpoint?: string;
'driver-opts'?: Array<string>;
status?: string;
'buildkitd-flags'?: string;
buildkit?: string;
platforms?: string;
};
export async function getImageIDFile(): Promise<string> {
return path.join(context.tmpDir(), 'iidfile').split(path.sep).join(path.posix.sep);
}
@@ -126,6 +141,112 @@ export async function isAvailable(standalone?: boolean): Promise<boolean> {
});
}
export async function satisfiesBuildKitVersion(builderName: string, range: string, standalone?: boolean): Promise<boolean> {
const builderInspect = await inspect(builderName, standalone);
for (const node of builderInspect.nodes) {
if (!node.buildkit) {
return false;
}
// BuildKit version reported by moby is in the format of `v0.11.0-moby`
if (builderInspect.driver == 'docker' && !node.buildkit.endsWith('-moby')) {
return false;
}
const version = node.buildkit.replace(/-moby$/, '');
if (!semver.satisfies(version, range)) {
return false;
}
}
return true;
}
async function inspect(name: string, standalone?: boolean): Promise<Builder> {
const cmd = getCommand(['inspect', name], standalone);
return await exec
.getExecOutput(cmd.command, cmd.args, {
ignoreReturnCode: true,
silent: true
})
.then(res => {
if (res.stderr.length > 0 && res.exitCode != 0) {
throw new Error(res.stderr.trim());
}
return parseInspect(res.stdout);
});
}
async function parseInspect(data: string): Promise<Builder> {
const builder: Builder = {
nodes: []
};
let node: Node = {};
for (const line of data.trim().split(`\n`)) {
const [key, ...rest] = line.split(':');
const value = rest.map(v => v.trim()).join(':');
if (key.length == 0 || value.length == 0) {
continue;
}
switch (key.toLowerCase()) {
case 'name': {
if (builder.name == undefined) {
builder.name = value;
} else {
if (Object.keys(node).length > 0) {
builder.nodes.push(node);
node = {};
}
node.name = value;
}
break;
}
case 'driver': {
builder.driver = value;
break;
}
case 'endpoint': {
node.endpoint = value;
break;
}
case 'driver options': {
node['driver-opts'] = (value.match(/(\w+)="([^"]*)"/g) || []).map(v => v.replace(/^(.*)="(.*)"$/g, '$1=$2'));
break;
}
case 'status': {
node.status = value;
break;
}
case 'flags': {
node['buildkitd-flags'] = value;
break;
}
case 'buildkit': {
node.buildkit = value;
break;
}
case 'platforms': {
let platforms: Array<string> = [];
// if a preferred platform is being set then use only these
// https://docs.docker.com/engine/reference/commandline/buildx_inspect/#get-information-about-a-builder-instance
if (value.includes('*')) {
for (const platform of value.split(', ')) {
if (platform.includes('*')) {
platforms.push(platform.replace('*', ''));
}
}
} else {
// otherwise set all platforms available
platforms = value.split(', ');
}
node.platforms = platforms.join(',');
break;
}
}
}
if (Object.keys(node).length > 0) {
builder.nodes.push(node);
}
return builder;
}
export async function getVersion(standalone?: boolean): Promise<string> {
const cmd = getCommand(['version'], standalone);
return await exec
+99 -3
View File
@@ -13,6 +13,7 @@ let _defaultContext, _tmpDir: string;
export interface Inputs {
addHosts: string[];
allow: string[];
attests: string[];
buildArgs: string[];
buildContexts: string[];
builder: string;
@@ -28,8 +29,10 @@ export interface Inputs {
noCacheFilters: string[];
outputs: string[];
platforms: string[];
provenance: string;
pull: boolean;
push: boolean;
sbom: string;
secrets: string[];
secretFiles: string[];
shmSize: string;
@@ -69,6 +72,7 @@ export async function getInputs(defaultContext: string): Promise<Inputs> {
return {
addHosts: await getInputList('add-hosts'),
allow: await getInputList('allow'),
attests: await getInputList('attests', true),
buildArgs: await getInputList('build-args', true),
buildContexts: await getInputList('build-contexts', true),
builder: core.getInput('builder'),
@@ -84,8 +88,10 @@ export async function getInputs(defaultContext: string): Promise<Inputs> {
noCacheFilters: await getInputList('no-cache-filters'),
outputs: await getInputList('outputs', true),
platforms: await getInputList('platforms'),
provenance: core.getInput('provenance'),
pull: core.getBooleanInput('pull'),
push: core.getBooleanInput('push'),
sbom: core.getInput('sbom'),
secrets: await getInputList('secrets', true),
secretFiles: await getInputList('secret-files', true),
shmSize: core.getInput('shm-size'),
@@ -97,17 +103,17 @@ export async function getInputs(defaultContext: string): Promise<Inputs> {
};
}
export async function getArgs(inputs: Inputs, defaultContext: string, buildxVersion: string): Promise<Array<string>> {
export async function getArgs(inputs: Inputs, defaultContext: string, buildxVersion: string, standalone?: boolean): Promise<Array<string>> {
const context = handlebars.compile(inputs.context)({defaultContext});
// prettier-ignore
return [
...await getBuildArgs(inputs, defaultContext, context, buildxVersion),
...await getBuildArgs(inputs, defaultContext, context, buildxVersion, standalone),
...await getCommonArgs(inputs, buildxVersion),
context
];
}
async function getBuildArgs(inputs: Inputs, defaultContext: string, context: string, buildxVersion: string): Promise<Array<string>> {
async function getBuildArgs(inputs: Inputs, defaultContext: string, context: string, buildxVersion: string, standalone?: boolean): Promise<Array<string>> {
const args: Array<string> = ['build'];
await asyncForEach(inputs.addHosts, async addHost => {
args.push('--add-host', addHost);
@@ -115,6 +121,11 @@ async function getBuildArgs(inputs: Inputs, defaultContext: string, context: str
if (inputs.allow.length > 0) {
args.push('--allow', inputs.allow.join(','));
}
if (buildx.satisfies(buildxVersion, '>=0.10.0')) {
await asyncForEach(inputs.attests, async attest => {
args.push('--attest', attest);
});
}
await asyncForEach(inputs.buildArgs, async buildArg => {
args.push('--build-arg', buildArg);
});
@@ -150,6 +161,29 @@ async function getBuildArgs(inputs: Inputs, defaultContext: string, context: str
if (inputs.platforms.length > 0) {
args.push('--platform', inputs.platforms.join(','));
}
if (buildx.satisfies(buildxVersion, '>=0.10.0')) {
const prvBuilderID = `${process.env.GITHUB_SERVER_URL || 'https://github.com'}/${github.context.repo.owner}/${github.context.repo.repo}/actions/runs/${github.context.runId}`;
if (inputs.provenance) {
args.push('--provenance', getProvenanceAttrs(inputs.provenance, prvBuilderID));
} else if ((await buildx.satisfiesBuildKitVersion(inputs.builder, '>=0.11.0', standalone)) && !hasDockerExport(inputs)) {
// if provenance not specified and BuildKit version compatible for
// attestation, set default provenance. Also needs to make sure user
// doesn't want to explicitly load the image to docker.
if (fromPayload('repository.private') !== false) {
// if this is a private repository, we set the default provenance
// attributes being set in buildx: https://github.com/docker/buildx/blob/fb27e3f919dcbf614d7126b10c2bc2d0b1927eb6/build/build.go#L603
// along the builder-id attribute.
args.push('--provenance', `mode=min,inline-only=true,builder-id=${prvBuilderID}`);
} else {
// for a public repository, we set max provenance mode and the
// builder-id attribute.
args.push('--provenance', `mode=max,builder-id=${prvBuilderID}`);
}
}
if (inputs.sbom) {
args.push('--sbom', inputs.sbom);
}
}
await asyncForEach(inputs.secrets, async secret => {
try {
args.push('--secret', await buildx.getSecretString(secret));
@@ -245,3 +279,65 @@ export const asyncForEach = async (array, callback) => {
await callback(array[index], index, array);
}
};
// eslint-disable-next-line @typescript-eslint/no-explicit-any
function fromPayload(path: string): any {
return select(github.context.payload, path);
}
// eslint-disable-next-line @typescript-eslint/no-explicit-any
function select(obj: any, path: string): any {
if (!obj) {
return undefined;
}
const i = path.indexOf('.');
if (i < 0) {
return obj[path];
}
const key = path.slice(0, i);
return select(obj[key], path.slice(i + 1));
}
function getProvenanceAttrs(input: string, builderID: string): string {
const fields = parse(input, {
relaxColumnCount: true,
skipEmptyLines: true
})[0];
// check if builder-id attribute exists in the input
for (const field of fields) {
const parts = field
.toString()
.split(/(?<=^[^=]+?)=/)
.map(item => item.trim());
if (parts[0] == 'builder-id') {
return input;
}
}
// if not add builder-id attribute
return `${input},builder-id=${builderID}`;
}
function hasDockerExport(inputs: Inputs): boolean {
if (inputs.load) {
return true;
}
for (const output of inputs.outputs) {
const fields = parse(output, {
relaxColumnCount: true,
skipEmptyLines: true
})[0];
for (const field of fields) {
const parts = field
.toString()
.split(/(?<=^[^=]+?)=/)
.map(item => item.trim());
if (parts.length != 2) {
continue;
}
if (parts[0] == 'type' && parts[1] == 'docker') {
return true;
}
}
}
return false;
}
+1 -1
View File
@@ -41,7 +41,7 @@ async function run(): Promise<void> {
});
});
const args: string[] = await context.getArgs(inputs, defContext, buildxVersion);
const args: string[] = await context.getArgs(inputs, defContext, buildxVersion, standalone);
const buildCmd = buildx.getCommand(args, standalone);
await exec
.getExecOutput(buildCmd.command, buildCmd.args, {
+16
View File
@@ -0,0 +1,16 @@
FROM golang:1.19-alpine AS base
ENV CGO_ENABLED=0
RUN apk add --no-cache file git
WORKDIR /src
FROM base as build
COPY go.mod go.sum ./
RUN go mod download -x
COPY . .
RUN go build -ldflags "-s -w" -o /usr/bin/app .
FROM scratch AS binary
COPY --from=build /usr/bin/app /bin/app
FROM alpine:3.17 AS image
COPY --from=build /usr/bin/app /bin/app
+19
View File
@@ -0,0 +1,19 @@
module github.com/docker/build-push-action/test/go
go 1.18
require github.com/labstack/echo/v4 v4.9.1
require (
github.com/golang-jwt/jwt v3.2.2+incompatible // indirect
github.com/labstack/gommon v0.4.0 // indirect
github.com/mattn/go-colorable v0.1.11 // indirect
github.com/mattn/go-isatty v0.0.14 // indirect
github.com/valyala/bytebufferpool v1.0.0 // indirect
github.com/valyala/fasttemplate v1.2.1 // indirect
golang.org/x/crypto v0.0.0-20210817164053-32db794688a5 // indirect
golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f // indirect
golang.org/x/sys v0.0.0-20211103235746-7861aae1554b // indirect
golang.org/x/text v0.3.7 // indirect
golang.org/x/time v0.0.0-20201208040808-7e3f01d25324 // indirect
)
+38
View File
@@ -0,0 +1,38 @@
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/golang-jwt/jwt v3.2.2+incompatible h1:IfV12K8xAKAnZqdXVzCZ+TOjboZ2keLg81eXfW3O+oY=
github.com/golang-jwt/jwt v3.2.2+incompatible/go.mod h1:8pz2t5EyA70fFQQSrl6XZXzqecmYZeUEB8OUGHkxJ+I=
github.com/labstack/echo/v4 v4.9.1 h1:GliPYSpzGKlyOhqIbG8nmHBo3i1saKWFOgh41AN3b+Y=
github.com/labstack/echo/v4 v4.9.1/go.mod h1:Pop5HLc+xoc4qhTZ1ip6C0RtP7Z+4VzRLWZZFKqbbjo=
github.com/labstack/gommon v0.4.0 h1:y7cvthEAEbU0yHOf4axH8ZG2NH8knB9iNSoTO8dyIk8=
github.com/labstack/gommon v0.4.0/go.mod h1:uW6kP17uPlLJsD3ijUYn3/M5bAxtlZhMI6m3MFxTMTM=
github.com/mattn/go-colorable v0.1.11 h1:nQ+aFkoE2TMGc0b68U2OKSexC+eq46+XwZzWXHRmPYs=
github.com/mattn/go-colorable v0.1.11/go.mod h1:u5H1YNBxpqRaxsYJYSkiCWKzEfiAb1Gb520KVy5xxl4=
github.com/mattn/go-isatty v0.0.14 h1:yVuAays6BHfxijgZPzw+3Zlu5yQgKGP2/hcQbHb7S9Y=
github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY=
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/valyala/bytebufferpool v1.0.0 h1:GqA5TC/0021Y/b9FG4Oi9Mr3q7XYx6KllzawFIhcdPw=
github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc=
github.com/valyala/fasttemplate v1.2.1 h1:TVEnxayobAdVkhQfrfes2IzOB6o+z4roRkPF52WA1u4=
github.com/valyala/fasttemplate v1.2.1/go.mod h1:KHLXt3tVN2HBp8eijSv/kGJopbvo7S+qRAEEKiv+SiQ=
golang.org/x/crypto v0.0.0-20210817164053-32db794688a5 h1:HWj/xjIHfjYU5nVXpTM0s39J9CbLn7Cc5a7IC5rwsMQ=
golang.org/x/crypto v0.0.0-20210817164053-32db794688a5/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f h1:OfiFi4JbukWwe3lzw+xunroH1mnC1e2Gy5cxNJApiSY=
golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20211103235746-7861aae1554b h1:1VkfZQv42XQlA/jchYumAnv1UPo6RgF9rJFkTgZIxO4=
golang.org/x/sys v0.0.0-20211103235746-7861aae1554b/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/text v0.3.7 h1:olpwvP2KacW1ZWvsR7uQhoyTYvKAupfQrRGBFM352Gk=
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
golang.org/x/time v0.0.0-20201208040808-7e3f01d25324 h1:Hir2P/De0WpUhtrKGGjvSb2YxUgyZ7EFOSLIcSSpiwE=
golang.org/x/time v0.0.0-20201208040808-7e3f01d25324/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo=
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
+31
View File
@@ -0,0 +1,31 @@
package main
import (
"net/http"
"os"
"github.com/labstack/echo/v4"
"github.com/labstack/echo/v4/middleware"
)
func main() {
e := echo.New()
e.Use(middleware.Logger())
e.Use(middleware.Recover())
e.GET("/", func(c echo.Context) error {
return c.HTML(http.StatusOK, "Hello World")
})
e.GET("/ping", func(c echo.Context) error {
return c.JSON(http.StatusOK, struct{ Status string }{Status: "OK"})
})
httpPort := os.Getenv("HTTP_PORT")
if httpPort == "" {
httpPort = "8080"
}
e.Logger.Fatal(e.Start(":" + httpPort))
}