Added proxy support for azure agent and github runner
This commit is contained in:
@@ -233,11 +233,11 @@ var n;!function(e){!function(t){var n="object"==typeof global?global:"object"==t
|
||||
/*!***************************************!*\
|
||||
!*** ./src/agent/mock/build-agent.ts ***!
|
||||
\***************************************/
|
||||
/*! no static exports found */function(e,t,n){"use strict";var r=this&&this.__decorate||function(e,t,n,r){var i,o=arguments.length,s=o<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(i=e[a])&&(s=(o<3?i(s):o>3?i(t,n,s):i(t,n))||s);return o>3&&s&&Object.defineProperty(t,n,s),s};Object.defineProperty(t,"__esModule",{value:!0});let i=class{get agentName(){return console.log("getAgentName"),"Mock"}find(e,t,n){return console.log("find"),"find"}cacheDir(e,t,n,r){return console.log("cacheDir"),Promise.resolve("cacheDir")}createTempDir(){return console.log("createTempDir"),Promise.resolve("createTempDir")}debug(e){console.log("debug")}setFailed(e,t){console.log("setFailed")}setSucceeded(e,t){console.log("setSucceeded")}exportVariable(e,t){console.log("exportVariable")}getVariable(e){return console.log("getVariable"),"getVariable"}addPath(e){console.log("addPath")}which(e,t){return console.log("which"),Promise.resolve("which")}exec(e,t){return Promise.resolve({code:0,error:null,stderr:"result.stderr",stdout:"result.stdout"})}getSourceDir(){return console.log("getSourceDir"),"getSourceDir"}setOutput(e,t){console.log("setOutput")}getInput(e,t){return console.log("getInput"),"getInput"}getListInput(e,t){return console.log("getListInput"),["getInput"]}getBooleanInput(e,t){return console.log("getBooleanInput"),!1}isValidInputFile(e,t){return console.log("isValidInputFile"),!1}fileExists(e){return console.log("fileExists"),!1}directoryExists(e){return console.log("directoryExists"),!1}};i=r([n(/*! inversify */"./node_modules/inversify/lib/inversify.js").injectable()],i),t.BuildAgent=i},"./src/core/dotnet-tool.ts":
|
||||
/*! no static exports found */function(e,t,n){"use strict";var r=this&&this.__decorate||function(e,t,n,r){var i,o=arguments.length,s=o<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(i=e[a])&&(s=(o<3?i(s):o>3?i(t,n,s):i(t,n))||s);return o>3&&s&&Object.defineProperty(t,n,s),s};Object.defineProperty(t,"__esModule",{value:!0});let i=class{proxyConfiguration(e){console.log("proxyConfiguration")}get agentName(){return console.log("getAgentName"),"Mock"}find(e,t,n){return console.log("find"),"find"}cacheDir(e,t,n,r){return console.log("cacheDir"),Promise.resolve("cacheDir")}createTempDir(){return console.log("createTempDir"),Promise.resolve("createTempDir")}debug(e){console.log("debug")}setFailed(e,t){console.log("setFailed")}setSucceeded(e,t){console.log("setSucceeded")}exportVariable(e,t){console.log("exportVariable")}getVariable(e){return console.log("getVariable"),"getVariable"}addPath(e){console.log("addPath")}which(e,t){return console.log("which"),Promise.resolve("which")}exec(e,t){return Promise.resolve({code:0,error:null,stderr:"result.stderr",stdout:"result.stdout"})}getSourceDir(){return console.log("getSourceDir"),"getSourceDir"}setOutput(e,t){console.log("setOutput")}getInput(e,t){return console.log("getInput"),"getInput"}getListInput(e,t){return console.log("getListInput"),["getInput"]}getBooleanInput(e,t){return console.log("getBooleanInput"),!1}isValidInputFile(e,t){return console.log("isValidInputFile"),!1}fileExists(e){return console.log("fileExists"),!1}directoryExists(e){return console.log("directoryExists"),!1}};i=r([n(/*! inversify */"./node_modules/inversify/lib/inversify.js").injectable()],i),t.BuildAgent=i},"./src/core/dotnet-tool.ts":
|
||||
/*!*********************************!*\
|
||||
!*** ./src/core/dotnet-tool.ts ***!
|
||||
\*********************************/
|
||||
/*! no static exports found */function(e,t,n){"use strict";var r=this&&this.__decorate||function(e,t,n,r){var i,o=arguments.length,s=o<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(i=e[a])&&(s=(o<3?i(s):o>3?i(t,n,s):i(t,n))||s);return o>3&&s&&Object.defineProperty(t,n,s),s},i=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)},o=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}},s=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}u((r=r.apply(e,t||[])).next())}))},a=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t};Object.defineProperty(t,"__esModule",{value:!0});const u=a(n(/*! fs */"fs")),c=a(n(/*! os */"os")),l=a(n(/*! path */"path")),d=a(n(/*! typed-rest-client/HttpClient */"./node_modules/typed-rest-client/HttpClient.js")),f=n(/*! inversify */"./node_modules/inversify/lib/inversify.js"),p=n(/*! ./models */"./src/core/models.ts");let h=class{constructor(e,t){this.buildAgent=e,this.versionManager=t,this.httpClient=new d.HttpClient("dotnet")}disableTelemetry(){this.buildAgent.exportVariable("DOTNET_CLI_TELEMETRY_OPTOUT","1")}execute(e,t){return console.log(`Command: ${e} ${t.join(" ")}`),this.buildAgent.exec(e,t)}toolInstall(e,t,n,r){return s(this,void 0,void 0,(function*(){let i;if(console.log(""),console.log("--------------------------"),console.log(`Installing ${e} version `+t),console.log("--------------------------"),this.versionManager.isExplicitVersion(t)&&(n=!1),n||(i=this.buildAgent.find(e,t)),!i){let n;if(this.versionManager.isExplicitVersion(t))n=t;else{if(n=yield this.queryLatestMatch(e,t,r),!n)throw new Error(`Unable to find ${e} version '${t}'.`);i=this.buildAgent.find(e,n)}i||(i=yield this.acquireTool(e,n))}if(this.buildAgent.debug(`toolPath: ${i}`),"win32"!==c.platform()&&!this.buildAgent.getVariable("DOTNET_ROOT")){let e=yield this.buildAgent.which("dotnet");e=u.readlinkSync(e)||e;const t=l.dirname(e);this.buildAgent.exportVariable("DOTNET_ROOT",t)}return this.buildAgent.addPath(i),i}))}queryLatestMatch(e,t,n){return s(this,void 0,void 0,(function*(){this.buildAgent.debug(`querying tool versions for ${e}${t?`@${t}`:""} ${n?"including pre-releases":""}`);const r=`https://api-v2v3search-0.nuget.org/query?q=${encodeURIComponent(e.toLowerCase())}&prerelease=${n?"true":"false"}&semVerLevel=2.0.0`,i=yield this.httpClient.get(r);if(!i||200!==i.message.statusCode)return null;const o=yield i.readBody(),s=JSON.parse(o).data[0].versions.map(e=>e.version);return s&&s.length?(this.buildAgent.debug(`got versions: ${s.join(", ")}`),this.versionManager.evaluateVersions(s,t)):null}))}acquireTool(e,t){return s(this,void 0,void 0,(function*(){const n=yield this.buildAgent.createTempDir();let r=["tool","install",e,"--tool-path",n];t&&(t=this.versionManager.cleanVersion(t),r=r.concat(["--version",t]));const i=yield this.execute("dotnet",r),o=0===i.code?"success":"failure",s=0===i.code?i.stdout:i.stderr;if(this.buildAgent.debug(`tool install result: ${o} ${s}`),i.code)throw new Error("Error installing tool");return yield this.buildAgent.cacheDir(n,e,t)}))}};h=r([f.injectable(),o(0,f.inject(p.TYPES.IBuildAgent)),o(1,f.inject(p.TYPES.IVersionManager)),i("design:paramtypes",[Object,Object])],h),t.DotnetTool=h},"./src/core/ioc.ts":
|
||||
/*! no static exports found */function(e,t,n){"use strict";var r,i=this&&this.__decorate||function(e,t,n,r){var i,o=arguments.length,s=o<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(i=e[a])&&(s=(o<3?i(s):o>3?i(t,n,s):i(t,n))||s);return o>3&&s&&Object.defineProperty(t,n,s),s},o=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)},s=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}},a=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}u((r=r.apply(e,t||[])).next())}))},u=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t};Object.defineProperty(t,"__esModule",{value:!0});const c=u(n(/*! fs */"fs")),l=u(n(/*! os */"os")),d=u(n(/*! path */"path")),f=u(n(/*! typed-rest-client/HttpClient */"./node_modules/typed-rest-client/HttpClient.js")),p=n(/*! inversify */"./node_modules/inversify/lib/inversify.js"),h=n(/*! ./models */"./src/core/models.ts");let y=r=class{constructor(e,t){this.buildAgent=e,this.versionManager=t,this.httpClient=new f.HttpClient("dotnet",void 0,this.buildAgent.proxyConfiguration(r.nugetRoot))}disableTelemetry(){this.buildAgent.exportVariable("DOTNET_CLI_TELEMETRY_OPTOUT","1")}execute(e,t){return console.log(`Command: ${e} ${t.join(" ")}`),this.buildAgent.exec(e,t)}toolInstall(e,t,n,r){return a(this,void 0,void 0,(function*(){let i;if(console.log(""),console.log("--------------------------"),console.log(`Installing ${e} version `+t),console.log("--------------------------"),this.versionManager.isExplicitVersion(t)&&(n=!1),n||(i=this.buildAgent.find(e,t)),!i){let n;if(this.versionManager.isExplicitVersion(t))n=t;else{if(n=yield this.queryLatestMatch(e,t,r),!n)throw new Error(`Unable to find ${e} version '${t}'.`);i=this.buildAgent.find(e,n)}i||(i=yield this.acquireTool(e,n))}if(this.buildAgent.debug(`toolPath: ${i}`),"win32"!==l.platform()&&!this.buildAgent.getVariable("DOTNET_ROOT")){let e=yield this.buildAgent.which("dotnet");e=c.readlinkSync(e)||e;const t=d.dirname(e);this.buildAgent.exportVariable("DOTNET_ROOT",t)}return this.buildAgent.addPath(i),i}))}queryLatestMatch(e,t,n){return a(this,void 0,void 0,(function*(){this.buildAgent.debug(`querying tool versions for ${e}${t?`@${t}`:""} ${n?"including pre-releases":""}`);const i=`${r.nugetRoot}query?q=${encodeURIComponent(e.toLowerCase())}&prerelease=${n?"true":"false"}&semVerLevel=2.0.0`,o=yield this.httpClient.get(i);if(!o||200!==o.message.statusCode)return null;const s=yield o.readBody(),a=JSON.parse(s).data[0].versions.map(e=>e.version);return a&&a.length?(this.buildAgent.debug(`got versions: ${a.join(", ")}`),this.versionManager.evaluateVersions(a,t)):null}))}acquireTool(e,t){return a(this,void 0,void 0,(function*(){const n=yield this.buildAgent.createTempDir();let r=["tool","install",e,"--tool-path",n];t&&(t=this.versionManager.cleanVersion(t),r=r.concat(["--version",t]));const i=yield this.execute("dotnet",r),o=0===i.code?"success":"failure",s=0===i.code?i.stdout:i.stderr;if(this.buildAgent.debug(`tool install result: ${o} ${s}`),i.code)throw new Error("Error installing tool");return yield this.buildAgent.cacheDir(n,e,t)}))}};y.nugetRoot="https://api-v2v3search-0.nuget.org/",y=r=i([p.injectable(),s(0,p.inject(h.TYPES.IBuildAgent)),s(1,p.inject(h.TYPES.IVersionManager)),o("design:paramtypes",[Object,Object])],y),t.DotnetTool=y},"./src/core/ioc.ts":
|
||||
/*!*************************!*\
|
||||
!*** ./src/core/ioc.ts ***!
|
||||
\*************************/
|
||||
|
||||
Reference in New Issue
Block a user