mirror of
https://github.com/azure/login.git
synced 2026-03-15 09:20:56 -04:00
Compare commits
1 Commits
kanika/rel
...
users/aksm
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
673e01b856 |
@@ -57,7 +57,7 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
|
|
||||||
- name: Login via Az module
|
- name: Login via Az module
|
||||||
uses: azure/login@v1
|
uses: azure/login@v1.1
|
||||||
with:
|
with:
|
||||||
creds: ${{secrets.AZURE_CREDENTIALS}}
|
creds: ${{secrets.AZURE_CREDENTIALS}}
|
||||||
enable-AzPSSession: true
|
enable-AzPSSession: true
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ jest.mock('../../src/PowerShell/Utilities/PowerShellToolRunner');
|
|||||||
let spnlogin: ServicePrincipalLogin;
|
let spnlogin: ServicePrincipalLogin;
|
||||||
|
|
||||||
beforeAll(() => {
|
beforeAll(() => {
|
||||||
spnlogin = new ServicePrincipalLogin("servicePrincipalID", "servicePrinicipalkey", "tenantId", "subscriptionId", false, null, null);
|
spnlogin = new ServicePrincipalLogin("servicePrincipalID", "servicePrinicipalkey", "tenantId", "subscriptionId");
|
||||||
});
|
});
|
||||||
|
|
||||||
afterEach(() => {
|
afterEach(() => {
|
||||||
|
|||||||
@@ -1,25 +0,0 @@
|
|||||||
import ScriptBuilder from "../../../src/PowerShell/Utilities/ScriptBuilder";
|
|
||||||
import Constants from "../../../src/PowerShell/Constants";
|
|
||||||
|
|
||||||
describe("Getting AzLogin PS script" , () => {
|
|
||||||
const scheme = Constants.ServicePrincipal;
|
|
||||||
let args: any = {
|
|
||||||
servicePrincipalId: "service-principal-id",
|
|
||||||
servicePrincipalKey: "service-principal-key",
|
|
||||||
environment: "environment",
|
|
||||||
scopeLevel: Constants.Subscription,
|
|
||||||
subscriptionId: "subId",
|
|
||||||
allowNoSubscriptionsLogin: true
|
|
||||||
}
|
|
||||||
|
|
||||||
test("PS script should not set context while passing allowNoSubscriptionsLogin as true", () => {
|
|
||||||
const loginScript = new ScriptBuilder().getAzPSLoginScript(scheme, "tenant-id", args);
|
|
||||||
expect(loginScript.includes("Set-AzContext -SubscriptionId")).toBeFalsy();
|
|
||||||
});
|
|
||||||
|
|
||||||
test("PS script should set context while passing allowNoSubscriptionsLogin as false", () => {
|
|
||||||
args["allowNoSubscriptionsLogin"] = false;
|
|
||||||
const loginScript = new ScriptBuilder().getAzPSLoginScript(scheme, "tenant-id", args);
|
|
||||||
expect(loginScript.includes("Set-AzContext -SubscriptionId")).toBeTruthy();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
19
action.yml
19
action.yml
@@ -4,28 +4,11 @@ description: 'Authenticate to Azure and run your Az CLI or Az
|
|||||||
inputs:
|
inputs:
|
||||||
creds:
|
creds:
|
||||||
description: 'Paste output of `az ad sp create-for-rbac` as value of secret variable: AZURE_CREDENTIALS'
|
description: 'Paste output of `az ad sp create-for-rbac` as value of secret variable: AZURE_CREDENTIALS'
|
||||||
required: false
|
required: true
|
||||||
client-id:
|
|
||||||
description: 'ClientId of the Azure Service principal created.'
|
|
||||||
required: false
|
|
||||||
tenant-id:
|
|
||||||
description: 'TenantId of the Azure Service principal created.'
|
|
||||||
required: false
|
|
||||||
subscription-id:
|
|
||||||
description: 'Azure subscriptionId'
|
|
||||||
required: false
|
|
||||||
enable-AzPSSession:
|
enable-AzPSSession:
|
||||||
description: 'Set this value to true to enable Azure PowerShell Login in addition to Az CLI login'
|
description: 'Set this value to true to enable Azure PowerShell Login in addition to Az CLI login'
|
||||||
required: false
|
required: false
|
||||||
default: false
|
default: false
|
||||||
environment:
|
|
||||||
description: 'Name of the environment. Supported values are azurecloud, azurestack, azureusgovernment, azurechinacloud, azuregermancloud. Default being azurecloud'
|
|
||||||
required: false
|
|
||||||
default: azurecloud
|
|
||||||
allow-no-subscriptions:
|
|
||||||
description: 'Set this value to true to enable support for accessing tenants without subscriptions'
|
|
||||||
required: false
|
|
||||||
default: false
|
|
||||||
branding:
|
branding:
|
||||||
icon: 'login.svg'
|
icon: 'login.svg'
|
||||||
color: 'blue'
|
color: 'blue'
|
||||||
|
|||||||
@@ -1,23 +1,4 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
||||||
if (k2 === undefined) k2 = k;
|
|
||||||
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
||||||
}) : (function(o, m, k, k2) {
|
|
||||||
if (k2 === undefined) k2 = k;
|
|
||||||
o[k2] = m[k];
|
|
||||||
}));
|
|
||||||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
||||||
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
||||||
}) : function(o, v) {
|
|
||||||
o["default"] = v;
|
|
||||||
});
|
|
||||||
var __importStar = (this && this.__importStar) || function (mod) {
|
|
||||||
if (mod && mod.__esModule) return mod;
|
|
||||||
var result = {};
|
|
||||||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
||||||
__setModuleDefault(result, mod);
|
|
||||||
return result;
|
|
||||||
};
|
|
||||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||||
return new (P || (P = Promise))(function (resolve, reject) {
|
return new (P || (P = Promise))(function (resolve, reject) {
|
||||||
@@ -27,26 +8,28 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|||||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
var __importStar = (this && this.__importStar) || function (mod) {
|
||||||
|
if (mod && mod.__esModule) return mod;
|
||||||
|
var result = {};
|
||||||
|
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
|
||||||
|
result["default"] = mod;
|
||||||
|
return result;
|
||||||
|
};
|
||||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||||
};
|
};
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
exports.ServicePrincipalLogin = void 0;
|
|
||||||
const core = __importStar(require("@actions/core"));
|
const core = __importStar(require("@actions/core"));
|
||||||
const Utils_1 = __importDefault(require("./Utilities/Utils"));
|
const Utils_1 = __importDefault(require("./Utilities/Utils"));
|
||||||
const PowerShellToolRunner_1 = __importDefault(require("./Utilities/PowerShellToolRunner"));
|
const PowerShellToolRunner_1 = __importDefault(require("./Utilities/PowerShellToolRunner"));
|
||||||
const ScriptBuilder_1 = __importDefault(require("./Utilities/ScriptBuilder"));
|
const ScriptBuilder_1 = __importDefault(require("./Utilities/ScriptBuilder"));
|
||||||
const Constants_1 = __importDefault(require("./Constants"));
|
const Constants_1 = __importDefault(require("./Constants"));
|
||||||
class ServicePrincipalLogin {
|
class ServicePrincipalLogin {
|
||||||
constructor(servicePrincipalId, servicePrincipalKey, federatedToken, tenantId, subscriptionId, allowNoSubscriptionsLogin, environment, resourceManagerEndpointUrl) {
|
constructor(servicePrincipalId, servicePrincipalKey, tenantId, subscriptionId) {
|
||||||
this.servicePrincipalId = servicePrincipalId;
|
this.servicePrincipalId = servicePrincipalId;
|
||||||
this.servicePrincipalKey = servicePrincipalKey;
|
this.servicePrincipalKey = servicePrincipalKey;
|
||||||
this.federatedToken = federatedToken;
|
|
||||||
this.tenantId = tenantId;
|
this.tenantId = tenantId;
|
||||||
this.subscriptionId = subscriptionId;
|
this.subscriptionId = subscriptionId;
|
||||||
this.environment = environment;
|
|
||||||
this.resourceManagerEndpointUrl = resourceManagerEndpointUrl;
|
|
||||||
this.allowNoSubscriptionsLogin = allowNoSubscriptionsLogin;
|
|
||||||
}
|
}
|
||||||
initialize() {
|
initialize() {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
@@ -69,12 +52,9 @@ class ServicePrincipalLogin {
|
|||||||
const args = {
|
const args = {
|
||||||
servicePrincipalId: this.servicePrincipalId,
|
servicePrincipalId: this.servicePrincipalId,
|
||||||
servicePrincipalKey: this.servicePrincipalKey,
|
servicePrincipalKey: this.servicePrincipalKey,
|
||||||
federatedToken: this.federatedToken,
|
|
||||||
subscriptionId: this.subscriptionId,
|
subscriptionId: this.subscriptionId,
|
||||||
environment: this.environment,
|
environment: ServicePrincipalLogin.environment,
|
||||||
scopeLevel: ServicePrincipalLogin.scopeLevel,
|
scopeLevel: ServicePrincipalLogin.scopeLevel
|
||||||
allowNoSubscriptionsLogin: this.allowNoSubscriptionsLogin,
|
|
||||||
resourceManagerEndpointUrl: this.resourceManagerEndpointUrl
|
|
||||||
};
|
};
|
||||||
const script = new ScriptBuilder_1.default().getAzPSLoginScript(ServicePrincipalLogin.scheme, this.tenantId, args);
|
const script = new ScriptBuilder_1.default().getAzPSLoginScript(ServicePrincipalLogin.scheme, this.tenantId, args);
|
||||||
yield PowerShellToolRunner_1.default.init();
|
yield PowerShellToolRunner_1.default.init();
|
||||||
@@ -88,5 +68,6 @@ class ServicePrincipalLogin {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
exports.ServicePrincipalLogin = ServicePrincipalLogin;
|
exports.ServicePrincipalLogin = ServicePrincipalLogin;
|
||||||
|
ServicePrincipalLogin.environment = Constants_1.default.AzureCloud;
|
||||||
ServicePrincipalLogin.scopeLevel = Constants_1.default.Subscription;
|
ServicePrincipalLogin.scopeLevel = Constants_1.default.Subscription;
|
||||||
ServicePrincipalLogin.scheme = Constants_1.default.ServicePrincipal;
|
ServicePrincipalLogin.scheme = Constants_1.default.ServicePrincipal;
|
||||||
|
|||||||
@@ -1,23 +1,4 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
||||||
if (k2 === undefined) k2 = k;
|
|
||||||
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
||||||
}) : (function(o, m, k, k2) {
|
|
||||||
if (k2 === undefined) k2 = k;
|
|
||||||
o[k2] = m[k];
|
|
||||||
}));
|
|
||||||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
||||||
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
||||||
}) : function(o, v) {
|
|
||||||
o["default"] = v;
|
|
||||||
});
|
|
||||||
var __importStar = (this && this.__importStar) || function (mod) {
|
|
||||||
if (mod && mod.__esModule) return mod;
|
|
||||||
var result = {};
|
|
||||||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
||||||
__setModuleDefault(result, mod);
|
|
||||||
return result;
|
|
||||||
};
|
|
||||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||||
return new (P || (P = Promise))(function (resolve, reject) {
|
return new (P || (P = Promise))(function (resolve, reject) {
|
||||||
@@ -27,6 +8,13 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|||||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
var __importStar = (this && this.__importStar) || function (mod) {
|
||||||
|
if (mod && mod.__esModule) return mod;
|
||||||
|
var result = {};
|
||||||
|
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
|
||||||
|
result["default"] = mod;
|
||||||
|
return result;
|
||||||
|
};
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
const io = __importStar(require("@actions/io"));
|
const io = __importStar(require("@actions/io"));
|
||||||
const exec = __importStar(require("@actions/exec"));
|
const exec = __importStar(require("@actions/exec"));
|
||||||
|
|||||||
@@ -1,21 +1,9 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
||||||
if (k2 === undefined) k2 = k;
|
|
||||||
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
||||||
}) : (function(o, m, k, k2) {
|
|
||||||
if (k2 === undefined) k2 = k;
|
|
||||||
o[k2] = m[k];
|
|
||||||
}));
|
|
||||||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
||||||
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
||||||
}) : function(o, v) {
|
|
||||||
o["default"] = v;
|
|
||||||
});
|
|
||||||
var __importStar = (this && this.__importStar) || function (mod) {
|
var __importStar = (this && this.__importStar) || function (mod) {
|
||||||
if (mod && mod.__esModule) return mod;
|
if (mod && mod.__esModule) return mod;
|
||||||
var result = {};
|
var result = {};
|
||||||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
|
||||||
__setModuleDefault(result, mod);
|
result["default"] = mod;
|
||||||
return result;
|
return result;
|
||||||
};
|
};
|
||||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||||
@@ -32,21 +20,10 @@ class ScriptBuilder {
|
|||||||
let command = `Clear-AzContext -Scope Process;
|
let command = `Clear-AzContext -Scope Process;
|
||||||
Clear-AzContext -Scope CurrentUser -Force -ErrorAction SilentlyContinue;`;
|
Clear-AzContext -Scope CurrentUser -Force -ErrorAction SilentlyContinue;`;
|
||||||
if (scheme === Constants_1.default.ServicePrincipal) {
|
if (scheme === Constants_1.default.ServicePrincipal) {
|
||||||
if (args.environment.toLowerCase() == "azurestack") {
|
command += `Connect-AzAccount -ServicePrincipal -Tenant '${tenantId}' -Credential \
|
||||||
command += `Add-AzEnvironment -Name ${args.environment} -ARMEndpoint ${args.resourceManagerEndpointUrl} | out-null;`;
|
(New-Object System.Management.Automation.PSCredential('${args.servicePrincipalId}',(ConvertTo-SecureString '${args.servicePrincipalKey.replace("'", "''")}' -AsPlainText -Force))) \
|
||||||
}
|
-Environment '${args.environment}' | out-null;`;
|
||||||
// Separate command script for OIDC and non-OIDC
|
if (args.scopeLevel === Constants_1.default.Subscription) {
|
||||||
if (!!args.federatedToken) {
|
|
||||||
command += `Connect-AzAccount -ServicePrincipal -ApplicationId '${args.servicePrincipalId}' -Tenant '${tenantId}' -FederatedToken '${args.federatedToken}' \
|
|
||||||
-Environment '${args.environment}' | out-null;`;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
command += `Connect-AzAccount -ServicePrincipal -Tenant '${tenantId}' -Credential \
|
|
||||||
(New-Object System.Management.Automation.PSCredential('${args.servicePrincipalId}',(ConvertTo-SecureString '${args.servicePrincipalKey.replace("'", "''")}' -AsPlainText -Force))) \
|
|
||||||
-Environment '${args.environment}' | out-null;`;
|
|
||||||
}
|
|
||||||
// command to set the subscription
|
|
||||||
if (args.scopeLevel === Constants_1.default.Subscription && !args.allowNoSubscriptionsLogin) {
|
|
||||||
command += `Set-AzContext -SubscriptionId '${args.subscriptionId}' -TenantId '${tenantId}' | out-null;`;
|
command += `Set-AzContext -SubscriptionId '${args.subscriptionId}' -TenantId '${tenantId}' | out-null;`;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,23 +1,4 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
||||||
if (k2 === undefined) k2 = k;
|
|
||||||
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
||||||
}) : (function(o, m, k, k2) {
|
|
||||||
if (k2 === undefined) k2 = k;
|
|
||||||
o[k2] = m[k];
|
|
||||||
}));
|
|
||||||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
||||||
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
||||||
}) : function(o, v) {
|
|
||||||
o["default"] = v;
|
|
||||||
});
|
|
||||||
var __importStar = (this && this.__importStar) || function (mod) {
|
|
||||||
if (mod && mod.__esModule) return mod;
|
|
||||||
var result = {};
|
|
||||||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
||||||
__setModuleDefault(result, mod);
|
|
||||||
return result;
|
|
||||||
};
|
|
||||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||||
return new (P || (P = Promise))(function (resolve, reject) {
|
return new (P || (P = Promise))(function (resolve, reject) {
|
||||||
@@ -27,6 +8,13 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|||||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
var __importStar = (this && this.__importStar) || function (mod) {
|
||||||
|
if (mod && mod.__esModule) return mod;
|
||||||
|
var result = {};
|
||||||
|
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
|
||||||
|
result["default"] = mod;
|
||||||
|
return result;
|
||||||
|
};
|
||||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||||
};
|
};
|
||||||
|
|||||||
165
lib/main.js
165
lib/main.js
@@ -1,23 +1,4 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
||||||
if (k2 === undefined) k2 = k;
|
|
||||||
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
||||||
}) : (function(o, m, k, k2) {
|
|
||||||
if (k2 === undefined) k2 = k;
|
|
||||||
o[k2] = m[k];
|
|
||||||
}));
|
|
||||||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
||||||
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
||||||
}) : function(o, v) {
|
|
||||||
o["default"] = v;
|
|
||||||
});
|
|
||||||
var __importStar = (this && this.__importStar) || function (mod) {
|
|
||||||
if (mod && mod.__esModule) return mod;
|
|
||||||
var result = {};
|
|
||||||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
||||||
__setModuleDefault(result, mod);
|
|
||||||
return result;
|
|
||||||
};
|
|
||||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||||
return new (P || (P = Promise))(function (resolve, reject) {
|
return new (P || (P = Promise))(function (resolve, reject) {
|
||||||
@@ -27,6 +8,13 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|||||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
var __importStar = (this && this.__importStar) || function (mod) {
|
||||||
|
if (mod && mod.__esModule) return mod;
|
||||||
|
var result = {};
|
||||||
|
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
|
||||||
|
result["default"] = mod;
|
||||||
|
return result;
|
||||||
|
};
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
const core = __importStar(require("@actions/core"));
|
const core = __importStar(require("@actions/core"));
|
||||||
const exec = __importStar(require("@actions/exec"));
|
const exec = __importStar(require("@actions/exec"));
|
||||||
@@ -48,141 +36,34 @@ function main() {
|
|||||||
core.exportVariable('AZURE_HTTP_USER_AGENT', userAgentString);
|
core.exportVariable('AZURE_HTTP_USER_AGENT', userAgentString);
|
||||||
core.exportVariable('AZUREPS_HOST_ENVIRONMENT', azurePSHostEnv);
|
core.exportVariable('AZUREPS_HOST_ENVIRONMENT', azurePSHostEnv);
|
||||||
azPath = yield io.which("az", true);
|
azPath = yield io.which("az", true);
|
||||||
core.debug(`az cli version used: ${azPath}`);
|
|
||||||
let azureSupportedCloudName = new Set([
|
|
||||||
"azureusgovernment",
|
|
||||||
"azurechinacloud",
|
|
||||||
"azuregermancloud",
|
|
||||||
"azurecloud",
|
|
||||||
"azurestack"
|
|
||||||
]);
|
|
||||||
let output = "";
|
let output = "";
|
||||||
const execOptions = {
|
const options = {
|
||||||
listeners: {
|
listeners: {
|
||||||
stdout: (data) => {
|
stdout: (data) => {
|
||||||
output += data.toString();
|
output += data.toString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
yield executeAzCliCommand("--version", true, execOptions);
|
yield executeAzCliCommand("--version", true, options);
|
||||||
core.debug(`az cli version used:\n${output}`);
|
core.debug(`az cli version used:\n${output}`);
|
||||||
let creds = core.getInput('creds', { required: false });
|
let creds = core.getInput('creds', { required: true });
|
||||||
let secrets = creds ? new actions_secret_parser_1.SecretParser(creds, actions_secret_parser_1.FormatType.JSON) : null;
|
let secrets = new actions_secret_parser_1.SecretParser(creds, actions_secret_parser_1.FormatType.JSON);
|
||||||
let environment = core.getInput("environment").toLowerCase();
|
let servicePrincipalId = secrets.getSecret("$.clientId", false);
|
||||||
|
let servicePrincipalKey = secrets.getSecret("$.clientSecret", true);
|
||||||
|
let tenantId = secrets.getSecret("$.tenantId", false);
|
||||||
|
let subscriptionId = secrets.getSecret("$.subscriptionId", false);
|
||||||
const enableAzPSSession = core.getInput('enable-AzPSSession').toLowerCase() === "true";
|
const enableAzPSSession = core.getInput('enable-AzPSSession').toLowerCase() === "true";
|
||||||
const allowNoSubscriptionsLogin = core.getInput('allow-no-subscriptions').toLowerCase() === "true";
|
if (!servicePrincipalId || !servicePrincipalKey || !tenantId || !subscriptionId) {
|
||||||
//Check for the credentials in individual parameters in the workflow.
|
throw new Error("Not all values are present in the creds object. Ensure clientId, clientSecret, tenantId and subscriptionId are supplied.");
|
||||||
var servicePrincipalId = core.getInput('client-id', { required: false });
|
|
||||||
;
|
|
||||||
var servicePrincipalKey = null;
|
|
||||||
var tenantId = core.getInput('tenant-id', { required: false });
|
|
||||||
var subscriptionId = core.getInput('subscription-id', { required: false });
|
|
||||||
var resourceManagerEndpointUrl = "https://management.azure.com/";
|
|
||||||
var enableOIDC = true;
|
|
||||||
var federatedToken = null;
|
|
||||||
// If any of the individual credentials (clent_id, tenat_id, subscription_id) is present.
|
|
||||||
if (servicePrincipalId || tenantId || subscriptionId) {
|
|
||||||
//If few of the individual credentials (clent_id, tenat_id, subscription_id) are missing in action inputs.
|
|
||||||
if (!(servicePrincipalId && tenantId && (subscriptionId || allowNoSubscriptionsLogin)))
|
|
||||||
throw new Error("Few credentials are missing. ClientId,tenantId are mandatory. SubscriptionId is also mandatory if allow-no-subscriptions is not set.");
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
if (creds) {
|
|
||||||
core.debug('using creds JSON...');
|
|
||||||
enableOIDC = false;
|
|
||||||
servicePrincipalId = secrets.getSecret("$.clientId", true);
|
|
||||||
servicePrincipalKey = secrets.getSecret("$.clientSecret", true);
|
|
||||||
tenantId = secrets.getSecret("$.tenantId", true);
|
|
||||||
subscriptionId = secrets.getSecret("$.subscriptionId", true);
|
|
||||||
resourceManagerEndpointUrl = secrets.getSecret("$.resourceManagerEndpointUrl", false);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
throw new Error("Credentials are not passed for Login action.");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//generic checks
|
|
||||||
//servicePrincipalKey is only required in non-oidc scenario.
|
|
||||||
if (!servicePrincipalId || !tenantId || !(servicePrincipalKey || enableOIDC)) {
|
|
||||||
throw new Error("Not all values are present in the credentials. Ensure clientId, clientSecret and tenantId are supplied.");
|
|
||||||
}
|
|
||||||
if (!subscriptionId && !allowNoSubscriptionsLogin) {
|
|
||||||
throw new Error("Not all values are present in the credentials. Ensure subscriptionId is supplied.");
|
|
||||||
}
|
|
||||||
if (!azureSupportedCloudName.has(environment)) {
|
|
||||||
throw new Error("Unsupported value for environment is passed.The list of supported values for environment are ‘azureusgovernment', ‘azurechinacloud’, ‘azuregermancloud’, ‘azurecloud’ or ’azurestack’");
|
|
||||||
}
|
|
||||||
// OIDC specific checks
|
|
||||||
if (enableOIDC) {
|
|
||||||
console.log('Using OIDC authentication...');
|
|
||||||
//generating ID-token
|
|
||||||
federatedToken = yield core.getIDToken('api://AzureADTokenExchange');
|
|
||||||
if (!!federatedToken) {
|
|
||||||
if (environment != "azurecloud")
|
|
||||||
throw new Error(`Your current environment - "${environment}" is not supported for OIDC login.`);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
throw new Error("Could not get ID token for authentication.");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
// Attempting Az cli login
|
// Attempting Az cli login
|
||||||
if (environment == "azurestack") {
|
yield executeAzCliCommand(`login --service-principal -u "${servicePrincipalId}" -p "${servicePrincipalKey}" --tenant "${tenantId}"`, true);
|
||||||
if (!resourceManagerEndpointUrl) {
|
yield executeAzCliCommand(`account set --subscription "${subscriptionId}"`, true);
|
||||||
throw new Error("resourceManagerEndpointUrl is a required parameter when environment is defined.");
|
|
||||||
}
|
|
||||||
console.log(`Unregistering cloud: "${environment}" first if it exists`);
|
|
||||||
try {
|
|
||||||
yield executeAzCliCommand(`cloud set -n AzureCloud`, true);
|
|
||||||
yield executeAzCliCommand(`cloud unregister -n "${environment}"`, false);
|
|
||||||
}
|
|
||||||
catch (error) {
|
|
||||||
console.log(`Ignore cloud not registered error: "${error}"`);
|
|
||||||
}
|
|
||||||
console.log(`Registering cloud: "${environment}" with ARM endpoint: "${resourceManagerEndpointUrl}"`);
|
|
||||||
try {
|
|
||||||
let baseUri = resourceManagerEndpointUrl;
|
|
||||||
if (baseUri.endsWith('/')) {
|
|
||||||
baseUri = baseUri.substring(0, baseUri.length - 1); // need to remove trailing / from resourceManagerEndpointUrl to correctly derive suffixes below
|
|
||||||
}
|
|
||||||
let suffixKeyvault = ".vault" + baseUri.substring(baseUri.indexOf('.')); // keyvault suffix starts with .
|
|
||||||
let suffixStorage = baseUri.substring(baseUri.indexOf('.') + 1); // storage suffix starts without .
|
|
||||||
let profileVersion = "2019-03-01-hybrid";
|
|
||||||
yield executeAzCliCommand(`cloud register -n "${environment}" --endpoint-resource-manager "${resourceManagerEndpointUrl}" --suffix-keyvault-dns "${suffixKeyvault}" --suffix-storage-endpoint "${suffixStorage}" --profile "${profileVersion}"`, false);
|
|
||||||
}
|
|
||||||
catch (error) {
|
|
||||||
core.error(`Error while trying to register cloud "${environment}": "${error}"`);
|
|
||||||
}
|
|
||||||
console.log(`Done registering cloud: "${environment}"`);
|
|
||||||
}
|
|
||||||
yield executeAzCliCommand(`cloud set -n "${environment}"`, false);
|
|
||||||
console.log(`Done setting cloud: "${environment}"`);
|
|
||||||
// Attempting Az cli login
|
|
||||||
var commonArgs = ["--service-principal",
|
|
||||||
"-u", servicePrincipalId,
|
|
||||||
"--tenant", tenantId
|
|
||||||
];
|
|
||||||
if (allowNoSubscriptionsLogin) {
|
|
||||||
commonArgs = commonArgs.concat("--allow-no-subscriptions");
|
|
||||||
}
|
|
||||||
if (enableOIDC) {
|
|
||||||
commonArgs = commonArgs.concat("--federated-token", federatedToken);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
commonArgs = commonArgs.concat("-p", servicePrincipalKey);
|
|
||||||
}
|
|
||||||
yield executeAzCliCommand(`login`, true, {}, commonArgs);
|
|
||||||
if (!allowNoSubscriptionsLogin) {
|
|
||||||
var args = [
|
|
||||||
"--subscription",
|
|
||||||
subscriptionId
|
|
||||||
];
|
|
||||||
yield executeAzCliCommand(`account set`, true, {}, args);
|
|
||||||
}
|
|
||||||
isAzCLISuccess = true;
|
isAzCLISuccess = true;
|
||||||
if (enableAzPSSession) {
|
if (enableAzPSSession) {
|
||||||
// Attempting Az PS login
|
// Attempting Az PS login
|
||||||
console.log(`Running Azure PS Login`);
|
console.log(`Running Azure PS Login`);
|
||||||
var spnlogin;
|
const spnlogin = new ServicePrincipalLogin_1.ServicePrincipalLogin(servicePrincipalId, servicePrincipalKey, tenantId, subscriptionId);
|
||||||
spnlogin = new ServicePrincipalLogin_1.ServicePrincipalLogin(servicePrincipalId, servicePrincipalKey, federatedToken, tenantId, subscriptionId, allowNoSubscriptionsLogin, environment, resourceManagerEndpointUrl);
|
|
||||||
yield spnlogin.initialize();
|
yield spnlogin.initialize();
|
||||||
yield spnlogin.login();
|
yield spnlogin.login();
|
||||||
}
|
}
|
||||||
@@ -204,11 +85,11 @@ function main() {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
function executeAzCliCommand(command, silent, execOptions = {}, args = []) {
|
function executeAzCliCommand(command, silent, options = {}) {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
execOptions.silent = !!silent;
|
options.silent = !!silent;
|
||||||
try {
|
try {
|
||||||
yield exec.exec(`"${azPath}" ${command}`, args, execOptions);
|
yield exec.exec(`"${azPath}" ${command}`, [], options);
|
||||||
}
|
}
|
||||||
catch (error) {
|
catch (error) {
|
||||||
throw new Error(error);
|
throw new Error(error);
|
||||||
|
|||||||
7910
node_modules/.package-lock.json
generated
vendored
7910
node_modules/.package-lock.json
generated
vendored
File diff suppressed because it is too large
Load Diff
177
node_modules/@actions/core/README.md
generated
vendored
177
node_modules/@actions/core/README.md
generated
vendored
@@ -16,14 +16,11 @@ import * as core from '@actions/core';
|
|||||||
|
|
||||||
#### Inputs/Outputs
|
#### Inputs/Outputs
|
||||||
|
|
||||||
Action inputs can be read with `getInput` which returns a `string` or `getBooleanInput` which parses a boolean based on the [yaml 1.2 specification](https://yaml.org/spec/1.2/spec.html#id2804923). If `required` set to be false, the input should have a default value in `action.yml`.
|
Action inputs can be read with `getInput`. Outputs can be set with `setOutput` which makes them available to be mapped into inputs of other actions to ensure they are decoupled.
|
||||||
|
|
||||||
Outputs can be set with `setOutput` which makes them available to be mapped into inputs of other actions to ensure they are decoupled.
|
|
||||||
|
|
||||||
```js
|
```js
|
||||||
const myInput = core.getInput('inputName', { required: true });
|
const myInput = core.getInput('inputName', { required: true });
|
||||||
const myBooleanInput = core.getBooleanInput('booleanInputName', { required: true });
|
|
||||||
const myMultilineInput = core.getMultilineInput('multilineInputName', { required: true });
|
|
||||||
core.setOutput('outputKey', 'outputVal');
|
core.setOutput('outputKey', 'outputVal');
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -65,10 +62,11 @@ catch (err) {
|
|||||||
// setFailed logs the message and sets a failing exit code
|
// setFailed logs the message and sets a failing exit code
|
||||||
core.setFailed(`Action failed with error ${err}`);
|
core.setFailed(`Action failed with error ${err}`);
|
||||||
}
|
}
|
||||||
```
|
|
||||||
|
|
||||||
Note that `setNeutral` is not yet implemented in actions V2 but equivalent functionality is being planned.
|
Note that `setNeutral` is not yet implemented in actions V2 but equivalent functionality is being planned.
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
#### Logging
|
#### Logging
|
||||||
|
|
||||||
Finally, this library provides some utilities for logging. Note that debug logging is hidden from the logs by default. This behavior can be toggled by enabling the [Step Debug Logs](../../docs/action-debugging.md#step-debug-logs).
|
Finally, this library provides some utilities for logging. Note that debug logging is hidden from the logs by default. This behavior can be toggled by enabling the [Step Debug Logs](../../docs/action-debugging.md#step-debug-logs).
|
||||||
@@ -92,8 +90,6 @@ try {
|
|||||||
|
|
||||||
// Do stuff
|
// Do stuff
|
||||||
core.info('Output to the actions build log')
|
core.info('Output to the actions build log')
|
||||||
|
|
||||||
core.notice('This is a message that will also emit an annotation')
|
|
||||||
}
|
}
|
||||||
catch (err) {
|
catch (err) {
|
||||||
core.error(`Error ${err}, action may still succeed though`);
|
core.error(`Error ${err}, action may still succeed though`);
|
||||||
@@ -117,123 +113,11 @@ const result = await core.group('Do something async', async () => {
|
|||||||
})
|
})
|
||||||
```
|
```
|
||||||
|
|
||||||
#### Annotations
|
|
||||||
|
|
||||||
This library has 3 methods that will produce [annotations](https://docs.github.com/en/rest/reference/checks#create-a-check-run).
|
|
||||||
```js
|
|
||||||
core.error('This is a bad error. This will also fail the build.')
|
|
||||||
|
|
||||||
core.warning('Something went wrong, but it\'s not bad enough to fail the build.')
|
|
||||||
|
|
||||||
core.notice('Something happened that you might want to know about.')
|
|
||||||
```
|
|
||||||
|
|
||||||
These will surface to the UI in the Actions page and on Pull Requests. They look something like this:
|
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
These annotations can also be attached to particular lines and columns of your source files to show exactly where a problem is occuring.
|
|
||||||
|
|
||||||
These options are:
|
|
||||||
```typescript
|
|
||||||
export interface AnnotationProperties {
|
|
||||||
/**
|
|
||||||
* A title for the annotation.
|
|
||||||
*/
|
|
||||||
title?: string
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The name of the file for which the annotation should be created.
|
|
||||||
*/
|
|
||||||
file?: string
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The start line for the annotation.
|
|
||||||
*/
|
|
||||||
startLine?: number
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The end line for the annotation. Defaults to `startLine` when `startLine` is provided.
|
|
||||||
*/
|
|
||||||
endLine?: number
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The start column for the annotation. Cannot be sent when `startLine` and `endLine` are different values.
|
|
||||||
*/
|
|
||||||
startColumn?: number
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The start column for the annotation. Cannot be sent when `startLine` and `endLine` are different values.
|
|
||||||
* Defaults to `startColumn` when `startColumn` is provided.
|
|
||||||
*/
|
|
||||||
endColumn?: number
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
#### Styling output
|
|
||||||
|
|
||||||
Colored output is supported in the Action logs via standard [ANSI escape codes](https://en.wikipedia.org/wiki/ANSI_escape_code). 3/4 bit, 8 bit and 24 bit colors are all supported.
|
|
||||||
|
|
||||||
Foreground colors:
|
|
||||||
|
|
||||||
```js
|
|
||||||
// 3/4 bit
|
|
||||||
core.info('\u001b[35mThis foreground will be magenta')
|
|
||||||
|
|
||||||
// 8 bit
|
|
||||||
core.info('\u001b[38;5;6mThis foreground will be cyan')
|
|
||||||
|
|
||||||
// 24 bit
|
|
||||||
core.info('\u001b[38;2;255;0;0mThis foreground will be bright red')
|
|
||||||
```
|
|
||||||
|
|
||||||
Background colors:
|
|
||||||
|
|
||||||
```js
|
|
||||||
// 3/4 bit
|
|
||||||
core.info('\u001b[43mThis background will be yellow');
|
|
||||||
|
|
||||||
// 8 bit
|
|
||||||
core.info('\u001b[48;5;6mThis background will be cyan')
|
|
||||||
|
|
||||||
// 24 bit
|
|
||||||
core.info('\u001b[48;2;255;0;0mThis background will be bright red')
|
|
||||||
```
|
|
||||||
|
|
||||||
Special styles:
|
|
||||||
|
|
||||||
```js
|
|
||||||
core.info('\u001b[1mBold text')
|
|
||||||
core.info('\u001b[3mItalic text')
|
|
||||||
core.info('\u001b[4mUnderlined text')
|
|
||||||
```
|
|
||||||
|
|
||||||
ANSI escape codes can be combined with one another:
|
|
||||||
|
|
||||||
```js
|
|
||||||
core.info('\u001b[31;46mRed foreground with a cyan background and \u001b[1mbold text at the end');
|
|
||||||
```
|
|
||||||
|
|
||||||
> Note: Escape codes reset at the start of each line
|
|
||||||
|
|
||||||
```js
|
|
||||||
core.info('\u001b[35mThis foreground will be magenta')
|
|
||||||
core.info('This foreground will reset to the default')
|
|
||||||
```
|
|
||||||
|
|
||||||
Manually typing escape codes can be a little difficult, but you can use third party modules such as [ansi-styles](https://github.com/chalk/ansi-styles).
|
|
||||||
|
|
||||||
```js
|
|
||||||
const style = require('ansi-styles');
|
|
||||||
core.info(style.color.ansi16m.hex('#abcdef') + 'Hello world!')
|
|
||||||
```
|
|
||||||
|
|
||||||
#### Action state
|
#### Action state
|
||||||
|
|
||||||
You can use this library to save state and get state for sharing information between a given wrapper action:
|
You can use this library to save state and get state for sharing information between a given wrapper action:
|
||||||
|
|
||||||
**action.yml**:
|
|
||||||
|
|
||||||
|
**action.yml**
|
||||||
```yaml
|
```yaml
|
||||||
name: 'Wrapper action sample'
|
name: 'Wrapper action sample'
|
||||||
inputs:
|
inputs:
|
||||||
@@ -254,7 +138,6 @@ core.saveState("pidToKill", 12345);
|
|||||||
```
|
```
|
||||||
|
|
||||||
In action's `cleanup.js`:
|
In action's `cleanup.js`:
|
||||||
|
|
||||||
```js
|
```js
|
||||||
const core = require('@actions/core');
|
const core = require('@actions/core');
|
||||||
|
|
||||||
@@ -262,51 +145,3 @@ var pid = core.getState("pidToKill");
|
|||||||
|
|
||||||
process.kill(pid);
|
process.kill(pid);
|
||||||
```
|
```
|
||||||
|
|
||||||
#### OIDC Token
|
|
||||||
|
|
||||||
You can use these methods to interact with the GitHub OIDC provider and get a JWT ID token which would help to get access token from third party cloud providers.
|
|
||||||
|
|
||||||
**Method Name**: getIDToken()
|
|
||||||
|
|
||||||
**Inputs**
|
|
||||||
|
|
||||||
audience : optional
|
|
||||||
|
|
||||||
**Outputs**
|
|
||||||
|
|
||||||
A [JWT](https://jwt.io/) ID Token
|
|
||||||
|
|
||||||
In action's `main.ts`:
|
|
||||||
```js
|
|
||||||
const core = require('@actions/core');
|
|
||||||
async function getIDTokenAction(): Promise<void> {
|
|
||||||
|
|
||||||
const audience = core.getInput('audience', {required: false})
|
|
||||||
|
|
||||||
const id_token1 = await core.getIDToken() // ID Token with default audience
|
|
||||||
const id_token2 = await core.getIDToken(audience) // ID token with custom audience
|
|
||||||
|
|
||||||
// this id_token can be used to get access token from third party cloud providers
|
|
||||||
}
|
|
||||||
getIDTokenAction()
|
|
||||||
```
|
|
||||||
|
|
||||||
In action's `actions.yml`:
|
|
||||||
|
|
||||||
```yaml
|
|
||||||
name: 'GetIDToken'
|
|
||||||
description: 'Get ID token from Github OIDC provider'
|
|
||||||
inputs:
|
|
||||||
audience:
|
|
||||||
description: 'Audience for which the ID token is intended for'
|
|
||||||
required: false
|
|
||||||
outputs:
|
|
||||||
id_token1:
|
|
||||||
description: 'ID token obtained from OIDC provider'
|
|
||||||
id_token2:
|
|
||||||
description: 'ID token obtained from OIDC provider'
|
|
||||||
runs:
|
|
||||||
using: 'node12'
|
|
||||||
main: 'dist/index.js'
|
|
||||||
```
|
|
||||||
3
node_modules/@actions/core/lib/command.d.ts
generated
vendored
3
node_modules/@actions/core/lib/command.d.ts
generated
vendored
@@ -1,4 +1,4 @@
|
|||||||
export interface CommandProperties {
|
interface CommandProperties {
|
||||||
[key: string]: any;
|
[key: string]: any;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
@@ -13,3 +13,4 @@ export interface CommandProperties {
|
|||||||
*/
|
*/
|
||||||
export declare function issueCommand(command: string, properties: CommandProperties, message: any): void;
|
export declare function issueCommand(command: string, properties: CommandProperties, message: any): void;
|
||||||
export declare function issue(name: string, message?: string): void;
|
export declare function issue(name: string, message?: string): void;
|
||||||
|
export {};
|
||||||
|
|||||||
17
node_modules/@actions/core/lib/command.js
generated
vendored
17
node_modules/@actions/core/lib/command.js
generated
vendored
@@ -1,25 +1,12 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
||||||
if (k2 === undefined) k2 = k;
|
|
||||||
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
||||||
}) : (function(o, m, k, k2) {
|
|
||||||
if (k2 === undefined) k2 = k;
|
|
||||||
o[k2] = m[k];
|
|
||||||
}));
|
|
||||||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
||||||
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
||||||
}) : function(o, v) {
|
|
||||||
o["default"] = v;
|
|
||||||
});
|
|
||||||
var __importStar = (this && this.__importStar) || function (mod) {
|
var __importStar = (this && this.__importStar) || function (mod) {
|
||||||
if (mod && mod.__esModule) return mod;
|
if (mod && mod.__esModule) return mod;
|
||||||
var result = {};
|
var result = {};
|
||||||
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
|
||||||
__setModuleDefault(result, mod);
|
result["default"] = mod;
|
||||||
return result;
|
return result;
|
||||||
};
|
};
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
exports.issue = exports.issueCommand = void 0;
|
|
||||||
const os = __importStar(require("os"));
|
const os = __importStar(require("os"));
|
||||||
const utils_1 = require("./utils");
|
const utils_1 = require("./utils");
|
||||||
/**
|
/**
|
||||||
|
|||||||
2
node_modules/@actions/core/lib/command.js.map
generated
vendored
2
node_modules/@actions/core/lib/command.js.map
generated
vendored
@@ -1 +1 @@
|
|||||||
{"version":3,"file":"command.js","sourceRoot":"","sources":["../src/command.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA,uCAAwB;AACxB,mCAAsC;AAWtC;;;;;;;;;GASG;AACH,SAAgB,YAAY,CAC1B,OAAe,EACf,UAA6B,EAC7B,OAAY;IAEZ,MAAM,GAAG,GAAG,IAAI,OAAO,CAAC,OAAO,EAAE,UAAU,EAAE,OAAO,CAAC,CAAA;IACrD,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,QAAQ,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,CAAA;AAC/C,CAAC;AAPD,oCAOC;AAED,SAAgB,KAAK,CAAC,IAAY,EAAE,OAAO,GAAG,EAAE;IAC9C,YAAY,CAAC,IAAI,EAAE,EAAE,EAAE,OAAO,CAAC,CAAA;AACjC,CAAC;AAFD,sBAEC;AAED,MAAM,UAAU,GAAG,IAAI,CAAA;AAEvB,MAAM,OAAO;IAKX,YAAY,OAAe,EAAE,UAA6B,EAAE,OAAe;QACzE,IAAI,CAAC,OAAO,EAAE;YACZ,OAAO,GAAG,iBAAiB,CAAA;SAC5B;QAED,IAAI,CAAC,OAAO,GAAG,OAAO,CAAA;QACtB,IAAI,CAAC,UAAU,GAAG,UAAU,CAAA;QAC5B,IAAI,CAAC,OAAO,GAAG,OAAO,CAAA;IACxB,CAAC;IAED,QAAQ;QACN,IAAI,MAAM,GAAG,UAAU,GAAG,IAAI,CAAC,OAAO,CAAA;QAEtC,IAAI,IAAI,CAAC,UAAU,IAAI,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,MAAM,GAAG,CAAC,EAAE;YAC9D,MAAM,IAAI,GAAG,CAAA;YACb,IAAI,KAAK,GAAG,IAAI,CAAA;YAChB,KAAK,MAAM,GAAG,IAAI,IAAI,CAAC,UAAU,EAAE;gBACjC,IAAI,IAAI,CAAC,UAAU,CAAC,cAAc,CAAC,GAAG,CAAC,EAAE;oBACvC,MAAM,GAAG,GAAG,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,CAAA;oBAChC,IAAI,GAAG,EAAE;wBACP,IAAI,KAAK,EAAE;4BACT,KAAK,GAAG,KAAK,CAAA;yBACd;6BAAM;4BACL,MAAM,IAAI,GAAG,CAAA;yBACd;wBAED,MAAM,IAAI,GAAG,GAAG,IAAI,cAAc,CAAC,GAAG,CAAC,EAAE,CAAA;qBAC1C;iBACF;aACF;SACF;QAED,MAAM,IAAI,GAAG,UAAU,GAAG,UAAU,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CAAA;QACpD,OAAO,MAAM,CAAA;IACf,CAAC;CACF;AAED,SAAS,UAAU,CAAC,CAAM;IACxB,OAAO,sBAAc,CAAC,CAAC,CAAC;SACrB,OAAO,CAAC,IAAI,EAAE,KAAK,CAAC;SACpB,OAAO,CAAC,KAAK,EAAE,KAAK,CAAC;SACrB,OAAO,CAAC,KAAK,EAAE,KAAK,CAAC,CAAA;AAC1B,CAAC;AAED,SAAS,cAAc,CAAC,CAAM;IAC5B,OAAO,sBAAc,CAAC,CAAC,CAAC;SACrB,OAAO,CAAC,IAAI,EAAE,KAAK,CAAC;SACpB,OAAO,CAAC,KAAK,EAAE,KAAK,CAAC;SACrB,OAAO,CAAC,KAAK,EAAE,KAAK,CAAC;SACrB,OAAO,CAAC,IAAI,EAAE,KAAK,CAAC;SACpB,OAAO,CAAC,IAAI,EAAE,KAAK,CAAC,CAAA;AACzB,CAAC"}
|
{"version":3,"file":"command.js","sourceRoot":"","sources":["../src/command.ts"],"names":[],"mappings":";;;;;;;;;AAAA,uCAAwB;AACxB,mCAAsC;AAWtC;;;;;;;;;GASG;AACH,SAAgB,YAAY,CAC1B,OAAe,EACf,UAA6B,EAC7B,OAAY;IAEZ,MAAM,GAAG,GAAG,IAAI,OAAO,CAAC,OAAO,EAAE,UAAU,EAAE,OAAO,CAAC,CAAA;IACrD,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,QAAQ,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,CAAA;AAC/C,CAAC;AAPD,oCAOC;AAED,SAAgB,KAAK,CAAC,IAAY,EAAE,UAAkB,EAAE;IACtD,YAAY,CAAC,IAAI,EAAE,EAAE,EAAE,OAAO,CAAC,CAAA;AACjC,CAAC;AAFD,sBAEC;AAED,MAAM,UAAU,GAAG,IAAI,CAAA;AAEvB,MAAM,OAAO;IAKX,YAAY,OAAe,EAAE,UAA6B,EAAE,OAAe;QACzE,IAAI,CAAC,OAAO,EAAE;YACZ,OAAO,GAAG,iBAAiB,CAAA;SAC5B;QAED,IAAI,CAAC,OAAO,GAAG,OAAO,CAAA;QACtB,IAAI,CAAC,UAAU,GAAG,UAAU,CAAA;QAC5B,IAAI,CAAC,OAAO,GAAG,OAAO,CAAA;IACxB,CAAC;IAED,QAAQ;QACN,IAAI,MAAM,GAAG,UAAU,GAAG,IAAI,CAAC,OAAO,CAAA;QAEtC,IAAI,IAAI,CAAC,UAAU,IAAI,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,MAAM,GAAG,CAAC,EAAE;YAC9D,MAAM,IAAI,GAAG,CAAA;YACb,IAAI,KAAK,GAAG,IAAI,CAAA;YAChB,KAAK,MAAM,GAAG,IAAI,IAAI,CAAC,UAAU,EAAE;gBACjC,IAAI,IAAI,CAAC,UAAU,CAAC,cAAc,CAAC,GAAG,CAAC,EAAE;oBACvC,MAAM,GAAG,GAAG,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,CAAA;oBAChC,IAAI,GAAG,EAAE;wBACP,IAAI,KAAK,EAAE;4BACT,KAAK,GAAG,KAAK,CAAA;yBACd;6BAAM;4BACL,MAAM,IAAI,GAAG,CAAA;yBACd;wBAED,MAAM,IAAI,GAAG,GAAG,IAAI,cAAc,CAAC,GAAG,CAAC,EAAE,CAAA;qBAC1C;iBACF;aACF;SACF;QAED,MAAM,IAAI,GAAG,UAAU,GAAG,UAAU,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CAAA;QACpD,OAAO,MAAM,CAAA;IACf,CAAC;CACF;AAED,SAAS,UAAU,CAAC,CAAM;IACxB,OAAO,sBAAc,CAAC,CAAC,CAAC;SACrB,OAAO,CAAC,IAAI,EAAE,KAAK,CAAC;SACpB,OAAO,CAAC,KAAK,EAAE,KAAK,CAAC;SACrB,OAAO,CAAC,KAAK,EAAE,KAAK,CAAC,CAAA;AAC1B,CAAC;AAED,SAAS,cAAc,CAAC,CAAM;IAC5B,OAAO,sBAAc,CAAC,CAAC,CAAC;SACrB,OAAO,CAAC,IAAI,EAAE,KAAK,CAAC;SACpB,OAAO,CAAC,KAAK,EAAE,KAAK,CAAC;SACrB,OAAO,CAAC,KAAK,EAAE,KAAK,CAAC;SACrB,OAAO,CAAC,IAAI,EAAE,KAAK,CAAC;SACpB,OAAO,CAAC,IAAI,EAAE,KAAK,CAAC,CAAA;AACzB,CAAC"}
|
||||||
72
node_modules/@actions/core/lib/core.d.ts
generated
vendored
72
node_modules/@actions/core/lib/core.d.ts
generated
vendored
@@ -4,8 +4,6 @@
|
|||||||
export interface InputOptions {
|
export interface InputOptions {
|
||||||
/** Optional. Whether the input is required. If required and not present, will throw. Defaults to false */
|
/** Optional. Whether the input is required. If required and not present, will throw. Defaults to false */
|
||||||
required?: boolean;
|
required?: boolean;
|
||||||
/** Optional. Whether leading/trailing whitespace will be trimmed for the input. Defaults to true */
|
|
||||||
trimWhitespace?: boolean;
|
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* The code to exit an action
|
* The code to exit an action
|
||||||
@@ -20,37 +18,6 @@ export declare enum ExitCode {
|
|||||||
*/
|
*/
|
||||||
Failure = 1
|
Failure = 1
|
||||||
}
|
}
|
||||||
/**
|
|
||||||
* Optional properties that can be sent with annotatation commands (notice, error, and warning)
|
|
||||||
* See: https://docs.github.com/en/rest/reference/checks#create-a-check-run for more information about annotations.
|
|
||||||
*/
|
|
||||||
export interface AnnotationProperties {
|
|
||||||
/**
|
|
||||||
* A title for the annotation.
|
|
||||||
*/
|
|
||||||
title?: string;
|
|
||||||
/**
|
|
||||||
* The path of the file for which the annotation should be created.
|
|
||||||
*/
|
|
||||||
file?: string;
|
|
||||||
/**
|
|
||||||
* The start line for the annotation.
|
|
||||||
*/
|
|
||||||
startLine?: number;
|
|
||||||
/**
|
|
||||||
* The end line for the annotation. Defaults to `startLine` when `startLine` is provided.
|
|
||||||
*/
|
|
||||||
endLine?: number;
|
|
||||||
/**
|
|
||||||
* The start column for the annotation. Cannot be sent when `startLine` and `endLine` are different values.
|
|
||||||
*/
|
|
||||||
startColumn?: number;
|
|
||||||
/**
|
|
||||||
* The start column for the annotation. Cannot be sent when `startLine` and `endLine` are different values.
|
|
||||||
* Defaults to `startColumn` when `startColumn` is provided.
|
|
||||||
*/
|
|
||||||
endColumn?: number;
|
|
||||||
}
|
|
||||||
/**
|
/**
|
||||||
* Sets env variable for this action and future actions in the job
|
* Sets env variable for this action and future actions in the job
|
||||||
* @param name the name of the variable to set
|
* @param name the name of the variable to set
|
||||||
@@ -68,35 +35,13 @@ export declare function setSecret(secret: string): void;
|
|||||||
*/
|
*/
|
||||||
export declare function addPath(inputPath: string): void;
|
export declare function addPath(inputPath: string): void;
|
||||||
/**
|
/**
|
||||||
* Gets the value of an input.
|
* Gets the value of an input. The value is also trimmed.
|
||||||
* Unless trimWhitespace is set to false in InputOptions, the value is also trimmed.
|
|
||||||
* Returns an empty string if the value is not defined.
|
|
||||||
*
|
*
|
||||||
* @param name name of the input to get
|
* @param name name of the input to get
|
||||||
* @param options optional. See InputOptions.
|
* @param options optional. See InputOptions.
|
||||||
* @returns string
|
* @returns string
|
||||||
*/
|
*/
|
||||||
export declare function getInput(name: string, options?: InputOptions): string;
|
export declare function getInput(name: string, options?: InputOptions): string;
|
||||||
/**
|
|
||||||
* Gets the values of an multiline input. Each value is also trimmed.
|
|
||||||
*
|
|
||||||
* @param name name of the input to get
|
|
||||||
* @param options optional. See InputOptions.
|
|
||||||
* @returns string[]
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
export declare function getMultilineInput(name: string, options?: InputOptions): string[];
|
|
||||||
/**
|
|
||||||
* Gets the input value of the boolean type in the YAML 1.2 "core schema" specification.
|
|
||||||
* Support boolean input list: `true | True | TRUE | false | False | FALSE` .
|
|
||||||
* The return value is also in boolean type.
|
|
||||||
* ref: https://yaml.org/spec/1.2/spec.html#id2804923
|
|
||||||
*
|
|
||||||
* @param name name of the input to get
|
|
||||||
* @param options optional. See InputOptions.
|
|
||||||
* @returns boolean
|
|
||||||
*/
|
|
||||||
export declare function getBooleanInput(name: string, options?: InputOptions): boolean;
|
|
||||||
/**
|
/**
|
||||||
* Sets the value of an output.
|
* Sets the value of an output.
|
||||||
*
|
*
|
||||||
@@ -128,21 +73,13 @@ export declare function debug(message: string): void;
|
|||||||
/**
|
/**
|
||||||
* Adds an error issue
|
* Adds an error issue
|
||||||
* @param message error issue message. Errors will be converted to string via toString()
|
* @param message error issue message. Errors will be converted to string via toString()
|
||||||
* @param properties optional properties to add to the annotation.
|
|
||||||
*/
|
*/
|
||||||
export declare function error(message: string | Error, properties?: AnnotationProperties): void;
|
export declare function error(message: string | Error): void;
|
||||||
/**
|
/**
|
||||||
* Adds a warning issue
|
* Adds an warning issue
|
||||||
* @param message warning issue message. Errors will be converted to string via toString()
|
* @param message warning issue message. Errors will be converted to string via toString()
|
||||||
* @param properties optional properties to add to the annotation.
|
|
||||||
*/
|
*/
|
||||||
export declare function warning(message: string | Error, properties?: AnnotationProperties): void;
|
export declare function warning(message: string | Error): void;
|
||||||
/**
|
|
||||||
* Adds a notice issue
|
|
||||||
* @param message notice issue message. Errors will be converted to string via toString()
|
|
||||||
* @param properties optional properties to add to the annotation.
|
|
||||||
*/
|
|
||||||
export declare function notice(message: string | Error, properties?: AnnotationProperties): void;
|
|
||||||
/**
|
/**
|
||||||
* Writes info to log with console.log.
|
* Writes info to log with console.log.
|
||||||
* @param message info message
|
* @param message info message
|
||||||
@@ -183,4 +120,3 @@ export declare function saveState(name: string, value: any): void;
|
|||||||
* @returns string
|
* @returns string
|
||||||
*/
|
*/
|
||||||
export declare function getState(name: string): string;
|
export declare function getState(name: string): string;
|
||||||
export declare function getIDToken(aud?: string): Promise<string>;
|
|
||||||
|
|||||||
100
node_modules/@actions/core/lib/core.js
generated
vendored
100
node_modules/@actions/core/lib/core.js
generated
vendored
@@ -1,23 +1,4 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
||||||
if (k2 === undefined) k2 = k;
|
|
||||||
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
||||||
}) : (function(o, m, k, k2) {
|
|
||||||
if (k2 === undefined) k2 = k;
|
|
||||||
o[k2] = m[k];
|
|
||||||
}));
|
|
||||||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
||||||
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
||||||
}) : function(o, v) {
|
|
||||||
o["default"] = v;
|
|
||||||
});
|
|
||||||
var __importStar = (this && this.__importStar) || function (mod) {
|
|
||||||
if (mod && mod.__esModule) return mod;
|
|
||||||
var result = {};
|
|
||||||
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
||||||
__setModuleDefault(result, mod);
|
|
||||||
return result;
|
|
||||||
};
|
|
||||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||||
return new (P || (P = Promise))(function (resolve, reject) {
|
return new (P || (P = Promise))(function (resolve, reject) {
|
||||||
@@ -27,14 +8,19 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|||||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
var __importStar = (this && this.__importStar) || function (mod) {
|
||||||
|
if (mod && mod.__esModule) return mod;
|
||||||
|
var result = {};
|
||||||
|
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
|
||||||
|
result["default"] = mod;
|
||||||
|
return result;
|
||||||
|
};
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
exports.getIDToken = exports.getState = exports.saveState = exports.group = exports.endGroup = exports.startGroup = exports.info = exports.notice = exports.warning = exports.error = exports.debug = exports.isDebug = exports.setFailed = exports.setCommandEcho = exports.setOutput = exports.getBooleanInput = exports.getMultilineInput = exports.getInput = exports.addPath = exports.setSecret = exports.exportVariable = exports.ExitCode = void 0;
|
|
||||||
const command_1 = require("./command");
|
const command_1 = require("./command");
|
||||||
const file_command_1 = require("./file-command");
|
const file_command_1 = require("./file-command");
|
||||||
const utils_1 = require("./utils");
|
const utils_1 = require("./utils");
|
||||||
const os = __importStar(require("os"));
|
const os = __importStar(require("os"));
|
||||||
const path = __importStar(require("path"));
|
const path = __importStar(require("path"));
|
||||||
const oidc_utils_1 = require("./oidc-utils");
|
|
||||||
/**
|
/**
|
||||||
* The code to exit an action
|
* The code to exit an action
|
||||||
*/
|
*/
|
||||||
@@ -96,9 +82,7 @@ function addPath(inputPath) {
|
|||||||
}
|
}
|
||||||
exports.addPath = addPath;
|
exports.addPath = addPath;
|
||||||
/**
|
/**
|
||||||
* Gets the value of an input.
|
* Gets the value of an input. The value is also trimmed.
|
||||||
* Unless trimWhitespace is set to false in InputOptions, the value is also trimmed.
|
|
||||||
* Returns an empty string if the value is not defined.
|
|
||||||
*
|
*
|
||||||
* @param name name of the input to get
|
* @param name name of the input to get
|
||||||
* @param options optional. See InputOptions.
|
* @param options optional. See InputOptions.
|
||||||
@@ -109,49 +93,9 @@ function getInput(name, options) {
|
|||||||
if (options && options.required && !val) {
|
if (options && options.required && !val) {
|
||||||
throw new Error(`Input required and not supplied: ${name}`);
|
throw new Error(`Input required and not supplied: ${name}`);
|
||||||
}
|
}
|
||||||
if (options && options.trimWhitespace === false) {
|
|
||||||
return val;
|
|
||||||
}
|
|
||||||
return val.trim();
|
return val.trim();
|
||||||
}
|
}
|
||||||
exports.getInput = getInput;
|
exports.getInput = getInput;
|
||||||
/**
|
|
||||||
* Gets the values of an multiline input. Each value is also trimmed.
|
|
||||||
*
|
|
||||||
* @param name name of the input to get
|
|
||||||
* @param options optional. See InputOptions.
|
|
||||||
* @returns string[]
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
function getMultilineInput(name, options) {
|
|
||||||
const inputs = getInput(name, options)
|
|
||||||
.split('\n')
|
|
||||||
.filter(x => x !== '');
|
|
||||||
return inputs;
|
|
||||||
}
|
|
||||||
exports.getMultilineInput = getMultilineInput;
|
|
||||||
/**
|
|
||||||
* Gets the input value of the boolean type in the YAML 1.2 "core schema" specification.
|
|
||||||
* Support boolean input list: `true | True | TRUE | false | False | FALSE` .
|
|
||||||
* The return value is also in boolean type.
|
|
||||||
* ref: https://yaml.org/spec/1.2/spec.html#id2804923
|
|
||||||
*
|
|
||||||
* @param name name of the input to get
|
|
||||||
* @param options optional. See InputOptions.
|
|
||||||
* @returns boolean
|
|
||||||
*/
|
|
||||||
function getBooleanInput(name, options) {
|
|
||||||
const trueValue = ['true', 'True', 'TRUE'];
|
|
||||||
const falseValue = ['false', 'False', 'FALSE'];
|
|
||||||
const val = getInput(name, options);
|
|
||||||
if (trueValue.includes(val))
|
|
||||||
return true;
|
|
||||||
if (falseValue.includes(val))
|
|
||||||
return false;
|
|
||||||
throw new TypeError(`Input does not meet YAML 1.2 "Core Schema" specification: ${name}\n` +
|
|
||||||
`Support boolean input list: \`true | True | TRUE | false | False | FALSE\``);
|
|
||||||
}
|
|
||||||
exports.getBooleanInput = getBooleanInput;
|
|
||||||
/**
|
/**
|
||||||
* Sets the value of an output.
|
* Sets the value of an output.
|
||||||
*
|
*
|
||||||
@@ -160,7 +104,6 @@ exports.getBooleanInput = getBooleanInput;
|
|||||||
*/
|
*/
|
||||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
function setOutput(name, value) {
|
function setOutput(name, value) {
|
||||||
process.stdout.write(os.EOL);
|
|
||||||
command_1.issueCommand('set-output', { name }, value);
|
command_1.issueCommand('set-output', { name }, value);
|
||||||
}
|
}
|
||||||
exports.setOutput = setOutput;
|
exports.setOutput = setOutput;
|
||||||
@@ -207,30 +150,19 @@ exports.debug = debug;
|
|||||||
/**
|
/**
|
||||||
* Adds an error issue
|
* Adds an error issue
|
||||||
* @param message error issue message. Errors will be converted to string via toString()
|
* @param message error issue message. Errors will be converted to string via toString()
|
||||||
* @param properties optional properties to add to the annotation.
|
|
||||||
*/
|
*/
|
||||||
function error(message, properties = {}) {
|
function error(message) {
|
||||||
command_1.issueCommand('error', utils_1.toCommandProperties(properties), message instanceof Error ? message.toString() : message);
|
command_1.issue('error', message instanceof Error ? message.toString() : message);
|
||||||
}
|
}
|
||||||
exports.error = error;
|
exports.error = error;
|
||||||
/**
|
/**
|
||||||
* Adds a warning issue
|
* Adds an warning issue
|
||||||
* @param message warning issue message. Errors will be converted to string via toString()
|
* @param message warning issue message. Errors will be converted to string via toString()
|
||||||
* @param properties optional properties to add to the annotation.
|
|
||||||
*/
|
*/
|
||||||
function warning(message, properties = {}) {
|
function warning(message) {
|
||||||
command_1.issueCommand('warning', utils_1.toCommandProperties(properties), message instanceof Error ? message.toString() : message);
|
command_1.issue('warning', message instanceof Error ? message.toString() : message);
|
||||||
}
|
}
|
||||||
exports.warning = warning;
|
exports.warning = warning;
|
||||||
/**
|
|
||||||
* Adds a notice issue
|
|
||||||
* @param message notice issue message. Errors will be converted to string via toString()
|
|
||||||
* @param properties optional properties to add to the annotation.
|
|
||||||
*/
|
|
||||||
function notice(message, properties = {}) {
|
|
||||||
command_1.issueCommand('notice', utils_1.toCommandProperties(properties), message instanceof Error ? message.toString() : message);
|
|
||||||
}
|
|
||||||
exports.notice = notice;
|
|
||||||
/**
|
/**
|
||||||
* Writes info to log with console.log.
|
* Writes info to log with console.log.
|
||||||
* @param message info message
|
* @param message info message
|
||||||
@@ -303,10 +235,4 @@ function getState(name) {
|
|||||||
return process.env[`STATE_${name}`] || '';
|
return process.env[`STATE_${name}`] || '';
|
||||||
}
|
}
|
||||||
exports.getState = getState;
|
exports.getState = getState;
|
||||||
function getIDToken(aud) {
|
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
|
||||||
return yield oidc_utils_1.OidcClient.getIDToken(aud);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
exports.getIDToken = getIDToken;
|
|
||||||
//# sourceMappingURL=core.js.map
|
//# sourceMappingURL=core.js.map
|
||||||
2
node_modules/@actions/core/lib/core.js.map
generated
vendored
2
node_modules/@actions/core/lib/core.js.map
generated
vendored
@@ -1 +1 @@
|
|||||||
{"version":3,"file":"core.js","sourceRoot":"","sources":["../src/core.ts"],"names":[],"mappings":"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"}
|
{"version":3,"file":"core.js","sourceRoot":"","sources":["../src/core.ts"],"names":[],"mappings":"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"}
|
||||||
17
node_modules/@actions/core/lib/file-command.js
generated
vendored
17
node_modules/@actions/core/lib/file-command.js
generated
vendored
@@ -1,26 +1,13 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
// For internal use, subject to change.
|
// For internal use, subject to change.
|
||||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
||||||
if (k2 === undefined) k2 = k;
|
|
||||||
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
||||||
}) : (function(o, m, k, k2) {
|
|
||||||
if (k2 === undefined) k2 = k;
|
|
||||||
o[k2] = m[k];
|
|
||||||
}));
|
|
||||||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
||||||
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
||||||
}) : function(o, v) {
|
|
||||||
o["default"] = v;
|
|
||||||
});
|
|
||||||
var __importStar = (this && this.__importStar) || function (mod) {
|
var __importStar = (this && this.__importStar) || function (mod) {
|
||||||
if (mod && mod.__esModule) return mod;
|
if (mod && mod.__esModule) return mod;
|
||||||
var result = {};
|
var result = {};
|
||||||
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
|
||||||
__setModuleDefault(result, mod);
|
result["default"] = mod;
|
||||||
return result;
|
return result;
|
||||||
};
|
};
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
exports.issueCommand = void 0;
|
|
||||||
// We use any as a valid input type
|
// We use any as a valid input type
|
||||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||||
const fs = __importStar(require("fs"));
|
const fs = __importStar(require("fs"));
|
||||||
|
|||||||
2
node_modules/@actions/core/lib/file-command.js.map
generated
vendored
2
node_modules/@actions/core/lib/file-command.js.map
generated
vendored
@@ -1 +1 @@
|
|||||||
{"version":3,"file":"file-command.js","sourceRoot":"","sources":["../src/file-command.ts"],"names":[],"mappings":";AAAA,uCAAuC;;;;;;;;;;;;;;;;;;;;;;AAEvC,mCAAmC;AACnC,uDAAuD;AAEvD,uCAAwB;AACxB,uCAAwB;AACxB,mCAAsC;AAEtC,SAAgB,YAAY,CAAC,OAAe,EAAE,OAAY;IACxD,MAAM,QAAQ,GAAG,OAAO,CAAC,GAAG,CAAC,UAAU,OAAO,EAAE,CAAC,CAAA;IACjD,IAAI,CAAC,QAAQ,EAAE;QACb,MAAM,IAAI,KAAK,CACb,wDAAwD,OAAO,EAAE,CAClE,CAAA;KACF;IACD,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,QAAQ,CAAC,EAAE;QAC5B,MAAM,IAAI,KAAK,CAAC,yBAAyB,QAAQ,EAAE,CAAC,CAAA;KACrD;IAED,EAAE,CAAC,cAAc,CAAC,QAAQ,EAAE,GAAG,sBAAc,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,GAAG,EAAE,EAAE;QACjE,QAAQ,EAAE,MAAM;KACjB,CAAC,CAAA;AACJ,CAAC;AAdD,oCAcC"}
|
{"version":3,"file":"file-command.js","sourceRoot":"","sources":["../src/file-command.ts"],"names":[],"mappings":";AAAA,uCAAuC;;;;;;;;;AAEvC,mCAAmC;AACnC,uDAAuD;AAEvD,uCAAwB;AACxB,uCAAwB;AACxB,mCAAsC;AAEtC,SAAgB,YAAY,CAAC,OAAe,EAAE,OAAY;IACxD,MAAM,QAAQ,GAAG,OAAO,CAAC,GAAG,CAAC,UAAU,OAAO,EAAE,CAAC,CAAA;IACjD,IAAI,CAAC,QAAQ,EAAE;QACb,MAAM,IAAI,KAAK,CACb,wDAAwD,OAAO,EAAE,CAClE,CAAA;KACF;IACD,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,QAAQ,CAAC,EAAE;QAC5B,MAAM,IAAI,KAAK,CAAC,yBAAyB,QAAQ,EAAE,CAAC,CAAA;KACrD;IAED,EAAE,CAAC,cAAc,CAAC,QAAQ,EAAE,GAAG,sBAAc,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,GAAG,EAAE,EAAE;QACjE,QAAQ,EAAE,MAAM;KACjB,CAAC,CAAA;AACJ,CAAC;AAdD,oCAcC"}
|
||||||
7
node_modules/@actions/core/lib/oidc-utils.d.ts
generated
vendored
7
node_modules/@actions/core/lib/oidc-utils.d.ts
generated
vendored
@@ -1,7 +0,0 @@
|
|||||||
export declare class OidcClient {
|
|
||||||
private static createHttpClient;
|
|
||||||
private static getRequestToken;
|
|
||||||
private static getIDTokenUrl;
|
|
||||||
private static getCall;
|
|
||||||
static getIDToken(audience?: string): Promise<string>;
|
|
||||||
}
|
|
||||||
77
node_modules/@actions/core/lib/oidc-utils.js
generated
vendored
77
node_modules/@actions/core/lib/oidc-utils.js
generated
vendored
@@ -1,77 +0,0 @@
|
|||||||
"use strict";
|
|
||||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
||||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
||||||
return new (P || (P = Promise))(function (resolve, reject) {
|
|
||||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
||||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
||||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
||||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
||||||
});
|
|
||||||
};
|
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
|
||||||
exports.OidcClient = void 0;
|
|
||||||
const http_client_1 = require("@actions/http-client");
|
|
||||||
const auth_1 = require("@actions/http-client/auth");
|
|
||||||
const core_1 = require("./core");
|
|
||||||
class OidcClient {
|
|
||||||
static createHttpClient(allowRetry = true, maxRetry = 10) {
|
|
||||||
const requestOptions = {
|
|
||||||
allowRetries: allowRetry,
|
|
||||||
maxRetries: maxRetry
|
|
||||||
};
|
|
||||||
return new http_client_1.HttpClient('actions/oidc-client', [new auth_1.BearerCredentialHandler(OidcClient.getRequestToken())], requestOptions);
|
|
||||||
}
|
|
||||||
static getRequestToken() {
|
|
||||||
const token = process.env['ACTIONS_ID_TOKEN_REQUEST_TOKEN'];
|
|
||||||
if (!token) {
|
|
||||||
throw new Error('Unable to get ACTIONS_ID_TOKEN_REQUEST_TOKEN env variable');
|
|
||||||
}
|
|
||||||
return token;
|
|
||||||
}
|
|
||||||
static getIDTokenUrl() {
|
|
||||||
const runtimeUrl = process.env['ACTIONS_ID_TOKEN_REQUEST_URL'];
|
|
||||||
if (!runtimeUrl) {
|
|
||||||
throw new Error('Unable to get ACTIONS_ID_TOKEN_REQUEST_URL env variable');
|
|
||||||
}
|
|
||||||
return runtimeUrl;
|
|
||||||
}
|
|
||||||
static getCall(id_token_url) {
|
|
||||||
var _a;
|
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
|
||||||
const httpclient = OidcClient.createHttpClient();
|
|
||||||
const res = yield httpclient
|
|
||||||
.getJson(id_token_url)
|
|
||||||
.catch(error => {
|
|
||||||
throw new Error(`Failed to get ID Token. \n
|
|
||||||
Error Code : ${error.statusCode}\n
|
|
||||||
Error Message: ${error.result.message}`);
|
|
||||||
});
|
|
||||||
const id_token = (_a = res.result) === null || _a === void 0 ? void 0 : _a.value;
|
|
||||||
if (!id_token) {
|
|
||||||
throw new Error('Response json body do not have ID Token field');
|
|
||||||
}
|
|
||||||
return id_token;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
static getIDToken(audience) {
|
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
|
||||||
try {
|
|
||||||
// New ID Token is requested from action service
|
|
||||||
let id_token_url = OidcClient.getIDTokenUrl();
|
|
||||||
if (audience) {
|
|
||||||
const encodedAudience = encodeURIComponent(audience);
|
|
||||||
id_token_url = `${id_token_url}&audience=${encodedAudience}`;
|
|
||||||
}
|
|
||||||
core_1.debug(`ID token url is ${id_token_url}`);
|
|
||||||
const id_token = yield OidcClient.getCall(id_token_url);
|
|
||||||
core_1.setSecret(id_token);
|
|
||||||
return id_token;
|
|
||||||
}
|
|
||||||
catch (error) {
|
|
||||||
throw new Error(`Error message: ${error.message}`);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
exports.OidcClient = OidcClient;
|
|
||||||
//# sourceMappingURL=oidc-utils.js.map
|
|
||||||
1
node_modules/@actions/core/lib/oidc-utils.js.map
generated
vendored
1
node_modules/@actions/core/lib/oidc-utils.js.map
generated
vendored
@@ -1 +0,0 @@
|
|||||||
{"version":3,"file":"oidc-utils.js","sourceRoot":"","sources":["../src/oidc-utils.ts"],"names":[],"mappings":";;;;;;;;;;;;AAGA,sDAA+C;AAC/C,oDAAiE;AACjE,iCAAuC;AAKvC,MAAa,UAAU;IACb,MAAM,CAAC,gBAAgB,CAC7B,UAAU,GAAG,IAAI,EACjB,QAAQ,GAAG,EAAE;QAEb,MAAM,cAAc,GAAoB;YACtC,YAAY,EAAE,UAAU;YACxB,UAAU,EAAE,QAAQ;SACrB,CAAA;QAED,OAAO,IAAI,wBAAU,CACnB,qBAAqB,EACrB,CAAC,IAAI,8BAAuB,CAAC,UAAU,CAAC,eAAe,EAAE,CAAC,CAAC,EAC3D,cAAc,CACf,CAAA;IACH,CAAC;IAEO,MAAM,CAAC,eAAe;QAC5B,MAAM,KAAK,GAAG,OAAO,CAAC,GAAG,CAAC,gCAAgC,CAAC,CAAA;QAC3D,IAAI,CAAC,KAAK,EAAE;YACV,MAAM,IAAI,KAAK,CACb,2DAA2D,CAC5D,CAAA;SACF;QACD,OAAO,KAAK,CAAA;IACd,CAAC;IAEO,MAAM,CAAC,aAAa;QAC1B,MAAM,UAAU,GAAG,OAAO,CAAC,GAAG,CAAC,8BAA8B,CAAC,CAAA;QAC9D,IAAI,CAAC,UAAU,EAAE;YACf,MAAM,IAAI,KAAK,CAAC,yDAAyD,CAAC,CAAA;SAC3E;QACD,OAAO,UAAU,CAAA;IACnB,CAAC;IAEO,MAAM,CAAO,OAAO,CAAC,YAAoB;;;YAC/C,MAAM,UAAU,GAAG,UAAU,CAAC,gBAAgB,EAAE,CAAA;YAEhD,MAAM,GAAG,GAAG,MAAM,UAAU;iBACzB,OAAO,CAAgB,YAAY,CAAC;iBACpC,KAAK,CAAC,KAAK,CAAC,EAAE;gBACb,MAAM,IAAI,KAAK,CACb;uBACa,KAAK,CAAC,UAAU;yBACd,KAAK,CAAC,MAAM,CAAC,OAAO,EAAE,CACtC,CAAA;YACH,CAAC,CAAC,CAAA;YAEJ,MAAM,QAAQ,SAAG,GAAG,CAAC,MAAM,0CAAE,KAAK,CAAA;YAClC,IAAI,CAAC,QAAQ,EAAE;gBACb,MAAM,IAAI,KAAK,CAAC,+CAA+C,CAAC,CAAA;aACjE;YACD,OAAO,QAAQ,CAAA;;KAChB;IAED,MAAM,CAAO,UAAU,CAAC,QAAiB;;YACvC,IAAI;gBACF,gDAAgD;gBAChD,IAAI,YAAY,GAAW,UAAU,CAAC,aAAa,EAAE,CAAA;gBACrD,IAAI,QAAQ,EAAE;oBACZ,MAAM,eAAe,GAAG,kBAAkB,CAAC,QAAQ,CAAC,CAAA;oBACpD,YAAY,GAAG,GAAG,YAAY,aAAa,eAAe,EAAE,CAAA;iBAC7D;gBAED,YAAK,CAAC,mBAAmB,YAAY,EAAE,CAAC,CAAA;gBAExC,MAAM,QAAQ,GAAG,MAAM,UAAU,CAAC,OAAO,CAAC,YAAY,CAAC,CAAA;gBACvD,gBAAS,CAAC,QAAQ,CAAC,CAAA;gBACnB,OAAO,QAAQ,CAAA;aAChB;YAAC,OAAO,KAAK,EAAE;gBACd,MAAM,IAAI,KAAK,CAAC,kBAAkB,KAAK,CAAC,OAAO,EAAE,CAAC,CAAA;aACnD;QACH,CAAC;KAAA;CACF;AAzED,gCAyEC"}
|
|
||||||
9
node_modules/@actions/core/lib/utils.d.ts
generated
vendored
9
node_modules/@actions/core/lib/utils.d.ts
generated
vendored
@@ -1,14 +1,5 @@
|
|||||||
import { AnnotationProperties } from './core';
|
|
||||||
import { CommandProperties } from './command';
|
|
||||||
/**
|
/**
|
||||||
* Sanitizes an input into a string so it can be passed into issueCommand safely
|
* Sanitizes an input into a string so it can be passed into issueCommand safely
|
||||||
* @param input input to sanitize into a string
|
* @param input input to sanitize into a string
|
||||||
*/
|
*/
|
||||||
export declare function toCommandValue(input: any): string;
|
export declare function toCommandValue(input: any): string;
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @param annotationProperties
|
|
||||||
* @returns The command properties to send with the actual annotation command
|
|
||||||
* See IssueCommandProperties: https://github.com/actions/runner/blob/main/src/Runner.Worker/ActionCommandManager.cs#L646
|
|
||||||
*/
|
|
||||||
export declare function toCommandProperties(annotationProperties: AnnotationProperties): CommandProperties;
|
|
||||||
|
|||||||
21
node_modules/@actions/core/lib/utils.js
generated
vendored
21
node_modules/@actions/core/lib/utils.js
generated
vendored
@@ -2,7 +2,6 @@
|
|||||||
// We use any as a valid input type
|
// We use any as a valid input type
|
||||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
exports.toCommandProperties = exports.toCommandValue = void 0;
|
|
||||||
/**
|
/**
|
||||||
* Sanitizes an input into a string so it can be passed into issueCommand safely
|
* Sanitizes an input into a string so it can be passed into issueCommand safely
|
||||||
* @param input input to sanitize into a string
|
* @param input input to sanitize into a string
|
||||||
@@ -17,24 +16,4 @@ function toCommandValue(input) {
|
|||||||
return JSON.stringify(input);
|
return JSON.stringify(input);
|
||||||
}
|
}
|
||||||
exports.toCommandValue = toCommandValue;
|
exports.toCommandValue = toCommandValue;
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @param annotationProperties
|
|
||||||
* @returns The command properties to send with the actual annotation command
|
|
||||||
* See IssueCommandProperties: https://github.com/actions/runner/blob/main/src/Runner.Worker/ActionCommandManager.cs#L646
|
|
||||||
*/
|
|
||||||
function toCommandProperties(annotationProperties) {
|
|
||||||
if (!Object.keys(annotationProperties).length) {
|
|
||||||
return {};
|
|
||||||
}
|
|
||||||
return {
|
|
||||||
title: annotationProperties.title,
|
|
||||||
file: annotationProperties.file,
|
|
||||||
line: annotationProperties.startLine,
|
|
||||||
endLine: annotationProperties.endLine,
|
|
||||||
col: annotationProperties.startColumn,
|
|
||||||
endColumn: annotationProperties.endColumn
|
|
||||||
};
|
|
||||||
}
|
|
||||||
exports.toCommandProperties = toCommandProperties;
|
|
||||||
//# sourceMappingURL=utils.js.map
|
//# sourceMappingURL=utils.js.map
|
||||||
2
node_modules/@actions/core/lib/utils.js.map
generated
vendored
2
node_modules/@actions/core/lib/utils.js.map
generated
vendored
@@ -1 +1 @@
|
|||||||
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":";AAAA,mCAAmC;AACnC,uDAAuD;;;AAKvD;;;GAGG;AACH,SAAgB,cAAc,CAAC,KAAU;IACvC,IAAI,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK,SAAS,EAAE;QACzC,OAAO,EAAE,CAAA;KACV;SAAM,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,YAAY,MAAM,EAAE;QAC/D,OAAO,KAAe,CAAA;KACvB;IACD,OAAO,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAA;AAC9B,CAAC;AAPD,wCAOC;AAED;;;;;GAKG;AACH,SAAgB,mBAAmB,CACjC,oBAA0C;IAE1C,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,oBAAoB,CAAC,CAAC,MAAM,EAAE;QAC7C,OAAO,EAAE,CAAA;KACV;IAED,OAAO;QACL,KAAK,EAAE,oBAAoB,CAAC,KAAK;QACjC,IAAI,EAAE,oBAAoB,CAAC,IAAI;QAC/B,IAAI,EAAE,oBAAoB,CAAC,SAAS;QACpC,OAAO,EAAE,oBAAoB,CAAC,OAAO;QACrC,GAAG,EAAE,oBAAoB,CAAC,WAAW;QACrC,SAAS,EAAE,oBAAoB,CAAC,SAAS;KAC1C,CAAA;AACH,CAAC;AAfD,kDAeC"}
|
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":";AAAA,mCAAmC;AACnC,uDAAuD;;AAEvD;;;GAGG;AACH,SAAgB,cAAc,CAAC,KAAU;IACvC,IAAI,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK,SAAS,EAAE;QACzC,OAAO,EAAE,CAAA;KACV;SAAM,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,YAAY,MAAM,EAAE;QAC/D,OAAO,KAAe,CAAA;KACvB;IACD,OAAO,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAA;AAC9B,CAAC;AAPD,wCAOC"}
|
||||||
67
node_modules/@actions/core/package.json
generated
vendored
67
node_modules/@actions/core/package.json
generated
vendored
@@ -1,16 +1,41 @@
|
|||||||
{
|
{
|
||||||
"name": "@actions/core",
|
"_args": [
|
||||||
"version": "1.6.0",
|
[
|
||||||
"description": "Actions core lib",
|
"@actions/core@1.2.6",
|
||||||
"keywords": [
|
"E:\\Repos\\GHActions\\login"
|
||||||
"github",
|
]
|
||||||
"actions",
|
|
||||||
"core"
|
|
||||||
],
|
],
|
||||||
"homepage": "https://github.com/actions/toolkit/tree/main/packages/core",
|
"_from": "@actions/core@1.2.6",
|
||||||
"license": "MIT",
|
"_id": "@actions/core@1.2.6",
|
||||||
"main": "lib/core.js",
|
"_inBundle": false,
|
||||||
"types": "lib/core.d.ts",
|
"_integrity": "sha512-ZQYitnqiyBc3D+k7LsgSBmMDVkOVidaagDG7j3fOym77jNunWRuYx7VSHa9GNfFZh+zh61xsCjRj4JxMZlDqTA==",
|
||||||
|
"_location": "/@actions/core",
|
||||||
|
"_phantomChildren": {},
|
||||||
|
"_requested": {
|
||||||
|
"type": "version",
|
||||||
|
"registry": true,
|
||||||
|
"raw": "@actions/core@1.2.6",
|
||||||
|
"name": "@actions/core",
|
||||||
|
"escapedName": "@actions%2fcore",
|
||||||
|
"scope": "@actions",
|
||||||
|
"rawSpec": "1.2.6",
|
||||||
|
"saveSpec": null,
|
||||||
|
"fetchSpec": "1.2.6"
|
||||||
|
},
|
||||||
|
"_requiredBy": [
|
||||||
|
"/",
|
||||||
|
"/actions-secret-parser"
|
||||||
|
],
|
||||||
|
"_resolved": "https://registry.npmjs.org/@actions/core/-/core-1.2.6.tgz",
|
||||||
|
"_spec": "1.2.6",
|
||||||
|
"_where": "E:\\Repos\\GHActions\\login",
|
||||||
|
"bugs": {
|
||||||
|
"url": "https://github.com/actions/toolkit/issues"
|
||||||
|
},
|
||||||
|
"description": "Actions core lib",
|
||||||
|
"devDependencies": {
|
||||||
|
"@types/node": "^12.0.2"
|
||||||
|
},
|
||||||
"directories": {
|
"directories": {
|
||||||
"lib": "lib",
|
"lib": "lib",
|
||||||
"test": "__tests__"
|
"test": "__tests__"
|
||||||
@@ -19,6 +44,15 @@
|
|||||||
"lib",
|
"lib",
|
||||||
"!.DS_Store"
|
"!.DS_Store"
|
||||||
],
|
],
|
||||||
|
"homepage": "https://github.com/actions/toolkit/tree/main/packages/core",
|
||||||
|
"keywords": [
|
||||||
|
"github",
|
||||||
|
"actions",
|
||||||
|
"core"
|
||||||
|
],
|
||||||
|
"license": "MIT",
|
||||||
|
"main": "lib/core.js",
|
||||||
|
"name": "@actions/core",
|
||||||
"publishConfig": {
|
"publishConfig": {
|
||||||
"access": "public"
|
"access": "public"
|
||||||
},
|
},
|
||||||
@@ -32,13 +66,6 @@
|
|||||||
"test": "echo \"Error: run tests from root\" && exit 1",
|
"test": "echo \"Error: run tests from root\" && exit 1",
|
||||||
"tsc": "tsc"
|
"tsc": "tsc"
|
||||||
},
|
},
|
||||||
"bugs": {
|
"types": "lib/core.d.ts",
|
||||||
"url": "https://github.com/actions/toolkit/issues"
|
"version": "1.2.6"
|
||||||
},
|
|
||||||
"dependencies": {
|
|
||||||
"@actions/http-client": "^1.0.11"
|
|
||||||
},
|
|
||||||
"devDependencies": {
|
|
||||||
"@types/node": "^12.0.2"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
21
node_modules/@actions/http-client/LICENSE
generated
vendored
21
node_modules/@actions/http-client/LICENSE
generated
vendored
@@ -1,21 +0,0 @@
|
|||||||
Actions Http Client for Node.js
|
|
||||||
|
|
||||||
Copyright (c) GitHub, Inc.
|
|
||||||
|
|
||||||
All rights reserved.
|
|
||||||
|
|
||||||
MIT License
|
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
|
|
||||||
associated documentation files (the "Software"), to deal in the Software without restriction,
|
|
||||||
including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
|
||||||
and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
|
|
||||||
subject to the following conditions:
|
|
||||||
|
|
||||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
|
|
||||||
LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
|
|
||||||
NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
|
||||||
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
|
||||||
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
||||||
79
node_modules/@actions/http-client/README.md
generated
vendored
79
node_modules/@actions/http-client/README.md
generated
vendored
@@ -1,79 +0,0 @@
|
|||||||
|
|
||||||
<p align="center">
|
|
||||||
<img src="actions.png">
|
|
||||||
</p>
|
|
||||||
|
|
||||||
# Actions Http-Client
|
|
||||||
|
|
||||||
[](https://github.com/actions/http-client/actions)
|
|
||||||
|
|
||||||
A lightweight HTTP client optimized for use with actions, TypeScript with generics and async await.
|
|
||||||
|
|
||||||
## Features
|
|
||||||
|
|
||||||
- HTTP client with TypeScript generics and async/await/Promises
|
|
||||||
- Typings included so no need to acquire separately (great for intellisense and no versioning drift)
|
|
||||||
- [Proxy support](https://help.github.com/en/actions/automating-your-workflow-with-github-actions/about-self-hosted-runners#using-a-proxy-server-with-self-hosted-runners) just works with actions and the runner
|
|
||||||
- Targets ES2019 (runner runs actions with node 12+). Only supported on node 12+.
|
|
||||||
- Basic, Bearer and PAT Support out of the box. Extensible handlers for others.
|
|
||||||
- Redirects supported
|
|
||||||
|
|
||||||
Features and releases [here](./RELEASES.md)
|
|
||||||
|
|
||||||
## Install
|
|
||||||
|
|
||||||
```
|
|
||||||
npm install @actions/http-client --save
|
|
||||||
```
|
|
||||||
|
|
||||||
## Samples
|
|
||||||
|
|
||||||
See the [HTTP](./__tests__) tests for detailed examples.
|
|
||||||
|
|
||||||
## Errors
|
|
||||||
|
|
||||||
### HTTP
|
|
||||||
|
|
||||||
The HTTP client does not throw unless truly exceptional.
|
|
||||||
|
|
||||||
* A request that successfully executes resulting in a 404, 500 etc... will return a response object with a status code and a body.
|
|
||||||
* Redirects (3xx) will be followed by default.
|
|
||||||
|
|
||||||
See [HTTP tests](./__tests__) for detailed examples.
|
|
||||||
|
|
||||||
## Debugging
|
|
||||||
|
|
||||||
To enable detailed console logging of all HTTP requests and responses, set the NODE_DEBUG environment varible:
|
|
||||||
|
|
||||||
```
|
|
||||||
export NODE_DEBUG=http
|
|
||||||
```
|
|
||||||
|
|
||||||
## Node support
|
|
||||||
|
|
||||||
The http-client is built using the latest LTS version of Node 12. It may work on previous node LTS versions but it's tested and officially supported on Node12+.
|
|
||||||
|
|
||||||
## Support and Versioning
|
|
||||||
|
|
||||||
We follow semver and will hold compatibility between major versions and increment the minor version with new features and capabilities (while holding compat).
|
|
||||||
|
|
||||||
## Contributing
|
|
||||||
|
|
||||||
We welcome PRs. Please create an issue and if applicable, a design before proceeding with code.
|
|
||||||
|
|
||||||
once:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
$ npm install
|
|
||||||
```
|
|
||||||
|
|
||||||
To build:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
$ npm run build
|
|
||||||
```
|
|
||||||
|
|
||||||
To run all tests:
|
|
||||||
```bash
|
|
||||||
$ npm test
|
|
||||||
```
|
|
||||||
26
node_modules/@actions/http-client/RELEASES.md
generated
vendored
26
node_modules/@actions/http-client/RELEASES.md
generated
vendored
@@ -1,26 +0,0 @@
|
|||||||
## Releases
|
|
||||||
|
|
||||||
## 1.0.10
|
|
||||||
|
|
||||||
Contains a bug fix where proxy is defined without a user and password. see [PR here](https://github.com/actions/http-client/pull/42)
|
|
||||||
|
|
||||||
## 1.0.9
|
|
||||||
Throw HttpClientError instead of a generic Error from the \<verb>Json() helper methods when the server responds with a non-successful status code.
|
|
||||||
|
|
||||||
## 1.0.8
|
|
||||||
Fixed security issue where a redirect (e.g. 302) to another domain would pass headers. The fix was to strip the authorization header if the hostname was different. More [details in PR #27](https://github.com/actions/http-client/pull/27)
|
|
||||||
|
|
||||||
## 1.0.7
|
|
||||||
Update NPM dependencies and add 429 to the list of HttpCodes
|
|
||||||
|
|
||||||
## 1.0.6
|
|
||||||
Automatically sends Content-Type and Accept application/json headers for \<verb>Json() helper methods if not set in the client or parameters.
|
|
||||||
|
|
||||||
## 1.0.5
|
|
||||||
Adds \<verb>Json() helper methods for json over http scenarios.
|
|
||||||
|
|
||||||
## 1.0.4
|
|
||||||
Started to add \<verb>Json() helper methods. Do not use this release for that. Use >= 1.0.5 since there was an issue with types.
|
|
||||||
|
|
||||||
## 1.0.1 to 1.0.3
|
|
||||||
Adds proxy support.
|
|
||||||
BIN
node_modules/@actions/http-client/actions.png
generated
vendored
BIN
node_modules/@actions/http-client/actions.png
generated
vendored
Binary file not shown.
|
Before Width: | Height: | Size: 33 KiB |
23
node_modules/@actions/http-client/auth.d.ts
generated
vendored
23
node_modules/@actions/http-client/auth.d.ts
generated
vendored
@@ -1,23 +0,0 @@
|
|||||||
import ifm = require('./interfaces');
|
|
||||||
export declare class BasicCredentialHandler implements ifm.IRequestHandler {
|
|
||||||
username: string;
|
|
||||||
password: string;
|
|
||||||
constructor(username: string, password: string);
|
|
||||||
prepareRequest(options: any): void;
|
|
||||||
canHandleAuthentication(response: ifm.IHttpClientResponse): boolean;
|
|
||||||
handleAuthentication(httpClient: ifm.IHttpClient, requestInfo: ifm.IRequestInfo, objs: any): Promise<ifm.IHttpClientResponse>;
|
|
||||||
}
|
|
||||||
export declare class BearerCredentialHandler implements ifm.IRequestHandler {
|
|
||||||
token: string;
|
|
||||||
constructor(token: string);
|
|
||||||
prepareRequest(options: any): void;
|
|
||||||
canHandleAuthentication(response: ifm.IHttpClientResponse): boolean;
|
|
||||||
handleAuthentication(httpClient: ifm.IHttpClient, requestInfo: ifm.IRequestInfo, objs: any): Promise<ifm.IHttpClientResponse>;
|
|
||||||
}
|
|
||||||
export declare class PersonalAccessTokenCredentialHandler implements ifm.IRequestHandler {
|
|
||||||
token: string;
|
|
||||||
constructor(token: string);
|
|
||||||
prepareRequest(options: any): void;
|
|
||||||
canHandleAuthentication(response: ifm.IHttpClientResponse): boolean;
|
|
||||||
handleAuthentication(httpClient: ifm.IHttpClient, requestInfo: ifm.IRequestInfo, objs: any): Promise<ifm.IHttpClientResponse>;
|
|
||||||
}
|
|
||||||
58
node_modules/@actions/http-client/auth.js
generated
vendored
58
node_modules/@actions/http-client/auth.js
generated
vendored
@@ -1,58 +0,0 @@
|
|||||||
"use strict";
|
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
|
||||||
class BasicCredentialHandler {
|
|
||||||
constructor(username, password) {
|
|
||||||
this.username = username;
|
|
||||||
this.password = password;
|
|
||||||
}
|
|
||||||
prepareRequest(options) {
|
|
||||||
options.headers['Authorization'] =
|
|
||||||
'Basic ' +
|
|
||||||
Buffer.from(this.username + ':' + this.password).toString('base64');
|
|
||||||
}
|
|
||||||
// This handler cannot handle 401
|
|
||||||
canHandleAuthentication(response) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
handleAuthentication(httpClient, requestInfo, objs) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
exports.BasicCredentialHandler = BasicCredentialHandler;
|
|
||||||
class BearerCredentialHandler {
|
|
||||||
constructor(token) {
|
|
||||||
this.token = token;
|
|
||||||
}
|
|
||||||
// currently implements pre-authorization
|
|
||||||
// TODO: support preAuth = false where it hooks on 401
|
|
||||||
prepareRequest(options) {
|
|
||||||
options.headers['Authorization'] = 'Bearer ' + this.token;
|
|
||||||
}
|
|
||||||
// This handler cannot handle 401
|
|
||||||
canHandleAuthentication(response) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
handleAuthentication(httpClient, requestInfo, objs) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
exports.BearerCredentialHandler = BearerCredentialHandler;
|
|
||||||
class PersonalAccessTokenCredentialHandler {
|
|
||||||
constructor(token) {
|
|
||||||
this.token = token;
|
|
||||||
}
|
|
||||||
// currently implements pre-authorization
|
|
||||||
// TODO: support preAuth = false where it hooks on 401
|
|
||||||
prepareRequest(options) {
|
|
||||||
options.headers['Authorization'] =
|
|
||||||
'Basic ' + Buffer.from('PAT:' + this.token).toString('base64');
|
|
||||||
}
|
|
||||||
// This handler cannot handle 401
|
|
||||||
canHandleAuthentication(response) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
handleAuthentication(httpClient, requestInfo, objs) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
exports.PersonalAccessTokenCredentialHandler = PersonalAccessTokenCredentialHandler;
|
|
||||||
124
node_modules/@actions/http-client/index.d.ts
generated
vendored
124
node_modules/@actions/http-client/index.d.ts
generated
vendored
@@ -1,124 +0,0 @@
|
|||||||
/// <reference types="node" />
|
|
||||||
import http = require('http');
|
|
||||||
import ifm = require('./interfaces');
|
|
||||||
export declare enum HttpCodes {
|
|
||||||
OK = 200,
|
|
||||||
MultipleChoices = 300,
|
|
||||||
MovedPermanently = 301,
|
|
||||||
ResourceMoved = 302,
|
|
||||||
SeeOther = 303,
|
|
||||||
NotModified = 304,
|
|
||||||
UseProxy = 305,
|
|
||||||
SwitchProxy = 306,
|
|
||||||
TemporaryRedirect = 307,
|
|
||||||
PermanentRedirect = 308,
|
|
||||||
BadRequest = 400,
|
|
||||||
Unauthorized = 401,
|
|
||||||
PaymentRequired = 402,
|
|
||||||
Forbidden = 403,
|
|
||||||
NotFound = 404,
|
|
||||||
MethodNotAllowed = 405,
|
|
||||||
NotAcceptable = 406,
|
|
||||||
ProxyAuthenticationRequired = 407,
|
|
||||||
RequestTimeout = 408,
|
|
||||||
Conflict = 409,
|
|
||||||
Gone = 410,
|
|
||||||
TooManyRequests = 429,
|
|
||||||
InternalServerError = 500,
|
|
||||||
NotImplemented = 501,
|
|
||||||
BadGateway = 502,
|
|
||||||
ServiceUnavailable = 503,
|
|
||||||
GatewayTimeout = 504
|
|
||||||
}
|
|
||||||
export declare enum Headers {
|
|
||||||
Accept = "accept",
|
|
||||||
ContentType = "content-type"
|
|
||||||
}
|
|
||||||
export declare enum MediaTypes {
|
|
||||||
ApplicationJson = "application/json"
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* Returns the proxy URL, depending upon the supplied url and proxy environment variables.
|
|
||||||
* @param serverUrl The server URL where the request will be sent. For example, https://api.github.com
|
|
||||||
*/
|
|
||||||
export declare function getProxyUrl(serverUrl: string): string;
|
|
||||||
export declare class HttpClientError extends Error {
|
|
||||||
constructor(message: string, statusCode: number);
|
|
||||||
statusCode: number;
|
|
||||||
result?: any;
|
|
||||||
}
|
|
||||||
export declare class HttpClientResponse implements ifm.IHttpClientResponse {
|
|
||||||
constructor(message: http.IncomingMessage);
|
|
||||||
message: http.IncomingMessage;
|
|
||||||
readBody(): Promise<string>;
|
|
||||||
}
|
|
||||||
export declare function isHttps(requestUrl: string): boolean;
|
|
||||||
export declare class HttpClient {
|
|
||||||
userAgent: string | undefined;
|
|
||||||
handlers: ifm.IRequestHandler[];
|
|
||||||
requestOptions: ifm.IRequestOptions;
|
|
||||||
private _ignoreSslError;
|
|
||||||
private _socketTimeout;
|
|
||||||
private _allowRedirects;
|
|
||||||
private _allowRedirectDowngrade;
|
|
||||||
private _maxRedirects;
|
|
||||||
private _allowRetries;
|
|
||||||
private _maxRetries;
|
|
||||||
private _agent;
|
|
||||||
private _proxyAgent;
|
|
||||||
private _keepAlive;
|
|
||||||
private _disposed;
|
|
||||||
constructor(userAgent?: string, handlers?: ifm.IRequestHandler[], requestOptions?: ifm.IRequestOptions);
|
|
||||||
options(requestUrl: string, additionalHeaders?: ifm.IHeaders): Promise<ifm.IHttpClientResponse>;
|
|
||||||
get(requestUrl: string, additionalHeaders?: ifm.IHeaders): Promise<ifm.IHttpClientResponse>;
|
|
||||||
del(requestUrl: string, additionalHeaders?: ifm.IHeaders): Promise<ifm.IHttpClientResponse>;
|
|
||||||
post(requestUrl: string, data: string, additionalHeaders?: ifm.IHeaders): Promise<ifm.IHttpClientResponse>;
|
|
||||||
patch(requestUrl: string, data: string, additionalHeaders?: ifm.IHeaders): Promise<ifm.IHttpClientResponse>;
|
|
||||||
put(requestUrl: string, data: string, additionalHeaders?: ifm.IHeaders): Promise<ifm.IHttpClientResponse>;
|
|
||||||
head(requestUrl: string, additionalHeaders?: ifm.IHeaders): Promise<ifm.IHttpClientResponse>;
|
|
||||||
sendStream(verb: string, requestUrl: string, stream: NodeJS.ReadableStream, additionalHeaders?: ifm.IHeaders): Promise<ifm.IHttpClientResponse>;
|
|
||||||
/**
|
|
||||||
* Gets a typed object from an endpoint
|
|
||||||
* Be aware that not found returns a null. Other errors (4xx, 5xx) reject the promise
|
|
||||||
*/
|
|
||||||
getJson<T>(requestUrl: string, additionalHeaders?: ifm.IHeaders): Promise<ifm.ITypedResponse<T>>;
|
|
||||||
postJson<T>(requestUrl: string, obj: any, additionalHeaders?: ifm.IHeaders): Promise<ifm.ITypedResponse<T>>;
|
|
||||||
putJson<T>(requestUrl: string, obj: any, additionalHeaders?: ifm.IHeaders): Promise<ifm.ITypedResponse<T>>;
|
|
||||||
patchJson<T>(requestUrl: string, obj: any, additionalHeaders?: ifm.IHeaders): Promise<ifm.ITypedResponse<T>>;
|
|
||||||
/**
|
|
||||||
* Makes a raw http request.
|
|
||||||
* All other methods such as get, post, patch, and request ultimately call this.
|
|
||||||
* Prefer get, del, post and patch
|
|
||||||
*/
|
|
||||||
request(verb: string, requestUrl: string, data: string | NodeJS.ReadableStream, headers: ifm.IHeaders): Promise<ifm.IHttpClientResponse>;
|
|
||||||
/**
|
|
||||||
* Needs to be called if keepAlive is set to true in request options.
|
|
||||||
*/
|
|
||||||
dispose(): void;
|
|
||||||
/**
|
|
||||||
* Raw request.
|
|
||||||
* @param info
|
|
||||||
* @param data
|
|
||||||
*/
|
|
||||||
requestRaw(info: ifm.IRequestInfo, data: string | NodeJS.ReadableStream): Promise<ifm.IHttpClientResponse>;
|
|
||||||
/**
|
|
||||||
* Raw request with callback.
|
|
||||||
* @param info
|
|
||||||
* @param data
|
|
||||||
* @param onResult
|
|
||||||
*/
|
|
||||||
requestRawWithCallback(info: ifm.IRequestInfo, data: string | NodeJS.ReadableStream, onResult: (err: any, res: ifm.IHttpClientResponse) => void): void;
|
|
||||||
/**
|
|
||||||
* Gets an http agent. This function is useful when you need an http agent that handles
|
|
||||||
* routing through a proxy server - depending upon the url and proxy environment variables.
|
|
||||||
* @param serverUrl The server URL where the request will be sent. For example, https://api.github.com
|
|
||||||
*/
|
|
||||||
getAgent(serverUrl: string): http.Agent;
|
|
||||||
private _prepareRequest;
|
|
||||||
private _mergeHeaders;
|
|
||||||
private _getExistingOrDefaultHeader;
|
|
||||||
private _getAgent;
|
|
||||||
private _performExponentialBackoff;
|
|
||||||
private static dateTimeDeserializer;
|
|
||||||
private _processResponse;
|
|
||||||
}
|
|
||||||
537
node_modules/@actions/http-client/index.js
generated
vendored
537
node_modules/@actions/http-client/index.js
generated
vendored
@@ -1,537 +0,0 @@
|
|||||||
"use strict";
|
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
|
||||||
const http = require("http");
|
|
||||||
const https = require("https");
|
|
||||||
const pm = require("./proxy");
|
|
||||||
let tunnel;
|
|
||||||
var HttpCodes;
|
|
||||||
(function (HttpCodes) {
|
|
||||||
HttpCodes[HttpCodes["OK"] = 200] = "OK";
|
|
||||||
HttpCodes[HttpCodes["MultipleChoices"] = 300] = "MultipleChoices";
|
|
||||||
HttpCodes[HttpCodes["MovedPermanently"] = 301] = "MovedPermanently";
|
|
||||||
HttpCodes[HttpCodes["ResourceMoved"] = 302] = "ResourceMoved";
|
|
||||||
HttpCodes[HttpCodes["SeeOther"] = 303] = "SeeOther";
|
|
||||||
HttpCodes[HttpCodes["NotModified"] = 304] = "NotModified";
|
|
||||||
HttpCodes[HttpCodes["UseProxy"] = 305] = "UseProxy";
|
|
||||||
HttpCodes[HttpCodes["SwitchProxy"] = 306] = "SwitchProxy";
|
|
||||||
HttpCodes[HttpCodes["TemporaryRedirect"] = 307] = "TemporaryRedirect";
|
|
||||||
HttpCodes[HttpCodes["PermanentRedirect"] = 308] = "PermanentRedirect";
|
|
||||||
HttpCodes[HttpCodes["BadRequest"] = 400] = "BadRequest";
|
|
||||||
HttpCodes[HttpCodes["Unauthorized"] = 401] = "Unauthorized";
|
|
||||||
HttpCodes[HttpCodes["PaymentRequired"] = 402] = "PaymentRequired";
|
|
||||||
HttpCodes[HttpCodes["Forbidden"] = 403] = "Forbidden";
|
|
||||||
HttpCodes[HttpCodes["NotFound"] = 404] = "NotFound";
|
|
||||||
HttpCodes[HttpCodes["MethodNotAllowed"] = 405] = "MethodNotAllowed";
|
|
||||||
HttpCodes[HttpCodes["NotAcceptable"] = 406] = "NotAcceptable";
|
|
||||||
HttpCodes[HttpCodes["ProxyAuthenticationRequired"] = 407] = "ProxyAuthenticationRequired";
|
|
||||||
HttpCodes[HttpCodes["RequestTimeout"] = 408] = "RequestTimeout";
|
|
||||||
HttpCodes[HttpCodes["Conflict"] = 409] = "Conflict";
|
|
||||||
HttpCodes[HttpCodes["Gone"] = 410] = "Gone";
|
|
||||||
HttpCodes[HttpCodes["TooManyRequests"] = 429] = "TooManyRequests";
|
|
||||||
HttpCodes[HttpCodes["InternalServerError"] = 500] = "InternalServerError";
|
|
||||||
HttpCodes[HttpCodes["NotImplemented"] = 501] = "NotImplemented";
|
|
||||||
HttpCodes[HttpCodes["BadGateway"] = 502] = "BadGateway";
|
|
||||||
HttpCodes[HttpCodes["ServiceUnavailable"] = 503] = "ServiceUnavailable";
|
|
||||||
HttpCodes[HttpCodes["GatewayTimeout"] = 504] = "GatewayTimeout";
|
|
||||||
})(HttpCodes = exports.HttpCodes || (exports.HttpCodes = {}));
|
|
||||||
var Headers;
|
|
||||||
(function (Headers) {
|
|
||||||
Headers["Accept"] = "accept";
|
|
||||||
Headers["ContentType"] = "content-type";
|
|
||||||
})(Headers = exports.Headers || (exports.Headers = {}));
|
|
||||||
var MediaTypes;
|
|
||||||
(function (MediaTypes) {
|
|
||||||
MediaTypes["ApplicationJson"] = "application/json";
|
|
||||||
})(MediaTypes = exports.MediaTypes || (exports.MediaTypes = {}));
|
|
||||||
/**
|
|
||||||
* Returns the proxy URL, depending upon the supplied url and proxy environment variables.
|
|
||||||
* @param serverUrl The server URL where the request will be sent. For example, https://api.github.com
|
|
||||||
*/
|
|
||||||
function getProxyUrl(serverUrl) {
|
|
||||||
let proxyUrl = pm.getProxyUrl(new URL(serverUrl));
|
|
||||||
return proxyUrl ? proxyUrl.href : '';
|
|
||||||
}
|
|
||||||
exports.getProxyUrl = getProxyUrl;
|
|
||||||
const HttpRedirectCodes = [
|
|
||||||
HttpCodes.MovedPermanently,
|
|
||||||
HttpCodes.ResourceMoved,
|
|
||||||
HttpCodes.SeeOther,
|
|
||||||
HttpCodes.TemporaryRedirect,
|
|
||||||
HttpCodes.PermanentRedirect
|
|
||||||
];
|
|
||||||
const HttpResponseRetryCodes = [
|
|
||||||
HttpCodes.BadGateway,
|
|
||||||
HttpCodes.ServiceUnavailable,
|
|
||||||
HttpCodes.GatewayTimeout
|
|
||||||
];
|
|
||||||
const RetryableHttpVerbs = ['OPTIONS', 'GET', 'DELETE', 'HEAD'];
|
|
||||||
const ExponentialBackoffCeiling = 10;
|
|
||||||
const ExponentialBackoffTimeSlice = 5;
|
|
||||||
class HttpClientError extends Error {
|
|
||||||
constructor(message, statusCode) {
|
|
||||||
super(message);
|
|
||||||
this.name = 'HttpClientError';
|
|
||||||
this.statusCode = statusCode;
|
|
||||||
Object.setPrototypeOf(this, HttpClientError.prototype);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
exports.HttpClientError = HttpClientError;
|
|
||||||
class HttpClientResponse {
|
|
||||||
constructor(message) {
|
|
||||||
this.message = message;
|
|
||||||
}
|
|
||||||
readBody() {
|
|
||||||
return new Promise(async (resolve, reject) => {
|
|
||||||
let output = Buffer.alloc(0);
|
|
||||||
this.message.on('data', (chunk) => {
|
|
||||||
output = Buffer.concat([output, chunk]);
|
|
||||||
});
|
|
||||||
this.message.on('end', () => {
|
|
||||||
resolve(output.toString());
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
exports.HttpClientResponse = HttpClientResponse;
|
|
||||||
function isHttps(requestUrl) {
|
|
||||||
let parsedUrl = new URL(requestUrl);
|
|
||||||
return parsedUrl.protocol === 'https:';
|
|
||||||
}
|
|
||||||
exports.isHttps = isHttps;
|
|
||||||
class HttpClient {
|
|
||||||
constructor(userAgent, handlers, requestOptions) {
|
|
||||||
this._ignoreSslError = false;
|
|
||||||
this._allowRedirects = true;
|
|
||||||
this._allowRedirectDowngrade = false;
|
|
||||||
this._maxRedirects = 50;
|
|
||||||
this._allowRetries = false;
|
|
||||||
this._maxRetries = 1;
|
|
||||||
this._keepAlive = false;
|
|
||||||
this._disposed = false;
|
|
||||||
this.userAgent = userAgent;
|
|
||||||
this.handlers = handlers || [];
|
|
||||||
this.requestOptions = requestOptions;
|
|
||||||
if (requestOptions) {
|
|
||||||
if (requestOptions.ignoreSslError != null) {
|
|
||||||
this._ignoreSslError = requestOptions.ignoreSslError;
|
|
||||||
}
|
|
||||||
this._socketTimeout = requestOptions.socketTimeout;
|
|
||||||
if (requestOptions.allowRedirects != null) {
|
|
||||||
this._allowRedirects = requestOptions.allowRedirects;
|
|
||||||
}
|
|
||||||
if (requestOptions.allowRedirectDowngrade != null) {
|
|
||||||
this._allowRedirectDowngrade = requestOptions.allowRedirectDowngrade;
|
|
||||||
}
|
|
||||||
if (requestOptions.maxRedirects != null) {
|
|
||||||
this._maxRedirects = Math.max(requestOptions.maxRedirects, 0);
|
|
||||||
}
|
|
||||||
if (requestOptions.keepAlive != null) {
|
|
||||||
this._keepAlive = requestOptions.keepAlive;
|
|
||||||
}
|
|
||||||
if (requestOptions.allowRetries != null) {
|
|
||||||
this._allowRetries = requestOptions.allowRetries;
|
|
||||||
}
|
|
||||||
if (requestOptions.maxRetries != null) {
|
|
||||||
this._maxRetries = requestOptions.maxRetries;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
options(requestUrl, additionalHeaders) {
|
|
||||||
return this.request('OPTIONS', requestUrl, null, additionalHeaders || {});
|
|
||||||
}
|
|
||||||
get(requestUrl, additionalHeaders) {
|
|
||||||
return this.request('GET', requestUrl, null, additionalHeaders || {});
|
|
||||||
}
|
|
||||||
del(requestUrl, additionalHeaders) {
|
|
||||||
return this.request('DELETE', requestUrl, null, additionalHeaders || {});
|
|
||||||
}
|
|
||||||
post(requestUrl, data, additionalHeaders) {
|
|
||||||
return this.request('POST', requestUrl, data, additionalHeaders || {});
|
|
||||||
}
|
|
||||||
patch(requestUrl, data, additionalHeaders) {
|
|
||||||
return this.request('PATCH', requestUrl, data, additionalHeaders || {});
|
|
||||||
}
|
|
||||||
put(requestUrl, data, additionalHeaders) {
|
|
||||||
return this.request('PUT', requestUrl, data, additionalHeaders || {});
|
|
||||||
}
|
|
||||||
head(requestUrl, additionalHeaders) {
|
|
||||||
return this.request('HEAD', requestUrl, null, additionalHeaders || {});
|
|
||||||
}
|
|
||||||
sendStream(verb, requestUrl, stream, additionalHeaders) {
|
|
||||||
return this.request(verb, requestUrl, stream, additionalHeaders);
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* Gets a typed object from an endpoint
|
|
||||||
* Be aware that not found returns a null. Other errors (4xx, 5xx) reject the promise
|
|
||||||
*/
|
|
||||||
async getJson(requestUrl, additionalHeaders = {}) {
|
|
||||||
additionalHeaders[Headers.Accept] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.Accept, MediaTypes.ApplicationJson);
|
|
||||||
let res = await this.get(requestUrl, additionalHeaders);
|
|
||||||
return this._processResponse(res, this.requestOptions);
|
|
||||||
}
|
|
||||||
async postJson(requestUrl, obj, additionalHeaders = {}) {
|
|
||||||
let data = JSON.stringify(obj, null, 2);
|
|
||||||
additionalHeaders[Headers.Accept] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.Accept, MediaTypes.ApplicationJson);
|
|
||||||
additionalHeaders[Headers.ContentType] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.ContentType, MediaTypes.ApplicationJson);
|
|
||||||
let res = await this.post(requestUrl, data, additionalHeaders);
|
|
||||||
return this._processResponse(res, this.requestOptions);
|
|
||||||
}
|
|
||||||
async putJson(requestUrl, obj, additionalHeaders = {}) {
|
|
||||||
let data = JSON.stringify(obj, null, 2);
|
|
||||||
additionalHeaders[Headers.Accept] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.Accept, MediaTypes.ApplicationJson);
|
|
||||||
additionalHeaders[Headers.ContentType] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.ContentType, MediaTypes.ApplicationJson);
|
|
||||||
let res = await this.put(requestUrl, data, additionalHeaders);
|
|
||||||
return this._processResponse(res, this.requestOptions);
|
|
||||||
}
|
|
||||||
async patchJson(requestUrl, obj, additionalHeaders = {}) {
|
|
||||||
let data = JSON.stringify(obj, null, 2);
|
|
||||||
additionalHeaders[Headers.Accept] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.Accept, MediaTypes.ApplicationJson);
|
|
||||||
additionalHeaders[Headers.ContentType] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.ContentType, MediaTypes.ApplicationJson);
|
|
||||||
let res = await this.patch(requestUrl, data, additionalHeaders);
|
|
||||||
return this._processResponse(res, this.requestOptions);
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* Makes a raw http request.
|
|
||||||
* All other methods such as get, post, patch, and request ultimately call this.
|
|
||||||
* Prefer get, del, post and patch
|
|
||||||
*/
|
|
||||||
async request(verb, requestUrl, data, headers) {
|
|
||||||
if (this._disposed) {
|
|
||||||
throw new Error('Client has already been disposed.');
|
|
||||||
}
|
|
||||||
let parsedUrl = new URL(requestUrl);
|
|
||||||
let info = this._prepareRequest(verb, parsedUrl, headers);
|
|
||||||
// Only perform retries on reads since writes may not be idempotent.
|
|
||||||
let maxTries = this._allowRetries && RetryableHttpVerbs.indexOf(verb) != -1
|
|
||||||
? this._maxRetries + 1
|
|
||||||
: 1;
|
|
||||||
let numTries = 0;
|
|
||||||
let response;
|
|
||||||
while (numTries < maxTries) {
|
|
||||||
response = await this.requestRaw(info, data);
|
|
||||||
// Check if it's an authentication challenge
|
|
||||||
if (response &&
|
|
||||||
response.message &&
|
|
||||||
response.message.statusCode === HttpCodes.Unauthorized) {
|
|
||||||
let authenticationHandler;
|
|
||||||
for (let i = 0; i < this.handlers.length; i++) {
|
|
||||||
if (this.handlers[i].canHandleAuthentication(response)) {
|
|
||||||
authenticationHandler = this.handlers[i];
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (authenticationHandler) {
|
|
||||||
return authenticationHandler.handleAuthentication(this, info, data);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
// We have received an unauthorized response but have no handlers to handle it.
|
|
||||||
// Let the response return to the caller.
|
|
||||||
return response;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
let redirectsRemaining = this._maxRedirects;
|
|
||||||
while (HttpRedirectCodes.indexOf(response.message.statusCode) != -1 &&
|
|
||||||
this._allowRedirects &&
|
|
||||||
redirectsRemaining > 0) {
|
|
||||||
const redirectUrl = response.message.headers['location'];
|
|
||||||
if (!redirectUrl) {
|
|
||||||
// if there's no location to redirect to, we won't
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
let parsedRedirectUrl = new URL(redirectUrl);
|
|
||||||
if (parsedUrl.protocol == 'https:' &&
|
|
||||||
parsedUrl.protocol != parsedRedirectUrl.protocol &&
|
|
||||||
!this._allowRedirectDowngrade) {
|
|
||||||
throw new Error('Redirect from HTTPS to HTTP protocol. This downgrade is not allowed for security reasons. If you want to allow this behavior, set the allowRedirectDowngrade option to true.');
|
|
||||||
}
|
|
||||||
// we need to finish reading the response before reassigning response
|
|
||||||
// which will leak the open socket.
|
|
||||||
await response.readBody();
|
|
||||||
// strip authorization header if redirected to a different hostname
|
|
||||||
if (parsedRedirectUrl.hostname !== parsedUrl.hostname) {
|
|
||||||
for (let header in headers) {
|
|
||||||
// header names are case insensitive
|
|
||||||
if (header.toLowerCase() === 'authorization') {
|
|
||||||
delete headers[header];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// let's make the request with the new redirectUrl
|
|
||||||
info = this._prepareRequest(verb, parsedRedirectUrl, headers);
|
|
||||||
response = await this.requestRaw(info, data);
|
|
||||||
redirectsRemaining--;
|
|
||||||
}
|
|
||||||
if (HttpResponseRetryCodes.indexOf(response.message.statusCode) == -1) {
|
|
||||||
// If not a retry code, return immediately instead of retrying
|
|
||||||
return response;
|
|
||||||
}
|
|
||||||
numTries += 1;
|
|
||||||
if (numTries < maxTries) {
|
|
||||||
await response.readBody();
|
|
||||||
await this._performExponentialBackoff(numTries);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return response;
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* Needs to be called if keepAlive is set to true in request options.
|
|
||||||
*/
|
|
||||||
dispose() {
|
|
||||||
if (this._agent) {
|
|
||||||
this._agent.destroy();
|
|
||||||
}
|
|
||||||
this._disposed = true;
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* Raw request.
|
|
||||||
* @param info
|
|
||||||
* @param data
|
|
||||||
*/
|
|
||||||
requestRaw(info, data) {
|
|
||||||
return new Promise((resolve, reject) => {
|
|
||||||
let callbackForResult = function (err, res) {
|
|
||||||
if (err) {
|
|
||||||
reject(err);
|
|
||||||
}
|
|
||||||
resolve(res);
|
|
||||||
};
|
|
||||||
this.requestRawWithCallback(info, data, callbackForResult);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* Raw request with callback.
|
|
||||||
* @param info
|
|
||||||
* @param data
|
|
||||||
* @param onResult
|
|
||||||
*/
|
|
||||||
requestRawWithCallback(info, data, onResult) {
|
|
||||||
let socket;
|
|
||||||
if (typeof data === 'string') {
|
|
||||||
info.options.headers['Content-Length'] = Buffer.byteLength(data, 'utf8');
|
|
||||||
}
|
|
||||||
let callbackCalled = false;
|
|
||||||
let handleResult = (err, res) => {
|
|
||||||
if (!callbackCalled) {
|
|
||||||
callbackCalled = true;
|
|
||||||
onResult(err, res);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
let req = info.httpModule.request(info.options, (msg) => {
|
|
||||||
let res = new HttpClientResponse(msg);
|
|
||||||
handleResult(null, res);
|
|
||||||
});
|
|
||||||
req.on('socket', sock => {
|
|
||||||
socket = sock;
|
|
||||||
});
|
|
||||||
// If we ever get disconnected, we want the socket to timeout eventually
|
|
||||||
req.setTimeout(this._socketTimeout || 3 * 60000, () => {
|
|
||||||
if (socket) {
|
|
||||||
socket.end();
|
|
||||||
}
|
|
||||||
handleResult(new Error('Request timeout: ' + info.options.path), null);
|
|
||||||
});
|
|
||||||
req.on('error', function (err) {
|
|
||||||
// err has statusCode property
|
|
||||||
// res should have headers
|
|
||||||
handleResult(err, null);
|
|
||||||
});
|
|
||||||
if (data && typeof data === 'string') {
|
|
||||||
req.write(data, 'utf8');
|
|
||||||
}
|
|
||||||
if (data && typeof data !== 'string') {
|
|
||||||
data.on('close', function () {
|
|
||||||
req.end();
|
|
||||||
});
|
|
||||||
data.pipe(req);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
req.end();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* Gets an http agent. This function is useful when you need an http agent that handles
|
|
||||||
* routing through a proxy server - depending upon the url and proxy environment variables.
|
|
||||||
* @param serverUrl The server URL where the request will be sent. For example, https://api.github.com
|
|
||||||
*/
|
|
||||||
getAgent(serverUrl) {
|
|
||||||
let parsedUrl = new URL(serverUrl);
|
|
||||||
return this._getAgent(parsedUrl);
|
|
||||||
}
|
|
||||||
_prepareRequest(method, requestUrl, headers) {
|
|
||||||
const info = {};
|
|
||||||
info.parsedUrl = requestUrl;
|
|
||||||
const usingSsl = info.parsedUrl.protocol === 'https:';
|
|
||||||
info.httpModule = usingSsl ? https : http;
|
|
||||||
const defaultPort = usingSsl ? 443 : 80;
|
|
||||||
info.options = {};
|
|
||||||
info.options.host = info.parsedUrl.hostname;
|
|
||||||
info.options.port = info.parsedUrl.port
|
|
||||||
? parseInt(info.parsedUrl.port)
|
|
||||||
: defaultPort;
|
|
||||||
info.options.path =
|
|
||||||
(info.parsedUrl.pathname || '') + (info.parsedUrl.search || '');
|
|
||||||
info.options.method = method;
|
|
||||||
info.options.headers = this._mergeHeaders(headers);
|
|
||||||
if (this.userAgent != null) {
|
|
||||||
info.options.headers['user-agent'] = this.userAgent;
|
|
||||||
}
|
|
||||||
info.options.agent = this._getAgent(info.parsedUrl);
|
|
||||||
// gives handlers an opportunity to participate
|
|
||||||
if (this.handlers) {
|
|
||||||
this.handlers.forEach(handler => {
|
|
||||||
handler.prepareRequest(info.options);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
return info;
|
|
||||||
}
|
|
||||||
_mergeHeaders(headers) {
|
|
||||||
const lowercaseKeys = obj => Object.keys(obj).reduce((c, k) => ((c[k.toLowerCase()] = obj[k]), c), {});
|
|
||||||
if (this.requestOptions && this.requestOptions.headers) {
|
|
||||||
return Object.assign({}, lowercaseKeys(this.requestOptions.headers), lowercaseKeys(headers));
|
|
||||||
}
|
|
||||||
return lowercaseKeys(headers || {});
|
|
||||||
}
|
|
||||||
_getExistingOrDefaultHeader(additionalHeaders, header, _default) {
|
|
||||||
const lowercaseKeys = obj => Object.keys(obj).reduce((c, k) => ((c[k.toLowerCase()] = obj[k]), c), {});
|
|
||||||
let clientHeader;
|
|
||||||
if (this.requestOptions && this.requestOptions.headers) {
|
|
||||||
clientHeader = lowercaseKeys(this.requestOptions.headers)[header];
|
|
||||||
}
|
|
||||||
return additionalHeaders[header] || clientHeader || _default;
|
|
||||||
}
|
|
||||||
_getAgent(parsedUrl) {
|
|
||||||
let agent;
|
|
||||||
let proxyUrl = pm.getProxyUrl(parsedUrl);
|
|
||||||
let useProxy = proxyUrl && proxyUrl.hostname;
|
|
||||||
if (this._keepAlive && useProxy) {
|
|
||||||
agent = this._proxyAgent;
|
|
||||||
}
|
|
||||||
if (this._keepAlive && !useProxy) {
|
|
||||||
agent = this._agent;
|
|
||||||
}
|
|
||||||
// if agent is already assigned use that agent.
|
|
||||||
if (!!agent) {
|
|
||||||
return agent;
|
|
||||||
}
|
|
||||||
const usingSsl = parsedUrl.protocol === 'https:';
|
|
||||||
let maxSockets = 100;
|
|
||||||
if (!!this.requestOptions) {
|
|
||||||
maxSockets = this.requestOptions.maxSockets || http.globalAgent.maxSockets;
|
|
||||||
}
|
|
||||||
if (useProxy) {
|
|
||||||
// If using proxy, need tunnel
|
|
||||||
if (!tunnel) {
|
|
||||||
tunnel = require('tunnel');
|
|
||||||
}
|
|
||||||
const agentOptions = {
|
|
||||||
maxSockets: maxSockets,
|
|
||||||
keepAlive: this._keepAlive,
|
|
||||||
proxy: {
|
|
||||||
...((proxyUrl.username || proxyUrl.password) && {
|
|
||||||
proxyAuth: `${proxyUrl.username}:${proxyUrl.password}`
|
|
||||||
}),
|
|
||||||
host: proxyUrl.hostname,
|
|
||||||
port: proxyUrl.port
|
|
||||||
}
|
|
||||||
};
|
|
||||||
let tunnelAgent;
|
|
||||||
const overHttps = proxyUrl.protocol === 'https:';
|
|
||||||
if (usingSsl) {
|
|
||||||
tunnelAgent = overHttps ? tunnel.httpsOverHttps : tunnel.httpsOverHttp;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
tunnelAgent = overHttps ? tunnel.httpOverHttps : tunnel.httpOverHttp;
|
|
||||||
}
|
|
||||||
agent = tunnelAgent(agentOptions);
|
|
||||||
this._proxyAgent = agent;
|
|
||||||
}
|
|
||||||
// if reusing agent across request and tunneling agent isn't assigned create a new agent
|
|
||||||
if (this._keepAlive && !agent) {
|
|
||||||
const options = { keepAlive: this._keepAlive, maxSockets: maxSockets };
|
|
||||||
agent = usingSsl ? new https.Agent(options) : new http.Agent(options);
|
|
||||||
this._agent = agent;
|
|
||||||
}
|
|
||||||
// if not using private agent and tunnel agent isn't setup then use global agent
|
|
||||||
if (!agent) {
|
|
||||||
agent = usingSsl ? https.globalAgent : http.globalAgent;
|
|
||||||
}
|
|
||||||
if (usingSsl && this._ignoreSslError) {
|
|
||||||
// we don't want to set NODE_TLS_REJECT_UNAUTHORIZED=0 since that will affect request for entire process
|
|
||||||
// http.RequestOptions doesn't expose a way to modify RequestOptions.agent.options
|
|
||||||
// we have to cast it to any and change it directly
|
|
||||||
agent.options = Object.assign(agent.options || {}, {
|
|
||||||
rejectUnauthorized: false
|
|
||||||
});
|
|
||||||
}
|
|
||||||
return agent;
|
|
||||||
}
|
|
||||||
_performExponentialBackoff(retryNumber) {
|
|
||||||
retryNumber = Math.min(ExponentialBackoffCeiling, retryNumber);
|
|
||||||
const ms = ExponentialBackoffTimeSlice * Math.pow(2, retryNumber);
|
|
||||||
return new Promise(resolve => setTimeout(() => resolve(), ms));
|
|
||||||
}
|
|
||||||
static dateTimeDeserializer(key, value) {
|
|
||||||
if (typeof value === 'string') {
|
|
||||||
let a = new Date(value);
|
|
||||||
if (!isNaN(a.valueOf())) {
|
|
||||||
return a;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return value;
|
|
||||||
}
|
|
||||||
async _processResponse(res, options) {
|
|
||||||
return new Promise(async (resolve, reject) => {
|
|
||||||
const statusCode = res.message.statusCode;
|
|
||||||
const response = {
|
|
||||||
statusCode: statusCode,
|
|
||||||
result: null,
|
|
||||||
headers: {}
|
|
||||||
};
|
|
||||||
// not found leads to null obj returned
|
|
||||||
if (statusCode == HttpCodes.NotFound) {
|
|
||||||
resolve(response);
|
|
||||||
}
|
|
||||||
let obj;
|
|
||||||
let contents;
|
|
||||||
// get the result from the body
|
|
||||||
try {
|
|
||||||
contents = await res.readBody();
|
|
||||||
if (contents && contents.length > 0) {
|
|
||||||
if (options && options.deserializeDates) {
|
|
||||||
obj = JSON.parse(contents, HttpClient.dateTimeDeserializer);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
obj = JSON.parse(contents);
|
|
||||||
}
|
|
||||||
response.result = obj;
|
|
||||||
}
|
|
||||||
response.headers = res.message.headers;
|
|
||||||
}
|
|
||||||
catch (err) {
|
|
||||||
// Invalid resource (contents not json); leaving result obj null
|
|
||||||
}
|
|
||||||
// note that 3xx redirects are handled by the http layer.
|
|
||||||
if (statusCode > 299) {
|
|
||||||
let msg;
|
|
||||||
// if exception/error in body, attempt to get better error
|
|
||||||
if (obj && obj.message) {
|
|
||||||
msg = obj.message;
|
|
||||||
}
|
|
||||||
else if (contents && contents.length > 0) {
|
|
||||||
// it may be the case that the exception is in the body message as string
|
|
||||||
msg = contents;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
msg = 'Failed request: (' + statusCode + ')';
|
|
||||||
}
|
|
||||||
let err = new HttpClientError(msg, statusCode);
|
|
||||||
err.result = response.result;
|
|
||||||
reject(err);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
resolve(response);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
exports.HttpClient = HttpClient;
|
|
||||||
49
node_modules/@actions/http-client/interfaces.d.ts
generated
vendored
49
node_modules/@actions/http-client/interfaces.d.ts
generated
vendored
@@ -1,49 +0,0 @@
|
|||||||
/// <reference types="node" />
|
|
||||||
import http = require('http');
|
|
||||||
export interface IHeaders {
|
|
||||||
[key: string]: any;
|
|
||||||
}
|
|
||||||
export interface IHttpClient {
|
|
||||||
options(requestUrl: string, additionalHeaders?: IHeaders): Promise<IHttpClientResponse>;
|
|
||||||
get(requestUrl: string, additionalHeaders?: IHeaders): Promise<IHttpClientResponse>;
|
|
||||||
del(requestUrl: string, additionalHeaders?: IHeaders): Promise<IHttpClientResponse>;
|
|
||||||
post(requestUrl: string, data: string, additionalHeaders?: IHeaders): Promise<IHttpClientResponse>;
|
|
||||||
patch(requestUrl: string, data: string, additionalHeaders?: IHeaders): Promise<IHttpClientResponse>;
|
|
||||||
put(requestUrl: string, data: string, additionalHeaders?: IHeaders): Promise<IHttpClientResponse>;
|
|
||||||
sendStream(verb: string, requestUrl: string, stream: NodeJS.ReadableStream, additionalHeaders?: IHeaders): Promise<IHttpClientResponse>;
|
|
||||||
request(verb: string, requestUrl: string, data: string | NodeJS.ReadableStream, headers: IHeaders): Promise<IHttpClientResponse>;
|
|
||||||
requestRaw(info: IRequestInfo, data: string | NodeJS.ReadableStream): Promise<IHttpClientResponse>;
|
|
||||||
requestRawWithCallback(info: IRequestInfo, data: string | NodeJS.ReadableStream, onResult: (err: any, res: IHttpClientResponse) => void): void;
|
|
||||||
}
|
|
||||||
export interface IRequestHandler {
|
|
||||||
prepareRequest(options: http.RequestOptions): void;
|
|
||||||
canHandleAuthentication(response: IHttpClientResponse): boolean;
|
|
||||||
handleAuthentication(httpClient: IHttpClient, requestInfo: IRequestInfo, objs: any): Promise<IHttpClientResponse>;
|
|
||||||
}
|
|
||||||
export interface IHttpClientResponse {
|
|
||||||
message: http.IncomingMessage;
|
|
||||||
readBody(): Promise<string>;
|
|
||||||
}
|
|
||||||
export interface IRequestInfo {
|
|
||||||
options: http.RequestOptions;
|
|
||||||
parsedUrl: URL;
|
|
||||||
httpModule: any;
|
|
||||||
}
|
|
||||||
export interface IRequestOptions {
|
|
||||||
headers?: IHeaders;
|
|
||||||
socketTimeout?: number;
|
|
||||||
ignoreSslError?: boolean;
|
|
||||||
allowRedirects?: boolean;
|
|
||||||
allowRedirectDowngrade?: boolean;
|
|
||||||
maxRedirects?: number;
|
|
||||||
maxSockets?: number;
|
|
||||||
keepAlive?: boolean;
|
|
||||||
deserializeDates?: boolean;
|
|
||||||
allowRetries?: boolean;
|
|
||||||
maxRetries?: number;
|
|
||||||
}
|
|
||||||
export interface ITypedResponse<T> {
|
|
||||||
statusCode: number;
|
|
||||||
result: T | null;
|
|
||||||
headers: Object;
|
|
||||||
}
|
|
||||||
2
node_modules/@actions/http-client/interfaces.js
generated
vendored
2
node_modules/@actions/http-client/interfaces.js
generated
vendored
@@ -1,2 +0,0 @@
|
|||||||
"use strict";
|
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
|
||||||
39
node_modules/@actions/http-client/package.json
generated
vendored
39
node_modules/@actions/http-client/package.json
generated
vendored
@@ -1,39 +0,0 @@
|
|||||||
{
|
|
||||||
"name": "@actions/http-client",
|
|
||||||
"version": "1.0.11",
|
|
||||||
"description": "Actions Http Client",
|
|
||||||
"main": "index.js",
|
|
||||||
"scripts": {
|
|
||||||
"build": "rm -Rf ./_out && tsc && cp package*.json ./_out && cp *.md ./_out && cp LICENSE ./_out && cp actions.png ./_out",
|
|
||||||
"test": "jest",
|
|
||||||
"format": "prettier --write *.ts && prettier --write **/*.ts",
|
|
||||||
"format-check": "prettier --check *.ts && prettier --check **/*.ts",
|
|
||||||
"audit-check": "npm audit --audit-level=moderate"
|
|
||||||
},
|
|
||||||
"repository": {
|
|
||||||
"type": "git",
|
|
||||||
"url": "git+https://github.com/actions/http-client.git"
|
|
||||||
},
|
|
||||||
"keywords": [
|
|
||||||
"Actions",
|
|
||||||
"Http"
|
|
||||||
],
|
|
||||||
"author": "GitHub, Inc.",
|
|
||||||
"license": "MIT",
|
|
||||||
"bugs": {
|
|
||||||
"url": "https://github.com/actions/http-client/issues"
|
|
||||||
},
|
|
||||||
"homepage": "https://github.com/actions/http-client#readme",
|
|
||||||
"devDependencies": {
|
|
||||||
"@types/jest": "^25.1.4",
|
|
||||||
"@types/node": "^12.12.31",
|
|
||||||
"jest": "^25.1.0",
|
|
||||||
"prettier": "^2.0.4",
|
|
||||||
"proxy": "^1.0.1",
|
|
||||||
"ts-jest": "^25.2.1",
|
|
||||||
"typescript": "^3.8.3"
|
|
||||||
},
|
|
||||||
"dependencies": {
|
|
||||||
"tunnel": "0.0.6"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
2
node_modules/@actions/http-client/proxy.d.ts
generated
vendored
2
node_modules/@actions/http-client/proxy.d.ts
generated
vendored
@@ -1,2 +0,0 @@
|
|||||||
export declare function getProxyUrl(reqUrl: URL): URL | undefined;
|
|
||||||
export declare function checkBypass(reqUrl: URL): boolean;
|
|
||||||
57
node_modules/@actions/http-client/proxy.js
generated
vendored
57
node_modules/@actions/http-client/proxy.js
generated
vendored
@@ -1,57 +0,0 @@
|
|||||||
"use strict";
|
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
|
||||||
function getProxyUrl(reqUrl) {
|
|
||||||
let usingSsl = reqUrl.protocol === 'https:';
|
|
||||||
let proxyUrl;
|
|
||||||
if (checkBypass(reqUrl)) {
|
|
||||||
return proxyUrl;
|
|
||||||
}
|
|
||||||
let proxyVar;
|
|
||||||
if (usingSsl) {
|
|
||||||
proxyVar = process.env['https_proxy'] || process.env['HTTPS_PROXY'];
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
proxyVar = process.env['http_proxy'] || process.env['HTTP_PROXY'];
|
|
||||||
}
|
|
||||||
if (proxyVar) {
|
|
||||||
proxyUrl = new URL(proxyVar);
|
|
||||||
}
|
|
||||||
return proxyUrl;
|
|
||||||
}
|
|
||||||
exports.getProxyUrl = getProxyUrl;
|
|
||||||
function checkBypass(reqUrl) {
|
|
||||||
if (!reqUrl.hostname) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
let noProxy = process.env['no_proxy'] || process.env['NO_PROXY'] || '';
|
|
||||||
if (!noProxy) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
// Determine the request port
|
|
||||||
let reqPort;
|
|
||||||
if (reqUrl.port) {
|
|
||||||
reqPort = Number(reqUrl.port);
|
|
||||||
}
|
|
||||||
else if (reqUrl.protocol === 'http:') {
|
|
||||||
reqPort = 80;
|
|
||||||
}
|
|
||||||
else if (reqUrl.protocol === 'https:') {
|
|
||||||
reqPort = 443;
|
|
||||||
}
|
|
||||||
// Format the request hostname and hostname with port
|
|
||||||
let upperReqHosts = [reqUrl.hostname.toUpperCase()];
|
|
||||||
if (typeof reqPort === 'number') {
|
|
||||||
upperReqHosts.push(`${upperReqHosts[0]}:${reqPort}`);
|
|
||||||
}
|
|
||||||
// Compare request host against noproxy
|
|
||||||
for (let upperNoProxyItem of noProxy
|
|
||||||
.split(',')
|
|
||||||
.map(x => x.trim().toUpperCase())
|
|
||||||
.filter(x => x)) {
|
|
||||||
if (upperReqHosts.some(x => x === upperNoProxyItem)) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
exports.checkBypass = checkBypass;
|
|
||||||
22
node_modules/fsevents/LICENSE
generated
vendored
22
node_modules/fsevents/LICENSE
generated
vendored
@@ -1,22 +0,0 @@
|
|||||||
MIT License
|
|
||||||
-----------
|
|
||||||
|
|
||||||
Copyright (C) 2010-2019 by Philipp Dunkel, Ben Noordhuis, Elan Shankar, Paul Miller
|
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
|
||||||
in the Software without restriction, including without limitation the rights
|
|
||||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
copies of the Software, and to permit persons to whom the Software is
|
|
||||||
furnished to do so, subject to the following conditions:
|
|
||||||
|
|
||||||
The above copyright notice and this permission notice shall be included in
|
|
||||||
all copies or substantial portions of the Software.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
||||||
THE SOFTWARE.
|
|
||||||
77
node_modules/fsevents/README.md
generated
vendored
77
node_modules/fsevents/README.md
generated
vendored
@@ -1,77 +0,0 @@
|
|||||||
# fsevents [](https://nodei.co/npm/fsevents/)
|
|
||||||
|
|
||||||
Native access to MacOS FSEvents in [Node.js](https://nodejs.org/)
|
|
||||||
|
|
||||||
The FSEvents API in MacOS allows applications to register for notifications of
|
|
||||||
changes to a given directory tree. It is a very fast and lightweight alternative
|
|
||||||
to kqueue.
|
|
||||||
|
|
||||||
This is a low-level library. For a cross-platform file watching module that
|
|
||||||
uses fsevents, check out [Chokidar](https://github.com/paulmillr/chokidar).
|
|
||||||
|
|
||||||
## Installation
|
|
||||||
|
|
||||||
Supports only **Node.js v8.16 and higher**.
|
|
||||||
|
|
||||||
```sh
|
|
||||||
npm install fsevents
|
|
||||||
```
|
|
||||||
|
|
||||||
## Usage
|
|
||||||
|
|
||||||
```js
|
|
||||||
const fsevents = require('fsevents');
|
|
||||||
const stop = fsevents.watch(__dirname, (path, flags, id) => {
|
|
||||||
const info = fsevents.getInfo(path, flags, id);
|
|
||||||
}); // To start observation
|
|
||||||
stop(); // To end observation
|
|
||||||
```
|
|
||||||
|
|
||||||
The callback passed as the second parameter to `.watch` get's called whenever the operating system detects a
|
|
||||||
a change in the file system. It takes three arguments:
|
|
||||||
|
|
||||||
###### `fsevents.watch(dirname: string, (path: string, flags: number, id: string) => void): () => Promise<undefined>`
|
|
||||||
|
|
||||||
* `path: string` - the item in the filesystem that have been changed
|
|
||||||
* `flags: number` - a numeric value describing what the change was
|
|
||||||
* `id: string` - an unique-id identifying this specific event
|
|
||||||
|
|
||||||
Returns closer callback which when called returns a Promise resolving when the watcher process has been shut down.
|
|
||||||
|
|
||||||
###### `fsevents.getInfo(path: string, flags: number, id: string): FsEventInfo`
|
|
||||||
|
|
||||||
The `getInfo` function takes the `path`, `flags` and `id` arguments and converts those parameters into a structure
|
|
||||||
that is easier to digest to determine what the change was.
|
|
||||||
|
|
||||||
The `FsEventsInfo` has the following shape:
|
|
||||||
|
|
||||||
```js
|
|
||||||
/**
|
|
||||||
* @typedef {'created'|'modified'|'deleted'|'moved'|'root-changed'|'cloned'|'unknown'} FsEventsEvent
|
|
||||||
* @typedef {'file'|'directory'|'symlink'} FsEventsType
|
|
||||||
*/
|
|
||||||
{
|
|
||||||
"event": "created",
|
|
||||||
"path": "file.txt", // {FsEventsEvent}
|
|
||||||
"type": "file", // {FsEventsType}
|
|
||||||
"changes": {
|
|
||||||
"inode": true, // Had iNode Meta-Information changed
|
|
||||||
"finder": false, // Had Finder Meta-Data changed
|
|
||||||
"access": false, // Had access permissions changed
|
|
||||||
"xattrs": false // Had xAttributes changed
|
|
||||||
},
|
|
||||||
"flags": 0x100000000
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
## Engine compatibility
|
|
||||||
|
|
||||||
- v2 supports node 8.16+
|
|
||||||
- v1.2.8 supports node 6+
|
|
||||||
- v1.2.7 supports node 4+
|
|
||||||
|
|
||||||
## License
|
|
||||||
|
|
||||||
The MIT License Copyright (C) 2010-2019 by Philipp Dunkel, Ben Noordhuis, Elan Shankar, Paul Miller — see LICENSE file.
|
|
||||||
|
|
||||||
Visit our [GitHub page](https://github.com/fsevents/fsevents) and [NPM Page](https://npmjs.org/package/fsevents)
|
|
||||||
55
node_modules/fsevents/fsevents.d.ts
generated
vendored
55
node_modules/fsevents/fsevents.d.ts
generated
vendored
@@ -1,55 +0,0 @@
|
|||||||
declare type Event =
|
|
||||||
| 'created'
|
|
||||||
| 'cloned'
|
|
||||||
| 'modified'
|
|
||||||
| 'deleted'
|
|
||||||
| 'moved'
|
|
||||||
| 'root-changed'
|
|
||||||
| 'unknown';
|
|
||||||
declare type Type = 'file' | 'directory' | 'symlink';
|
|
||||||
declare type FileChanges = {
|
|
||||||
inode: boolean;
|
|
||||||
finder: boolean;
|
|
||||||
access: boolean;
|
|
||||||
xattrs: boolean;
|
|
||||||
};
|
|
||||||
declare type Info = {
|
|
||||||
event: Event;
|
|
||||||
path: string;
|
|
||||||
type: Type;
|
|
||||||
changes: FileChanges;
|
|
||||||
flags: number;
|
|
||||||
};
|
|
||||||
declare type WatchHandler = (path: string, flags: number, id: string) => void;
|
|
||||||
export declare function watch(
|
|
||||||
path: string,
|
|
||||||
handler: WatchHandler,
|
|
||||||
): () => Promise<void>;
|
|
||||||
export declare function getInfo(path: string, flags: number): Info;
|
|
||||||
export declare const constants: {
|
|
||||||
None: 0x00000000;
|
|
||||||
MustScanSubDirs: 0x00000001;
|
|
||||||
UserDropped: 0x00000002;
|
|
||||||
KernelDropped: 0x00000004;
|
|
||||||
EventIdsWrapped: 0x00000008;
|
|
||||||
HistoryDone: 0x00000010;
|
|
||||||
RootChanged: 0x00000020;
|
|
||||||
Mount: 0x00000040;
|
|
||||||
Unmount: 0x00000080;
|
|
||||||
ItemCreated: 0x00000100;
|
|
||||||
ItemRemoved: 0x00000200;
|
|
||||||
ItemInodeMetaMod: 0x00000400;
|
|
||||||
ItemRenamed: 0x00000800;
|
|
||||||
ItemModified: 0x00001000;
|
|
||||||
ItemFinderInfoMod: 0x00002000;
|
|
||||||
ItemChangeOwner: 0x00004000;
|
|
||||||
ItemXattrMod: 0x00008000;
|
|
||||||
ItemIsFile: 0x00010000;
|
|
||||||
ItemIsDir: 0x00020000;
|
|
||||||
ItemIsSymlink: 0x00040000;
|
|
||||||
ItemIsHardlink: 0x00100000;
|
|
||||||
ItemIsLastHardlink: 0x00200000;
|
|
||||||
OwnEvent: 0x00080000;
|
|
||||||
ItemCloned: 0x00400000;
|
|
||||||
};
|
|
||||||
export {}
|
|
||||||
77
node_modules/fsevents/fsevents.js
generated
vendored
77
node_modules/fsevents/fsevents.js
generated
vendored
@@ -1,77 +0,0 @@
|
|||||||
/*
|
|
||||||
** © 2018 by Philipp Dunkel, Ben Noordhuis, Elan Shankar, Paul Miller
|
|
||||||
** Licensed under MIT License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* jshint node:true */
|
|
||||||
'use strict';
|
|
||||||
|
|
||||||
if (process.platform !== 'darwin') {
|
|
||||||
throw new Error(`Module 'fsevents' is not compatible with platform '${process.platform}'`);
|
|
||||||
}
|
|
||||||
|
|
||||||
const Native = require('./fsevents.node');
|
|
||||||
const events = Native.constants;
|
|
||||||
|
|
||||||
function watch(path, handler) {
|
|
||||||
if (typeof path !== 'string') {
|
|
||||||
throw new TypeError(`fsevents argument 1 must be a string and not a ${typeof path}`);
|
|
||||||
}
|
|
||||||
if (typeof handler !== 'function') {
|
|
||||||
throw new TypeError(`fsevents argument 2 must be a function and not a ${typeof handler}`);
|
|
||||||
}
|
|
||||||
|
|
||||||
let instance = Native.start(path, handler);
|
|
||||||
if (!instance) throw new Error(`could not watch: ${path}`);
|
|
||||||
return () => {
|
|
||||||
const result = instance
|
|
||||||
? Promise.resolve(instance).then(Native.stop)
|
|
||||||
: Promise.resolve(undefined);
|
|
||||||
instance = undefined;
|
|
||||||
return result;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
function getInfo(path, flags) {
|
|
||||||
return {
|
|
||||||
path,
|
|
||||||
flags,
|
|
||||||
event: getEventType(flags),
|
|
||||||
type: getFileType(flags),
|
|
||||||
changes: getFileChanges(flags)
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
function getFileType(flags) {
|
|
||||||
if (events.ItemIsFile & flags) return 'file';
|
|
||||||
if (events.ItemIsDir & flags) return 'directory';
|
|
||||||
if (events.ItemIsSymlink & flags) return 'symlink';
|
|
||||||
}
|
|
||||||
function anyIsTrue(obj) {
|
|
||||||
for (let key in obj) {
|
|
||||||
if (obj[key]) return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
function getEventType(flags) {
|
|
||||||
if (events.ItemRemoved & flags) return 'deleted';
|
|
||||||
if (events.ItemRenamed & flags) return 'moved';
|
|
||||||
if (events.ItemCreated & flags) return 'created';
|
|
||||||
if (events.ItemModified & flags) return 'modified';
|
|
||||||
if (events.RootChanged & flags) return 'root-changed';
|
|
||||||
if (events.ItemCloned & flags) return 'cloned';
|
|
||||||
if (anyIsTrue(flags)) return 'modified';
|
|
||||||
return 'unknown';
|
|
||||||
}
|
|
||||||
function getFileChanges(flags) {
|
|
||||||
return {
|
|
||||||
inode: !!(events.ItemInodeMetaMod & flags),
|
|
||||||
finder: !!(events.ItemFinderInfoMod & flags),
|
|
||||||
access: !!(events.ItemChangeOwner & flags),
|
|
||||||
xattrs: !!(events.ItemXattrMod & flags)
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
exports.watch = watch;
|
|
||||||
exports.getInfo = getInfo;
|
|
||||||
exports.constants = events;
|
|
||||||
BIN
node_modules/fsevents/fsevents.node
generated
vendored
BIN
node_modules/fsevents/fsevents.node
generated
vendored
Binary file not shown.
59
node_modules/fsevents/package.json
generated
vendored
59
node_modules/fsevents/package.json
generated
vendored
@@ -1,59 +0,0 @@
|
|||||||
{
|
|
||||||
"name": "fsevents",
|
|
||||||
"version": "2.1.2",
|
|
||||||
"description": "Native Access to MacOS FSEvents",
|
|
||||||
"main": "fsevents.js",
|
|
||||||
"types": "fsevents.d.ts",
|
|
||||||
"os": [
|
|
||||||
"darwin"
|
|
||||||
],
|
|
||||||
"files": [
|
|
||||||
"fsevents.d.ts",
|
|
||||||
"fsevents.js",
|
|
||||||
"fsevents.node"
|
|
||||||
],
|
|
||||||
"engines": {
|
|
||||||
"node": "^8.16.0 || ^10.6.0 || >=11.0.0"
|
|
||||||
},
|
|
||||||
"scripts": {
|
|
||||||
"clean": "node-gyp clean && rm -f fsevents.node",
|
|
||||||
"build": "node-gyp clean && rm -f fsevents.node && node-gyp rebuild && node-gyp clean",
|
|
||||||
"test": "/bin/bash ./test.sh 2>/dev/null",
|
|
||||||
"prepublishOnly": "npm run build"
|
|
||||||
},
|
|
||||||
"repository": {
|
|
||||||
"type": "git",
|
|
||||||
"url": "https://github.com/fsevents/fsevents.git"
|
|
||||||
},
|
|
||||||
"keywords": [
|
|
||||||
"fsevents",
|
|
||||||
"mac"
|
|
||||||
],
|
|
||||||
"contributors": [
|
|
||||||
{
|
|
||||||
"name": "Philipp Dunkel",
|
|
||||||
"email": "pip@pipobscure.com"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "Ben Noordhuis",
|
|
||||||
"email": "info@bnoordhuis.nl"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "Elan Shankar",
|
|
||||||
"email": "elan.shanker@gmail.com"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "Miroslav Bajtoš",
|
|
||||||
"email": "mbajtoss@gmail.com"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "Paul Miller",
|
|
||||||
"url": "https://paulmillr.com"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"license": "MIT",
|
|
||||||
"bugs": {
|
|
||||||
"url": "https://github.com/fsevents/fsevents/issues"
|
|
||||||
},
|
|
||||||
"homepage": "https://github.com/fsevents/fsevents"
|
|
||||||
}
|
|
||||||
6
node_modules/tunnel/.travis.yml
generated
vendored
6
node_modules/tunnel/.travis.yml
generated
vendored
@@ -1,6 +0,0 @@
|
|||||||
language: node_js
|
|
||||||
node_js:
|
|
||||||
- "4"
|
|
||||||
- "6"
|
|
||||||
- "8"
|
|
||||||
- "10"
|
|
||||||
22
node_modules/tunnel/CHANGELOG.md
generated
vendored
22
node_modules/tunnel/CHANGELOG.md
generated
vendored
@@ -1,22 +0,0 @@
|
|||||||
# Changelog
|
|
||||||
|
|
||||||
- 0.0.6 (2018/09/11)
|
|
||||||
- Fix `localAddress` not working (#25)
|
|
||||||
- Fix `Host:` header for CONNECT method by @tmurakam (#29, #30)
|
|
||||||
- Fix default port for https (#32)
|
|
||||||
- Fix error handling when the proxy send illegal response body (#33)
|
|
||||||
|
|
||||||
- 0.0.5 (2017/06/12)
|
|
||||||
- Fix socket leak.
|
|
||||||
|
|
||||||
- 0.0.4 (2016/01/23)
|
|
||||||
- supported Node v0.12 or later.
|
|
||||||
|
|
||||||
- 0.0.3 (2014/01/20)
|
|
||||||
- fixed package.json
|
|
||||||
|
|
||||||
- 0.0.1 (2012/02/18)
|
|
||||||
- supported Node v0.6.x (0.6.11 or later).
|
|
||||||
|
|
||||||
- 0.0.0 (2012/02/11)
|
|
||||||
- first release.
|
|
||||||
21
node_modules/tunnel/LICENSE
generated
vendored
21
node_modules/tunnel/LICENSE
generated
vendored
@@ -1,21 +0,0 @@
|
|||||||
The MIT License (MIT)
|
|
||||||
|
|
||||||
Copyright (c) 2012 Koichi Kobayashi
|
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
|
||||||
in the Software without restriction, including without limitation the rights
|
|
||||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
copies of the Software, and to permit persons to whom the Software is
|
|
||||||
furnished to do so, subject to the following conditions:
|
|
||||||
|
|
||||||
The above copyright notice and this permission notice shall be included in
|
|
||||||
all copies or substantial portions of the Software.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
||||||
THE SOFTWARE.
|
|
||||||
185
node_modules/tunnel/README.md
generated
vendored
185
node_modules/tunnel/README.md
generated
vendored
@@ -1,185 +0,0 @@
|
|||||||
# node-tunnel - HTTP/HTTPS Agents for tunneling proxies
|
|
||||||
|
|
||||||
[](https://travis-ci.org/koichik/node-tunnel)
|
|
||||||
[](https://david-dm.org/koichik/node-tunnel#info=dependencies)
|
|
||||||
[](https://david-dm.org/koichik/node-tunnel#info=devDependencies)
|
|
||||||
|
|
||||||
## Example
|
|
||||||
|
|
||||||
```javascript
|
|
||||||
var tunnel = require('tunnel');
|
|
||||||
|
|
||||||
var tunnelingAgent = tunnel.httpsOverHttp({
|
|
||||||
proxy: {
|
|
||||||
host: 'localhost',
|
|
||||||
port: 3128
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
var req = https.request({
|
|
||||||
host: 'example.com',
|
|
||||||
port: 443,
|
|
||||||
agent: tunnelingAgent
|
|
||||||
});
|
|
||||||
```
|
|
||||||
|
|
||||||
## Installation
|
|
||||||
|
|
||||||
$ npm install tunnel
|
|
||||||
|
|
||||||
## Usages
|
|
||||||
|
|
||||||
### HTTP over HTTP tunneling
|
|
||||||
|
|
||||||
```javascript
|
|
||||||
var tunnelingAgent = tunnel.httpOverHttp({
|
|
||||||
maxSockets: poolSize, // Defaults to http.Agent.defaultMaxSockets
|
|
||||||
|
|
||||||
proxy: { // Proxy settings
|
|
||||||
host: proxyHost, // Defaults to 'localhost'
|
|
||||||
port: proxyPort, // Defaults to 80
|
|
||||||
localAddress: localAddress, // Local interface if necessary
|
|
||||||
|
|
||||||
// Basic authorization for proxy server if necessary
|
|
||||||
proxyAuth: 'user:password',
|
|
||||||
|
|
||||||
// Header fields for proxy server if necessary
|
|
||||||
headers: {
|
|
||||||
'User-Agent': 'Node'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
var req = http.request({
|
|
||||||
host: 'example.com',
|
|
||||||
port: 80,
|
|
||||||
agent: tunnelingAgent
|
|
||||||
});
|
|
||||||
```
|
|
||||||
|
|
||||||
### HTTPS over HTTP tunneling
|
|
||||||
|
|
||||||
```javascript
|
|
||||||
var tunnelingAgent = tunnel.httpsOverHttp({
|
|
||||||
maxSockets: poolSize, // Defaults to http.Agent.defaultMaxSockets
|
|
||||||
|
|
||||||
// CA for origin server if necessary
|
|
||||||
ca: [ fs.readFileSync('origin-server-ca.pem')],
|
|
||||||
|
|
||||||
// Client certification for origin server if necessary
|
|
||||||
key: fs.readFileSync('origin-server-key.pem'),
|
|
||||||
cert: fs.readFileSync('origin-server-cert.pem'),
|
|
||||||
|
|
||||||
proxy: { // Proxy settings
|
|
||||||
host: proxyHost, // Defaults to 'localhost'
|
|
||||||
port: proxyPort, // Defaults to 80
|
|
||||||
localAddress: localAddress, // Local interface if necessary
|
|
||||||
|
|
||||||
// Basic authorization for proxy server if necessary
|
|
||||||
proxyAuth: 'user:password',
|
|
||||||
|
|
||||||
// Header fields for proxy server if necessary
|
|
||||||
headers: {
|
|
||||||
'User-Agent': 'Node'
|
|
||||||
},
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
var req = https.request({
|
|
||||||
host: 'example.com',
|
|
||||||
port: 443,
|
|
||||||
agent: tunnelingAgent
|
|
||||||
});
|
|
||||||
```
|
|
||||||
|
|
||||||
### HTTP over HTTPS tunneling
|
|
||||||
|
|
||||||
```javascript
|
|
||||||
var tunnelingAgent = tunnel.httpOverHttps({
|
|
||||||
maxSockets: poolSize, // Defaults to http.Agent.defaultMaxSockets
|
|
||||||
|
|
||||||
proxy: { // Proxy settings
|
|
||||||
host: proxyHost, // Defaults to 'localhost'
|
|
||||||
port: proxyPort, // Defaults to 443
|
|
||||||
localAddress: localAddress, // Local interface if necessary
|
|
||||||
|
|
||||||
// Basic authorization for proxy server if necessary
|
|
||||||
proxyAuth: 'user:password',
|
|
||||||
|
|
||||||
// Header fields for proxy server if necessary
|
|
||||||
headers: {
|
|
||||||
'User-Agent': 'Node'
|
|
||||||
},
|
|
||||||
|
|
||||||
// CA for proxy server if necessary
|
|
||||||
ca: [ fs.readFileSync('origin-server-ca.pem')],
|
|
||||||
|
|
||||||
// Server name for verification if necessary
|
|
||||||
servername: 'example.com',
|
|
||||||
|
|
||||||
// Client certification for proxy server if necessary
|
|
||||||
key: fs.readFileSync('origin-server-key.pem'),
|
|
||||||
cert: fs.readFileSync('origin-server-cert.pem'),
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
var req = http.request({
|
|
||||||
host: 'example.com',
|
|
||||||
port: 80,
|
|
||||||
agent: tunnelingAgent
|
|
||||||
});
|
|
||||||
```
|
|
||||||
|
|
||||||
### HTTPS over HTTPS tunneling
|
|
||||||
|
|
||||||
```javascript
|
|
||||||
var tunnelingAgent = tunnel.httpsOverHttps({
|
|
||||||
maxSockets: poolSize, // Defaults to http.Agent.defaultMaxSockets
|
|
||||||
|
|
||||||
// CA for origin server if necessary
|
|
||||||
ca: [ fs.readFileSync('origin-server-ca.pem')],
|
|
||||||
|
|
||||||
// Client certification for origin server if necessary
|
|
||||||
key: fs.readFileSync('origin-server-key.pem'),
|
|
||||||
cert: fs.readFileSync('origin-server-cert.pem'),
|
|
||||||
|
|
||||||
proxy: { // Proxy settings
|
|
||||||
host: proxyHost, // Defaults to 'localhost'
|
|
||||||
port: proxyPort, // Defaults to 443
|
|
||||||
localAddress: localAddress, // Local interface if necessary
|
|
||||||
|
|
||||||
// Basic authorization for proxy server if necessary
|
|
||||||
proxyAuth: 'user:password',
|
|
||||||
|
|
||||||
// Header fields for proxy server if necessary
|
|
||||||
headers: {
|
|
||||||
'User-Agent': 'Node'
|
|
||||||
}
|
|
||||||
|
|
||||||
// CA for proxy server if necessary
|
|
||||||
ca: [ fs.readFileSync('origin-server-ca.pem')],
|
|
||||||
|
|
||||||
// Server name for verification if necessary
|
|
||||||
servername: 'example.com',
|
|
||||||
|
|
||||||
// Client certification for proxy server if necessary
|
|
||||||
key: fs.readFileSync('origin-server-key.pem'),
|
|
||||||
cert: fs.readFileSync('origin-server-cert.pem'),
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
var req = https.request({
|
|
||||||
host: 'example.com',
|
|
||||||
port: 443,
|
|
||||||
agent: tunnelingAgent
|
|
||||||
});
|
|
||||||
```
|
|
||||||
|
|
||||||
## CONTRIBUTORS
|
|
||||||
* [Aleksis Brezas (abresas)](https://github.com/abresas)
|
|
||||||
* [Jackson Tian (JacksonTian)](https://github.com/JacksonTian)
|
|
||||||
* [Dmitry Sorin (1999)](https://github.com/1999)
|
|
||||||
|
|
||||||
## License
|
|
||||||
|
|
||||||
Licensed under the [MIT](https://github.com/koichik/node-tunnel/blob/master/LICENSE) license.
|
|
||||||
1
node_modules/tunnel/index.js
generated
vendored
1
node_modules/tunnel/index.js
generated
vendored
@@ -1 +0,0 @@
|
|||||||
module.exports = require('./lib/tunnel');
|
|
||||||
264
node_modules/tunnel/lib/tunnel.js
generated
vendored
264
node_modules/tunnel/lib/tunnel.js
generated
vendored
@@ -1,264 +0,0 @@
|
|||||||
'use strict';
|
|
||||||
|
|
||||||
var net = require('net');
|
|
||||||
var tls = require('tls');
|
|
||||||
var http = require('http');
|
|
||||||
var https = require('https');
|
|
||||||
var events = require('events');
|
|
||||||
var assert = require('assert');
|
|
||||||
var util = require('util');
|
|
||||||
|
|
||||||
|
|
||||||
exports.httpOverHttp = httpOverHttp;
|
|
||||||
exports.httpsOverHttp = httpsOverHttp;
|
|
||||||
exports.httpOverHttps = httpOverHttps;
|
|
||||||
exports.httpsOverHttps = httpsOverHttps;
|
|
||||||
|
|
||||||
|
|
||||||
function httpOverHttp(options) {
|
|
||||||
var agent = new TunnelingAgent(options);
|
|
||||||
agent.request = http.request;
|
|
||||||
return agent;
|
|
||||||
}
|
|
||||||
|
|
||||||
function httpsOverHttp(options) {
|
|
||||||
var agent = new TunnelingAgent(options);
|
|
||||||
agent.request = http.request;
|
|
||||||
agent.createSocket = createSecureSocket;
|
|
||||||
agent.defaultPort = 443;
|
|
||||||
return agent;
|
|
||||||
}
|
|
||||||
|
|
||||||
function httpOverHttps(options) {
|
|
||||||
var agent = new TunnelingAgent(options);
|
|
||||||
agent.request = https.request;
|
|
||||||
return agent;
|
|
||||||
}
|
|
||||||
|
|
||||||
function httpsOverHttps(options) {
|
|
||||||
var agent = new TunnelingAgent(options);
|
|
||||||
agent.request = https.request;
|
|
||||||
agent.createSocket = createSecureSocket;
|
|
||||||
agent.defaultPort = 443;
|
|
||||||
return agent;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
function TunnelingAgent(options) {
|
|
||||||
var self = this;
|
|
||||||
self.options = options || {};
|
|
||||||
self.proxyOptions = self.options.proxy || {};
|
|
||||||
self.maxSockets = self.options.maxSockets || http.Agent.defaultMaxSockets;
|
|
||||||
self.requests = [];
|
|
||||||
self.sockets = [];
|
|
||||||
|
|
||||||
self.on('free', function onFree(socket, host, port, localAddress) {
|
|
||||||
var options = toOptions(host, port, localAddress);
|
|
||||||
for (var i = 0, len = self.requests.length; i < len; ++i) {
|
|
||||||
var pending = self.requests[i];
|
|
||||||
if (pending.host === options.host && pending.port === options.port) {
|
|
||||||
// Detect the request to connect same origin server,
|
|
||||||
// reuse the connection.
|
|
||||||
self.requests.splice(i, 1);
|
|
||||||
pending.request.onSocket(socket);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
socket.destroy();
|
|
||||||
self.removeSocket(socket);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
util.inherits(TunnelingAgent, events.EventEmitter);
|
|
||||||
|
|
||||||
TunnelingAgent.prototype.addRequest = function addRequest(req, host, port, localAddress) {
|
|
||||||
var self = this;
|
|
||||||
var options = mergeOptions({request: req}, self.options, toOptions(host, port, localAddress));
|
|
||||||
|
|
||||||
if (self.sockets.length >= this.maxSockets) {
|
|
||||||
// We are over limit so we'll add it to the queue.
|
|
||||||
self.requests.push(options);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// If we are under maxSockets create a new one.
|
|
||||||
self.createSocket(options, function(socket) {
|
|
||||||
socket.on('free', onFree);
|
|
||||||
socket.on('close', onCloseOrRemove);
|
|
||||||
socket.on('agentRemove', onCloseOrRemove);
|
|
||||||
req.onSocket(socket);
|
|
||||||
|
|
||||||
function onFree() {
|
|
||||||
self.emit('free', socket, options);
|
|
||||||
}
|
|
||||||
|
|
||||||
function onCloseOrRemove(err) {
|
|
||||||
self.removeSocket(socket);
|
|
||||||
socket.removeListener('free', onFree);
|
|
||||||
socket.removeListener('close', onCloseOrRemove);
|
|
||||||
socket.removeListener('agentRemove', onCloseOrRemove);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
TunnelingAgent.prototype.createSocket = function createSocket(options, cb) {
|
|
||||||
var self = this;
|
|
||||||
var placeholder = {};
|
|
||||||
self.sockets.push(placeholder);
|
|
||||||
|
|
||||||
var connectOptions = mergeOptions({}, self.proxyOptions, {
|
|
||||||
method: 'CONNECT',
|
|
||||||
path: options.host + ':' + options.port,
|
|
||||||
agent: false,
|
|
||||||
headers: {
|
|
||||||
host: options.host + ':' + options.port
|
|
||||||
}
|
|
||||||
});
|
|
||||||
if (options.localAddress) {
|
|
||||||
connectOptions.localAddress = options.localAddress;
|
|
||||||
}
|
|
||||||
if (connectOptions.proxyAuth) {
|
|
||||||
connectOptions.headers = connectOptions.headers || {};
|
|
||||||
connectOptions.headers['Proxy-Authorization'] = 'Basic ' +
|
|
||||||
new Buffer(connectOptions.proxyAuth).toString('base64');
|
|
||||||
}
|
|
||||||
|
|
||||||
debug('making CONNECT request');
|
|
||||||
var connectReq = self.request(connectOptions);
|
|
||||||
connectReq.useChunkedEncodingByDefault = false; // for v0.6
|
|
||||||
connectReq.once('response', onResponse); // for v0.6
|
|
||||||
connectReq.once('upgrade', onUpgrade); // for v0.6
|
|
||||||
connectReq.once('connect', onConnect); // for v0.7 or later
|
|
||||||
connectReq.once('error', onError);
|
|
||||||
connectReq.end();
|
|
||||||
|
|
||||||
function onResponse(res) {
|
|
||||||
// Very hacky. This is necessary to avoid http-parser leaks.
|
|
||||||
res.upgrade = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
function onUpgrade(res, socket, head) {
|
|
||||||
// Hacky.
|
|
||||||
process.nextTick(function() {
|
|
||||||
onConnect(res, socket, head);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function onConnect(res, socket, head) {
|
|
||||||
connectReq.removeAllListeners();
|
|
||||||
socket.removeAllListeners();
|
|
||||||
|
|
||||||
if (res.statusCode !== 200) {
|
|
||||||
debug('tunneling socket could not be established, statusCode=%d',
|
|
||||||
res.statusCode);
|
|
||||||
socket.destroy();
|
|
||||||
var error = new Error('tunneling socket could not be established, ' +
|
|
||||||
'statusCode=' + res.statusCode);
|
|
||||||
error.code = 'ECONNRESET';
|
|
||||||
options.request.emit('error', error);
|
|
||||||
self.removeSocket(placeholder);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (head.length > 0) {
|
|
||||||
debug('got illegal response body from proxy');
|
|
||||||
socket.destroy();
|
|
||||||
var error = new Error('got illegal response body from proxy');
|
|
||||||
error.code = 'ECONNRESET';
|
|
||||||
options.request.emit('error', error);
|
|
||||||
self.removeSocket(placeholder);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
debug('tunneling connection has established');
|
|
||||||
self.sockets[self.sockets.indexOf(placeholder)] = socket;
|
|
||||||
return cb(socket);
|
|
||||||
}
|
|
||||||
|
|
||||||
function onError(cause) {
|
|
||||||
connectReq.removeAllListeners();
|
|
||||||
|
|
||||||
debug('tunneling socket could not be established, cause=%s\n',
|
|
||||||
cause.message, cause.stack);
|
|
||||||
var error = new Error('tunneling socket could not be established, ' +
|
|
||||||
'cause=' + cause.message);
|
|
||||||
error.code = 'ECONNRESET';
|
|
||||||
options.request.emit('error', error);
|
|
||||||
self.removeSocket(placeholder);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
TunnelingAgent.prototype.removeSocket = function removeSocket(socket) {
|
|
||||||
var pos = this.sockets.indexOf(socket)
|
|
||||||
if (pos === -1) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
this.sockets.splice(pos, 1);
|
|
||||||
|
|
||||||
var pending = this.requests.shift();
|
|
||||||
if (pending) {
|
|
||||||
// If we have pending requests and a socket gets closed a new one
|
|
||||||
// needs to be created to take over in the pool for the one that closed.
|
|
||||||
this.createSocket(pending, function(socket) {
|
|
||||||
pending.request.onSocket(socket);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
function createSecureSocket(options, cb) {
|
|
||||||
var self = this;
|
|
||||||
TunnelingAgent.prototype.createSocket.call(self, options, function(socket) {
|
|
||||||
var hostHeader = options.request.getHeader('host');
|
|
||||||
var tlsOptions = mergeOptions({}, self.options, {
|
|
||||||
socket: socket,
|
|
||||||
servername: hostHeader ? hostHeader.replace(/:.*$/, '') : options.host
|
|
||||||
});
|
|
||||||
|
|
||||||
// 0 is dummy port for v0.6
|
|
||||||
var secureSocket = tls.connect(0, tlsOptions);
|
|
||||||
self.sockets[self.sockets.indexOf(socket)] = secureSocket;
|
|
||||||
cb(secureSocket);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
function toOptions(host, port, localAddress) {
|
|
||||||
if (typeof host === 'string') { // since v0.10
|
|
||||||
return {
|
|
||||||
host: host,
|
|
||||||
port: port,
|
|
||||||
localAddress: localAddress
|
|
||||||
};
|
|
||||||
}
|
|
||||||
return host; // for v0.11 or later
|
|
||||||
}
|
|
||||||
|
|
||||||
function mergeOptions(target) {
|
|
||||||
for (var i = 1, len = arguments.length; i < len; ++i) {
|
|
||||||
var overrides = arguments[i];
|
|
||||||
if (typeof overrides === 'object') {
|
|
||||||
var keys = Object.keys(overrides);
|
|
||||||
for (var j = 0, keyLen = keys.length; j < keyLen; ++j) {
|
|
||||||
var k = keys[j];
|
|
||||||
if (overrides[k] !== undefined) {
|
|
||||||
target[k] = overrides[k];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return target;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
var debug;
|
|
||||||
if (process.env.NODE_DEBUG && /\btunnel\b/.test(process.env.NODE_DEBUG)) {
|
|
||||||
debug = function() {
|
|
||||||
var args = Array.prototype.slice.call(arguments);
|
|
||||||
if (typeof args[0] === 'string') {
|
|
||||||
args[0] = 'TUNNEL: ' + args[0];
|
|
||||||
} else {
|
|
||||||
args.unshift('TUNNEL:');
|
|
||||||
}
|
|
||||||
console.error.apply(console, args);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
debug = function() {};
|
|
||||||
}
|
|
||||||
exports.debug = debug; // for test
|
|
||||||
34
node_modules/tunnel/package.json
generated
vendored
34
node_modules/tunnel/package.json
generated
vendored
@@ -1,34 +0,0 @@
|
|||||||
{
|
|
||||||
"name": "tunnel",
|
|
||||||
"version": "0.0.6",
|
|
||||||
"description": "Node HTTP/HTTPS Agents for tunneling proxies",
|
|
||||||
"keywords": [
|
|
||||||
"http",
|
|
||||||
"https",
|
|
||||||
"agent",
|
|
||||||
"proxy",
|
|
||||||
"tunnel"
|
|
||||||
],
|
|
||||||
"homepage": "https://github.com/koichik/node-tunnel/",
|
|
||||||
"bugs": "https://github.com/koichik/node-tunnel/issues",
|
|
||||||
"license": "MIT",
|
|
||||||
"author": "Koichi Kobayashi <koichik@improvement.jp>",
|
|
||||||
"main": "./index.js",
|
|
||||||
"directories": {
|
|
||||||
"lib": "./lib"
|
|
||||||
},
|
|
||||||
"repository": {
|
|
||||||
"type": "git",
|
|
||||||
"url": "https://github.com/koichik/node-tunnel.git"
|
|
||||||
},
|
|
||||||
"scripts": {
|
|
||||||
"test": "mocha"
|
|
||||||
},
|
|
||||||
"devDependencies": {
|
|
||||||
"mocha": "^5.2.0",
|
|
||||||
"should": "^13.2.3"
|
|
||||||
},
|
|
||||||
"engines": {
|
|
||||||
"node": ">=0.6.11 <=0.7.0 || >=0.7.3"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
7947
package-lock.json
generated
7947
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -18,7 +18,7 @@
|
|||||||
"typescript": "^3.6.3"
|
"typescript": "^3.6.3"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@actions/core": "1.6.0",
|
"@actions/core": "^1.2.6",
|
||||||
"@actions/exec": "^1.0.1",
|
"@actions/exec": "^1.0.1",
|
||||||
"@actions/io": "^1.0.1",
|
"@actions/io": "^1.0.1",
|
||||||
"actions-secret-parser": "^1.0.2",
|
"actions-secret-parser": "^1.0.2",
|
||||||
|
|||||||
@@ -6,34 +6,19 @@ import ScriptBuilder from './Utilities/ScriptBuilder';
|
|||||||
import Constants from './Constants';
|
import Constants from './Constants';
|
||||||
|
|
||||||
export class ServicePrincipalLogin implements IAzurePowerShellSession {
|
export class ServicePrincipalLogin implements IAzurePowerShellSession {
|
||||||
|
static readonly environment: string = Constants.AzureCloud;
|
||||||
static readonly scopeLevel: string = Constants.Subscription;
|
static readonly scopeLevel: string = Constants.Subscription;
|
||||||
static readonly scheme: string = Constants.ServicePrincipal;
|
static readonly scheme: string = Constants.ServicePrincipal;
|
||||||
environment: string;
|
|
||||||
servicePrincipalId: string;
|
servicePrincipalId: string;
|
||||||
servicePrincipalKey: string;
|
servicePrincipalKey: string;
|
||||||
tenantId: string;
|
tenantId: string;
|
||||||
subscriptionId: string;
|
subscriptionId: string;
|
||||||
resourceManagerEndpointUrl: string;
|
|
||||||
allowNoSubscriptionsLogin: boolean;
|
|
||||||
federatedToken: string;
|
|
||||||
|
|
||||||
constructor(servicePrincipalId: string,
|
|
||||||
servicePrincipalKey: string,
|
|
||||||
federatedToken: string,
|
|
||||||
tenantId: string,
|
|
||||||
subscriptionId: string,
|
|
||||||
allowNoSubscriptionsLogin: boolean,
|
|
||||||
environment: string,
|
|
||||||
resourceManagerEndpointUrl: string) {
|
|
||||||
|
|
||||||
|
constructor(servicePrincipalId: string, servicePrincipalKey: string, tenantId: string, subscriptionId: string) {
|
||||||
this.servicePrincipalId = servicePrincipalId;
|
this.servicePrincipalId = servicePrincipalId;
|
||||||
this.servicePrincipalKey = servicePrincipalKey;
|
this.servicePrincipalKey = servicePrincipalKey;
|
||||||
this.federatedToken = federatedToken;
|
|
||||||
this.tenantId = tenantId;
|
this.tenantId = tenantId;
|
||||||
this.subscriptionId = subscriptionId;
|
this.subscriptionId = subscriptionId;
|
||||||
this.environment = environment;
|
|
||||||
this.resourceManagerEndpointUrl = resourceManagerEndpointUrl;
|
|
||||||
this.allowNoSubscriptionsLogin = allowNoSubscriptionsLogin;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async initialize() {
|
async initialize() {
|
||||||
@@ -55,12 +40,9 @@ export class ServicePrincipalLogin implements IAzurePowerShellSession {
|
|||||||
const args: any = {
|
const args: any = {
|
||||||
servicePrincipalId: this.servicePrincipalId,
|
servicePrincipalId: this.servicePrincipalId,
|
||||||
servicePrincipalKey: this.servicePrincipalKey,
|
servicePrincipalKey: this.servicePrincipalKey,
|
||||||
federatedToken: this.federatedToken,
|
|
||||||
subscriptionId: this.subscriptionId,
|
subscriptionId: this.subscriptionId,
|
||||||
environment: this.environment,
|
environment: ServicePrincipalLogin.environment,
|
||||||
scopeLevel: ServicePrincipalLogin.scopeLevel,
|
scopeLevel: ServicePrincipalLogin.scopeLevel
|
||||||
allowNoSubscriptionsLogin: this.allowNoSubscriptionsLogin,
|
|
||||||
resourceManagerEndpointUrl: this.resourceManagerEndpointUrl
|
|
||||||
}
|
}
|
||||||
const script: string = new ScriptBuilder().getAzPSLoginScript(ServicePrincipalLogin.scheme, this.tenantId, args);
|
const script: string = new ScriptBuilder().getAzPSLoginScript(ServicePrincipalLogin.scheme, this.tenantId, args);
|
||||||
await PowerShellToolRunner.init();
|
await PowerShellToolRunner.init();
|
||||||
|
|||||||
@@ -8,28 +8,14 @@ export default class ScriptBuilder {
|
|||||||
getAzPSLoginScript(scheme: string, tenantId: string, args: any): string {
|
getAzPSLoginScript(scheme: string, tenantId: string, args: any): string {
|
||||||
let command = `Clear-AzContext -Scope Process;
|
let command = `Clear-AzContext -Scope Process;
|
||||||
Clear-AzContext -Scope CurrentUser -Force -ErrorAction SilentlyContinue;`;
|
Clear-AzContext -Scope CurrentUser -Force -ErrorAction SilentlyContinue;`;
|
||||||
|
|
||||||
if (scheme === Constants.ServicePrincipal) {
|
if (scheme === Constants.ServicePrincipal) {
|
||||||
|
command += `Connect-AzAccount -ServicePrincipal -Tenant '${tenantId}' -Credential \
|
||||||
if (args.environment.toLowerCase() == "azurestack") {
|
(New-Object System.Management.Automation.PSCredential('${args.servicePrincipalId}',(ConvertTo-SecureString '${args.servicePrincipalKey.replace("'", "''")}' -AsPlainText -Force))) \
|
||||||
command += `Add-AzEnvironment -Name ${args.environment} -ARMEndpoint ${args.resourceManagerEndpointUrl} | out-null;`;
|
-Environment '${args.environment}' | out-null;`;
|
||||||
}
|
if (args.scopeLevel === Constants.Subscription) {
|
||||||
// Separate command script for OIDC and non-OIDC
|
|
||||||
if (!!args.federatedToken) {
|
|
||||||
command += `Connect-AzAccount -ServicePrincipal -ApplicationId '${args.servicePrincipalId}' -Tenant '${tenantId}' -FederatedToken '${args.federatedToken}' \
|
|
||||||
-Environment '${args.environment}' | out-null;`;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
command += `Connect-AzAccount -ServicePrincipal -Tenant '${tenantId}' -Credential \
|
|
||||||
(New-Object System.Management.Automation.PSCredential('${args.servicePrincipalId}',(ConvertTo-SecureString '${args.servicePrincipalKey.replace("'", "''")}' -AsPlainText -Force))) \
|
|
||||||
-Environment '${args.environment}' | out-null;`;
|
|
||||||
}
|
|
||||||
// command to set the subscription
|
|
||||||
if (args.scopeLevel === Constants.Subscription && !args.allowNoSubscriptionsLogin) {
|
|
||||||
command += `Set-AzContext -SubscriptionId '${args.subscriptionId}' -TenantId '${tenantId}' | out-null;`;
|
command += `Set-AzContext -SubscriptionId '${args.subscriptionId}' -TenantId '${tenantId}' | out-null;`;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
this.script += `try {
|
this.script += `try {
|
||||||
$ErrorActionPreference = "Stop"
|
$ErrorActionPreference = "Stop"
|
||||||
$WarningPreference = "SilentlyContinue"
|
$WarningPreference = "SilentlyContinue"
|
||||||
@@ -41,7 +27,6 @@ export default class ScriptBuilder {
|
|||||||
$output['${Constants.Error}'] = $_.exception.Message
|
$output['${Constants.Error}'] = $_.exception.Message
|
||||||
}
|
}
|
||||||
return ConvertTo-Json $output`;
|
return ConvertTo-Json $output`;
|
||||||
|
|
||||||
core.debug(`Azure PowerShell Login Script: ${this.script}`);
|
core.debug(`Azure PowerShell Login Script: ${this.script}`);
|
||||||
return this.script;
|
return this.script;
|
||||||
}
|
}
|
||||||
|
|||||||
295
src/main.ts
295
src/main.ts
@@ -1,214 +1,81 @@
|
|||||||
import * as core from '@actions/core';
|
import * as core from '@actions/core';
|
||||||
import * as exec from '@actions/exec';
|
import * as exec from '@actions/exec';
|
||||||
import * as io from '@actions/io';
|
import * as io from '@actions/io';
|
||||||
import { FormatType, SecretParser } from 'actions-secret-parser';
|
|
||||||
import { ServicePrincipalLogin } from './PowerShell/ServicePrincipalLogin';
|
import { FormatType, SecretParser } from 'actions-secret-parser';
|
||||||
|
import { ServicePrincipalLogin } from './PowerShell/ServicePrincipalLogin';
|
||||||
var azPath: string;
|
|
||||||
var prefix = !!process.env.AZURE_HTTP_USER_AGENT ? `${process.env.AZURE_HTTP_USER_AGENT}` : "";
|
var azPath: string;
|
||||||
var azPSHostEnv = !!process.env.AZUREPS_HOST_ENVIRONMENT ? `${process.env.AZUREPS_HOST_ENVIRONMENT}` : "";
|
var prefix = !!process.env.AZURE_HTTP_USER_AGENT ? `${process.env.AZURE_HTTP_USER_AGENT}` : "";
|
||||||
|
var azPSHostEnv = !!process.env.AZUREPS_HOST_ENVIRONMENT ? `${process.env.AZUREPS_HOST_ENVIRONMENT}` : "";
|
||||||
async function main() {
|
|
||||||
try {
|
async function main() {
|
||||||
// Set user agent variable
|
try {
|
||||||
var isAzCLISuccess = false;
|
// Set user agent variable
|
||||||
let usrAgentRepo = `${process.env.GITHUB_REPOSITORY}`;
|
var isAzCLISuccess = false;
|
||||||
let actionName = 'AzureLogin';
|
let usrAgentRepo = `${process.env.GITHUB_REPOSITORY}`;
|
||||||
let userAgentString = (!!prefix ? `${prefix}+` : '') + `GITHUBACTIONS/${actionName}@v1_${usrAgentRepo}`;
|
let actionName = 'AzureLogin';
|
||||||
let azurePSHostEnv = (!!azPSHostEnv ? `${azPSHostEnv}+` : '') + `GITHUBACTIONS/${actionName}@v1_${usrAgentRepo}`;
|
let userAgentString = (!!prefix ? `${prefix}+` : '') + `GITHUBACTIONS/${actionName}@v1_${usrAgentRepo}`;
|
||||||
core.exportVariable('AZURE_HTTP_USER_AGENT', userAgentString);
|
let azurePSHostEnv = (!!azPSHostEnv ? `${azPSHostEnv}+` : '') + `GITHUBACTIONS/${actionName}@v1_${usrAgentRepo}`;
|
||||||
core.exportVariable('AZUREPS_HOST_ENVIRONMENT', azurePSHostEnv);
|
core.exportVariable('AZURE_HTTP_USER_AGENT', userAgentString);
|
||||||
|
core.exportVariable('AZUREPS_HOST_ENVIRONMENT', azurePSHostEnv);
|
||||||
azPath = await io.which("az", true);
|
|
||||||
core.debug(`az cli version used: ${azPath}`);
|
azPath = await io.which("az", true);
|
||||||
let azureSupportedCloudName = new Set([
|
let output: string = "";
|
||||||
"azureusgovernment",
|
const options: any = {
|
||||||
"azurechinacloud",
|
listeners: {
|
||||||
"azuregermancloud",
|
stdout: (data: Buffer) => {
|
||||||
"azurecloud",
|
output += data.toString();
|
||||||
"azurestack"]);
|
}
|
||||||
|
}
|
||||||
let output: string = "";
|
};
|
||||||
const execOptions: any = {
|
await executeAzCliCommand("--version", true, options);
|
||||||
listeners: {
|
core.debug(`az cli version used:\n${output}`);
|
||||||
stdout: (data: Buffer) => {
|
|
||||||
output += data.toString();
|
let creds = core.getInput('creds', { required: true });
|
||||||
}
|
let secrets = new SecretParser(creds, FormatType.JSON);
|
||||||
}
|
let servicePrincipalId = secrets.getSecret("$.clientId", false);
|
||||||
};
|
let servicePrincipalKey = secrets.getSecret("$.clientSecret", true);
|
||||||
await executeAzCliCommand("--version", true, execOptions);
|
let tenantId = secrets.getSecret("$.tenantId", false);
|
||||||
core.debug(`az cli version used:\n${output}`);
|
let subscriptionId = secrets.getSecret("$.subscriptionId", false);
|
||||||
|
const enableAzPSSession = core.getInput('enable-AzPSSession').toLowerCase() === "true";
|
||||||
let creds = core.getInput('creds', { required: false });
|
if (!servicePrincipalId || !servicePrincipalKey || !tenantId || !subscriptionId) {
|
||||||
let secrets = creds ? new SecretParser(creds, FormatType.JSON) : null;
|
throw new Error("Not all values are present in the creds object. Ensure clientId, clientSecret, tenantId and subscriptionId are supplied.");
|
||||||
let environment = core.getInput("environment").toLowerCase();
|
}
|
||||||
const enableAzPSSession = core.getInput('enable-AzPSSession').toLowerCase() === "true";
|
// Attempting Az cli login
|
||||||
const allowNoSubscriptionsLogin = core.getInput('allow-no-subscriptions').toLowerCase() === "true";
|
await executeAzCliCommand(`login --service-principal -u "${servicePrincipalId}" -p "${servicePrincipalKey}" --tenant "${tenantId}"`, true);
|
||||||
|
await executeAzCliCommand(`account set --subscription "${subscriptionId}"`, true);
|
||||||
//Check for the credentials in individual parameters in the workflow.
|
isAzCLISuccess = true;
|
||||||
var servicePrincipalId = core.getInput('client-id', { required: false });;
|
if (enableAzPSSession) {
|
||||||
var servicePrincipalKey = null;
|
// Attempting Az PS login
|
||||||
var tenantId = core.getInput('tenant-id', { required: false });
|
console.log(`Running Azure PS Login`);
|
||||||
var subscriptionId = core.getInput('subscription-id', { required: false });
|
const spnlogin: ServicePrincipalLogin = new ServicePrincipalLogin(servicePrincipalId, servicePrincipalKey, tenantId, subscriptionId);
|
||||||
var resourceManagerEndpointUrl = "https://management.azure.com/";
|
await spnlogin.initialize();
|
||||||
var enableOIDC = true;
|
await spnlogin.login();
|
||||||
var federatedToken = null;
|
}
|
||||||
|
console.log("Login successful.");
|
||||||
// If any of the individual credentials (clent_id, tenat_id, subscription_id) is present.
|
} catch (error) {
|
||||||
if (servicePrincipalId || tenantId || subscriptionId) {
|
if (!isAzCLISuccess) {
|
||||||
|
core.error("Az CLI Login failed. Please check the credentials. For more information refer https://aka.ms/create-secrets-for-GitHub-workflows");
|
||||||
//If few of the individual credentials (clent_id, tenat_id, subscription_id) are missing in action inputs.
|
} else {
|
||||||
if (!(servicePrincipalId && tenantId && (subscriptionId || allowNoSubscriptionsLogin)))
|
core.error(`Azure PowerShell Login failed. Please check the credentials. For more information refer https://aka.ms/create-secrets-for-GitHub-workflows"`);
|
||||||
throw new Error("Few credentials are missing. ClientId,tenantId are mandatory. SubscriptionId is also mandatory if allow-no-subscriptions is not set.");
|
}
|
||||||
}
|
core.setFailed(error);
|
||||||
else {
|
} finally {
|
||||||
if (creds) {
|
// Reset AZURE_HTTP_USER_AGENT
|
||||||
core.debug('using creds JSON...');
|
core.exportVariable('AZURE_HTTP_USER_AGENT', prefix);
|
||||||
enableOIDC = false;
|
core.exportVariable('AZUREPS_HOST_ENVIRONMENT', azPSHostEnv);
|
||||||
servicePrincipalId = secrets.getSecret("$.clientId", true);
|
}
|
||||||
servicePrincipalKey = secrets.getSecret("$.clientSecret", true);
|
}
|
||||||
tenantId = secrets.getSecret("$.tenantId", true);
|
|
||||||
subscriptionId = secrets.getSecret("$.subscriptionId", true);
|
async function executeAzCliCommand(command: string, silent?: boolean, options: any = {}) {
|
||||||
resourceManagerEndpointUrl = secrets.getSecret("$.resourceManagerEndpointUrl", false);
|
options.silent = !!silent;
|
||||||
}
|
try {
|
||||||
else {
|
await exec.exec(`"${azPath}" ${command}`, [], options);
|
||||||
throw new Error("Credentials are not passed for Login action.");
|
}
|
||||||
}
|
catch(error) {
|
||||||
}
|
throw new Error(error);
|
||||||
//generic checks
|
}
|
||||||
//servicePrincipalKey is only required in non-oidc scenario.
|
}
|
||||||
if (!servicePrincipalId || !tenantId || !(servicePrincipalKey || enableOIDC)) {
|
|
||||||
throw new Error("Not all values are present in the credentials. Ensure clientId, clientSecret and tenantId are supplied.");
|
main();
|
||||||
}
|
|
||||||
if (!subscriptionId && !allowNoSubscriptionsLogin) {
|
|
||||||
throw new Error("Not all values are present in the credentials. Ensure subscriptionId is supplied.");
|
|
||||||
}
|
|
||||||
if (!azureSupportedCloudName.has(environment)) {
|
|
||||||
throw new Error("Unsupported value for environment is passed.The list of supported values for environment are ‘azureusgovernment', ‘azurechinacloud’, ‘azuregermancloud’, ‘azurecloud’ or ’azurestack’");
|
|
||||||
}
|
|
||||||
|
|
||||||
// OIDC specific checks
|
|
||||||
if (enableOIDC) {
|
|
||||||
console.log('Using OIDC authentication...')
|
|
||||||
//generating ID-token
|
|
||||||
federatedToken = await core.getIDToken('api://AzureADTokenExchange');
|
|
||||||
if (!!federatedToken) {
|
|
||||||
if (environment != "azurecloud")
|
|
||||||
throw new Error(`Your current environment - "${environment}" is not supported for OIDC login.`);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
throw new Error("Could not get ID token for authentication.");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Attempting Az cli login
|
|
||||||
if (environment == "azurestack") {
|
|
||||||
if (!resourceManagerEndpointUrl) {
|
|
||||||
throw new Error("resourceManagerEndpointUrl is a required parameter when environment is defined.");
|
|
||||||
}
|
|
||||||
|
|
||||||
console.log(`Unregistering cloud: "${environment}" first if it exists`);
|
|
||||||
try {
|
|
||||||
await executeAzCliCommand(`cloud set -n AzureCloud`, true);
|
|
||||||
await executeAzCliCommand(`cloud unregister -n "${environment}"`, false);
|
|
||||||
}
|
|
||||||
catch (error) {
|
|
||||||
console.log(`Ignore cloud not registered error: "${error}"`);
|
|
||||||
}
|
|
||||||
|
|
||||||
console.log(`Registering cloud: "${environment}" with ARM endpoint: "${resourceManagerEndpointUrl}"`);
|
|
||||||
try {
|
|
||||||
let baseUri = resourceManagerEndpointUrl;
|
|
||||||
if (baseUri.endsWith('/')) {
|
|
||||||
baseUri = baseUri.substring(0, baseUri.length - 1); // need to remove trailing / from resourceManagerEndpointUrl to correctly derive suffixes below
|
|
||||||
}
|
|
||||||
let suffixKeyvault = ".vault" + baseUri.substring(baseUri.indexOf('.')); // keyvault suffix starts with .
|
|
||||||
let suffixStorage = baseUri.substring(baseUri.indexOf('.') + 1); // storage suffix starts without .
|
|
||||||
let profileVersion = "2019-03-01-hybrid";
|
|
||||||
await executeAzCliCommand(`cloud register -n "${environment}" --endpoint-resource-manager "${resourceManagerEndpointUrl}" --suffix-keyvault-dns "${suffixKeyvault}" --suffix-storage-endpoint "${suffixStorage}" --profile "${profileVersion}"`, false);
|
|
||||||
}
|
|
||||||
catch (error) {
|
|
||||||
core.error(`Error while trying to register cloud "${environment}": "${error}"`);
|
|
||||||
}
|
|
||||||
|
|
||||||
console.log(`Done registering cloud: "${environment}"`)
|
|
||||||
}
|
|
||||||
|
|
||||||
await executeAzCliCommand(`cloud set -n "${environment}"`, false);
|
|
||||||
console.log(`Done setting cloud: "${environment}"`);
|
|
||||||
|
|
||||||
// Attempting Az cli login
|
|
||||||
var commonArgs = ["--service-principal",
|
|
||||||
"-u", servicePrincipalId,
|
|
||||||
"--tenant", tenantId
|
|
||||||
];
|
|
||||||
if (allowNoSubscriptionsLogin) {
|
|
||||||
commonArgs = commonArgs.concat("--allow-no-subscriptions");
|
|
||||||
}
|
|
||||||
if (enableOIDC) {
|
|
||||||
commonArgs = commonArgs.concat("--federated-token", federatedToken);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
commonArgs = commonArgs.concat("-p", servicePrincipalKey);
|
|
||||||
}
|
|
||||||
await executeAzCliCommand(`login`, true, {}, commonArgs);
|
|
||||||
|
|
||||||
if (!allowNoSubscriptionsLogin) {
|
|
||||||
var args = [
|
|
||||||
"--subscription",
|
|
||||||
subscriptionId
|
|
||||||
];
|
|
||||||
await executeAzCliCommand(`account set`, true, {}, args);
|
|
||||||
}
|
|
||||||
isAzCLISuccess = true;
|
|
||||||
if (enableAzPSSession) {
|
|
||||||
// Attempting Az PS login
|
|
||||||
console.log(`Running Azure PS Login`);
|
|
||||||
var spnlogin: ServicePrincipalLogin;
|
|
||||||
|
|
||||||
spnlogin = new ServicePrincipalLogin(
|
|
||||||
servicePrincipalId,
|
|
||||||
servicePrincipalKey,
|
|
||||||
federatedToken,
|
|
||||||
tenantId,
|
|
||||||
subscriptionId,
|
|
||||||
allowNoSubscriptionsLogin,
|
|
||||||
environment,
|
|
||||||
resourceManagerEndpointUrl);
|
|
||||||
await spnlogin.initialize();
|
|
||||||
await spnlogin.login();
|
|
||||||
}
|
|
||||||
|
|
||||||
console.log("Login successful.");
|
|
||||||
}
|
|
||||||
catch (error) {
|
|
||||||
if (!isAzCLISuccess) {
|
|
||||||
core.error("Az CLI Login failed. Please check the credentials. For more information refer https://aka.ms/create-secrets-for-GitHub-workflows");
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
core.error(`Azure PowerShell Login failed. Please check the credentials. For more information refer https://aka.ms/create-secrets-for-GitHub-workflows"`);
|
|
||||||
}
|
|
||||||
core.setFailed(error);
|
|
||||||
}
|
|
||||||
finally {
|
|
||||||
// Reset AZURE_HTTP_USER_AGENT
|
|
||||||
core.exportVariable('AZURE_HTTP_USER_AGENT', prefix);
|
|
||||||
core.exportVariable('AZUREPS_HOST_ENVIRONMENT', azPSHostEnv);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
async function executeAzCliCommand(
|
|
||||||
command: string,
|
|
||||||
silent?: boolean,
|
|
||||||
execOptions: any = {},
|
|
||||||
args: any = []) {
|
|
||||||
execOptions.silent = !!silent;
|
|
||||||
try {
|
|
||||||
await exec.exec(`"${azPath}" ${command}`, args, execOptions);
|
|
||||||
}
|
|
||||||
catch (error) {
|
|
||||||
throw new Error(error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
main();
|
|
||||||
Reference in New Issue
Block a user