Files
setup-docker-action/dist/index.js

22 lines
780 KiB
JavaScript
Raw Normal View History

2023-03-02 15:21:43 +01:00
require('./sourcemap-register.js');(()=>{var __webpack_modules__={6561:function(r,a,i){"use strict";var s=this&&this.__createBinding||(Object.create?function(r,a,i,s){if(s===undefined)s=i;var p=Object.getOwnPropertyDescriptor(a,i);if(!p||("get"in p?!a.__esModule:p.writable||p.configurable)){p={enumerable:true,get:function(){return a[i]}}}Object.defineProperty(r,s,p)}:function(r,a,i,s){if(s===undefined)s=i;r[s]=a[i]});var p=this&&this.__setModuleDefault||(Object.create?function(r,a){Object.defineProperty(r,"default",{enumerable:true,value:a})}:function(r,a){r["default"]=a});var d=this&&this.__importStar||function(r){if(r&&r.__esModule)return r;var a={};if(r!=null)for(var i in r)if(i!=="default"&&Object.prototype.hasOwnProperty.call(r,i))s(a,r,i);p(a,r);return a};var l=this&&this.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(a,"__esModule",{value:true});a.Context=void 0;const u=l(i(7147));const c=l(i(2037));const m=l(i(1017));const h=d(i(9540));const v=d(i(2239));const g=i(3527);class Context{static tmpDir(){return Context._tmpDir}static tmpName(r){return h.tmpNameSync(r)}static gitRef(){let r=v.context.ref;if(v.context.sha&&r&&!r.startsWith("refs/")){r=`refs/heads/${v.context.ref}`}if(v.context.sha&&!r.startsWith(`refs/pull/`)){r=v.context.sha}return r}static gitContext(){return`${g.GitHub.serverURL}/${v.context.repo.owner}/${v.context.repo.repo}.git#${Context.gitRef()}`}static provenanceBuilderID(){return`${g.GitHub.serverURL}/${v.context.repo.owner}/${v.context.repo.repo}/actions/runs/${v.context.runId}`}}a.Context=Context;Context._tmpDir=u.default.mkdtempSync(m.default.join(c.default.tmpdir(),"docker-actions-toolkit-"))},1590:function(r,a,i){"use strict";var s=this&&this.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(a,"__esModule",{value:true});a.colimaYamlData=a.dockerServiceLogsPs1Data=a.setupDockerWinPs1Data=a.setupDockerLinuxShData=a.colimaYaml=a.dockerServiceLogsPs1=a.setupDockerWinPs1=a.setupDockerLinuxSh=void 0;const p=s(i(7147));const d=i(6561);const setupDockerLinuxSh=()=>get("docker-setup-linux.sh",a.setupDockerLinuxShData,"0755");a.setupDockerLinuxSh=setupDockerLinuxSh;const setupDockerWinPs1=()=>get("docker-setup-win.ps1",a.setupDockerWinPs1Data);a.setupDockerWinPs1=setupDockerWinPs1;const dockerServiceLogsPs1=()=>get("docker-service-logs.ps1",a.dockerServiceLogsPs1Data);a.dockerServiceLogsPs1=dockerServiceLogsPs1;const colimaYaml=()=>get("colima.yaml",a.colimaYamlData);a.colimaYaml=colimaYaml;const get=(r,a,i)=>{const s=d.Context.tmpName({template:`docker-asset-XXXXXX-${r}`,tmpdir:d.Context.tmpDir()});p.default.writeFileSync(s,a);if(i){p.default.chmodSync(s,i)}return s};a.setupDockerLinuxShData=`\n#!/usr/bin/env bash\n\nset -eu\n\n: "\${TOOLDIR=}"\n: "\${RUNDIR=}"\n: "\${DOCKER_HOST=}"\n\nexport PATH="$TOOLDIR::$PATH"\n\nif [ -z "$DOCKER_HOST" ]; then\n echo >&2 'error: DOCKER_HOST required'\n false\nfi\n\nif ! command -v dockerd &> /dev/null; then\n echo >&2 'error: dockerd missing from PATH'\n false\nfi\n\nmkdir -p "$RUNDIR"\n\n(\n echo "Starting dockerd"\n set -x\n exec dockerd \\\n --host="$DOCKER_HOST" \\\n --exec-root="$RUNDIR/execroot" \\\n --data-root="$RUNDIR/data" \\\n --pidfile="$RUNDIR/docker.pid" \\\n --userland-proxy=false \\\n 2>&1 | tee "$RUNDIR/dockerd.log"\n) &\n`;a.setupDockerWinPs1Data=`\n[CmdletBinding()]\nparam(\n [Parameter(Mandatory = $true)]\n [string]$ToolDir,\n\n [Parameter(Mandatory = $true)]\n [string]$RunDir,\n\n [Parameter(Mandatory = $true)]\n [string]$DockerHost)\n\n$pwver = (Get-ItemProperty -Path HKLM:\\SOFTWARE\\Microsoft\\PowerShell\\3\\PowerShellEngine -Name 'PowerShellVersion').PowerShellVersion\nWrite-Host "PowerShell version: $pwver"\n\n# Create run directory\nNew-Item -ItemType Directory "$RunDir" -ErrorAction SilentlyContinue | Out-Null\n\n# Remove existing service\nif (Get-Service docker -ErrorAction SilentlyContinue) {\n $dockerVersion = (docker version -f "{{.Server.Version}}")\n Write-Host "Current installed Docker version: $docke
2023-03-02 14:00:16 +01:00
/*!
* is-plain-object <https://github.com/jonschlinkert/is-plain-object>
*
* Copyright (c) 2014-2017, Jon Schlinkert.
* Released under the MIT License.
2023-03-02 15:21:43 +01:00
*/function isObject(r){return Object.prototype.toString.call(r)==="[object Object]"}function isPlainObject(r){var a,i;if(isObject(r)===false)return false;a=r.constructor;if(a===undefined)return true;i=a.prototype;if(isObject(i)===false)return false;if(i.hasOwnProperty("isPrototypeOf")===false){return false}return true}a.isPlainObject=isPlainObject},9320:(r,a,i)=>{"use strict";Object.defineProperty(a,"__esModule",{value:true});function _interopDefault(r){return r&&typeof r==="object"&&"default"in r?r["default"]:r}var s=_interopDefault(i(2502));var p=i(4005);function lowercaseKeys(r){if(!r){return{}}return Object.keys(r).reduce(((a,i)=>{a[i.toLowerCase()]=r[i];return a}),{})}function mergeDeep(r,a){const i=Object.assign({},r);Object.keys(a).forEach((p=>{if(s(a[p])){if(!(p in r))Object.assign(i,{[p]:a[p]});else i[p]=mergeDeep(r[p],a[p])}else{Object.assign(i,{[p]:a[p]})}}));return i}function merge(r,a,i){if(typeof a==="string"){let[r,s]=a.split(" ");i=Object.assign(s?{method:r,url:s}:{url:r},i)}else{i=Object.assign({},a)}i.headers=lowercaseKeys(i.headers);const s=mergeDeep(r||{},i);if(r&&r.mediaType.previews.length){s.mediaType.previews=r.mediaType.previews.filter((r=>!s.mediaType.previews.includes(r))).concat(s.mediaType.previews)}s.mediaType.previews=s.mediaType.previews.map((r=>r.replace(/-preview/,"")));return s}function addQueryParameters(r,a){const i=/\?/.test(r)?"&":"?";const s=Object.keys(a);if(s.length===0){return r}return r+i+s.map((r=>{if(r==="q"){return"q="+a.q.split("+").map(encodeURIComponent).join("+")}return`${r}=${encodeURIComponent(a[r])}`})).join("&")}const d=/\{[^}]+\}/g;function removeNonChars(r){return r.replace(/^\W+|\W+$/g,"").split(/,/)}function extractUrlVariableNames(r){const a=r.match(d);if(!a){return[]}return a.map(removeNonChars).reduce(((r,a)=>r.concat(a)),[])}function omit(r,a){return Object.keys(r).filter((r=>!a.includes(r))).reduce(((a,i)=>{a[i]=r[i];return a}),{})}function encodeReserved(r){return r.split(/(%[0-9A-Fa-f]{2})/g).map((function(r){if(!/%[0-9A-Fa-f]/.test(r)){r=encodeURI(r).replace(/%5B/g,"[").replace(/%5D/g,"]")}return r})).join("")}function encodeUnreserved(r){return encodeURIComponent(r).replace(/[!'()*]/g,(function(r){return"%"+r.charCodeAt(0).toString(16).toUpperCase()}))}function encodeValue(r,a,i){a=r==="+"||r==="#"?encodeReserved(a):encodeUnreserved(a);if(i){return encodeUnreserved(i)+"="+a}else{return a}}function isDefined(r){return r!==undefined&&r!==null}function isKeyOperator(r){return r===";"||r==="&"||r==="?"}function getValues(r,a,i,s){var p=r[i],d=[];if(isDefined(p)&&p!==""){if(typeof p==="string"||typeof p==="number"||typeof p==="boolean"){p=p.toString();if(s&&s!=="*"){p=p.substring(0,parseInt(s,10))}d.push(encodeValue(a,p,isKeyOperator(a)?i:""))}else{if(s==="*"){if(Array.isArray(p)){p.filter(isDefined).forEach((function(r){d.push(encodeValue(a,r,isKeyOperator(a)?i:""))}))}else{Object.keys(p).forEach((function(r){if(isDefined(p[r])){d.push(encodeValue(a,p[r],r))}}))}}else{const r=[];if(Array.isArray(p)){p.filter(isDefined).forEach((function(i){r.push(encodeValue(a,i))}))}else{Object.keys(p).forEach((function(i){if(isDefined(p[i])){r.push(encodeUnreserved(i));r.push(encodeValue(a,p[i].toString()))}}))}if(isKeyOperator(a)){d.push(encodeUnreserved(i)+"="+r.join(","))}else if(r.length!==0){d.push(r.join(","))}}}}else{if(a===";"){if(isDefined(p)){d.push(encodeUnreserved(i))}}else if(p===""&&(a==="&"||a==="?")){d.push(encodeUnreserved(i)+"=")}else if(p===""){d.push("")}}return d}function parseUrl(r){return{expand:expand.bind(null,r)}}function expand(r,a){var i=["+","#",".","/",";","?","&"];return r.replace(/\{([^\{\}]+)\}|([^\{\}]+)/g,(function(r,s,p){if(s){let r="";const p=[];if(i.indexOf(s.charAt(0))!==-1){r=s.charAt(0);s=s.substr(1)}s.split(/,/g).forEach((function(i){var s=/([^:\*]*)(?::(\d+)|(\*))?/.exec(i);p.push(getValues(a,r,s[1],s[2]||s[3]))}));if(r&&r!=="+"){var d=",";if(r==="?"){d="&"}else if(r!=="#"){d=r}return(p.length!==0?r:"")+p.join(d)}else{return p.join(",")}}else{return encodeReserved(p)}}))}function parse(r){let a=r.method.toUpperCase();let i=(r.ur
2023-03-02 14:00:16 +01:00
/*!
* is-plain-object <https://github.com/jonschlinkert/is-plain-object>
*
* Copyright (c) 2014-2017, Jon Schlinkert.
* Released under the MIT License.
2023-03-02 15:21:43 +01:00
*/function isObject(r){return Object.prototype.toString.call(r)==="[object Object]"}function isPlainObject(r){var a,i;if(isObject(r)===false)return false;a=r.constructor;if(a===undefined)return true;i=a.prototype;if(isObject(i)===false)return false;if(i.hasOwnProperty("isPrototypeOf")===false){return false}return true}r.exports=isPlainObject},5665:r=>{"use strict";function e(r){this.message=r}e.prototype=new Error,e.prototype.name="InvalidCharacterError";var a="undefined"!=typeof window&&window.atob&&window.atob.bind(window)||function(r){var a=String(r).replace(/=+$/,"");if(a.length%4==1)throw new e("'atob' failed: The string to be decoded is not correctly encoded.");for(var i,s,p=0,d=0,l="";s=a.charAt(d++);~s&&(i=p%4?64*i+s:s,p++%4)?l+=String.fromCharCode(255&i>>(-2*p&6)):0)s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(s);return l};function t(r){var i=r.replace(/-/g,"+").replace(/_/g,"/");switch(i.length%4){case 0:break;case 2:i+="==";break;case 3:i+="=";break;default:throw"Illegal base64url string!"}try{return function(r){return decodeURIComponent(a(r).replace(/(.)/g,(function(r,a){var i=a.charCodeAt(0).toString(16).toUpperCase();return i.length<2&&(i="0"+i),"%"+i})))}(i)}catch(r){return a(i)}}function n(r){this.message=r}function o(r,a){if("string"!=typeof r)throw new n("Invalid token specified");var i=!0===(a=a||{}).header?0:1;try{return JSON.parse(t(r.split(".")[i]))}catch(r){throw new n("Invalid token specified: "+r.message)}}n.prototype=new Error,n.prototype.name="InvalidTokenError";const i=o;i.default=o,i.InvalidTokenError=n,r.exports=i},4385:(r,a,i)=>{r.exports=minimatch;minimatch.Minimatch=Minimatch;var s=function(){try{return i(1017)}catch(r){}}()||{sep:"/"};minimatch.sep=s.sep;var p=minimatch.GLOBSTAR=Minimatch.GLOBSTAR={};var d=i(4497);var l={"!":{open:"(?:(?!(?:",close:"))[^/]*?)"},"?":{open:"(?:",close:")?"},"+":{open:"(?:",close:")+"},"*":{open:"(?:",close:")*"},"@":{open:"(?:",close:")"}};var u="[^/]";var c=u+"*?";var m="(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?";var h="(?:(?!(?:\\/|^)\\.).)*?";var v=charSet("().*{}+?[]^$\\!");function charSet(r){return r.split("").reduce((function(r,a){r[a]=true;return r}),{})}var g=/\/+/;minimatch.filter=filter;function filter(r,a){a=a||{};return function(i,s,p){return minimatch(i,r,a)}}function ext(r,a){a=a||{};var i={};Object.keys(r).forEach((function(a){i[a]=r[a]}));Object.keys(a).forEach((function(r){i[r]=a[r]}));return i}minimatch.defaults=function(r){if(!r||typeof r!=="object"||!Object.keys(r).length){return minimatch}var a=minimatch;var i=function minimatch(i,s,p){return a(i,s,ext(r,p))};i.Minimatch=function Minimatch(i,s){return new a.Minimatch(i,ext(r,s))};i.Minimatch.defaults=function defaults(i){return a.defaults(ext(r,i)).Minimatch};i.filter=function filter(i,s){return a.filter(i,ext(r,s))};i.defaults=function defaults(i){return a.defaults(ext(r,i))};i.makeRe=function makeRe(i,s){return a.makeRe(i,ext(r,s))};i.braceExpand=function braceExpand(i,s){return a.braceExpand(i,ext(r,s))};i.match=function(i,s,p){return a.match(i,s,ext(r,p))};return i};Minimatch.defaults=function(r){return minimatch.defaults(r).Minimatch};function minimatch(r,a,i){assertValidPattern(a);if(!i)i={};if(!i.nocomment&&a.charAt(0)==="#"){return false}return new Minimatch(a,i).match(r)}function Minimatch(r,a){if(!(this instanceof Minimatch)){return new Minimatch(r,a)}assertValidPattern(r);if(!a)a={};r=r.trim();if(!a.allowWindowsEscape&&s.sep!=="/"){r=r.split(s.sep).join("/")}this.options=a;this.set=[];this.pattern=r;this.regexp=null;this.negate=false;this.comment=false;this.empty=false;this.partial=!!a.partial;this.make()}Minimatch.prototype.debug=function(){};Minimatch.prototype.make=make;function make(){var r=this.pattern;var a=this.options;if(!a.nocomment&&r.charAt(0)==="#"){this.comment=true;return}if(!r){this.empty=true;return}this.parseNegate();var i=this.globSet=this.braceExpand();if(a.debug)this.debug=function debug(){console.error.apply(console,arguments)};this.debug(this.pattern,i);i=this.globParts=i.map((function(r){return r.split(g)}));this.debug
2023-03-02 14:00:16 +01:00
/*!
* Tmp
*
* Copyright (c) 2011-2017 KARASZI Istvan <github@spam.raszi.hu>
*
* MIT Licensed
*/
2023-03-02 15:21:43 +01:00
const s=i(7147);const p=i(2037);const d=i(1017);const l=i(6113);const u={fs:s.constants,os:p.constants};const c=i(78);const m="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",h=/XXXXXX/,v=3,g=(u.O_CREAT||u.fs.O_CREAT)|(u.O_EXCL||u.fs.O_EXCL)|(u.O_RDWR||u.fs.O_RDWR),_=p.platform()==="win32",w=u.EBADF||u.os.errno.EBADF,y=u.ENOENT||u.os.errno.ENOENT,b=448,E=384,S="exit",T=[],O=s.rmdirSync.bind(s),k=c.sync;let P=false;function tmpName(r,a){const i=_parseArguments(r,a),p=i[0],d=i[1];try{_assertAndSanitizeOptions(p)}catch(r){return d(r)}let l=p.tries;(function _getUniqueName(){try{const r=_generateTmpName(p);s.stat(r,(function(a){if(!a){if(l-- >0)return _getUniqueName();return d(new Error("Could not get a unique tmp filename, max tries reached "+r))}d(null,r)}))}catch(r){d(r)}})()}function tmpNameSync(r){const a=_parseArguments(r),i=a[0];_assertAndSanitizeOptions(i);let p=i.tries;do{const r=_generateTmpName(i);try{s.statSync(r)}catch(a){return r}}while(p-- >0);throw new Error("Could not get a unique tmp filename, max tries reached")}function file(r,a){const i=_parseArguments(r,a),p=i[0],d=i[1];tmpName(p,(function _tmpNameCreated(r,a){if(r)return d(r);s.open(a,g,p.mode||E,(function _fileCreated(r,i){if(r)return d(r);if(p.discardDescriptor){return s.close(i,(function _discardCallback(r){return d(r,a,undefined,_prepareTmpFileRemoveCallback(a,-1,p,false))}))}else{const r=p.discardDescriptor||p.detachDescriptor;d(null,a,i,_prepareTmpFileRemoveCallback(a,r?-1:i,p,false))}}))}))}function fileSync(r){const a=_parseArguments(r),i=a[0];const p=i.discardDescriptor||i.detachDescriptor;const d=tmpNameSync(i);var l=s.openSync(d,g,i.mode||E);if(i.discardDescriptor){s.closeSync(l);l=undefined}return{name:d,fd:l,removeCallback:_prepareTmpFileRemoveCallback(d,p?-1:l,i,true)}}function dir(r,a){const i=_parseArguments(r,a),p=i[0],d=i[1];tmpName(p,(function _tmpNameCreated(r,a){if(r)return d(r);s.mkdir(a,p.mode||b,(function _dirCreated(r){if(r)return d(r);d(null,a,_prepareTmpDirRemoveCallback(a,p,false))}))}))}function dirSync(r){const a=_parseArguments(r),i=a[0];const p=tmpNameSync(i);s.mkdirSync(p,i.mode||b);return{name:p,removeCallback:_prepareTmpDirRemoveCallback(p,i,true)}}function _removeFileAsync(r,a){const _handler=function(r){if(r&&!_isENOENT(r)){return a(r)}a()};if(0<=r[0])s.close(r[0],(function(){s.unlink(r[1],_handler)}));else s.unlink(r[1],_handler)}function _removeFileSync(r){let a=null;try{if(0<=r[0])s.closeSync(r[0])}catch(r){if(!_isEBADF(r)&&!_isENOENT(r))throw r}finally{try{s.unlinkSync(r[1])}catch(r){if(!_isENOENT(r))a=r}}if(a!==null){throw a}}function _prepareTmpFileRemoveCallback(r,a,i,s){const p=_prepareRemoveCallback(_removeFileSync,[a,r],s);const d=_prepareRemoveCallback(_removeFileAsync,[a,r],s,p);if(!i.keep)T.unshift(p);return s?p:d}function _prepareTmpDirRemoveCallback(r,a,i){const p=a.unsafeCleanup?c:s.rmdir.bind(s);const d=a.unsafeCleanup?k:O;const l=_prepareRemoveCallback(d,r,i);const u=_prepareRemoveCallback(p,r,i,l);if(!a.keep)T.unshift(l);return i?l:u}function _prepareRemoveCallback(r,a,i,s){let p=false;return function _cleanupCallback(d){if(!p){const l=s||_cleanupCallback;const u=T.indexOf(l);if(u>=0)T.splice(u,1);p=true;if(i||r===O||r===k){return r(a)}else{return r(a,d||function(){})}}}}function _garbageCollector(){if(!P)return;while(T.length){try{T[0]()}catch(r){}}}function _randomChars(r){let a=[],i=null;try{i=l.randomBytes(r)}catch(a){i=l.pseudoRandomBytes(r)}for(var s=0;s<r;s++){a.push(m[i[s]%m.length])}return a.join("")}function _isBlank(r){return r===null||_isUndefined(r)||!r.trim()}function _isUndefined(r){return typeof r==="undefined"}function _parseArguments(r,a){if(typeof r==="function"){return[{},r]}if(_isUndefined(r)){return[{},a]}const i={};for(const a of Object.getOwnPropertyNames(r)){i[a]=r[a]}return[i,a]}function _generateTmpName(r){const a=r.tmpdir;if(!_isUndefined(r.name))return d.join(a,r.dir,r.name);if(!_isUndefined(r.template))return d.join(a,r.dir,r.template).replace(h,_randomChars(6));const i=[r.prefix?r.prefix:"tmp","-",process.pid,"-",_randomChars(12),r.postfix?"-"+r.post
2023-03-02 14:00:16 +01:00
//# sourceMappingURL=index.js.map