Bump dependencies versions (#419)

* bump dependencies version

* abandon jsonpath

* remove jspath
This commit is contained in:
Shiying Chen
2024-02-22 16:10:10 +08:00
committed by GitHub
parent 332d569187
commit c847559275
4 changed files with 473 additions and 3776 deletions

View File

@@ -96,7 +96,7 @@ describe("LoginConfig Test", () => {
expect(loginConfig.servicePrincipalId).toBe("client-id"); expect(loginConfig.servicePrincipalId).toBe("client-id");
expect(loginConfig.servicePrincipalSecret).toBe("client-secret"); expect(loginConfig.servicePrincipalSecret).toBe("client-secret");
expect(loginConfig.tenantId).toBe("tenant-id"); expect(loginConfig.tenantId).toBe("tenant-id");
expect(loginConfig.subscriptionId).toBe(""); expect(loginConfig.subscriptionId).toBe(undefined);
}); });
test('initialize with creds', async () => { test('initialize with creds', async () => {

4224
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -7,11 +7,11 @@
"build": "tsc", "build": "tsc",
"test": "jest" "test": "jest"
}, },
"author": "Sumiran Aggarwal", "author": "Microsoft",
"license": "MIT", "license": "MIT",
"devDependencies": { "devDependencies": {
"@types/jest": "^29.2.4", "@types/jest": "^29.2.4",
"@types/node": "^12.7.11", "@types/node": "^20.11.1",
"jest": "^29.3.1", "jest": "^29.3.1",
"jest-circus": "^29.3.1", "jest-circus": "^29.3.1",
"ts-jest": "^29.0.3", "ts-jest": "^29.0.3",
@@ -21,7 +21,6 @@
"@actions/core": "1.9.1", "@actions/core": "1.9.1",
"@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.4",
"package-lock": "^1.0.3" "package-lock": "^1.0.3"
} }
} }

View File

@@ -1,5 +1,4 @@
import * as core from '@actions/core'; import * as core from '@actions/core';
import { FormatType, SecretParser } from 'actions-secret-parser';
export class LoginConfig { export class LoginConfig {
static readonly AUTH_TYPE_SERVICE_PRINCIPAL = "SERVICE_PRINCIPAL"; static readonly AUTH_TYPE_SERVICE_PRINCIPAL = "SERVICE_PRINCIPAL";
@@ -49,10 +48,10 @@ export class LoginConfig {
private readParametersFromCreds() { private readParametersFromCreds() {
let creds = core.getInput('creds', { required: false }); let creds = core.getInput('creds', { required: false });
let secrets = creds ? new SecretParser(creds, FormatType.JSON) : null; if (!creds) {
if (!secrets) {
return; return;
} }
let secrets = JSON.parse(creds);
if(this.authType != LoginConfig.AUTH_TYPE_SERVICE_PRINCIPAL){ if(this.authType != LoginConfig.AUTH_TYPE_SERVICE_PRINCIPAL){
return; return;
@@ -64,11 +63,11 @@ export class LoginConfig {
} }
core.debug('Reading creds in JSON...'); core.debug('Reading creds in JSON...');
this.servicePrincipalId = this.servicePrincipalId ? this.servicePrincipalId : secrets.getSecret("$.clientId", false); this.servicePrincipalId = this.servicePrincipalId ? this.servicePrincipalId : secrets.clientId;
this.servicePrincipalSecret = secrets.getSecret("$.clientSecret", false); this.servicePrincipalSecret = secrets.clientSecret;
this.tenantId = this.tenantId ? this.tenantId : secrets.getSecret("$.tenantId", false); this.tenantId = this.tenantId ? this.tenantId : secrets.tenantId;
this.subscriptionId = this.subscriptionId ? this.subscriptionId : secrets.getSecret("$.subscriptionId", false); this.subscriptionId = this.subscriptionId ? this.subscriptionId : secrets.subscriptionId;
this.resourceManagerEndpointUrl = secrets.getSecret("$.resourceManagerEndpointUrl", false); this.resourceManagerEndpointUrl = secrets.resourceManagerEndpointUrl;
if (!this.servicePrincipalId || !this.servicePrincipalSecret || !this.tenantId) { if (!this.servicePrincipalId || !this.servicePrincipalSecret || !this.tenantId) {
throw new Error("Not all parameters are provided in 'creds'. Double-check if all keys are defined in 'creds': 'clientId', 'clientSecret', 'tenantId'."); throw new Error("Not all parameters are provided in 'creds'. Double-check if all keys are defined in 'creds': 'clientId', 'clientSecret', 'tenantId'.");
} }
@@ -117,4 +116,3 @@ async function jwtParser(federatedToken: string) {
let decodedPayload = JSON.parse(bufferObj.toString("utf8")); let decodedPayload = JSON.parse(bufferObj.toString("utf8"));
return [decodedPayload['iss'], decodedPayload['sub']]; return [decodedPayload['iss'], decodedPayload['sub']];
} }