mirror of
https://github.com/redhat-actions/push-to-registry.git
synced 2025-02-23 10:31:22 +01:00
2 lines
No EOL
34 KiB
JavaScript
2 lines
No EOL
34 KiB
JavaScript
require('./sourcemap-register.js');module.exports=(()=>{var e={351:function(e,t,n){"use strict";var i=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n in e)if(Object.hasOwnProperty.call(e,n))t[n]=e[n];t["default"]=e;return t};Object.defineProperty(t,"__esModule",{value:true});const r=i(n(87));const o=n(278);function issueCommand(e,t,n){const i=new Command(e,t,n);process.stdout.write(i.toString()+r.EOL)}t.issueCommand=issueCommand;function issue(e,t=""){issueCommand(e,{},t)}t.issue=issue;const s="::";class Command{constructor(e,t,n){if(!e){e="missing.command"}this.command=e;this.properties=t;this.message=n}toString(){let e=s+this.command;if(this.properties&&Object.keys(this.properties).length>0){e+=" ";let t=true;for(const n in this.properties){if(this.properties.hasOwnProperty(n)){const i=this.properties[n];if(i){if(t){t=false}else{e+=","}e+=`${n}=${escapeProperty(i)}`}}}}e+=`${s}${escapeData(this.message)}`;return e}}function escapeData(e){return o.toCommandValue(e).replace(/%/g,"%25").replace(/\r/g,"%0D").replace(/\n/g,"%0A")}function escapeProperty(e){return o.toCommandValue(e).replace(/%/g,"%25").replace(/\r/g,"%0D").replace(/\n/g,"%0A").replace(/:/g,"%3A").replace(/,/g,"%2C")}},186:function(e,t,n){"use strict";var i=this&&this.__awaiter||function(e,t,n,i){function adopt(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||(n=Promise))(function(n,r){function fulfilled(e){try{step(i.next(e))}catch(e){r(e)}}function rejected(e){try{step(i["throw"](e))}catch(e){r(e)}}function step(e){e.done?n(e.value):adopt(e.value).then(fulfilled,rejected)}step((i=i.apply(e,t||[])).next())})};var r=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n in e)if(Object.hasOwnProperty.call(e,n))t[n]=e[n];t["default"]=e;return t};Object.defineProperty(t,"__esModule",{value:true});const o=n(351);const s=n(717);const c=n(278);const a=r(n(87));const u=r(n(622));var l;(function(e){e[e["Success"]=0]="Success";e[e["Failure"]=1]="Failure"})(l=t.ExitCode||(t.ExitCode={}));function exportVariable(e,t){const n=c.toCommandValue(t);process.env[e]=n;const i=process.env["GITHUB_ENV"]||"";if(i){const t="_GitHubActionsFileCommandDelimeter_";const i=`${e}<<${t}${a.EOL}${n}${a.EOL}${t}`;s.issueCommand("ENV",i)}else{o.issueCommand("set-env",{name:e},n)}}t.exportVariable=exportVariable;function setSecret(e){o.issueCommand("add-mask",{},e)}t.setSecret=setSecret;function addPath(e){const t=process.env["GITHUB_PATH"]||"";if(t){s.issueCommand("PATH",e)}else{o.issueCommand("add-path",{},e)}process.env["PATH"]=`${e}${u.delimiter}${process.env["PATH"]}`}t.addPath=addPath;function getInput(e,t){const n=process.env[`INPUT_${e.replace(/ /g,"_").toUpperCase()}`]||"";if(t&&t.required&&!n){throw new Error(`Input required and not supplied: ${e}`)}return n.trim()}t.getInput=getInput;function setOutput(e,t){o.issueCommand("set-output",{name:e},t)}t.setOutput=setOutput;function setCommandEcho(e){o.issue("echo",e?"on":"off")}t.setCommandEcho=setCommandEcho;function setFailed(e){process.exitCode=l.Failure;error(e)}t.setFailed=setFailed;function isDebug(){return process.env["RUNNER_DEBUG"]==="1"}t.isDebug=isDebug;function debug(e){o.issueCommand("debug",{},e)}t.debug=debug;function error(e){o.issue("error",e instanceof Error?e.toString():e)}t.error=error;function warning(e){o.issue("warning",e instanceof Error?e.toString():e)}t.warning=warning;function info(e){process.stdout.write(e+a.EOL)}t.info=info;function startGroup(e){o.issue("group",e)}t.startGroup=startGroup;function endGroup(){o.issue("endgroup")}t.endGroup=endGroup;function group(e,t){return i(this,void 0,void 0,function*(){startGroup(e);let n;try{n=yield t()}finally{endGroup()}return n})}t.group=group;function saveState(e,t){o.issueCommand("save-state",{name:e},t)}t.saveState=saveState;function getState(e){return process.env[`STATE_${e}`]||""}t.getState=getState},717:function(e,t,n){"use strict";var i=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n in e)if(Object.hasOwnProperty.call(e,n))t[n]=e[n];t["default"]=e;return t};Object.defineProperty(t,"__esModule",{value:true});const r=i(n(747));const o=i(n(87));const s=n(278);function issueCommand(e,t){const n=process.env[`GITHUB_${e}`];if(!n){throw new Error(`Unable to find environment variable for file command ${e}`)}if(!r.existsSync(n)){throw new Error(`Missing file at path: ${n}`)}r.appendFileSync(n,`${s.toCommandValue(t)}${o.EOL}`,{encoding:"utf8"})}t.issueCommand=issueCommand},278:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});function toCommandValue(e){if(e===null||e===undefined){return""}else if(typeof e==="string"||e instanceof String){return e}return JSON.stringify(e)}t.toCommandValue=toCommandValue},514:function(e,t,n){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,t,n,i){if(i===undefined)i=n;Object.defineProperty(e,i,{enumerable:true,get:function(){return t[n]}})}:function(e,t,n,i){if(i===undefined)i=n;e[i]=t[n]});var r=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:true,value:t})}:function(e,t){e["default"]=t});var o=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n in e)if(n!=="default"&&Object.hasOwnProperty.call(e,n))i(t,e,n);r(t,e);return t};var s=this&&this.__awaiter||function(e,t,n,i){function adopt(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||(n=Promise))(function(n,r){function fulfilled(e){try{step(i.next(e))}catch(e){r(e)}}function rejected(e){try{step(i["throw"](e))}catch(e){r(e)}}function step(e){e.done?n(e.value):adopt(e.value).then(fulfilled,rejected)}step((i=i.apply(e,t||[])).next())})};Object.defineProperty(t,"__esModule",{value:true});t.getExecOutput=t.exec=void 0;const c=n(304);const a=o(n(159));function exec(e,t,n){return s(this,void 0,void 0,function*(){const i=a.argStringToArray(e);if(i.length===0){throw new Error(`Parameter 'commandLine' cannot be null or empty.`)}const r=i[0];t=i.slice(1).concat(t||[]);const o=new a.ToolRunner(r,t,n);return o.exec()})}t.exec=exec;function getExecOutput(e,t,n){var i,r;return s(this,void 0,void 0,function*(){let o="";let s="";const a=new c.StringDecoder("utf8");const u=new c.StringDecoder("utf8");const l=(i=n===null||n===void 0?void 0:n.listeners)===null||i===void 0?void 0:i.stdout;const f=(r=n===null||n===void 0?void 0:n.listeners)===null||r===void 0?void 0:r.stderr;const d=e=>{s+=u.write(e);if(f){f(e)}};const h=e=>{o+=a.write(e);if(l){l(e)}};const p=Object.assign(Object.assign({},n===null||n===void 0?void 0:n.listeners),{stdout:h,stderr:d});const g=yield exec(e,t,Object.assign(Object.assign({},n),{listeners:p}));o+=a.end();s+=u.end();return{exitCode:g,stdout:o,stderr:s}})}t.getExecOutput=getExecOutput},159:function(e,t,n){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,t,n,i){if(i===undefined)i=n;Object.defineProperty(e,i,{enumerable:true,get:function(){return t[n]}})}:function(e,t,n,i){if(i===undefined)i=n;e[i]=t[n]});var r=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:true,value:t})}:function(e,t){e["default"]=t});var o=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n in e)if(n!=="default"&&Object.hasOwnProperty.call(e,n))i(t,e,n);r(t,e);return t};var s=this&&this.__awaiter||function(e,t,n,i){function adopt(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||(n=Promise))(function(n,r){function fulfilled(e){try{step(i.next(e))}catch(e){r(e)}}function rejected(e){try{step(i["throw"](e))}catch(e){r(e)}}function step(e){e.done?n(e.value):adopt(e.value).then(fulfilled,rejected)}step((i=i.apply(e,t||[])).next())})};Object.defineProperty(t,"__esModule",{value:true});t.argStringToArray=t.ToolRunner=void 0;const c=o(n(87));const a=o(n(614));const u=o(n(129));const l=o(n(622));const f=o(n(436));const d=o(n(962));const h=n(213);const p=process.platform==="win32";class ToolRunner extends a.EventEmitter{constructor(e,t,n){super();if(!e){throw new Error("Parameter 'toolPath' cannot be null or empty.")}this.toolPath=e;this.args=t||[];this.options=n||{}}_debug(e){if(this.options.listeners&&this.options.listeners.debug){this.options.listeners.debug(e)}}_getCommandString(e,t){const n=this._getSpawnFileName();const i=this._getSpawnArgs(e);let r=t?"":"[command]";if(p){if(this._isCmdFile()){r+=n;for(const e of i){r+=` ${e}`}}else if(e.windowsVerbatimArguments){r+=`"${n}"`;for(const e of i){r+=` ${e}`}}else{r+=this._windowsQuoteCmdArg(n);for(const e of i){r+=` ${this._windowsQuoteCmdArg(e)}`}}}else{r+=n;for(const e of i){r+=` ${e}`}}return r}_processLineBuffer(e,t,n){try{let i=t+e.toString();let r=i.indexOf(c.EOL);while(r>-1){const e=i.substring(0,r);n(e);i=i.substring(r+c.EOL.length);r=i.indexOf(c.EOL)}return i}catch(e){this._debug(`error processing line. Failed with error ${e}`);return""}}_getSpawnFileName(){if(p){if(this._isCmdFile()){return process.env["COMSPEC"]||"cmd.exe"}}return this.toolPath}_getSpawnArgs(e){if(p){if(this._isCmdFile()){let t=`/D /S /C "${this._windowsQuoteCmdArg(this.toolPath)}`;for(const n of this.args){t+=" ";t+=e.windowsVerbatimArguments?n:this._windowsQuoteCmdArg(n)}t+='"';return[t]}}return this.args}_endsWith(e,t){return e.endsWith(t)}_isCmdFile(){const e=this.toolPath.toUpperCase();return this._endsWith(e,".CMD")||this._endsWith(e,".BAT")}_windowsQuoteCmdArg(e){if(!this._isCmdFile()){return this._uvQuoteCmdArg(e)}if(!e){return'""'}const t=[" ","\t","&","(",")","[","]","{","}","^","=",";","!","'","+",",","`","~","|","<",">",'"'];let n=false;for(const i of e){if(t.some(e=>e===i)){n=true;break}}if(!n){return e}let i='"';let r=true;for(let t=e.length;t>0;t--){i+=e[t-1];if(r&&e[t-1]==="\\"){i+="\\"}else if(e[t-1]==='"'){r=true;i+='"'}else{r=false}}i+='"';return i.split("").reverse().join("")}_uvQuoteCmdArg(e){if(!e){return'""'}if(!e.includes(" ")&&!e.includes("\t")&&!e.includes('"')){return e}if(!e.includes('"')&&!e.includes("\\")){return`"${e}"`}let t='"';let n=true;for(let i=e.length;i>0;i--){t+=e[i-1];if(n&&e[i-1]==="\\"){t+="\\"}else if(e[i-1]==='"'){n=true;t+="\\"}else{n=false}}t+='"';return t.split("").reverse().join("")}_cloneExecOptions(e){e=e||{};const t={cwd:e.cwd||process.cwd(),env:e.env||process.env,silent:e.silent||false,windowsVerbatimArguments:e.windowsVerbatimArguments||false,failOnStdErr:e.failOnStdErr||false,ignoreReturnCode:e.ignoreReturnCode||false,delay:e.delay||1e4};t.outStream=e.outStream||process.stdout;t.errStream=e.errStream||process.stderr;return t}_getSpawnOptions(e,t){e=e||{};const n={};n.cwd=e.cwd;n.env=e.env;n["windowsVerbatimArguments"]=e.windowsVerbatimArguments||this._isCmdFile();if(e.windowsVerbatimArguments){n.argv0=`"${t}"`}return n}exec(){return s(this,void 0,void 0,function*(){if(!d.isRooted(this.toolPath)&&(this.toolPath.includes("/")||p&&this.toolPath.includes("\\"))){this.toolPath=l.resolve(process.cwd(),this.options.cwd||process.cwd(),this.toolPath)}this.toolPath=yield f.which(this.toolPath,true);return new Promise((e,t)=>s(this,void 0,void 0,function*(){this._debug(`exec tool: ${this.toolPath}`);this._debug("arguments:");for(const e of this.args){this._debug(` ${e}`)}const n=this._cloneExecOptions(this.options);if(!n.silent&&n.outStream){n.outStream.write(this._getCommandString(n)+c.EOL)}const i=new ExecState(n,this.toolPath);i.on("debug",e=>{this._debug(e)});if(this.options.cwd&&!(yield d.exists(this.options.cwd))){return t(new Error(`The cwd: ${this.options.cwd} does not exist!`))}const r=this._getSpawnFileName();const o=u.spawn(r,this._getSpawnArgs(n),this._getSpawnOptions(this.options,r));let s="";if(o.stdout){o.stdout.on("data",e=>{if(this.options.listeners&&this.options.listeners.stdout){this.options.listeners.stdout(e)}if(!n.silent&&n.outStream){n.outStream.write(e)}s=this._processLineBuffer(e,s,e=>{if(this.options.listeners&&this.options.listeners.stdline){this.options.listeners.stdline(e)}})})}let a="";if(o.stderr){o.stderr.on("data",e=>{i.processStderr=true;if(this.options.listeners&&this.options.listeners.stderr){this.options.listeners.stderr(e)}if(!n.silent&&n.errStream&&n.outStream){const t=n.failOnStdErr?n.errStream:n.outStream;t.write(e)}a=this._processLineBuffer(e,a,e=>{if(this.options.listeners&&this.options.listeners.errline){this.options.listeners.errline(e)}})})}o.on("error",e=>{i.processError=e.message;i.processExited=true;i.processClosed=true;i.CheckComplete()});o.on("exit",e=>{i.processExitCode=e;i.processExited=true;this._debug(`Exit code ${e} received from tool '${this.toolPath}'`);i.CheckComplete()});o.on("close",e=>{i.processExitCode=e;i.processExited=true;i.processClosed=true;this._debug(`STDIO streams have closed for tool '${this.toolPath}'`);i.CheckComplete()});i.on("done",(n,i)=>{if(s.length>0){this.emit("stdline",s)}if(a.length>0){this.emit("errline",a)}o.removeAllListeners();if(n){t(n)}else{e(i)}});if(this.options.input){if(!o.stdin){throw new Error("child process missing stdin")}o.stdin.end(this.options.input)}}))})}}t.ToolRunner=ToolRunner;function argStringToArray(e){const t=[];let n=false;let i=false;let r="";function append(e){if(i&&e!=='"'){r+="\\"}r+=e;i=false}for(let o=0;o<e.length;o++){const s=e.charAt(o);if(s==='"'){if(!i){n=!n}else{append(s)}continue}if(s==="\\"&&i){append(s);continue}if(s==="\\"&&n){i=true;continue}if(s===" "&&!n){if(r.length>0){t.push(r);r=""}continue}append(s)}if(r.length>0){t.push(r.trim())}return t}t.argStringToArray=argStringToArray;class ExecState extends a.EventEmitter{constructor(e,t){super();this.processClosed=false;this.processError="";this.processExitCode=0;this.processExited=false;this.processStderr=false;this.delay=1e4;this.done=false;this.timeout=null;if(!t){throw new Error("toolPath must not be empty")}this.options=e;this.toolPath=t;if(e.delay){this.delay=e.delay}}CheckComplete(){if(this.done){return}if(this.processClosed){this._setResult()}else if(this.processExited){this.timeout=h.setTimeout(ExecState.HandleTimeout,this.delay,this)}}_debug(e){this.emit("debug",e)}_setResult(){let e;if(this.processExited){if(this.processError){e=new Error(`There was an error when attempting to execute the process '${this.toolPath}'. This may indicate the process failed to start. Error: ${this.processError}`)}else if(this.processExitCode!==0&&!this.options.ignoreReturnCode){e=new Error(`The process '${this.toolPath}' failed with exit code ${this.processExitCode}`)}else if(this.processStderr&&this.options.failOnStdErr){e=new Error(`The process '${this.toolPath}' failed because one or more lines were written to the STDERR stream`)}}if(this.timeout){clearTimeout(this.timeout);this.timeout=null}this.done=true;this.emit("done",e,this.processExitCode)}static HandleTimeout(e){if(e.done){return}if(!e.processClosed&&e.processExited){const t=`The STDIO streams did not close within ${e.delay/1e3} seconds of the exit event from process '${e.toolPath}'. This may indicate a child process inherited the STDIO streams and has not yet exited.`;e._debug(t)}e._setResult()}}},962:function(e,t,n){"use strict";var i=this&&this.__awaiter||function(e,t,n,i){function adopt(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||(n=Promise))(function(n,r){function fulfilled(e){try{step(i.next(e))}catch(e){r(e)}}function rejected(e){try{step(i["throw"](e))}catch(e){r(e)}}function step(e){e.done?n(e.value):adopt(e.value).then(fulfilled,rejected)}step((i=i.apply(e,t||[])).next())})};var r;Object.defineProperty(t,"__esModule",{value:true});const o=n(357);const s=n(747);const c=n(622);r=s.promises,t.chmod=r.chmod,t.copyFile=r.copyFile,t.lstat=r.lstat,t.mkdir=r.mkdir,t.readdir=r.readdir,t.readlink=r.readlink,t.rename=r.rename,t.rmdir=r.rmdir,t.stat=r.stat,t.symlink=r.symlink,t.unlink=r.unlink;t.IS_WINDOWS=process.platform==="win32";function exists(e){return i(this,void 0,void 0,function*(){try{yield t.stat(e)}catch(e){if(e.code==="ENOENT"){return false}throw e}return true})}t.exists=exists;function isDirectory(e,n=false){return i(this,void 0,void 0,function*(){const i=n?yield t.stat(e):yield t.lstat(e);return i.isDirectory()})}t.isDirectory=isDirectory;function isRooted(e){e=normalizeSeparators(e);if(!e){throw new Error('isRooted() parameter "p" cannot be empty')}if(t.IS_WINDOWS){return e.startsWith("\\")||/^[A-Z]:/i.test(e)}return e.startsWith("/")}t.isRooted=isRooted;function mkdirP(e,n=1e3,r=1){return i(this,void 0,void 0,function*(){o.ok(e,"a path argument must be provided");e=c.resolve(e);if(r>=n)return t.mkdir(e);try{yield t.mkdir(e);return}catch(i){switch(i.code){case"ENOENT":{yield mkdirP(c.dirname(e),n,r+1);yield t.mkdir(e);return}default:{let n;try{n=yield t.stat(e)}catch(e){throw i}if(!n.isDirectory())throw i}}}})}t.mkdirP=mkdirP;function tryGetExecutablePath(e,n){return i(this,void 0,void 0,function*(){let i=undefined;try{i=yield t.stat(e)}catch(t){if(t.code!=="ENOENT"){console.log(`Unexpected error attempting to determine if executable file exists '${e}': ${t}`)}}if(i&&i.isFile()){if(t.IS_WINDOWS){const t=c.extname(e).toUpperCase();if(n.some(e=>e.toUpperCase()===t)){return e}}else{if(isUnixExecutable(i)){return e}}}const r=e;for(const o of n){e=r+o;i=undefined;try{i=yield t.stat(e)}catch(t){if(t.code!=="ENOENT"){console.log(`Unexpected error attempting to determine if executable file exists '${e}': ${t}`)}}if(i&&i.isFile()){if(t.IS_WINDOWS){try{const n=c.dirname(e);const i=c.basename(e).toUpperCase();for(const r of yield t.readdir(n)){if(i===r.toUpperCase()){e=c.join(n,r);break}}}catch(t){console.log(`Unexpected error attempting to determine the actual case of the file '${e}': ${t}`)}return e}else{if(isUnixExecutable(i)){return e}}}}return""})}t.tryGetExecutablePath=tryGetExecutablePath;function normalizeSeparators(e){e=e||"";if(t.IS_WINDOWS){e=e.replace(/\//g,"\\");return e.replace(/\\\\+/g,"\\")}return e.replace(/\/\/+/g,"/")}function isUnixExecutable(e){return(e.mode&1)>0||(e.mode&8)>0&&e.gid===process.getgid()||(e.mode&64)>0&&e.uid===process.getuid()}},436:function(e,t,n){"use strict";var i=this&&this.__awaiter||function(e,t,n,i){function adopt(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||(n=Promise))(function(n,r){function fulfilled(e){try{step(i.next(e))}catch(e){r(e)}}function rejected(e){try{step(i["throw"](e))}catch(e){r(e)}}function step(e){e.done?n(e.value):adopt(e.value).then(fulfilled,rejected)}step((i=i.apply(e,t||[])).next())})};Object.defineProperty(t,"__esModule",{value:true});const r=n(129);const o=n(622);const s=n(669);const c=n(962);const a=s.promisify(r.exec);function cp(e,t,n={}){return i(this,void 0,void 0,function*(){const{force:i,recursive:r}=readCopyOptions(n);const s=(yield c.exists(t))?yield c.stat(t):null;if(s&&s.isFile()&&!i){return}const a=s&&s.isDirectory()?o.join(t,o.basename(e)):t;if(!(yield c.exists(e))){throw new Error(`no such file or directory: ${e}`)}const u=yield c.stat(e);if(u.isDirectory()){if(!r){throw new Error(`Failed to copy. ${e} is a directory, but tried to copy without recursive flag.`)}else{yield cpDirRecursive(e,a,0,i)}}else{if(o.relative(e,a)===""){throw new Error(`'${a}' and '${e}' are the same file`)}yield copyFile(e,a,i)}})}t.cp=cp;function mv(e,t,n={}){return i(this,void 0,void 0,function*(){if(yield c.exists(t)){let i=true;if(yield c.isDirectory(t)){t=o.join(t,o.basename(e));i=yield c.exists(t)}if(i){if(n.force==null||n.force){yield rmRF(t)}else{throw new Error("Destination already exists")}}}yield mkdirP(o.dirname(t));yield c.rename(e,t)})}t.mv=mv;function rmRF(e){return i(this,void 0,void 0,function*(){if(c.IS_WINDOWS){try{if(yield c.isDirectory(e,true)){yield a(`rd /s /q "${e}"`)}else{yield a(`del /f /a "${e}"`)}}catch(e){if(e.code!=="ENOENT")throw e}try{yield c.unlink(e)}catch(e){if(e.code!=="ENOENT")throw e}}else{let t=false;try{t=yield c.isDirectory(e)}catch(e){if(e.code!=="ENOENT")throw e;return}if(t){yield a(`rm -rf "${e}"`)}else{yield c.unlink(e)}}})}t.rmRF=rmRF;function mkdirP(e){return i(this,void 0,void 0,function*(){yield c.mkdirP(e)})}t.mkdirP=mkdirP;function which(e,t){return i(this,void 0,void 0,function*(){if(!e){throw new Error("parameter 'tool' is required")}if(t){const t=yield which(e,false);if(!t){if(c.IS_WINDOWS){throw new Error(`Unable to locate executable file: ${e}. Please verify either the file path exists or the file can be found within a directory specified by the PATH environment variable. Also verify the file has a valid extension for an executable file.`)}else{throw new Error(`Unable to locate executable file: ${e}. Please verify either the file path exists or the file can be found within a directory specified by the PATH environment variable. Also check the file mode to verify the file is executable.`)}}}try{const t=[];if(c.IS_WINDOWS&&process.env.PATHEXT){for(const e of process.env.PATHEXT.split(o.delimiter)){if(e){t.push(e)}}}if(c.isRooted(e)){const n=yield c.tryGetExecutablePath(e,t);if(n){return n}return""}if(e.includes("/")||c.IS_WINDOWS&&e.includes("\\")){return""}const n=[];if(process.env.PATH){for(const e of process.env.PATH.split(o.delimiter)){if(e){n.push(e)}}}for(const i of n){const n=yield c.tryGetExecutablePath(i+o.sep+e,t);if(n){return n}}return""}catch(e){throw new Error(`which failed with message ${e.message}`)}})}t.which=which;function readCopyOptions(e){const t=e.force==null?true:e.force;const n=Boolean(e.recursive);return{force:t,recursive:n}}function cpDirRecursive(e,t,n,r){return i(this,void 0,void 0,function*(){if(n>=255)return;n++;yield mkdirP(t);const i=yield c.readdir(e);for(const o of i){const i=`${e}/${o}`;const s=`${t}/${o}`;const a=yield c.lstat(i);if(a.isDirectory()){yield cpDirRecursive(i,s,n,r)}else{yield copyFile(i,s,r)}}yield c.chmod(t,(yield c.stat(e)).mode)})}function copyFile(e,t,n){return i(this,void 0,void 0,function*(){if((yield c.lstat(e)).isSymbolicLink()){try{yield c.lstat(t);yield c.unlink(t)}catch(e){if(e.code==="EPERM"){yield c.chmod(t,"0666");yield c.unlink(t)}}const n=yield c.readlink(e);yield c.symlink(n,t,c.IS_WINDOWS?"junction":null)}else if(!(yield c.exists(t))||n){yield c.copyFile(e,t)}})}},885:e=>{const{hasOwnProperty:t}=Object.prototype;const n=typeof process!=="undefined"&&process.platform==="win32"?"\r\n":"\n";const i=(e,t)=>{const o=[];let s="";if(typeof t==="string"){t={section:t,whitespace:false}}else{t=t||Object.create(null);t.whitespace=t.whitespace===true}const a=t.whitespace?" = ":"=";for(const t of Object.keys(e)){const i=e[t];if(i&&Array.isArray(i)){for(const e of i)s+=c(t+"[]")+a+c(e)+"\n"}else if(i&&typeof i==="object")o.push(t);else s+=c(t)+a+c(i)+n}if(t.section&&s.length)s="["+c(t.section)+"]"+n+s;for(const c of o){const o=r(c).join("\\.");const a=(t.section?t.section+".":"")+o;const{whitespace:u}=t;const l=i(e[c],{section:a,whitespace:u});if(s.length&&l.length)s+=n;s+=l}return s};const r=e=>e.replace(/\1/g,"LITERAL\\1LITERAL").replace(/\\\./g,"").split(/\./).map(e=>e.replace(/\1/g,"\\.").replace(/\2LITERAL\\1LITERAL\2/g,""));const o=e=>{const n=Object.create(null);let i=n;let o=null;const s=/^\[([^\]]*)\]$|^([^=]+)(=(.*))?$/i;const c=e.split(/[\r\n]+/g);for(const e of c){if(!e||e.match(/^\s*[;#]/))continue;const r=e.match(s);if(!r)continue;if(r[1]!==undefined){o=a(r[1]);if(o==="__proto__"){i=Object.create(null);continue}i=n[o]=n[o]||Object.create(null);continue}const c=a(r[2]);const u=c.length>2&&c.slice(-2)==="[]";const l=u?c.slice(0,-2):c;if(l==="__proto__")continue;const f=r[3]?a(r[4]):true;const d=f==="true"||f==="false"||f==="null"?JSON.parse(f):f;if(u){if(!t.call(i,l))i[l]=[];else if(!Array.isArray(i[l]))i[l]=[i[l]]}if(Array.isArray(i[l]))i[l].push(d);else i[l]=d}const u=[];for(const e of Object.keys(n)){if(!t.call(n,e)||typeof n[e]!=="object"||Array.isArray(n[e]))continue;const i=r(e);let o=n;const s=i.pop();const c=s.replace(/\\\./g,".");for(const e of i){if(e==="__proto__")continue;if(!t.call(o,e)||typeof o[e]!=="object")o[e]=Object.create(null);o=o[e]}if(o===n&&c===s)continue;o[c]=n[e];u.push(e)}for(const e of u)delete n[e];return n};const s=e=>e.charAt(0)==='"'&&e.slice(-1)==='"'||e.charAt(0)==="'"&&e.slice(-1)==="'";const c=e=>typeof e!=="string"||e.match(/[=\r\n]/)||e.match(/^\[/)||e.length>1&&s(e)||e!==e.trim()?JSON.stringify(e):e.replace(/;/g,"\\;").replace(/#/g,"\\#");const a=(e,t)=>{e=(e||"").trim();if(s(e)){if(e.charAt(0)==="'")e=e.substr(1,e.length-2);try{e=JSON.parse(e)}catch(e){}}else{let t=false;let n="";for(let i=0,r=e.length;i<r;i++){const r=e.charAt(i);if(t){if("\\;#".indexOf(r)!==-1)n+=r;else n+="\\"+r;t=false}else if(";#".indexOf(r)!==-1)break;else if(r==="\\")t=true;else n+=r}if(t)n+="\\";return n.trim()}return e};e.exports={parse:o,decode:o,stringify:i,encode:i,safe:c,unsafe:a}},69:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.Outputs=t.Inputs=void 0;var n;(function(e){e["DIGESTFILE"]="digestfile";e["EXTRA_ARGS"]="extra-args";e["IMAGE"]="image";e["PASSWORD"]="password";e["REGISTRY"]="registry";e["TAGS"]="tags";e["TLS_VERIFY"]="tls-verify";e["USERNAME"]="username"})(n=t.Inputs||(t.Inputs={}));var i;(function(e){e["DIGEST"]="digest";e["REGISTRY_PATH"]="registry-path";e["REGISTRY_PATHS"]="registry-paths"})(i=t.Outputs||(t.Outputs={}))},144:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});const i=n(186);const r=n(514);const o=n(436);const s=n(747);const c=n(87);const a=n(622);const u=n(629);const l=n(69);let f;let d=false;let h;let p;let g;let m;async function getPodmanPath(){if(f==null){f=await o.which("podman",true);await execute(f,["version"],{group:true})}return f}async function run(){const e="latest";const t=i.getInput(l.Inputs.IMAGE);const n=i.getInput(l.Inputs.TAGS);const r=n.trim().split(/\s+/);if(r.length===0){i.info(`Input "${l.Inputs.TAGS}" is not provided, using default tag "${e}"`);r.push(e)}const o=i.getInput(l.Inputs.REGISTRY);const c=i.getInput(l.Inputs.USERNAME);const a=i.getInput(l.Inputs.PASSWORD);const f=i.getInput(l.Inputs.TLS_VERIFY);const g=i.getInput(l.Inputs.DIGESTFILE);const w=u.isFullImageName(r[0]);if(r.some(e=>u.isFullImageName(e)!==w)){throw new Error(`Input "${l.Inputs.TAGS}" cannot have a mix of full name and non full name tags`)}if(!w){if(!t){throw new Error(`Input "${l.Inputs.IMAGE}" must be provided when using non full name tags`)}if(!o){throw new Error(`Input "${l.Inputs.REGISTRY}" must be provided when using non full name tags`)}const e=o.replace(/\/$/,"");const n=`${e}/${t}`;i.info(`Combining image name "${t}" and registry "${o}" `+`to form registry path "${n}"`);if(t.indexOf("/")>-1&&o.indexOf("/")>-1){i.warning(`"${n}" does not seem to be a valid registry path. `+`The registry path should not contain more than 2 slashes. `+`Refer to the Inputs section of the readme for naming image and registry.`)}h=r.map(e=>u.getFullImageName(t,e));p=r.map(e=>u.getFullImageName(n,e))}else{h=r;p=r}const y=i.getInput(l.Inputs.EXTRA_ARGS);let v=[];if(y){const e=u.splitByNewline(y);v=e.flatMap(e=>e.split(" ")).map(e=>e.trim())}const _=[];const b=await checkImageInPodman();const S=b.foundTags;const E=b.missingTags;if(S.length>0){i.info(`Tag${S.length!==1?"s":""} "${S.join(", ")}" `+`found in Podman image storage`)}if(E.length>0&&S.length>0){i.warning(`Tag${E.length!==1?"s":""} "${E.join(", ")}" `+`not found in Podman image storage`)}const $=await pullImageFromDocker();const x=$.foundTags;const O=$.missingTags;if(x.length>0){i.info(`Tag${x.length!==1?"s":""} "${x.join(", ")}" `+`found in Docker image storage`)}if(O.length>0&&x.length>0){i.warning(`Tag${O.length!==1?"s":""} "${O.join(", ")}" `+`not found in Docker image storage`)}if(E.length>0&&O.length>0){throw new Error(`❌ All tags were not found in either Podman image storage, or Docker image storage. `+`Tag${E.length!==1?"s":""} "${E.join(", ")}" `+`not found in Podman image storage, and tag${O.length!==1?"s":""} `+`"${O.join(", ")}" not found in Docker image storage.`)}const C=S.length===r.length;const T=x.length===r.length;if(C&&T){const e=await isPodmanLocalImageLatest();if(!e){i.warning(`The version of "${h[0]}" in the Docker image storage is more recent `+`than the version in the Podman image storage. The image(s) from the Docker image storage `+`will be pushed.`);d=true}else{i.warning(`The version of "${h[0]}" in the Podman image storage is more recent `+`than the version in the Docker image storage. The image(s) from the Podman image `+`storage will be pushed.`)}}else if(T){i.info(`Tag "${h[0]}" was found in the Docker image storage, but not in the Podman `+`image storage. The image(s) will be pulled into Podman image storage, pushed, and then `+`removed from the Podman image storage.`);d=true}else{i.info(`Tag "${h[0]}" was found in the Podman image storage, but not in the Docker `+`image storage. The image(s) will be pushed from Podman image storage.`)}let A=`⏳ Pushing "${h[0]}" to ${p.join(", ")}`;if(c){A+=` as "${c}"`}i.info(A);let I="";if(c&&!a){i.warning("Username is provided, but password is missing")}else if(!c&&a){i.warning("Password is provided, but username is missing")}else if(c&&a){I=`${c}:${a}`}let D=g;if(!D){D=`${h[0].replace(/[/\\/?%*:|"<>]/g,"-")}_digest.txt`}for(const e of p){const t=[...d?m:[],"push","--quiet","--digestfile",D,d?u.getFullDockerImageName(h[0]):h[0],e];if(v.length>0){t.push(...v)}if(f){t.push(`--tls-verify=${f}`)}if(I){t.push(`--creds=${I}`)}await execute(await getPodmanPath(),t);i.info(`✅ Successfully pushed "${h[0]}" to "${e}"`);_.push(e);try{const e=(await s.promises.readFile(D)).toString();i.info(e);i.setOutput(l.Outputs.DIGEST,e)}catch(e){i.warning(`Failed to read digest file "${D}": ${e}`)}}i.setOutput(l.Outputs.REGISTRY_PATH,_[0]);i.setOutput(l.Outputs.REGISTRY_PATHS,JSON.stringify(_))}async function pullImageFromDocker(){i.info(`🔍 Checking if "${h.join(", ")}" present in the local Docker image storage`);const e=[];const t=[];try{for(const n of h){const i=await execute(await getPodmanPath(),[...m,"pull",`docker-daemon:${n}`],{ignoreReturnCode:true,failOnStdErr:false,group:true});if(i.exitCode===0){e.push(n)}else{t.push(n)}}}catch(e){i.warning(e)}return{foundTags:e,missingTags:t}}async function checkImageInPodman(){i.info(`🔍 Checking if "${h.join(", ")}" present in the local Podman image storage`);const e=[];const t=[];try{for(const n of h){const i=await execute(await getPodmanPath(),["image","exists",n],{ignoreReturnCode:true});if(i.exitCode===0){e.push(n)}else{t.push(n)}}}catch(e){i.debug(e)}return{foundTags:e,missingTags:t}}async function isPodmanLocalImageLatest(){const e=h[0];const t=await execute(await getPodmanPath(),["image","inspect",e,"--format","{{.Created}}"]);const n=await execute(await getPodmanPath(),[...m,"image","inspect",u.getFullDockerImageName(e),"--format","{{.Created}}"]);const i=new Date(t.stdout).getTime();const r=new Date(n.stdout).getTime();return i>r}async function removeDockerImage(){i.info(`Removing "${h[0]}" from the Podman image storage`);for(const e of h){await execute(await getPodmanPath(),[...m,"rmi",u.getFullDockerImageName(e)],{ignoreReturnCode:true,failOnStdErr:false,group:true})}}async function createDockerPodmanImageStroage(){i.info(`Creating temporary Podman image storage for pulling from Docker daemon`);g=await s.promises.mkdtemp(a.join(c.tmpdir(),"podman-from-docker-"));m=["--root",g];if(await u.isStorageDriverOverlay()){const e=await u.findFuseOverlayfsPath();if(e){i.info(`Overriding storage mount_program with "fuse-overlayfs" in environment`);m.push("--storage-opt");m.push(`overlay.mount_program=${e}`)}else{i.warning(`"fuse-overlayfs" is not found. Install it before running this action. `+`For more detail see https://github.com/redhat-actions/buildah-build/issues/45`)}}else{i.info("Storage driver is not 'overlay', so not overriding storage configuration")}}async function removeDockerPodmanImageStroage(){if(g){try{await removeDockerImage();i.info(`Removing temporary Podman image storage for pulling from Docker daemon`);await s.promises.rmdir(g,{recursive:true})}catch(e){i.warning(`Failed to remove podman image stroage ${g}: ${e}`)}}}async function execute(e,t,n={}){let o="";let s="";const c={...n};c.ignoreReturnCode=true;c.listeners={stdline:e=>{o+=`${e}\n`},errline:e=>{s+=`${e}\n`}};if(n.group){const n=[e,...t].join(" ");i.startGroup(n)}try{const u=await r.exec(e,t,c);if(n.ignoreReturnCode!==true&&u!==0){let t=`${a.basename(e)} exited with code ${u}`;if(s){t+=`\n${s}`}throw new Error(t)}return{exitCode:u,stdout:o,stderr:s}}finally{if(n.group){i.endGroup()}}}async function main(){try{await createDockerPodmanImageStroage();await run()}finally{await removeDockerPodmanImageStroage()}}main().catch(e=>{i.setFailed(e.message)})},629:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.getFullDockerImageName=t.getFullImageName=t.isFullImageName=t.splitByNewline=t.findFuseOverlayfsPath=t.isStorageDriverOverlay=void 0;const i=n(885);const r=n(747);const o=n(186);const s=n(622);const c=n(436);const a=n(87);async function findStorageDriver(e){let t="";for(const n of e){o.debug(`Checking if the storage file exists at ${n}`);if(await fileExists(n)){o.debug(`Storage file exists at ${n}`);const e=i.parse(await r.promises.readFile(n,"utf-8"));if(e.storage.driver){t=e.storage.driver}}}return t}async function isStorageDriverOverlay(){let e=s.join(a.homedir(),".config");if(process.env.XDG_CONFIG_HOME){e=process.env.XDG_CONFIG_HOME}const t=["/etc/containers/storage.conf",s.join(e,"containers/storage.conf")];const n=await findStorageDriver(t);return n==="overlay"}t.isStorageDriverOverlay=isStorageDriverOverlay;async function fileExists(e){try{await r.promises.access(e);return true}catch(e){return false}}async function findFuseOverlayfsPath(){let e;try{e=await c.which("fuse-overlayfs")}catch(e){o.debug(e)}return e}t.findFuseOverlayfsPath=findFuseOverlayfsPath;function splitByNewline(e){return e.split(/\r?\n/)}t.splitByNewline=splitByNewline;function isFullImageName(e){return e.indexOf(":")>0}t.isFullImageName=isFullImageName;function getFullImageName(e,t){if(isFullImageName(t)){return t}return`${e}:${t}`}t.getFullImageName=getFullImageName;const u=`docker.io`;const l=u+`/library`;function getFullDockerImageName(e){switch(e.split("/").length){case 1:return`${l}/${e}`;case 2:return`${u}/${e}`;default:return e}}t.getFullDockerImageName=getFullDockerImageName},357:e=>{"use strict";e.exports=require("assert")},129:e=>{"use strict";e.exports=require("child_process")},614:e=>{"use strict";e.exports=require("events")},747:e=>{"use strict";e.exports=require("fs")},87:e=>{"use strict";e.exports=require("os")},622:e=>{"use strict";e.exports=require("path")},304:e=>{"use strict";e.exports=require("string_decoder")},213:e=>{"use strict";e.exports=require("timers")},669:e=>{"use strict";e.exports=require("util")}};var t={};function __webpack_require__(n){if(t[n]){return t[n].exports}var i=t[n]={exports:{}};var r=true;try{e[n].call(i.exports,i,i.exports,__webpack_require__);r=false}finally{if(r)delete t[n]}return i.exports}__webpack_require__.ab=__dirname+"/";return __webpack_require__(144)})();
|
||
//# sourceMappingURL=index.js.map
|