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