Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update node dependencies 2024-12-19 #275

Merged
merged 4 commits into from
Dec 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions agent/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@fs/ppaas-agent",
"version": "3.3.4",
"version": "3.3.5",
"description": "Agent Service for running pewpew tests",
"main": "dist/src/app.js",
"scripts": {
Expand Down Expand Up @@ -58,7 +58,7 @@
"axios": "~1.7.0",
"chai": "^4.3.7",
"eslint": "^9.15.0",
"mocha": "^10.2.0",
"mocha": "^11.0.0",
"nyc": "^17.0.0",
"typescript": "^5.3.0"
}
Expand Down
5 changes: 3 additions & 2 deletions common/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@fs/ppaas-common",
"version": "3.3.4",
"version": "3.3.5",
"description": "Common Code for the PewPewController and PewPewAgent",
"main": "dist/src/index.js",
"types": "dist/src/index.d.ts",
Expand Down Expand Up @@ -35,6 +35,7 @@
"dependencies": {
"@aws-sdk/client-s3": "^3.363.0",
"@aws-sdk/client-sqs": "^3.363.0",
"@aws-sdk/ec2-metadata-service": "^3.363.0",
"@aws-sdk/lib-storage": "^3.363.0",
"bunyan": "~1.8.0",
"rimraf": "^5.0.0"
Expand All @@ -55,7 +56,7 @@
"dotenv": "^16.0.0",
"dotenv-flow": "^4.0.1",
"eslint": "^9.15.0",
"mocha": "^10.2.0",
"mocha": "^11.0.0",
"nyc": "^17.0.0",
"typescript": "^5.3.0"
}
Expand Down
24 changes: 24 additions & 0 deletions common/src/util/ec2.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import { LogLevel, log } from "./log";
import { IS_RUNNING_IN_AWS } from "./util";
import { MetadataService } from "@aws-sdk/ec2-metadata-service";
import { exec as _exec } from "child_process";
import { promisify } from "util";
import { readFile } from "fs/promises";
Expand All @@ -8,7 +10,29 @@ export const INSTANCE_ID_FILE = "/var/lib/cloud/data/instance-id";
export const INSTANCE_ID_REGEX = /^i-[0-9a-z]+$/;
export const INSTANCE_FILE_REGEX = /^instance-id:\s*(i-[0-9a-z]+)$/;
export const INSTANCE_ID_COMMAND = "ec2-metadata --instance-id";

// Putting back code removed by https://github.com/fs-eng/ppaas-common/commit/397d38e31ebafa9551dec8d9a2082140e8d949ae#diff-b0083bb9a17262c7a014463e8dee3fd0489cad8cb220d19531f295b9592826a0L14
// AWS SDK V3 finally supports the MetadataService
const metadata: MetadataService = new MetadataService({
// host: "169.254.169.254"
});

export async function getInstanceId (): Promise<string> {
// Our current mocks do not support the metadata service. bypass when not in AWS so we don't timeout on integration and unit tests
if (IS_RUNNING_IN_AWS) {
try {
// curl http://169.254.169.254/latest/meta-data/instance-id -> "i-0cfd3309705a3ce79"
const instanceId: string = await metadata.request("/latest/meta-data/instance-id", {});
log("getInstanceId MetadataService /latest/meta-data/instance-id: " + instanceId, LogLevel.WARN, instanceId);
if (!INSTANCE_ID_REGEX.test(instanceId)) {
log(`InstanceId did not match regex [${instanceId}]`, LogLevel.WARN, { match: instanceId?.match(INSTANCE_ID_REGEX), INSTANCE_ID_REGEX });
throw new Error("InstanceId did not match regex");
}
return instanceId;
} catch (error: unknown) {
log("Could not load instanceId metadata", LogLevel.WARN, error);
}
}
// Try to load from file first
// $ cat /var/lib/cloud/data/instance-id -> "i-0cfd3309705a3ce79"
try {
Expand Down
1 change: 1 addition & 0 deletions common/src/util/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ export const CONTROLLER_APPLICATION_PREFIX: string = CONTROLLER_APPLICATION_NAME
export const SYSTEM_NAME: string = process.env.SYSTEM_NAME || "unittests";
export const CONTROLLER_ENV = process.env.CONTROLLER_ENV;
export const AGENT_ENV = process.env.AGENT_ENV;
export const IS_RUNNING_IN_AWS: boolean = process.env.APPLICATION_NAME !== undefined && process.env.SYSTEM_NAME !== undefined;

export const PEWPEW_BINARY_FOLDER: string = "pewpew";
export const PEWPEW_VERSION_LATEST: string = "latest";
Expand Down
2 changes: 1 addition & 1 deletion controller/next-env.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
/// <reference types="next/image-types/global" />

// NOTE: This file should not be edited
// see https://nextjs.org/docs/pages/building-your-application/configuring/typescript for more information.
// see https://nextjs.org/docs/pages/api-reference/config/typescript for more information.
10 changes: 5 additions & 5 deletions controller/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@fs/ppaas-controller",
"version": "3.3.4",
"version": "3.3.5",
"description": "Controller Service for running pewpew tests",
"private": true,
"scripts": {
Expand Down Expand Up @@ -63,7 +63,7 @@
"formidable": "~3.5.0",
"js-cookie": "^3.0.5",
"js-yaml": "^4.1.0",
"next": "~15.0.3",
"next": "~15.1.0",
"next-cookies": "^2.0.3",
"openid-client": "~5.7.0",
"rc-progress": "^4.0.0",
Expand All @@ -84,7 +84,7 @@
"@aws-sdk/util-stream-node": "^3.363.0",
"@eslint/eslintrc": "^3.1.0",
"@eslint/js": "^9.8.0",
"@next/eslint-plugin-next": "~15.0.3",
"@next/eslint-plugin-next": "~15.1.0",
"@storybook/addon-actions": "~8.4.0",
"@storybook/addon-links": "~8.4.0",
"@storybook/nextjs": "~8.4.0",
Expand Down Expand Up @@ -115,13 +115,13 @@
"dotenv-flow": "^4.0.1",
"esbuild": ">=0.17",
"eslint": "^9.15.0",
"eslint-config-next": "~15.0.3",
"eslint-config-next": "~15.1.0",
"form-data": "^4.0.0",
"glob-parent": "^6.0.2",
"immer": "^10.0.2",
"jsdom": ">=23.0.0",
"jsdom-global": "^3.0.2",
"mocha": "^10.2.0",
"mocha": "^11.0.0",
"nyc": "^17.0.0",
"postcss": "^8.4.24",
"set-value": "^4.1.0",
Expand Down
Loading
Loading