mirror of
https://github.com/redhat-actions/buildah-build.git
synced 2025-04-19 16:51:23 +00:00
2 lines
No EOL
29 KiB
JavaScript
2 lines
No EOL
29 KiB
JavaScript
require('./sourcemap-register.js');module.exports=(()=>{var e={351:function(e,t,i){"use strict";var n=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var i in e)if(Object.hasOwnProperty.call(e,i))t[i]=e[i];t["default"]=e;return t};Object.defineProperty(t,"__esModule",{value:true});const s=n(i(87));const r=i(278);function issueCommand(e,t,i){const n=new Command(e,t,i);process.stdout.write(n.toString()+s.EOL)}t.issueCommand=issueCommand;function issue(e,t=""){issueCommand(e,{},t)}t.issue=issue;const o="::";class Command{constructor(e,t,i){if(!e){e="missing.command"}this.command=e;this.properties=t;this.message=i}toString(){let e=o+this.command;if(this.properties&&Object.keys(this.properties).length>0){e+=" ";let t=true;for(const i in this.properties){if(this.properties.hasOwnProperty(i)){const n=this.properties[i];if(n){if(t){t=false}else{e+=","}e+=`${i}=${escapeProperty(n)}`}}}}e+=`${o}${escapeData(this.message)}`;return e}}function escapeData(e){return r.toCommandValue(e).replace(/%/g,"%25").replace(/\r/g,"%0D").replace(/\n/g,"%0A")}function escapeProperty(e){return r.toCommandValue(e).replace(/%/g,"%25").replace(/\r/g,"%0D").replace(/\n/g,"%0A").replace(/:/g,"%3A").replace(/,/g,"%2C")}},186:function(e,t,i){"use strict";var n=this&&this.__awaiter||function(e,t,i,n){function adopt(e){return e instanceof i?e:new i(function(t){t(e)})}return new(i||(i=Promise))(function(i,s){function fulfilled(e){try{step(n.next(e))}catch(e){s(e)}}function rejected(e){try{step(n["throw"](e))}catch(e){s(e)}}function step(e){e.done?i(e.value):adopt(e.value).then(fulfilled,rejected)}step((n=n.apply(e,t||[])).next())})};var s=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var i in e)if(Object.hasOwnProperty.call(e,i))t[i]=e[i];t["default"]=e;return t};Object.defineProperty(t,"__esModule",{value:true});const r=i(351);const o=i(717);const c=i(278);const u=s(i(87));const a=s(i(622));var f;(function(e){e[e["Success"]=0]="Success";e[e["Failure"]=1]="Failure"})(f=t.ExitCode||(t.ExitCode={}));function exportVariable(e,t){const i=c.toCommandValue(t);process.env[e]=i;const n=process.env["GITHUB_ENV"]||"";if(n){const t="_GitHubActionsFileCommandDelimeter_";const n=`${e}<<${t}${u.EOL}${i}${u.EOL}${t}`;o.issueCommand("ENV",n)}else{r.issueCommand("set-env",{name:e},i)}}t.exportVariable=exportVariable;function setSecret(e){r.issueCommand("add-mask",{},e)}t.setSecret=setSecret;function addPath(e){const t=process.env["GITHUB_PATH"]||"";if(t){o.issueCommand("PATH",e)}else{r.issueCommand("add-path",{},e)}process.env["PATH"]=`${e}${a.delimiter}${process.env["PATH"]}`}t.addPath=addPath;function getInput(e,t){const i=process.env[`INPUT_${e.replace(/ /g,"_").toUpperCase()}`]||"";if(t&&t.required&&!i){throw new Error(`Input required and not supplied: ${e}`)}return i.trim()}t.getInput=getInput;function setOutput(e,t){r.issueCommand("set-output",{name:e},t)}t.setOutput=setOutput;function setCommandEcho(e){r.issue("echo",e?"on":"off")}t.setCommandEcho=setCommandEcho;function setFailed(e){process.exitCode=f.Failure;error(e)}t.setFailed=setFailed;function isDebug(){return process.env["RUNNER_DEBUG"]==="1"}t.isDebug=isDebug;function debug(e){r.issueCommand("debug",{},e)}t.debug=debug;function error(e){r.issue("error",e instanceof Error?e.toString():e)}t.error=error;function warning(e){r.issue("warning",e instanceof Error?e.toString():e)}t.warning=warning;function info(e){process.stdout.write(e+u.EOL)}t.info=info;function startGroup(e){r.issue("group",e)}t.startGroup=startGroup;function endGroup(){r.issue("endgroup")}t.endGroup=endGroup;function group(e,t){return n(this,void 0,void 0,function*(){startGroup(e);let i;try{i=yield t()}finally{endGroup()}return i})}t.group=group;function saveState(e,t){r.issueCommand("save-state",{name:e},t)}t.saveState=saveState;function getState(e){return process.env[`STATE_${e}`]||""}t.getState=getState},717:function(e,t,i){"use strict";var n=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var i in e)if(Object.hasOwnProperty.call(e,i))t[i]=e[i];t["default"]=e;return t};Object.defineProperty(t,"__esModule",{value:true});const s=n(i(747));const r=n(i(87));const o=i(278);function issueCommand(e,t){const i=process.env[`GITHUB_${e}`];if(!i){throw new Error(`Unable to find environment variable for file command ${e}`)}if(!s.existsSync(i)){throw new Error(`Missing file at path: ${i}`)}s.appendFileSync(i,`${o.toCommandValue(t)}${r.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,i){"use strict";var n=this&&this.__awaiter||function(e,t,i,n){function adopt(e){return e instanceof i?e:new i(function(t){t(e)})}return new(i||(i=Promise))(function(i,s){function fulfilled(e){try{step(n.next(e))}catch(e){s(e)}}function rejected(e){try{step(n["throw"](e))}catch(e){s(e)}}function step(e){e.done?i(e.value):adopt(e.value).then(fulfilled,rejected)}step((n=n.apply(e,t||[])).next())})};var s=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var i in e)if(Object.hasOwnProperty.call(e,i))t[i]=e[i];t["default"]=e;return t};Object.defineProperty(t,"__esModule",{value:true});const r=s(i(159));function exec(e,t,i){return n(this,void 0,void 0,function*(){const n=r.argStringToArray(e);if(n.length===0){throw new Error(`Parameter 'commandLine' cannot be null or empty.`)}const s=n[0];t=n.slice(1).concat(t||[]);const o=new r.ToolRunner(s,t,i);return o.exec()})}t.exec=exec},159:function(e,t,i){"use strict";var n=this&&this.__awaiter||function(e,t,i,n){function adopt(e){return e instanceof i?e:new i(function(t){t(e)})}return new(i||(i=Promise))(function(i,s){function fulfilled(e){try{step(n.next(e))}catch(e){s(e)}}function rejected(e){try{step(n["throw"](e))}catch(e){s(e)}}function step(e){e.done?i(e.value):adopt(e.value).then(fulfilled,rejected)}step((n=n.apply(e,t||[])).next())})};var s=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var i in e)if(Object.hasOwnProperty.call(e,i))t[i]=e[i];t["default"]=e;return t};Object.defineProperty(t,"__esModule",{value:true});const r=s(i(87));const o=s(i(614));const c=s(i(129));const u=s(i(622));const a=s(i(436));const f=s(i(962));const l=process.platform==="win32";class ToolRunner extends o.EventEmitter{constructor(e,t,i){super();if(!e){throw new Error("Parameter 'toolPath' cannot be null or empty.")}this.toolPath=e;this.args=t||[];this.options=i||{}}_debug(e){if(this.options.listeners&&this.options.listeners.debug){this.options.listeners.debug(e)}}_getCommandString(e,t){const i=this._getSpawnFileName();const n=this._getSpawnArgs(e);let s=t?"":"[command]";if(l){if(this._isCmdFile()){s+=i;for(const e of n){s+=` ${e}`}}else if(e.windowsVerbatimArguments){s+=`"${i}"`;for(const e of n){s+=` ${e}`}}else{s+=this._windowsQuoteCmdArg(i);for(const e of n){s+=` ${this._windowsQuoteCmdArg(e)}`}}}else{s+=i;for(const e of n){s+=` ${e}`}}return s}_processLineBuffer(e,t,i){try{let n=t+e.toString();let s=n.indexOf(r.EOL);while(s>-1){const e=n.substring(0,s);i(e);n=n.substring(s+r.EOL.length);s=n.indexOf(r.EOL)}t=n}catch(e){this._debug(`error processing line. Failed with error ${e}`)}}_getSpawnFileName(){if(l){if(this._isCmdFile()){return process.env["COMSPEC"]||"cmd.exe"}}return this.toolPath}_getSpawnArgs(e){if(l){if(this._isCmdFile()){let t=`/D /S /C "${this._windowsQuoteCmdArg(this.toolPath)}`;for(const i of this.args){t+=" ";t+=e.windowsVerbatimArguments?i:this._windowsQuoteCmdArg(i)}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 i=false;for(const n of e){if(t.some(e=>e===n)){i=true;break}}if(!i){return e}let n='"';let s=true;for(let t=e.length;t>0;t--){n+=e[t-1];if(s&&e[t-1]==="\\"){n+="\\"}else if(e[t-1]==='"'){s=true;n+='"'}else{s=false}}n+='"';return n.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 i=true;for(let n=e.length;n>0;n--){t+=e[n-1];if(i&&e[n-1]==="\\"){t+="\\"}else if(e[n-1]==='"'){i=true;t+="\\"}else{i=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 i={};i.cwd=e.cwd;i.env=e.env;i["windowsVerbatimArguments"]=e.windowsVerbatimArguments||this._isCmdFile();if(e.windowsVerbatimArguments){i.argv0=`"${t}"`}return i}exec(){return n(this,void 0,void 0,function*(){if(!f.isRooted(this.toolPath)&&(this.toolPath.includes("/")||l&&this.toolPath.includes("\\"))){this.toolPath=u.resolve(process.cwd(),this.options.cwd||process.cwd(),this.toolPath)}this.toolPath=yield a.which(this.toolPath,true);return new Promise((e,t)=>{this._debug(`exec tool: ${this.toolPath}`);this._debug("arguments:");for(const e of this.args){this._debug(` ${e}`)}const i=this._cloneExecOptions(this.options);if(!i.silent&&i.outStream){i.outStream.write(this._getCommandString(i)+r.EOL)}const n=new ExecState(i,this.toolPath);n.on("debug",e=>{this._debug(e)});const s=this._getSpawnFileName();const o=c.spawn(s,this._getSpawnArgs(i),this._getSpawnOptions(this.options,s));const u="";if(o.stdout){o.stdout.on("data",e=>{if(this.options.listeners&&this.options.listeners.stdout){this.options.listeners.stdout(e)}if(!i.silent&&i.outStream){i.outStream.write(e)}this._processLineBuffer(e,u,e=>{if(this.options.listeners&&this.options.listeners.stdline){this.options.listeners.stdline(e)}})})}const a="";if(o.stderr){o.stderr.on("data",e=>{n.processStderr=true;if(this.options.listeners&&this.options.listeners.stderr){this.options.listeners.stderr(e)}if(!i.silent&&i.errStream&&i.outStream){const t=i.failOnStdErr?i.errStream:i.outStream;t.write(e)}this._processLineBuffer(e,a,e=>{if(this.options.listeners&&this.options.listeners.errline){this.options.listeners.errline(e)}})})}o.on("error",e=>{n.processError=e.message;n.processExited=true;n.processClosed=true;n.CheckComplete()});o.on("exit",e=>{n.processExitCode=e;n.processExited=true;this._debug(`Exit code ${e} received from tool '${this.toolPath}'`);n.CheckComplete()});o.on("close",e=>{n.processExitCode=e;n.processExited=true;n.processClosed=true;this._debug(`STDIO streams have closed for tool '${this.toolPath}'`);n.CheckComplete()});n.on("done",(i,n)=>{if(u.length>0){this.emit("stdline",u)}if(a.length>0){this.emit("errline",a)}o.removeAllListeners();if(i){t(i)}else{e(n)}});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 i=false;let n=false;let s="";function append(e){if(n&&e!=='"'){s+="\\"}s+=e;n=false}for(let r=0;r<e.length;r++){const o=e.charAt(r);if(o==='"'){if(!n){i=!i}else{append(o)}continue}if(o==="\\"&&n){append(o);continue}if(o==="\\"&&i){n=true;continue}if(o===" "&&!i){if(s.length>0){t.push(s);s=""}continue}append(o)}if(s.length>0){t.push(s.trim())}return t}t.argStringToArray=argStringToArray;class ExecState extends o.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=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,i){"use strict";var n=this&&this.__awaiter||function(e,t,i,n){function adopt(e){return e instanceof i?e:new i(function(t){t(e)})}return new(i||(i=Promise))(function(i,s){function fulfilled(e){try{step(n.next(e))}catch(e){s(e)}}function rejected(e){try{step(n["throw"](e))}catch(e){s(e)}}function step(e){e.done?i(e.value):adopt(e.value).then(fulfilled,rejected)}step((n=n.apply(e,t||[])).next())})};var s;Object.defineProperty(t,"__esModule",{value:true});const r=i(357);const o=i(747);const c=i(622);s=o.promises,t.chmod=s.chmod,t.copyFile=s.copyFile,t.lstat=s.lstat,t.mkdir=s.mkdir,t.readdir=s.readdir,t.readlink=s.readlink,t.rename=s.rename,t.rmdir=s.rmdir,t.stat=s.stat,t.symlink=s.symlink,t.unlink=s.unlink;t.IS_WINDOWS=process.platform==="win32";function exists(e){return n(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,i=false){return n(this,void 0,void 0,function*(){const n=i?yield t.stat(e):yield t.lstat(e);return n.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,i=1e3,s=1){return n(this,void 0,void 0,function*(){r.ok(e,"a path argument must be provided");e=c.resolve(e);if(s>=i)return t.mkdir(e);try{yield t.mkdir(e);return}catch(n){switch(n.code){case"ENOENT":{yield mkdirP(c.dirname(e),i,s+1);yield t.mkdir(e);return}default:{let i;try{i=yield t.stat(e)}catch(e){throw n}if(!i.isDirectory())throw n}}}})}t.mkdirP=mkdirP;function tryGetExecutablePath(e,i){return n(this,void 0,void 0,function*(){let n=undefined;try{n=yield t.stat(e)}catch(t){if(t.code!=="ENOENT"){console.log(`Unexpected error attempting to determine if executable file exists '${e}': ${t}`)}}if(n&&n.isFile()){if(t.IS_WINDOWS){const t=c.extname(e).toUpperCase();if(i.some(e=>e.toUpperCase()===t)){return e}}else{if(isUnixExecutable(n)){return e}}}const s=e;for(const r of i){e=s+r;n=undefined;try{n=yield t.stat(e)}catch(t){if(t.code!=="ENOENT"){console.log(`Unexpected error attempting to determine if executable file exists '${e}': ${t}`)}}if(n&&n.isFile()){if(t.IS_WINDOWS){try{const i=c.dirname(e);const n=c.basename(e).toUpperCase();for(const s of yield t.readdir(i)){if(n===s.toUpperCase()){e=c.join(i,s);break}}}catch(t){console.log(`Unexpected error attempting to determine the actual case of the file '${e}': ${t}`)}return e}else{if(isUnixExecutable(n)){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,i){"use strict";var n=this&&this.__awaiter||function(e,t,i,n){function adopt(e){return e instanceof i?e:new i(function(t){t(e)})}return new(i||(i=Promise))(function(i,s){function fulfilled(e){try{step(n.next(e))}catch(e){s(e)}}function rejected(e){try{step(n["throw"](e))}catch(e){s(e)}}function step(e){e.done?i(e.value):adopt(e.value).then(fulfilled,rejected)}step((n=n.apply(e,t||[])).next())})};Object.defineProperty(t,"__esModule",{value:true});const s=i(129);const r=i(622);const o=i(669);const c=i(962);const u=o.promisify(s.exec);function cp(e,t,i={}){return n(this,void 0,void 0,function*(){const{force:n,recursive:s}=readCopyOptions(i);const o=(yield c.exists(t))?yield c.stat(t):null;if(o&&o.isFile()&&!n){return}const u=o&&o.isDirectory()?r.join(t,r.basename(e)):t;if(!(yield c.exists(e))){throw new Error(`no such file or directory: ${e}`)}const a=yield c.stat(e);if(a.isDirectory()){if(!s){throw new Error(`Failed to copy. ${e} is a directory, but tried to copy without recursive flag.`)}else{yield cpDirRecursive(e,u,0,n)}}else{if(r.relative(e,u)===""){throw new Error(`'${u}' and '${e}' are the same file`)}yield copyFile(e,u,n)}})}t.cp=cp;function mv(e,t,i={}){return n(this,void 0,void 0,function*(){if(yield c.exists(t)){let n=true;if(yield c.isDirectory(t)){t=r.join(t,r.basename(e));n=yield c.exists(t)}if(n){if(i.force==null||i.force){yield rmRF(t)}else{throw new Error("Destination already exists")}}}yield mkdirP(r.dirname(t));yield c.rename(e,t)})}t.mv=mv;function rmRF(e){return n(this,void 0,void 0,function*(){if(c.IS_WINDOWS){try{if(yield c.isDirectory(e,true)){yield u(`rd /s /q "${e}"`)}else{yield u(`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 u(`rm -rf "${e}"`)}else{yield c.unlink(e)}}})}t.rmRF=rmRF;function mkdirP(e){return n(this,void 0,void 0,function*(){yield c.mkdirP(e)})}t.mkdirP=mkdirP;function which(e,t){return n(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(r.delimiter)){if(e){t.push(e)}}}if(c.isRooted(e)){const i=yield c.tryGetExecutablePath(e,t);if(i){return i}return""}if(e.includes("/")||c.IS_WINDOWS&&e.includes("\\")){return""}const i=[];if(process.env.PATH){for(const e of process.env.PATH.split(r.delimiter)){if(e){i.push(e)}}}for(const n of i){const i=yield c.tryGetExecutablePath(n+r.sep+e,t);if(i){return i}}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 i=Boolean(e.recursive);return{force:t,recursive:i}}function cpDirRecursive(e,t,i,s){return n(this,void 0,void 0,function*(){if(i>=255)return;i++;yield mkdirP(t);const n=yield c.readdir(e);for(const r of n){const n=`${e}/${r}`;const o=`${t}/${r}`;const u=yield c.lstat(n);if(u.isDirectory()){yield cpDirRecursive(n,o,i,s)}else{yield copyFile(n,o,s)}}yield c.chmod(t,(yield c.stat(e)).mode)})}function copyFile(e,t,i){return n(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 i=yield c.readlink(e);yield c.symlink(i,t,c.IS_WINDOWS?"junction":null)}else if(!(yield c.exists(t))||i){yield c.copyFile(e,t)}})}},885:e=>{const{hasOwnProperty:t}=Object.prototype;const i=typeof process!=="undefined"&&process.platform==="win32"?"\r\n":"\n";const n=(e,t)=>{const r=[];let o="";if(typeof t==="string"){t={section:t,whitespace:false}}else{t=t||Object.create(null);t.whitespace=t.whitespace===true}const u=t.whitespace?" = ":"=";for(const t of Object.keys(e)){const n=e[t];if(n&&Array.isArray(n)){for(const e of n)o+=c(t+"[]")+u+c(e)+"\n"}else if(n&&typeof n==="object")r.push(t);else o+=c(t)+u+c(n)+i}if(t.section&&o.length)o="["+c(t.section)+"]"+i+o;for(const c of r){const r=s(c).join("\\.");const u=(t.section?t.section+".":"")+r;const{whitespace:a}=t;const f=n(e[c],{section:u,whitespace:a});if(o.length&&f.length)o+=i;o+=f}return o};const s=e=>e.replace(/\1/g,"LITERAL\\1LITERAL").replace(/\\\./g,"").split(/\./).map(e=>e.replace(/\1/g,"\\.").replace(/\2LITERAL\\1LITERAL\2/g,""));const r=e=>{const i=Object.create(null);let n=i;let r=null;const o=/^\[([^\]]*)\]$|^([^=]+)(=(.*))?$/i;const c=e.split(/[\r\n]+/g);for(const e of c){if(!e||e.match(/^\s*[;#]/))continue;const s=e.match(o);if(!s)continue;if(s[1]!==undefined){r=u(s[1]);if(r==="__proto__"){n=Object.create(null);continue}n=i[r]=i[r]||Object.create(null);continue}const c=u(s[2]);const a=c.length>2&&c.slice(-2)==="[]";const f=a?c.slice(0,-2):c;if(f==="__proto__")continue;const l=s[3]?u(s[4]):true;const d=l==="true"||l==="false"||l==="null"?JSON.parse(l):l;if(a){if(!t.call(n,f))n[f]=[];else if(!Array.isArray(n[f]))n[f]=[n[f]]}if(Array.isArray(n[f]))n[f].push(d);else n[f]=d}const a=[];for(const e of Object.keys(i)){if(!t.call(i,e)||typeof i[e]!=="object"||Array.isArray(i[e]))continue;const n=s(e);let r=i;const o=n.pop();const c=o.replace(/\\\./g,".");for(const e of n){if(e==="__proto__")continue;if(!t.call(r,e)||typeof r[e]!=="object")r[e]=Object.create(null);r=r[e]}if(r===i&&c===o)continue;r[c]=i[e];a.push(e)}for(const e of a)delete i[e];return i};const o=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&&o(e)||e!==e.trim()?JSON.stringify(e):e.replace(/;/g,"\\;").replace(/#/g,"\\#");const u=(e,t)=>{e=(e||"").trim();if(o(e)){if(e.charAt(0)==="'")e=e.substr(1,e.length-2);try{e=JSON.parse(e)}catch(e){}}else{let t=false;let i="";for(let n=0,s=e.length;n<s;n++){const s=e.charAt(n);if(t){if("\\;#".indexOf(s)!==-1)i+=s;else i+="\\"+s;t=false}else if(";#".indexOf(s)!==-1)break;else if(s==="\\")t=true;else i+=s}if(t)i+="\\";return i.trim()}return e};e.exports={parse:r,decode:r,stringify:n,encode:n,safe:c,unsafe:u}},987:(e,t,i)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.BuildahCli=void 0;const n=i(186);const s=i(514);const r=i(436);const o=i(622);const c=i(314);class BuildahCli{constructor(e){this.storageOptsEnv="";this.executable=e}async checkFuseOverlayfs(){const e=await r.which("fuse-overlayfs");if(e.startsWith("/usr/bin")){if(await c.checkStorageDriver()){this.storageOptsEnv="overlay.mount_program=/usr/bin/fuse-overlayfs"}}}static getImageFormatOption(e){return["--format",e?"oci":"docker"]}async buildUsingDocker(e,t,i,n,s,r,o){const c=["bud"];if(r){c.push("--arch");c.push(r)}i.forEach(e=>{c.push("-f");c.push(e)});n.forEach(e=>{c.push("--build-arg");c.push(e)});c.push(...BuildahCli.getImageFormatOption(s));if(o){c.push(`--layers=${o}`)}c.push("-t");c.push(e);c.push(t);return this.execute(c)}async from(e){return this.execute(["from",e])}async copy(e,t,i){if(t.length===0){return undefined}n.debug("copy");n.debug(e);for(const n of t){const t=["copy",e,n];if(i){t.push(i)}return this.execute(t)}return undefined}async config(e,t){n.debug("config");n.debug(e);const i=["config"];if(t.entrypoint){i.push("--entrypoint");i.push(BuildahCli.convertArrayToStringArg(t.entrypoint))}if(t.port){i.push("--port");i.push(t.port)}if(t.envs){t.envs.forEach(e=>{i.push("--env");i.push(e)})}if(t.archs){i.push("--arch");i.push(t.archs)}if(t.workingdir){i.push("--workingdir");i.push(t.workingdir)}i.push(e);return this.execute(i)}async commit(e,t,i){n.debug("commit");n.debug(e);n.debug(t);const s=["commit",...BuildahCli.getImageFormatOption(i),"--squash",e,t];return this.execute(s)}async tag(e,t){const i=["tag"];for(const n of t){i.push(`${e}:${n}`)}n.info(`Tagging the built image with tags ${t.toString()}`);return this.execute(i)}static convertArrayToStringArg(e){let t="[";e.forEach(e=>{t+=`"${e}",`});return`${t.slice(0,-1)}]`}async execute(e,t={}){let i="";let n="";const r={...t};r.ignoreReturnCode=true;r.listeners={stdline:e=>{i+=e+"\n"},errline:e=>{n+=e+"\n"}};const c={};Object.entries(process.env).forEach(([e,t])=>{if(t!=null){c[e]=t}});if(this.storageOptsEnv){c.STORAGE_OPTS=this.storageOptsEnv}r.env=c;const u=await s.exec(this.executable,e,r);if(t.ignoreReturnCode!==true&&u!==0){let e=`${o.basename(this.executable)} exited with code ${u}`;if(n){e+=`\n${n}`}throw new Error(e)}return{exitCode:u,output:i,error:n}}}t.BuildahCli=BuildahCli},69:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.Outputs=t.Inputs=void 0;var i;(function(e){e["ARCHS"]="archs";e["BASE_IMAGE"]="base-image";e["BUILD_ARGS"]="build-args";e["CONTENT"]="content";e["CONTEXT"]="context";e["DOCKERFILES"]="dockerfiles";e["ENTRYPOINT"]="entrypoint";e["ENVS"]="envs";e["IMAGE"]="image";e["LAYERS"]="layers";e["OCI"]="oci";e["PORT"]="port";e["TAGS"]="tags";e["WORKDIR"]="workdir"})(i=t.Inputs||(t.Inputs={}));var n;(function(e){e["IMAGE"]="image";e["TAGS"]="tags"})(n=t.Outputs||(t.Outputs={}))},144:(e,t,i)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.run=void 0;const n=i(186);const s=i(436);const r=i(622);const o=i(69);const c=i(987);async function run(){if(process.env.RUNNER_OS!=="Linux"){throw new Error("buildah, and therefore this action, only works on Linux. Please use a Linux runner.")}const e=await s.which("buildah",true);const t=new c.BuildahCli(e);await t.execute(["version"]);await t.checkFuseOverlayfs();const i="latest";const r=process.env.GITHUB_WORKSPACE||process.cwd();const u=getInputList(o.Inputs.DOCKERFILES);const a=n.getInput(o.Inputs.IMAGE,{required:true});const f=n.getInput(o.Inputs.TAGS);const l=f.split(" ");if(!l.length){n.info(`Input "${o.Inputs.TAGS}" is not provided, using default tag "${i}"`);l.push(i)}const d=`${a}:${l[0]}`;const p=n.getInput(o.Inputs.OCI)==="true";let h=n.getInput(o.Inputs.ARCHS);h=h.replace(/\s+/g,"");if(u.length!==0){await doBuildUsingDockerFiles(t,d,r,u,p,h)}else{await doBuildFromScratch(t,d,p,h)}if(l.length>1){await t.tag(a,l)}n.setOutput(o.Outputs.IMAGE,a);n.setOutput(o.Outputs.TAGS,f)}t.run=run;async function doBuildUsingDockerFiles(e,t,i,s,c,u){if(s.length===1){n.info(`Performing build from Dockerfile`)}else{n.info(`Performing build from ${s.length} Dockerfiles`)}const a=r.join(i,n.getInput(o.Inputs.CONTEXT));const f=getInputList(o.Inputs.BUILD_ARGS);const l=s.map(e=>r.join(i,e));const d=n.getInput(o.Inputs.LAYERS);await e.buildUsingDocker(t,a,l,f,c,u,d)}async function doBuildFromScratch(e,t,i,s){n.info(`Performing build from scratch`);const r=n.getInput(o.Inputs.BASE_IMAGE,{required:true});const c=getInputList(o.Inputs.CONTENT);const u=getInputList(o.Inputs.ENTRYPOINT);const a=n.getInput(o.Inputs.PORT);const f=n.getInput(o.Inputs.WORKDIR);const l=getInputList(o.Inputs.ENVS);const d=await e.from(r);const p=d.output.replace("\n","");await e.copy(p,c);const h={entrypoint:u,port:a,workingdir:f,envs:l,archs:s};await e.config(p,h);await e.commit(p,t,i)}function getInputList(e){const t=n.getInput(e);if(!t){return[]}return t.split(/\r?\n/).filter(e=>e).reduce((e,t)=>e.concat(t).map(e=>e.trim()),[])}run().catch(n.setFailed)},314:(e,t,i)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.checkStorageDriver=void 0;const n=i(885);const s=i(747);const r=i(186);const o=i(622);async function findStorageDriver(e){let t="";for(const i of e){r.debug(`Checking if the storage file exists at ${i}`);if(await fileExists(i)){r.debug(`Storage file exists at ${i}`);const e=n.parse(await s.promises.readFile(i,"utf-8"));t=e.storage.driver}}return t}async function checkStorageDriver(){let e="~/.config";if(process.env.XDG_CONFIG_HOME){e=process.env.XDG_CONFIG_HOME}const t=["/etc/containers/storage.conf",o.join(e,"containers/storage.conf")];const i=await findStorageDriver(t);return i==="overlay"}t.checkStorageDriver=checkStorageDriver;async function fileExists(e){try{await s.promises.access(e);return true}catch(e){return false}}},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")},669:e=>{"use strict";e.exports=require("util")}};var t={};function __webpack_require__(i){if(t[i]){return t[i].exports}var n=t[i]={exports:{}};var s=true;try{e[i].call(n.exports,n,n.exports,__webpack_require__);s=false}finally{if(s)delete t[i]}return n.exports}__webpack_require__.ab=__dirname+"/";return __webpack_require__(144)})();
|
||
//# sourceMappingURL=index.js.map
|