Merge pull request #992 from crazy-max/annotations

add annotations input
This commit is contained in:
Tõnis Tiigi authored and GitHub committed 2023-11-15 13:19:25 -08:00
commit 7a786bb2b9
7 files changed
+110 -3

No files matched your search

+53 -1
View File
@@ -24,7 +24,7 @@ on:
pull_request:
env:
BUILDX_VERSION: latest
BUILDX_VERSION: v0.12.0-rc1
BUILDKIT_IMAGE: moby/buildkit:buildx-stable-1
jobs:
@@ -1125,3 +1125,55 @@ jobs:
with:
context: ./test
file: ./test/Dockerfile
annotations:
runs-on: ubuntu-latest
env:
DOCKER_IMAGE: localhost:5000/name/app
services:
registry:
image: registry:2
ports:
- 5000:5000
steps:
-
name: Checkout
uses: actions/checkout@v4
-
name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.DOCKER_IMAGE }}
tags: |
type=schedule
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
type=sha
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
version: ${{ inputs.buildx-version || env.BUILDX_VERSION }}
driver-opts: |
network=host
image=${{ inputs.buildkit-image || env.BUILDKIT_IMAGE }}
-
name: Build and push to local registry
uses: ./
with:
context: ./test
file: ./test/Dockerfile
push: true
tags: ${{ steps.meta.outputs.tags }}
annotations: |
index:com.example.key=value
index:com.example.key2=value2
manifest:com.example.key3=value3
-
name: Check manifest
run: |
docker buildx imagetools inspect ${{ env.DOCKER_IMAGE }}:${{ steps.meta.outputs.version }} --format '{{json .}}'
+1
View File
@@ -217,6 +217,7 @@ Following inputs can be used as `step.with` keys
|--------------------|-------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `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`) |
| `annotations` | List | List of annotation to set to the image |
| `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) |
+44
View File
@@ -662,6 +662,50 @@ ANOTHER_SECRET=ANOTHER_SECRET_ENV`]
'.'
]
],
[
27,
'0.11.0',
new Map<string, string>([
['context', '.'],
['annotations', 'example1=www\nindex:example2=xxx\nmanifest:example3=yyy\nmanifest-descriptor[linux/amd64]:example4=zzz'],
['outputs', 'type=local,dest=./release-out'],
['load', 'false'],
['no-cache', 'false'],
['push', 'false'],
['pull', 'false'],
]),
[
'build',
'--output', 'type=local,dest=./release-out',
"--provenance", `mode=min,inline-only=true,builder-id=https://github.com/docker/build-push-action/actions/runs/123456789`,
'--metadata-file', path.join(tmpDir, 'metadata-file'),
'.'
]
],
[
28,
'0.12.0',
new Map<string, string>([
['context', '.'],
['annotations', 'example1=www\nindex:example2=xxx\nmanifest:example3=yyy\nmanifest-descriptor[linux/amd64]:example4=zzz'],
['outputs', 'type=local,dest=./release-out'],
['load', 'false'],
['no-cache', 'false'],
['push', 'false'],
['pull', 'false'],
]),
[
'build',
'--annotation', 'example1=www',
'--annotation', 'index:example2=xxx',
'--annotation', 'manifest:example3=yyy',
'--annotation', 'manifest-descriptor[linux/amd64]:example4=zzz',
'--output', 'type=local,dest=./release-out',
"--provenance", `mode=min,inline-only=true,builder-id=https://github.com/docker/build-push-action/actions/runs/123456789`,
'--metadata-file', path.join(tmpDir, 'metadata-file'),
'.'
]
]
])(
'[%d] given %p with %p as inputs, returns %p',
async (num: number, buildxVersion: string, inputs: Map<string, string>, expected: Array<string>) => {
+3
View File
@@ -13,6 +13,9 @@ inputs:
allow:
description: "List of extra privileged entitlement (e.g., network.host,security.insecure)"
required: false
annotations:
description: "List of annotation to set to the image"
required: false
attests:
description: "List of attestation parameters (e.g., type=sbom,generator=image)"
required: false
Generated Vendored
+1 -1
View File
@@ -28,5 +28,5 @@ r.exports=s(3765)},3583:(r,i,s)=>{"use strict";
*/
const a=s(7147);const l=s(2037);const c=s(1017);const p=s(6113);const d={fs:a.constants,os:l.constants};const A=s(4959);const u="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",m=/XXXXXX/,h=3,g=(d.O_CREAT||d.fs.O_CREAT)|(d.O_EXCL||d.fs.O_EXCL)|(d.O_RDWR||d.fs.O_RDWR),E=l.platform()==="win32",y=d.EBADF||d.os.errno.EBADF,C=d.ENOENT||d.os.errno.ENOENT,b=448,v=384,I="exit",B=[],Q=a.rmdirSync.bind(a),w=A.sync;let S=false;function tmpName(r,i){const s=_parseArguments(r,i),l=s[0],c=s[1];try{_assertAndSanitizeOptions(l)}catch(r){return c(r)}let p=l.tries;(function _getUniqueName(){try{const r=_generateTmpName(l);a.stat(r,(function(i){if(!i){if(p-- >0)return _getUniqueName();return c(new Error("Could not get a unique tmp filename, max tries reached "+r))}c(null,r)}))}catch(r){c(r)}})()}function tmpNameSync(r){const i=_parseArguments(r),s=i[0];_assertAndSanitizeOptions(s);let l=s.tries;do{const r=_generateTmpName(s);try{a.statSync(r)}catch(i){return r}}while(l-- >0);throw new Error("Could not get a unique tmp filename, max tries reached")}function file(r,i){const s=_parseArguments(r,i),l=s[0],c=s[1];tmpName(l,(function _tmpNameCreated(r,i){if(r)return c(r);a.open(i,g,l.mode||v,(function _fileCreated(r,s){if(r)return c(r);if(l.discardDescriptor){return a.close(s,(function _discardCallback(r){return c(r,i,undefined,_prepareTmpFileRemoveCallback(i,-1,l,false))}))}else{const r=l.discardDescriptor||l.detachDescriptor;c(null,i,s,_prepareTmpFileRemoveCallback(i,r?-1:s,l,false))}}))}))}function fileSync(r){const i=_parseArguments(r),s=i[0];const l=s.discardDescriptor||s.detachDescriptor;const c=tmpNameSync(s);var p=a.openSync(c,g,s.mode||v);if(s.discardDescriptor){a.closeSync(p);p=undefined}return{name:c,fd:p,removeCallback:_prepareTmpFileRemoveCallback(c,l?-1:p,s,true)}}function dir(r,i){const s=_parseArguments(r,i),l=s[0],c=s[1];tmpName(l,(function _tmpNameCreated(r,i){if(r)return c(r);a.mkdir(i,l.mode||b,(function _dirCreated(r){if(r)return c(r);c(null,i,_prepareTmpDirRemoveCallback(i,l,false))}))}))}function dirSync(r){const i=_parseArguments(r),s=i[0];const l=tmpNameSync(s);a.mkdirSync(l,s.mode||b);return{name:l,removeCallback:_prepareTmpDirRemoveCallback(l,s,true)}}function _removeFileAsync(r,i){const _handler=function(r){if(r&&!_isENOENT(r)){return i(r)}i()};if(0<=r[0])a.close(r[0],(function(){a.unlink(r[1],_handler)}));else a.unlink(r[1],_handler)}function _removeFileSync(r){let i=null;try{if(0<=r[0])a.closeSync(r[0])}catch(r){if(!_isEBADF(r)&&!_isENOENT(r))throw r}finally{try{a.unlinkSync(r[1])}catch(r){if(!_isENOENT(r))i=r}}if(i!==null){throw i}}function _prepareTmpFileRemoveCallback(r,i,s,a){const l=_prepareRemoveCallback(_removeFileSync,[i,r],a);const c=_prepareRemoveCallback(_removeFileAsync,[i,r],a,l);if(!s.keep)B.unshift(l);return a?l:c}function _prepareTmpDirRemoveCallback(r,i,s){const l=i.unsafeCleanup?A:a.rmdir.bind(a);const c=i.unsafeCleanup?w:Q;const p=_prepareRemoveCallback(c,r,s);const d=_prepareRemoveCallback(l,r,s,p);if(!i.keep)B.unshift(p);return s?p:d}function _prepareRemoveCallback(r,i,s,a){let l=false;return function _cleanupCallback(c){if(!l){const p=a||_cleanupCallback;const d=B.indexOf(p);if(d>=0)B.splice(d,1);l=true;if(s||r===Q||r===w){return r(i)}else{return r(i,c||function(){})}}}}function _garbageCollector(){if(!S)return;while(B.length){try{B[0]()}catch(r){}}}function _randomChars(r){let i=[],s=null;try{s=p.randomBytes(r)}catch(i){s=p.pseudoRandomBytes(r)}for(var a=0;a<r;a++){i.push(u[s[a]%u.length])}return i.join("")}function _isBlank(r){return r===null||_isUndefined(r)||!r.trim()}function _isUndefined(r){return typeof r==="undefined"}function _parseArguments(r,i){if(typeof r==="function"){return[{},r]}if(_isUndefined(r)){return[{},i]}const s={};for(const i of Object.getOwnPropertyNames(r)){s[i]=r[i]}return[s,i]}function _generateTmpName(r){const i=r.tmpdir;if(!_isUndefined(r.name))return c.join(i,r.dir,r.name);if(!_isUndefined(r.template))return c.join(i,r.dir,r.template).replace(m,_randomChars(6));const s=[r.prefix?r.prefix:"tmp","-",process.pid,"-",_randomChars(12),r.postfix?"-"+r.postfix:""].join("");return c.join(i,r.dir,s)}function _assertAndSanitizeOptions(r){r.tmpdir=_getTmpDir(r);const i=r.tmpdir;if(!_isUndefined(r.name))_assertIsRelative(r.name,"name",i);if(!_isUndefined(r.dir))_assertIsRelative(r.dir,"dir",i);if(!_isUndefined(r.template)){_assertIsRelative(r.template,"template",i);if(!r.template.match(m))throw new Error(`Invalid template, found "${r.template}".`)}if(!_isUndefined(r.tries)&&isNaN(r.tries)||r.tries<0)throw new Error(`Invalid tries, found "${r.tries}".`);r.tries=_isUndefined(r.name)?r.tries||h:1;r.keep=!!r.keep;r.detachDescriptor=!!r.detachDescriptor;r.discardDescriptor=!!r.discardDescriptor;r.unsafeCleanup=!!r.unsafeCleanup;r.dir=_isUndefined(r.dir)?"":c.relative(i,_resolvePath(r.dir,i));r.template=_isUndefined(r.template)?undefined:c.relative(i,_resolvePath(r.template,i));r.template=_isBlank(r.template)?undefined:c.relative(r.dir,r.template);r.naLine truncated
/*! formdata-polyfill. MIT License. Jimmy Wärting <https://jimmy.warting.se/opensource> */;const escape=r=>r.replace(/\n/g,"%0A").replace(/\r/g,"%0D").replace(/"/g,"%22");const normalizeLinefeeds=r=>r.replace(/\r?\n|\r/g,"\r\n");const a=new TextEncoder;const l=[];const c=new Uint8Array([13,10]);h=0;let p=false;for(const[i,d]of r){if(typeof d==="string"){const r=a.encode(s+`; name="${escape(normalizeLinefeeds(i))}"`+`\r\n\r\n${normalizeLinefeeds(d)}\r\n`);l.push(r);h+=r.byteLength}else{const r=a.encode(`${s}; name="${escape(normalizeLinefeeds(i))}"`+(d.name?`; filename="${escape(d.name)}"`:"")+"\r\n"+`Content-Type: ${d.type||"application/octet-stream"}\r\n\r\n`);l.push(r,d,c);if(typeof d.size==="number"){h+=r.byteLength+d.size+c.byteLength}else{p=true}}}const d=a.encode(`--${i}--`);l.push(d);h+=d.byteLength;if(p){h=null}m=r;u=async function*(){for(const r of l){if(r.stream){yield*r.stream()}else{yield r}}};g="multipart/form-data; boundary="+i}else if(p(r)){m=r;h=r.size;if(r.type){g=r.type}}else if(typeof r[Symbol.asyncIterator]==="function"){if(i){throw new TypeError("keepalive")}if(l.isDisturbed(r)||r.locked){throw new TypeError("Response body object should not be disturbed or locked")}a=r instanceof D?r:c(r)}if(typeof m==="string"||l.isBuffer(m)){h=Buffer.byteLength(m)}if(u!=null){let i;a=new D({async start(){i=u(r)[Symbol.asyncIterator]()},async pull(r){const{value:s,done:l}=await i.next();if(l){queueMicrotask((()=>{r.close()}))}else{if(!Q(a)){r.enqueue(new Uint8Array(s))}}return r.desiredSize>0},async cancel(r){await i.return()},type:undefined})}const E={stream:a,source:m,length:h};return[E,g]}function safelyExtractBody(r,i=false){if(!D){D=s(5356).ReadableStream}if(r instanceof D){B(!l.isDisturbed(r),"The body has already been consumed.");B(!r.locked,"The stream is locked.")}return extractBody(r,i)}function cloneBody(r){const[i,s]=r.stream.tee();const a=C(s,{transfer:[s]});const[,l]=a.tee();r.stream=i;return{stream:l,length:r.length,source:r.source}}async function*consumeBody(r){if(r){if(w(r)){yield r}else{const i=r.stream;if(l.isDisturbed(i)){throw new TypeError("The body has already been consumed.")}if(i.locked){throw new TypeError("The stream is locked.")}i[I]=true;yield*i}}}function throwIfAborted(r){if(r.aborted){throw new y("The operation was aborted.","AbortError")}}function bodyMixinMethods(r){const i={blob(){return specConsumeBody(this,(r=>{let i=bodyMimeType(this);if(i==="failure"){i=""}else if(i){i=R(i)}return new b([r],{type:i})}),r)},arrayBuffer(){return specConsumeBody(this,(r=>new Uint8Array(r).buffer),r)},text(){return specConsumeBody(this,utf8DecodeBytes,r)},json(){return specConsumeBody(this,parseJSONFromBytes,r)},async formData(){E.brandCheck(this,r);throwIfAborted(this[g]);const i=this.headers.get("Content-Type");if(/multipart\/form-data/.test(i)){const r={};for(const[i,s]of this.headers)r[i.toLowerCase()]=s;const i=new h;let s;try{s=new a({headers:r,preservePath:true})}catch(r){throw new y(`${r}`,"AbortError")}s.on("field",((r,s)=>{i.append(r,s)}));s.on("file",((r,s,a,l,c)=>{const p=[];if(l==="base64"||l.toLowerCase()==="base64"){let l="";s.on("data",(r=>{l+=r.toString().replace(/[\r\n]/gm,"");const i=l.length-l.length%4;p.push(Buffer.from(l.slice(0,i),"base64"));l=l.slice(i)}));s.on("end",(()=>{p.push(Buffer.from(l,"base64"));i.append(r,new T(p,a,{type:c}))}))}else{s.on("data",(r=>{p.push(r)}));s.on("end",(()=>{i.append(r,new T(p,a,{type:c}))}))}}));const l=new Promise(((r,i)=>{s.on("finish",r);s.on("error",(r=>i(new TypeError(r))))}));if(this.body!==null)for await(const r of consumeBody(this[g].body))s.write(r);s.end();await l;return i}else if(/application\/x-www-form-urlencoded/.test(i)){let r;try{let i="";const s=new TextDecoder("utf-8",{ignoreBOM:true});for await(const r of consumeBody(this[g].body)){if(!w(r)){throw new TypeError("Expected Uint8Array chunk")}i+=s.decode(r,{stream:true})}i+=s.decode();r=new URLSearchParams(i)}catch(r){throw Object.assign(new TypeError,{cause:r})}const i=new h;for(const[s,a]of r){i.append(s,a)}return i}else{await Promise.resolve();throwIfAborted(this[g]);throw E.errors.exception({header:`${r.name}.formData`,message:"Could not parse content as FormData."})}}};return i}function mixinBody(r){Object.assign(r.prototype,bodyMixinMethods(r))}async function specConsumeBody(r,i,s){E.brandCheck(r,s);throwIfAborted(r[g]);if(bodyUnusable(r[g].body)){throw new TypeError("Body is unusable")}const a=u();const errorSteps=r=>a.reject(r);const successSteps=r=>{try{a.resolve(i(r))}catch(r){errorSteps(r)}};if(r[g].body==null){successSteps(new Uint8Array);return a.promise}await m(r[g].body,successSteps,errorSteps);return a.promise}function bodyUnusable(r){return r!=null&&(r.stream.locked||l.isDisturbed(r.stream))}function utf8DecodeBytes(r){if(r.length===0){return""}if(r[0]===239&&r[1]===187&&r[2]===191){r=r.subarray(3)}const i=(new TextDecoder).decode(r);return i}function parseJSONFromBytes(r){return JSON.parse(utf8DecodeBytes(r))}function bodyMimeType(r){const{heaLine truncated
/*! ws. MIT License. Einar Otto Stangvik <einaros@gmail.com> */c[l-4]=this.maskKey[0];c[l-3]=this.maskKey[1];c[l-2]=this.maskKey[2];c[l-1]=this.maskKey[3];c[1]=s;if(s===126){c.writeUInt16BE(i,2)}else if(s===127){c[2]=c[3]=0;c.writeUIntBE(i,4,6)}c[1]|=128;for(let r=0;r<i;r++){c[l+r]=this.frameData[r]^this.maskKey[r%4]}return c}}r.exports={WebsocketFrameSend:WebsocketFrameSend}},1688:(r,i,s)=>{"use strict";const{Writable:a}=s(2781);const l=s(7643);const{parserStates:c,opcodes:p,states:d,emptyBuffer:A}=s(9188);const{kReadyState:u,kSentClose:m,kResponse:h,kReceivedClose:g}=s(7578);const{isValidStatusCode:E,failWebsocketConnection:y,websocketMessageReceived:C}=s(5515);const{WebsocketFrameSend:b}=s(5444);const v={};v.ping=l.channel("undici:websocket:ping");v.pong=l.channel("undici:websocket:pong");class ByteParser extends a{#a=[];#o=0;#l=c.INFO;#c={};#p=[];constructor(r){super();this.ws=r}_write(r,i,s){this.#a.push(r);this.#o+=r.length;this.run(s)}run(r){while(true){if(this.#l===c.INFO){if(this.#o<2){return r()}const i=this.consume(2);this.#c.fin=(i[0]&128)!==0;this.#c.opcode=i[0]&15;this.#c.originalOpcode??=this.#c.opcode;this.#c.fragmented=!this.#c.fin&&this.#c.opcode!==p.CONTINUATION;if(this.#c.fragmented&&this.#c.opcode!==p.BINARY&&this.#c.opcode!==p.TEXT){y(this.ws,"Invalid frame type was fragmented.");return}const s=i[1]&127;if(s<=125){this.#c.payloadLength=s;this.#l=c.READ_DATA}else if(s===126){this.#l=c.PAYLOADLENGTH_16}else if(s===127){this.#l=c.PAYLOADLENGTH_64}if(this.#c.fragmented&&s>125){y(this.ws,"Fragmented frame exceeded 125 bytes.");return}else if((this.#c.opcode===p.PING||this.#c.opcode===p.PONG||this.#c.opcode===p.CLOSE)&&s>125){y(this.ws,"Payload length for control frame exceeded 125 bytes.");return}else if(this.#c.opcode===p.CLOSE){if(s===1){y(this.ws,"Received close frame with a 1-byte body.");return}const r=this.consume(s);this.#c.closeInfo=this.parseCloseBody(false,r);if(!this.ws[m]){const r=Buffer.allocUnsafe(2);r.writeUInt16BE(this.#c.closeInfo.code,0);const i=new b(r);this.ws[h].socket.write(i.createFrame(p.CLOSE),(r=>{if(!r){this.ws[m]=true}}))}this.ws[u]=d.CLOSING;this.ws[g]=true;this.end();return}else if(this.#c.opcode===p.PING){const i=this.consume(s);if(!this.ws[g]){const r=new b(i);this.ws[h].socket.write(r.createFrame(p.PONG));if(v.ping.hasSubscribers){v.ping.publish({payload:i})}}this.#l=c.INFO;if(this.#o>0){continue}else{r();return}}else if(this.#c.opcode===p.PONG){const i=this.consume(s);if(v.pong.hasSubscribers){v.pong.publish({payload:i})}if(this.#o>0){continue}else{r();return}}}else if(this.#l===c.PAYLOADLENGTH_16){if(this.#o<2){return r()}const i=this.consume(2);this.#c.payloadLength=i.readUInt16BE(0);this.#l=c.READ_DATA}else if(this.#l===c.PAYLOADLENGTH_64){if(this.#o<8){return r()}const i=this.consume(8);const s=i.readUInt32BE(0);if(s>2**31-1){y(this.ws,"Received payload length > 2^31 bytes.");return}const a=i.readUInt32BE(4);this.#c.payloadLength=(s<<8)+a;this.#l=c.READ_DATA}else if(this.#l===c.READ_DATA){if(this.#o<this.#c.payloadLength){return r()}else if(this.#o>=this.#c.payloadLength){const r=this.consume(this.#c.payloadLength);this.#p.push(r);if(!this.#c.fragmented||this.#c.fin&&this.#c.opcode===p.CONTINUATION){const r=Buffer.concat(this.#p);C(this.ws,this.#c.originalOpcode,r);this.#c={};this.#p.length=0}this.#l=c.INFO}}if(this.#o>0){continue}else{r();break}}}consume(r){if(r>this.#o){return null}else if(r===0){return A}if(this.#a[0].length===r){this.#o-=this.#a[0].length;return this.#a.shift()}const i=Buffer.allocUnsafe(r);let s=0;while(s!==r){const a=this.#a[0];const{length:l}=a;if(l+s===r){i.set(this.#a.shift(),s);break}else if(l+s>r){i.set(a.subarray(0,r-s),s);this.#a[0]=a.subarray(r-s);break}else{i.set(this.#a.shift(),s);s+=a.length}}this.#o-=r;return i}parseCloseBody(r,i){let s;if(i.length>=2){s=i.readUInt16BE(0)}if(r){if(!E(s)){return null}return{code:s}}let a=i.subarray(2);if(a[0]===239&&a[1]===187&&a[2]===191){a=a.subarray(3)}if(s!==undefined&&!E(s)){return null}try{a=new TextDecoder("utf-8",{fatal:true}).decode(a)}catch{return null}return{code:s,reason:a}}get closingInfo(){return this.#c.closeInfo}}r.exports={ByteParser:ByteParser}},7578:r=>{"use strict";r.exports={kWebSocketURL:Symbol("url"),kReadyState:Symbol("ready state"),kController:Symbol("controller"),kResponse:Symbol("response"),kBinaryType:Symbol("binary type"),kSentClose:Symbol("sent close"),kReceivedClose:Symbol("received close"),kByteParser:Symbol("byte parser")}},5515:(r,i,s)=>{"use strict";const{kReadyState:a,kController:l,kResponse:c,kBinaryType:p,kWebSocketURL:d}=s(7578);const{states:A,opcodes:u}=s(9188);const{MessageEvent:m,ErrorEvent:h}=s(2611);function isEstablished(r){return r[a]===A.OPEN}function isClosing(r){return r[a]===A.CLOSING}function isClosed(r){return r[a]===A.CLOSED}function fireEvent(r,i,s=Event,a){const l=new s(r,a);i.dispatchEvent(l)}function websocketMessageReceived(r,i,s){if(r[a]!==A.OPEN){return}let l;if(i===u.TEXT){try{l=new TextDecoder("utf-8",{fatal:true}).decode(s)Line truncated
/*! ws. MIT License. Einar Otto Stangvik <einaros@gmail.com> */c[l-4]=this.maskKey[0];c[l-3]=this.maskKey[1];c[l-2]=this.maskKey[2];c[l-1]=this.maskKey[3];c[1]=s;if(s===126){c.writeUInt16BE(i,2)}else if(s===127){c[2]=c[3]=0;c.writeUIntBE(i,4,6)}c[1]|=128;for(let r=0;r<i;r++){c[l+r]=this.frameData[r]^this.maskKey[r%4]}return c}}r.exports={WebsocketFrameSend:WebsocketFrameSend}},1688:(r,i,s)=>{"use strict";const{Writable:a}=s(2781);const l=s(7643);const{parserStates:c,opcodes:p,states:d,emptyBuffer:A}=s(9188);const{kReadyState:u,kSentClose:m,kResponse:h,kReceivedClose:g}=s(7578);const{isValidStatusCode:E,failWebsocketConnection:y,websocketMessageReceived:C}=s(5515);const{WebsocketFrameSend:b}=s(5444);const v={};v.ping=l.channel("undici:websocket:ping");v.pong=l.channel("undici:websocket:pong");class ByteParser extends a{#a=[];#o=0;#l=c.INFO;#c={};#p=[];constructor(r){super();this.ws=r}_write(r,i,s){this.#a.push(r);this.#o+=r.length;this.run(s)}run(r){while(true){if(this.#l===c.INFO){if(this.#o<2){return r()}const i=this.consume(2);this.#c.fin=(i[0]&128)!==0;this.#c.opcode=i[0]&15;this.#c.originalOpcode??=this.#c.opcode;this.#c.fragmented=!this.#c.fin&&this.#c.opcode!==p.CONTINUATION;if(this.#c.fragmented&&this.#c.opcode!==p.BINARY&&this.#c.opcode!==p.TEXT){y(this.ws,"Invalid frame type was fragmented.");return}const s=i[1]&127;if(s<=125){this.#c.payloadLength=s;this.#l=c.READ_DATA}else if(s===126){this.#l=c.PAYLOADLENGTH_16}else if(s===127){this.#l=c.PAYLOADLENGTH_64}if(this.#c.fragmented&&s>125){y(this.ws,"Fragmented frame exceeded 125 bytes.");return}else if((this.#c.opcode===p.PING||this.#c.opcode===p.PONG||this.#c.opcode===p.CLOSE)&&s>125){y(this.ws,"Payload length for control frame exceeded 125 bytes.");return}else if(this.#c.opcode===p.CLOSE){if(s===1){y(this.ws,"Received close frame with a 1-byte body.");return}const r=this.consume(s);this.#c.closeInfo=this.parseCloseBody(false,r);if(!this.ws[m]){const r=Buffer.allocUnsafe(2);r.writeUInt16BE(this.#c.closeInfo.code,0);const i=new b(r);this.ws[h].socket.write(i.createFrame(p.CLOSE),(r=>{if(!r){this.ws[m]=true}}))}this.ws[u]=d.CLOSING;this.ws[g]=true;this.end();return}else if(this.#c.opcode===p.PING){const i=this.consume(s);if(!this.ws[g]){const r=new b(i);this.ws[h].socket.write(r.createFrame(p.PONG));if(v.ping.hasSubscribers){v.ping.publish({payload:i})}}this.#l=c.INFO;if(this.#o>0){continue}else{r();return}}else if(this.#c.opcode===p.PONG){const i=this.consume(s);if(v.pong.hasSubscribers){v.pong.publish({payload:i})}if(this.#o>0){continue}else{r();return}}}else if(this.#l===c.PAYLOADLENGTH_16){if(this.#o<2){return r()}const i=this.consume(2);this.#c.payloadLength=i.readUInt16BE(0);this.#l=c.READ_DATA}else if(this.#l===c.PAYLOADLENGTH_64){if(this.#o<8){return r()}const i=this.consume(8);const s=i.readUInt32BE(0);if(s>2**31-1){y(this.ws,"Received payload length > 2^31 bytes.");return}const a=i.readUInt32BE(4);this.#c.payloadLength=(s<<8)+a;this.#l=c.READ_DATA}else if(this.#l===c.READ_DATA){if(this.#o<this.#c.payloadLength){return r()}else if(this.#o>=this.#c.payloadLength){const r=this.consume(this.#c.payloadLength);this.#p.push(r);if(!this.#c.fragmented||this.#c.fin&&this.#c.opcode===p.CONTINUATION){const r=Buffer.concat(this.#p);C(this.ws,this.#c.originalOpcode,r);this.#c={};this.#p.length=0}this.#l=c.INFO}}if(this.#o>0){continue}else{r();break}}}consume(r){if(r>this.#o){return null}else if(r===0){return A}if(this.#a[0].length===r){this.#o-=this.#a[0].length;return this.#a.shift()}const i=Buffer.allocUnsafe(r);let s=0;while(s!==r){const a=this.#a[0];const{length:l}=a;if(l+s===r){i.set(this.#a.shift(),s);break}else if(l+s>r){i.set(a.subarray(0,r-s),s);this.#a[0]=a.subarray(r-s);break}else{i.set(this.#a.shift(),s);s+=a.length}}this.#o-=r;return i}parseCloseBody(r,i){let s;if(i.length>=2){s=i.readUInt16BE(0)}if(r){if(!E(s)){return null}return{code:s}}let a=i.subarray(2);if(a[0]===239&&a[1]===187&&a[2]===191){a=a.subarray(3)}if(s!==undefined&&!E(s)){return null}try{a=new TextDecoder("utf-8",{fatal:true}).decode(a)}catch{return null}return{code:s,reason:a}}get closingInfo(){return this.#c.closeInfo}}r.exports={ByteParser:ByteParser}},7578:r=>{"use strict";r.exports={kWebSocketURL:Symbol("url"),kReadyState:Symbol("ready state"),kController:Symbol("controller"),kResponse:Symbol("response"),kBinaryType:Symbol("binary type"),kSentClose:Symbol("sent close"),kReceivedClose:Symbol("received close"),kByteParser:Symbol("byte parser")}},5515:(r,i,s)=>{"use strict";const{kReadyState:a,kController:l,kResponse:c,kBinaryType:p,kWebSocketURL:d}=s(7578);const{states:A,opcodes:u}=s(9188);const{MessageEvent:m,ErrorEvent:h}=s(2611);function isEstablished(r){return r[a]===A.OPEN}function isClosing(r){return r[a]===A.CLOSING}function isClosed(r){return r[a]===A.CLOSED}function fireEvent(r,i,s=Event,a){const l=new s(r,a);i.dispatchEvent(l)}function websocketMessageReceived(r,i,s){if(r[a]!==A.OPEN){return}let l;if(i===u.TEXT){try{l=new TextDecoder("utf-8",{fatal:true}).decode(s)Line truncated
//# sourceMappingURL=index.js.map
Generated Vendored
+1 -1
View File
@@ -1 +1 @@
{"version":3,"file":"index.js","names":["__createBinding","this","Object","create","o","m","k","k2","undefined","desc","getOwnPropertyDescriptor","__esModule","writable","configurable","enumerable","get","defineProperty","__setModuleDefault","v","value","__importStar","mod","result","prototype","hasOwnProperty","call","__awaiter","thisArg","_arguments","P","generator","adopt","resolve","Promise","reject","fulfilled","step","next","e","rejected","done","then","apply","exports","saveCache","restoreCache","isFeatureAvailable","ReserveCacheError","ValidationError","core","__webpack_require__","path","utils","cacheHttpClient","tar_1","Error","constructor","message","super","name","setPrototypeOf","checkPaths","paths","length","checkKey","key","regex","test","process","env","primaryKey","restoreKeys","options","enableCrossOsArchive","keys","debug","JSON","stringify","compressionMethod","getCompressionMethod","archivePath","cacheEntry","getCacheEntry","archiveLocation","lookupOnly","info","cacheKey","join","createTempDirectory","getCacheFileName","downloadCache","isDebug","listTar","archiveFileSize","getArchiveFileSizeInBytes","Math","round","extractTar","error","typedError","warning","unlinkFile","_a","_b","_c","_d","_e","cacheId","cachePaths","resolvePaths","archiveFolder","createTar","fileSizeLimit","isGhes","reserveCacheResponse","reserveCache","cacheSize","statusCode","getCacheVersion","http_client_1","auth_1","crypto","fs","url_1","downloadUtils_1","options_1","requestUtils_1","versionSalt","getCacheApiUrl","resource","baseUrl","url","createAcceptHeader","type","apiVersion","getRequestOptions","requestOptions","headers","Accept","createHttpClient","token","bearerCredentialHandler","BearerCredentialHandler","HttpClient","components","push","platform","createHash","update","digest","httpClient","version","encodeURIComponent","response","retryTypedResponse","getJson","printCachesListForDiagnostics","isSuccessStatusCode","cacheResult","cacheDownloadUrl","setSecret","cacheListResult","totalCount","artifactCaches","cacheVersion","scope","creationTime","archiveUrl","URL","downloadOptions","getDownloadOptions","hostname","endsWith","useAzureSdk","downloadCacheStorageSDK","concurrentBlobDownloads","downloadCacheHttpClientConcurrent","downloadCacheHttpClient","reserveCacheRequest","postJson","getContentRange","start","end","uploadChunk","resourceUrl","openStream","additionalHeaders","uploadChunkResponse","retryHttpClientResponse","sendStream","uploadFile","fileSize","toString","fd","openSync","uploadOptions","getUploadOptions","concurrency","assertDefined","uploadConcurrency","maxChunkSize","uploadChunkSize","parallelUploads","Array","offset","all","map","chunkSize","min","createReadStream","autoClose","on","closeSync","commitCache","filesize","commitCacheRequest","size","commitCacheResponse","__asyncValues","Symbol","asyncIterator","TypeError","i","__values","iterator","verb","n","settle","d","getGnuTarPathOnWindows","exec","glob","io","semver","util","uuid_1","constants_1","IS_WINDOWS","tempDirectory","baseLocation","dest","v4","mkdirP","filePath","statSync","patterns","e_1","workspace","cwd","globber","implicitDescendants","_f","globGenerator","_g","file","relativeFile","relative","replace","RegExp","sep","e_1_1","return","promisify","unlink","getVersion","app","additionalArgs","versionOutput","ignoreReturnCode","silent","listeners","stdout","data","stderr","err","trim","clean","CompressionMethod","Gzip","ZstdWithoutLong","CacheFilename","Zstd","existsSync","GnuTarPathOnWindows","toLowerCase","includes","which","ghUrl","toUpperCase","ManifestFilename","TarFilename","SystemTarPathOnWindows","SocketTimeout","DefaultRetryDelay","DefaultRetryAttempts","ArchiveToolType","DownloadProgress","storage_blob_1","buffer","stream","abort_controller_1","pipeResponseToStream","output","pipeline","contentLength","segmentIndex","segmentSize","segmentOffset","receivedBytes","displayedComplete","startTime","Date","now","nextSegment","setReceivedBytes","getTransferredBytes","isDone","display","transferredBytes","percentage","toFixed","elapsedTime","downloadSpeed","onProgress","progress","loadedBytes","startDisplayTimer","delayInMs","displayCallback","timeoutHandle","setTimeout","stopDisplayTimer","clearTimeout","writeStream","createWriteStream","downloadResponse","socket","destroy","contentLengthHeader","expectedLength","parseInt","actualLength","archiveDescriptor","promises","open","socketTimeout","timeoutInMs","keepAlive","res","request","lengthHeader","Number","isNaN","downloads","blockSize","count","promiseGetter","downloadSegmentRetry","reverse","actives","bytesDownloaded","progressFn","activeDownloads","nextDownload","waitAndWrite","segment","race","values","write","pop","downloadConcurrency","dispose","close","retries","failures","timeout","promiseWithTimeout","downloadSegment","partRes","Range","readBodyBuffer","client","BlockBlobClient","retryOptions","tryTimeoutInMs","properties","getProperties","maxSegmentSize","constants"Line truncated
{"version":3,"file":"index.js","names":["__createBinding","this","Object","create","o","m","k","k2","undefined","desc","getOwnPropertyDescriptor","__esModule","writable","configurable","enumerable","get","defineProperty","__setModuleDefault","v","value","__importStar","mod","result","prototype","hasOwnProperty","call","__awaiter","thisArg","_arguments","P","generator","adopt","resolve","Promise","reject","fulfilled","step","next","e","rejected","done","then","apply","exports","saveCache","restoreCache","isFeatureAvailable","ReserveCacheError","ValidationError","core","__webpack_require__","path","utils","cacheHttpClient","tar_1","Error","constructor","message","super","name","setPrototypeOf","checkPaths","paths","length","checkKey","key","regex","test","process","env","primaryKey","restoreKeys","options","enableCrossOsArchive","keys","debug","JSON","stringify","compressionMethod","getCompressionMethod","archivePath","cacheEntry","getCacheEntry","archiveLocation","lookupOnly","info","cacheKey","join","createTempDirectory","getCacheFileName","downloadCache","isDebug","listTar","archiveFileSize","getArchiveFileSizeInBytes","Math","round","extractTar","error","typedError","warning","unlinkFile","_a","_b","_c","_d","_e","cacheId","cachePaths","resolvePaths","archiveFolder","createTar","fileSizeLimit","isGhes","reserveCacheResponse","reserveCache","cacheSize","statusCode","getCacheVersion","http_client_1","auth_1","crypto","fs","url_1","downloadUtils_1","options_1","requestUtils_1","versionSalt","getCacheApiUrl","resource","baseUrl","url","createAcceptHeader","type","apiVersion","getRequestOptions","requestOptions","headers","Accept","createHttpClient","token","bearerCredentialHandler","BearerCredentialHandler","HttpClient","components","push","platform","createHash","update","digest","httpClient","version","encodeURIComponent","response","retryTypedResponse","getJson","printCachesListForDiagnostics","isSuccessStatusCode","cacheResult","cacheDownloadUrl","setSecret","cacheListResult","totalCount","artifactCaches","cacheVersion","scope","creationTime","archiveUrl","URL","downloadOptions","getDownloadOptions","hostname","endsWith","useAzureSdk","downloadCacheStorageSDK","concurrentBlobDownloads","downloadCacheHttpClientConcurrent","downloadCacheHttpClient","reserveCacheRequest","postJson","getContentRange","start","end","uploadChunk","resourceUrl","openStream","additionalHeaders","uploadChunkResponse","retryHttpClientResponse","sendStream","uploadFile","fileSize","toString","fd","openSync","uploadOptions","getUploadOptions","concurrency","assertDefined","uploadConcurrency","maxChunkSize","uploadChunkSize","parallelUploads","Array","offset","all","map","chunkSize","min","createReadStream","autoClose","on","closeSync","commitCache","filesize","commitCacheRequest","size","commitCacheResponse","__asyncValues","Symbol","asyncIterator","TypeError","i","__values","iterator","verb","n","settle","d","getGnuTarPathOnWindows","exec","glob","io","semver","util","uuid_1","constants_1","IS_WINDOWS","tempDirectory","baseLocation","dest","v4","mkdirP","filePath","statSync","patterns","e_1","workspace","cwd","globber","implicitDescendants","_f","globGenerator","_g","file","relativeFile","relative","replace","RegExp","sep","e_1_1","return","promisify","unlink","getVersion","app","additionalArgs","versionOutput","ignoreReturnCode","silent","listeners","stdout","data","stderr","err","trim","clean","CompressionMethod","Gzip","ZstdWithoutLong","CacheFilename","Zstd","existsSync","GnuTarPathOnWindows","toLowerCase","includes","which","ghUrl","toUpperCase","ManifestFilename","TarFilename","SystemTarPathOnWindows","SocketTimeout","DefaultRetryDelay","DefaultRetryAttempts","ArchiveToolType","DownloadProgress","storage_blob_1","buffer","stream","abort_controller_1","pipeResponseToStream","output","pipeline","contentLength","segmentIndex","segmentSize","segmentOffset","receivedBytes","displayedComplete","startTime","Date","now","nextSegment","setReceivedBytes","getTransferredBytes","isDone","display","transferredBytes","percentage","toFixed","elapsedTime","downloadSpeed","onProgress","progress","loadedBytes","startDisplayTimer","delayInMs","displayCallback","timeoutHandle","setTimeout","stopDisplayTimer","clearTimeout","writeStream","createWriteStream","downloadResponse","socket","destroy","contentLengthHeader","expectedLength","parseInt","actualLength","archiveDescriptor","promises","open","socketTimeout","timeoutInMs","keepAlive","res","request","lengthHeader","Number","isNaN","downloads","blockSize","count","promiseGetter","downloadSegmentRetry","reverse","actives","bytesDownloaded","progressFn","activeDownloads","nextDownload","waitAndWrite","segment","race","values","write","pop","downloadConcurrency","dispose","close","retries","failures","timeout","promiseWithTimeout","downloadSegment","partRes","Range","readBodyBuffer","client","BlockBlobClient","retryOptions","tryTimeoutInMs","properties","getProperties","maxSegmentSize","constants"Line truncated
+7
View File
@@ -9,6 +9,7 @@ import {Util} from '@docker/actions-toolkit/lib/util';
export interface Inputs {
addHosts: string[];
allow: string[];
annotations: string[];
attests: string[];
buildArgs: string[];
buildContexts: string[];
@@ -44,6 +45,7 @@ export async function getInputs(): Promise<Inputs> {
return {
addHosts: Util.getInputList('add-hosts'),
allow: Util.getInputList('allow'),
annotations: Util.getInputList('annotations', {ignoreComma: true}),
attests: Util.getInputList('attests', {ignoreComma: true}),
buildArgs: Util.getInputList('build-args', {ignoreComma: true}),
buildContexts: Util.getInputList('build-contexts', {ignoreComma: true}),
@@ -101,6 +103,11 @@ async function getBuildArgs(inputs: Inputs, context: string, toolkit: Toolkit):
args.push('--attest', attest);
});
}
if (await toolkit.buildx.versionSatisfies('>=0.12.0')) {
await Util.asyncForEach(inputs.annotations, async annotation => {
args.push('--annotation', annotation);
});
}
await Util.asyncForEach(inputs.buildArgs, async buildArg => {
args.push('--build-arg', buildArg);
});