buildah-build/dist/index.js
Divyanshu Agrawal f9dfea0413
Replace input dockerfiles with containerfiles (#69)
* Replace input dockerfiles with containerfiles

Signed-off-by: divyansh42 <diagrawa@redhat.com>
2021-09-15 00:33:38 +05:30

2 lines
No EOL
31 KiB
JavaScript
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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 s=i(n(87));const r=n(278);function issueCommand(e,t,n){const i=new Command(e,t,n);process.stdout.write(i.toString()+s.EOL)}t.issueCommand=issueCommand;function issue(e,t=""){issueCommand(e,{},t)}t.issue=issue;const o="::";class Command{constructor(e,t,n){if(!e){e="missing.command"}this.command=e;this.properties=t;this.message=n}toString(){let e=o+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+=`${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,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,s){function fulfilled(e){try{step(i.next(e))}catch(e){s(e)}}function rejected(e){try{step(i["throw"](e))}catch(e){s(e)}}function step(e){e.done?n(e.value):adopt(e.value).then(fulfilled,rejected)}step((i=i.apply(e,t||[])).next())})};var s=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=n(351);const o=n(717);const c=n(278);const u=s(n(87));const a=s(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}${u.EOL}${n}${u.EOL}${t}`;o.issueCommand("ENV",i)}else{r.issueCommand("set-env",{name:e},n)}}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 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){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=l.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 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){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,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 s=i(n(747));const r=i(n(87));const o=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(!s.existsSync(n)){throw new Error(`Missing file at path: ${n}`)}s.appendFileSync(n,`${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,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,s){function fulfilled(e){try{step(i.next(e))}catch(e){s(e)}}function rejected(e){try{step(i["throw"](e))}catch(e){s(e)}}function step(e){e.done?n(e.value):adopt(e.value).then(fulfilled,rejected)}step((i=i.apply(e,t||[])).next())})};var s=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=s(n(159));function exec(e,t,n){return i(this,void 0,void 0,function*(){const i=r.argStringToArray(e);if(i.length===0){throw new Error(`Parameter 'commandLine' cannot be null or empty.`)}const s=i[0];t=i.slice(1).concat(t||[]);const o=new r.ToolRunner(s,t,n);return o.exec()})}t.exec=exec},159: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,s){function fulfilled(e){try{step(i.next(e))}catch(e){s(e)}}function rejected(e){try{step(i["throw"](e))}catch(e){s(e)}}function step(e){e.done?n(e.value):adopt(e.value).then(fulfilled,rejected)}step((i=i.apply(e,t||[])).next())})};var s=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=s(n(87));const o=s(n(614));const c=s(n(129));const u=s(n(622));const a=s(n(436));const l=s(n(962));const f=process.platform==="win32";class ToolRunner extends o.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 s=t?"":"[command]";if(f){if(this._isCmdFile()){s+=n;for(const e of i){s+=` ${e}`}}else if(e.windowsVerbatimArguments){s+=`"${n}"`;for(const e of i){s+=` ${e}`}}else{s+=this._windowsQuoteCmdArg(n);for(const e of i){s+=` ${this._windowsQuoteCmdArg(e)}`}}}else{s+=n;for(const e of i){s+=` ${e}`}}return s}_processLineBuffer(e,t,n){try{let i=t+e.toString();let s=i.indexOf(r.EOL);while(s>-1){const e=i.substring(0,s);n(e);i=i.substring(s+r.EOL.length);s=i.indexOf(r.EOL)}t=i}catch(e){this._debug(`error processing line. Failed with error ${e}`)}}_getSpawnFileName(){if(f){if(this._isCmdFile()){return process.env["COMSPEC"]||"cmd.exe"}}return this.toolPath}_getSpawnArgs(e){if(f){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 s=true;for(let t=e.length;t>0;t--){i+=e[t-1];if(s&&e[t-1]==="\\"){i+="\\"}else if(e[t-1]==='"'){s=true;i+='"'}else{s=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 i(this,void 0,void 0,function*(){if(!l.isRooted(this.toolPath)&&(this.toolPath.includes("/")||f&&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 n=this._cloneExecOptions(this.options);if(!n.silent&&n.outStream){n.outStream.write(this._getCommandString(n)+r.EOL)}const i=new ExecState(n,this.toolPath);i.on("debug",e=>{this._debug(e)});const s=this._getSpawnFileName();const o=c.spawn(s,this._getSpawnArgs(n),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(!n.silent&&n.outStream){n.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=>{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)}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(u.length>0){this.emit("stdline",u)}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 s="";function append(e){if(i&&e!=='"'){s+="\\"}s+=e;i=false}for(let r=0;r<e.length;r++){const o=e.charAt(r);if(o==='"'){if(!i){n=!n}else{append(o)}continue}if(o==="\\"&&i){append(o);continue}if(o==="\\"&&n){i=true;continue}if(o===" "&&!n){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,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,s){function fulfilled(e){try{step(i.next(e))}catch(e){s(e)}}function rejected(e){try{step(i["throw"](e))}catch(e){s(e)}}function step(e){e.done?n(e.value):adopt(e.value).then(fulfilled,rejected)}step((i=i.apply(e,t||[])).next())})};var s;Object.defineProperty(t,"__esModule",{value:true});const r=n(357);const o=n(747);const c=n(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 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,s=1){return i(this,void 0,void 0,function*(){r.ok(e,"a path argument must be provided");e=c.resolve(e);if(s>=n)return t.mkdir(e);try{yield t.mkdir(e);return}catch(i){switch(i.code){case"ENOENT":{yield mkdirP(c.dirname(e),n,s+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 s=e;for(const r of n){e=s+r;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 s of yield t.readdir(n)){if(i===s.toUpperCase()){e=c.join(n,s);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,s){function fulfilled(e){try{step(i.next(e))}catch(e){s(e)}}function rejected(e){try{step(i["throw"](e))}catch(e){s(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 s=n(129);const r=n(622);const o=n(669);const c=n(962);const u=o.promisify(s.exec);function cp(e,t,n={}){return i(this,void 0,void 0,function*(){const{force:i,recursive:s}=readCopyOptions(n);const o=(yield c.exists(t))?yield c.stat(t):null;if(o&&o.isFile()&&!i){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,i)}}else{if(r.relative(e,u)===""){throw new Error(`'${u}' and '${e}' are the same file`)}yield copyFile(e,u,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=r.join(t,r.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(r.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 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 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(r.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(r.delimiter)){if(e){n.push(e)}}}for(const i of n){const n=yield c.tryGetExecutablePath(i+r.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,s){return i(this,void 0,void 0,function*(){if(n>=255)return;n++;yield mkdirP(t);const i=yield c.readdir(e);for(const r of i){const i=`${e}/${r}`;const o=`${t}/${r}`;const u=yield c.lstat(i);if(u.isDirectory()){yield cpDirRecursive(i,o,n,s)}else{yield copyFile(i,o,s)}}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 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 i=e[t];if(i&&Array.isArray(i)){for(const e of i)o+=c(t+"[]")+u+c(e)+"\n"}else if(i&&typeof i==="object")r.push(t);else o+=c(t)+u+c(i)+n}if(t.section&&o.length)o="["+c(t.section)+"]"+n+o;for(const c of r){const r=s(c).join("\\.");const u=(t.section?t.section+".":"")+r;const{whitespace:a}=t;const l=i(e[c],{section:u,whitespace:a});if(o.length&&l.length)o+=n;o+=l}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 n=Object.create(null);let i=n;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__"){i=Object.create(null);continue}i=n[r]=n[r]||Object.create(null);continue}const c=u(s[2]);const a=c.length>2&&c.slice(-2)==="[]";const l=a?c.slice(0,-2):c;if(l==="__proto__")continue;const f=s[3]?u(s[4]):true;const d=f==="true"||f==="false"||f==="null"?JSON.parse(f):f;if(a){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 a=[];for(const e of Object.keys(n)){if(!t.call(n,e)||typeof n[e]!=="object"||Array.isArray(n[e]))continue;const i=s(e);let r=n;const o=i.pop();const c=o.replace(/\\\./g,".");for(const e of i){if(e==="__proto__")continue;if(!t.call(r,e)||typeof r[e]!=="object")r[e]=Object.create(null);r=r[e]}if(r===n&&c===o)continue;r[c]=n[e];a.push(e)}for(const e of a)delete n[e];return n};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 n="";for(let i=0,s=e.length;i<s;i++){const s=e.charAt(i);if(t){if("\\;#".indexOf(s)!==-1)n+=s;else n+="\\"+s;t=false}else if(";#".indexOf(s)!==-1)break;else if(s==="\\")t=true;else n+=s}if(t)n+="\\";return n.trim()}return e};e.exports={parse:r,decode:r,stringify:i,encode:i,safe:c,unsafe:u}},987:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.BuildahCli=void 0;const i=n(186);const s=n(514);const r=n(622);const o=n(314);class BuildahCli{constructor(e){this.storageOptsEnv="";this.executable=e}async setStorageOptsEnv(){if(await o.isStorageDriverOverlay()){const e=await o.findFuseOverlayfsPath();if(e){i.info(`Overriding storage mount_program with "fuse-overlayfs" in environment`);this.storageOptsEnv=`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")}}static getImageFormatOption(e){return["--format",e?"oci":"docker"]}async buildUsingDocker(e,t,n,i,s,r,o,c){const u=["bud"];if(r){u.push("--arch");u.push(r)}n.forEach(e=>{u.push("-f");u.push(e)});i.forEach(e=>{u.push("--build-arg");u.push(e)});u.push(...BuildahCli.getImageFormatOption(s));if(o){u.push(`--layers=${o}`)}if(c.length>0){u.push(...c)}u.push("-t");u.push(e);u.push(t);return this.execute(u)}async from(e){return this.execute(["from",e])}async copy(e,t,n){if(t.length===0){return undefined}i.debug("copy");i.debug(e);for(const i of t){const t=["copy",e,i];if(n){t.push(n)}return this.execute(t)}return undefined}async config(e,t){i.debug("config");i.debug(e);const n=["config"];if(t.entrypoint){n.push("--entrypoint");n.push(BuildahCli.convertArrayToStringArg(t.entrypoint))}if(t.port){n.push("--port");n.push(t.port)}if(t.envs){t.envs.forEach(e=>{n.push("--env");n.push(e)})}if(t.arch){n.push("--arch");n.push(t.arch)}if(t.workingdir){n.push("--workingdir");n.push(t.workingdir)}n.push(e);return this.execute(n)}async commit(e,t,n){i.debug("commit");i.debug(e);i.debug(t);const s=["commit",...BuildahCli.getImageFormatOption(n),"--squash",e,t];return this.execute(s)}async tag(e,t){const n=["tag"];for(const i of t){n.push(`${e}:${i}`)}i.info(`Tagging the built image with tags ${t.toString()}`);return this.execute(n)}static convertArrayToStringArg(e){let t="[";e.forEach(e=>{t+=`"${e}",`});return`${t.slice(0,-1)}]`}async execute(e,t={}){let n="";let o="";const c={...t};c.ignoreReturnCode=true;c.listeners={stdline:e=>{n+=e+"\n"},errline:e=>{o+=e+"\n"}};if(t.group){const t=[this.executable,...e].join(" ");i.startGroup(t)}const u={};Object.entries(process.env).forEach(([e,t])=>{if(t!=null){u[e]=t}});if(this.storageOptsEnv){u.STORAGE_OPTS=this.storageOptsEnv}c.env=u;try{const u=await s.exec(this.executable,e,c);if(t.ignoreReturnCode!==true&&u!==0){let e=`${r.basename(this.executable)} exited with code ${u}`;if(o){e+=`\n${o}`}throw new Error(e)}return{exitCode:u,output:n,error:o}}finally{if(t.group){i.endGroup()}}}}t.BuildahCli=BuildahCli},69:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.Outputs=t.Inputs=void 0;var n;(function(e){e["ARCH"]="arch";e["ARCHS"]="archs";e["BASE_IMAGE"]="base-image";e["BUILD_ARGS"]="build-args";e["CONTAINERFILES"]="containerfiles";e["CONTENT"]="content";e["CONTEXT"]="context";e["DOCKERFILES"]="dockerfiles";e["ENTRYPOINT"]="entrypoint";e["ENVS"]="envs";e["EXTRA_ARGS"]="extra-args";e["IMAGE"]="image";e["LAYERS"]="layers";e["OCI"]="oci";e["PORT"]="port";e["TAGS"]="tags";e["WORKDIR"]="workdir"})(n=t.Inputs||(t.Inputs={}));var i;(function(e){e["IMAGE"]="image";e["IMAGE_WITH_TAG"]="image-with-tag";e["TAGS"]="tags"})(i=t.Outputs||(t.Outputs={}))},144:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.run=void 0;const i=n(186);const s=n(436);const r=n(622);const o=n(69);const c=n(987);const u=n(314);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"],{group:true});await t.setStorageOptsEnv();const n="latest";const r=process.env.GITHUB_WORKSPACE||process.cwd();const a=u.getContainerfiles();const l=i.getInput(o.Inputs.IMAGE,{required:true});const f=i.getInput(o.Inputs.TAGS);const d=f.split(" ");if(d.length===0){i.info(`Input "${o.Inputs.TAGS}" is not provided, using default tag "${n}"`);d.push(n)}const p=`${l}:${d[0]}`;const h=i.getInput(o.Inputs.OCI)==="true";const g=u.getArch();if(a.length!==0){await doBuildUsingContainerFiles(t,p,r,a,h,g)}else{await doBuildFromScratch(t,p,h,g)}if(d.length>1){await t.tag(l,d)}i.setOutput(o.Outputs.IMAGE,l);i.setOutput(o.Outputs.TAGS,f);i.setOutput(o.Outputs.IMAGE_WITH_TAG,`${l}:${d[0]}`)}t.run=run;async function doBuildUsingContainerFiles(e,t,n,s,c,a){if(s.length===1){i.info(`Performing build from Containerfile`)}else{i.info(`Performing build from ${s.length} Containerfiles`)}const l=r.join(n,i.getInput(o.Inputs.CONTEXT));const f=u.getInputList(o.Inputs.BUILD_ARGS);const d=s.map(e=>r.join(n,e));const p=i.getInput(o.Inputs.LAYERS);const h=i.getInput(o.Inputs.EXTRA_ARGS);let g=[];if(h){const e=u.splitByNewline(h);g=e.flatMap(e=>e.split(" ")).map(e=>e.trim())}await e.buildUsingDocker(t,l,d,f,c,a,p,g)}async function doBuildFromScratch(e,t,n,s){i.info(`Performing build from scratch`);const r=i.getInput(o.Inputs.BASE_IMAGE,{required:true});const c=u.getInputList(o.Inputs.CONTENT);const a=u.getInputList(o.Inputs.ENTRYPOINT);const l=i.getInput(o.Inputs.PORT);const f=i.getInput(o.Inputs.WORKDIR);const d=u.getInputList(o.Inputs.ENVS);const p=await e.from(r);const h=p.output.replace("\n","");const g={entrypoint:a,port:l,workingdir:f,envs:d,arch:s};await e.config(h,g);await e.copy(h,c);await e.commit(h,t,n)}run().catch(i.setFailed)},314:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.getInputList=t.getContainerfiles=t.getArch=t.splitByNewline=t.findFuseOverlayfsPath=t.isStorageDriverOverlay=void 0;const i=n(885);const s=n(747);const r=n(186);const o=n(622);const c=n(436);const u=n(87);const a=n(69);async function findStorageDriver(e){let t="";for(const n of e){r.debug(`Checking if the storage file exists at ${n}`);if(await fileExists(n)){r.debug(`Storage file exists at ${n}`);const e=i.parse(await s.promises.readFile(n,"utf-8"));if(e.storage.driver){t=e.storage.driver}}}return t}async function isStorageDriverOverlay(){let e=o.join(u.homedir(),".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 n=await findStorageDriver(t);return n==="overlay"}t.isStorageDriverOverlay=isStorageDriverOverlay;async function fileExists(e){try{await s.promises.access(e);return true}catch(e){return false}}async function findFuseOverlayfsPath(){let e;try{e=await c.which("fuse-overlayfs")}catch(e){r.debug(e)}return e}t.findFuseOverlayfsPath=findFuseOverlayfsPath;function splitByNewline(e){return e.split(/\r?\n/)}t.splitByNewline=splitByNewline;function getArch(){const e=r.getInput(a.Inputs.ARCHS);const t=r.getInput(a.Inputs.ARCH);if(t&&e){r.warning(`Both "${a.Inputs.ARCH}" and "${a.Inputs.ARCHS}" inputs are set. `+`Please use only one of these two inputs, as they are aliases of one another. `+`"${a.Inputs.ARCH}" takes precedence.`)}return t||e}t.getArch=getArch;function getContainerfiles(){const e=getInputList(a.Inputs.CONTAINERFILES);const t=getInputList(a.Inputs.DOCKERFILES);if(e.length!==0&&t.length!==0){r.warning(`Both "${a.Inputs.CONTAINERFILES}" and "${a.Inputs.DOCKERFILES}" inputs are set. `+`Please use only one of these two inputs, as they are aliases of one another. `+`"${a.Inputs.CONTAINERFILES}" takes precedence.`)}return e.length!==0?e:t}t.getContainerfiles=getContainerfiles;function getInputList(e){const t=r.getInput(e);if(!t){return[]}const n=splitByNewline(t);return n.reduce((e,t)=>e.concat(t).map(e=>e.trim()),[])}t.getInputList=getInputList},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__(n){if(t[n]){return t[n].exports}var i=t[n]={exports:{}};var s=true;try{e[n].call(i.exports,i,i.exports,__webpack_require__);s=false}finally{if(s)delete t[n]}return i.exports}__webpack_require__.ab=__dirname+"/";return __webpack_require__(144)})();
//# sourceMappingURL=index.js.map