Skip to content

chore: replace npm private package scope by an org we own #4103

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

Merged
merged 2 commits into from
Aug 28, 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
6 changes: 3 additions & 3 deletions lambdas/functions/ami-housekeeper/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "@terraform-aws-github-runner/ami-housekeeper",
"name": "@aws-github-runner/ami-housekeeper",
"version": "1.0.0",
"main": "lambda.ts",
"license": "MIT",
Expand Down Expand Up @@ -37,11 +37,11 @@
"ts-node-dev": "^2.0.0"
},
"dependencies": {
"@aws-github-runner/aws-powertools-util": "*",
"@aws-github-runner/aws-ssm-util": "*",
"@aws-sdk/client-ec2": "^3.637.0",
"@aws-sdk/client-ssm": "^3.637.0",
"@aws-sdk/types": "^3.609.0",
"@terraform-aws-github-runner/aws-powertools-util": "*",
"@terraform-aws-github-runner/aws-ssm-util": "*",
"cron-parser": "^4.9.0",
"typescript": "^5.5.4"
},
Expand Down
4 changes: 2 additions & 2 deletions lambdas/functions/ami-housekeeper/src/ami.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import {
Image,
} from '@aws-sdk/client-ec2';
import { DescribeParametersCommand, GetParameterCommand, SSMClient } from '@aws-sdk/client-ssm';
import { createChildLogger } from '@terraform-aws-github-runner/aws-powertools-util';
import { getTracedAWSV3Client } from '@terraform-aws-github-runner/aws-powertools-util';
import { createChildLogger } from '@aws-github-runner/aws-powertools-util';
import { getTracedAWSV3Client } from '@aws-github-runner/aws-powertools-util';

const logger = createChildLogger('ami');

Expand Down
4 changes: 2 additions & 2 deletions lambdas/functions/ami-housekeeper/src/lambda.test.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { logger } from '@terraform-aws-github-runner/aws-powertools-util';
import { logger } from '@aws-github-runner/aws-powertools-util';
import { Context } from 'aws-lambda';
import { mocked } from 'jest-mock';

import { AmiCleanupOptions, amiCleanup } from './ami';
import { handler } from './lambda';

jest.mock('./ami');
jest.mock('@terraform-aws-github-runner/aws-powertools-util');
jest.mock('@aws-github-runner/aws-powertools-util');

const amiCleanupOptions: AmiCleanupOptions = {
minimumDaysOld: undefined,
Expand Down
2 changes: 1 addition & 1 deletion lambdas/functions/ami-housekeeper/src/lambda.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { logger, setContext } from '@terraform-aws-github-runner/aws-powertools-util';
import { logger, setContext } from '@aws-github-runner/aws-powertools-util';
import { Context } from 'aws-lambda';
import 'source-map-support/register';

Expand Down
2 changes: 1 addition & 1 deletion lambdas/functions/ami-housekeeper/src/local.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { logger } from '@terraform-aws-github-runner/aws-powertools-util';
import { logger } from '@aws-github-runner/aws-powertools-util';

import { amiCleanup } from './ami';

Expand Down
6 changes: 3 additions & 3 deletions lambdas/functions/control-plane/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "@terraform-aws-github-runner/control-plane",
"name": "@aws-github-runner/control-plane",
"version": "1.0.0",
"main": "lambda.ts",
"license": "MIT",
Expand Down Expand Up @@ -38,6 +38,8 @@
"ts-node-dev": "^2.0.0"
},
"dependencies": {
"@aws-github-runner/aws-powertools-util": "*",
"@aws-github-runner/aws-ssm-util": "*",
"@aws-lambda-powertools/parameters": "^2.7.0",
"@aws-sdk/client-ec2": "^3.637.0",
"@aws-sdk/client-sqs": "^3.637.0",
Expand All @@ -48,8 +50,6 @@
"@octokit/plugin-throttling": "8.2.0",
"@octokit/rest": "20.1.1",
"@octokit/types": "^13.5.0",
"@terraform-aws-github-runner/aws-powertools-util": "*",
"@terraform-aws-github-runner/aws-ssm-util": "*",
"cron-parser": "^4.9.0",
"typescript": "^5.5.4"
},
Expand Down
2 changes: 1 addition & 1 deletion lambdas/functions/control-plane/src/aws/runners.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import {
TerminateInstancesCommand,
} from '@aws-sdk/client-ec2';
import { GetParameterCommand, GetParameterResult, PutParameterCommand, SSMClient } from '@aws-sdk/client-ssm';
import { tracer } from '@terraform-aws-github-runner/aws-powertools-util';
import { tracer } from '@aws-github-runner/aws-powertools-util';
import { mockClient } from 'aws-sdk-client-mock';
import 'aws-sdk-client-mock-jest';

Expand Down
6 changes: 3 additions & 3 deletions lambdas/functions/control-plane/src/aws/runners.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ import {
TerminateInstancesCommand,
_InstanceType,
} from '@aws-sdk/client-ec2';
import { createChildLogger } from '@terraform-aws-github-runner/aws-powertools-util';
import { getTracedAWSV3Client, tracer } from '@terraform-aws-github-runner/aws-powertools-util';
import { getParameter } from '@terraform-aws-github-runner/aws-ssm-util';
import { createChildLogger } from '@aws-github-runner/aws-powertools-util';
import { getTracedAWSV3Client, tracer } from '@aws-github-runner/aws-powertools-util';
import { getParameter } from '@aws-github-runner/aws-ssm-util';
import moment from 'moment';

import ScaleError from './../scale-runners/ScaleError';
Expand Down
2 changes: 1 addition & 1 deletion lambdas/functions/control-plane/src/aws/sqs.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { SendMessageCommand, SQSClient } from '@aws-sdk/client-sqs';
import { mockClient } from 'aws-sdk-client-mock';
import 'aws-sdk-client-mock-jest';
import { publishMessage } from './sqs';
import { logger } from '@terraform-aws-github-runner/aws-powertools-util';
import { logger } from '@aws-github-runner/aws-powertools-util';

const mockSQSClient = mockClient(SQSClient);

Expand Down
2 changes: 1 addition & 1 deletion lambdas/functions/control-plane/src/aws/sqs.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { SQSClient, SendMessageCommand, SendMessageCommandOutput } from '@aws-sdk/client-sqs';
import { logger } from '@terraform-aws-github-runner/aws-powertools-util';
import { logger } from '@aws-github-runner/aws-powertools-util';

const sqs = new SQSClient({});

Expand Down
4 changes: 2 additions & 2 deletions lambdas/functions/control-plane/src/github/auth.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@ import { createAppAuth } from '@octokit/auth-app';
import { StrategyOptions } from '@octokit/auth-app/dist-types/types';
import { request } from '@octokit/request';
import { RequestInterface } from '@octokit/types';
import { getParameter } from '@terraform-aws-github-runner/aws-ssm-util';
import { getParameter } from '@aws-github-runner/aws-ssm-util';
import { mocked } from 'jest-mock';
import { MockProxy, mock } from 'jest-mock-extended';
import nock from 'nock';

import { createGithubAppAuth, createOctokitClient } from './auth';

jest.mock('@terraform-aws-github-runner/aws-ssm-util');
jest.mock('@aws-github-runner/aws-ssm-util');
jest.mock('@octokit/auth-app');

const cleanEnv = process.env;
Expand Down
4 changes: 2 additions & 2 deletions lambdas/functions/control-plane/src/github/auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ import { OctokitOptions } from '@octokit/core/dist-types/types';
import { request } from '@octokit/request';
import { Octokit } from '@octokit/rest';
import { throttling } from '@octokit/plugin-throttling';
import { createChildLogger } from '@terraform-aws-github-runner/aws-powertools-util';
import { getParameter } from '@terraform-aws-github-runner/aws-ssm-util';
import { createChildLogger } from '@aws-github-runner/aws-powertools-util';
import { getParameter } from '@aws-github-runner/aws-ssm-util';
import { EndpointDefaults } from '@octokit/types';

const logger = createChildLogger('gh-auth');
Expand Down
10 changes: 5 additions & 5 deletions lambdas/functions/control-plane/src/github/rate-limit.test.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { ResponseHeaders } from '@octokit/types';
import { createSingleMetric } from '@terraform-aws-github-runner/aws-powertools-util';
import { createSingleMetric } from '@aws-github-runner/aws-powertools-util';
import { MetricUnit } from '@aws-lambda-powertools/metrics';
import { metricGitHubAppRateLimit } from './rate-limit';

process.env.PARAMETER_GITHUB_APP_ID_NAME = 'test';
jest.mock('@terraform-aws-github-runner/aws-ssm-util', () => ({
...jest.requireActual('@terraform-aws-github-runner/aws-ssm-util'),
jest.mock('@aws-github-runner/aws-ssm-util', () => ({
...jest.requireActual('@aws-github-runner/aws-ssm-util'),
// get parameter name from process.env.PARAMETER_GITHUB_APP_ID_NAME rerunt 1234
getParameter: jest.fn((name: string) => {
if (name === process.env.PARAMETER_GITHUB_APP_ID_NAME) {
Expand All @@ -16,8 +16,8 @@ jest.mock('@terraform-aws-github-runner/aws-ssm-util', () => ({
}),
}));

jest.mock('@terraform-aws-github-runner/aws-powertools-util', () => ({
...jest.requireActual('@terraform-aws-github-runner/aws-powertools-util'),
jest.mock('@aws-github-runner/aws-powertools-util', () => ({
...jest.requireActual('@aws-github-runner/aws-powertools-util'),
// eslint-disable-next-line @typescript-eslint/no-unused-vars
createSingleMetric: jest.fn((name: string, unit: string, value: number, dimensions?: Record<string, string>) => {
return {
Expand Down
4 changes: 2 additions & 2 deletions lambdas/functions/control-plane/src/github/rate-limit.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { ResponseHeaders } from '@octokit/types';
import { createSingleMetric, logger } from '@terraform-aws-github-runner/aws-powertools-util';
import { createSingleMetric, logger } from '@aws-github-runner/aws-powertools-util';
import { MetricUnit } from '@aws-lambda-powertools/metrics';
import yn from 'yn';
import { getParameter } from '@terraform-aws-github-runner/aws-ssm-util';
import { getParameter } from '@aws-github-runner/aws-ssm-util';

export async function metricGitHubAppRateLimit(headers: ResponseHeaders): Promise<void> {
try {
Expand Down
6 changes: 3 additions & 3 deletions lambdas/functions/control-plane/src/lambda.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { captureLambdaHandler, logger } from '@terraform-aws-github-runner/aws-powertools-util';
import { captureLambdaHandler, logger } from '@aws-github-runner/aws-powertools-util';
import { Context, SQSEvent, SQSRecord } from 'aws-lambda';
import { mocked } from 'jest-mock';

Expand Down Expand Up @@ -66,8 +66,8 @@ jest.mock('./scale-runners/scale-down');
jest.mock('./scale-runners/scale-up');
jest.mock('./scale-runners/ssm-housekeeper');
jest.mock('./scale-runners/job-retry');
jest.mock('@terraform-aws-github-runner/aws-powertools-util');
jest.mock('@terraform-aws-github-runner/aws-ssm-util');
jest.mock('@aws-github-runner/aws-powertools-util');
jest.mock('@aws-github-runner/aws-ssm-util');

// Docs for testing async with jest: https://jestjs.io/docs/tutorial-async
describe('Test scale up lambda wrapper.', () => {
Expand Down
4 changes: 2 additions & 2 deletions lambdas/functions/control-plane/src/lambda.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import middy from '@middy/core';
import { logger, setContext } from '@terraform-aws-github-runner/aws-powertools-util';
import { captureLambdaHandler, tracer } from '@terraform-aws-github-runner/aws-powertools-util';
import { logger, setContext } from '@aws-github-runner/aws-powertools-util';
import { captureLambdaHandler, tracer } from '@aws-github-runner/aws-powertools-util';
import { Context, SQSEvent } from 'aws-lambda';

import { PoolEvent, adjust } from './pool/pool';
Expand Down
2 changes: 1 addition & 1 deletion lambdas/functions/control-plane/src/local.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { logger } from '@terraform-aws-github-runner/aws-powertools-util';
import { logger } from '@aws-github-runner/aws-powertools-util';

import { ActionRequestMessage, scaleUp } from './scale-runners/scale-up';

Expand Down
2 changes: 1 addition & 1 deletion lambdas/functions/control-plane/src/pool/pool.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Octokit } from '@octokit/rest';
import { createChildLogger } from '@terraform-aws-github-runner/aws-powertools-util';
import { createChildLogger } from '@aws-github-runner/aws-powertools-util';
import yn from 'yn';

import { bootTimeExceeded, listEC2Runners } from '../aws/runners';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ import { ActionRequestMessage, ActionRequestMessageRetry } from './scale-up';
import { getOctokit } from '../github/octokit';
import { Octokit } from '@octokit/rest';
import { mocked } from 'jest-mock';
import { createSingleMetric } from '@terraform-aws-github-runner/aws-powertools-util';
import { createSingleMetric } from '@aws-github-runner/aws-powertools-util';

jest.mock('../aws/sqs');

jest.mock('@terraform-aws-github-runner/aws-powertools-util', () => ({
...jest.requireActual('@terraform-aws-github-runner/aws-powertools-util'),
jest.mock('@aws-github-runner/aws-powertools-util', () => ({
...jest.requireActual('@aws-github-runner/aws-powertools-util'),
// eslint-disable-next-line @typescript-eslint/no-unused-vars
createSingleMetric: jest.fn((name: string, unit: string, value: number, dimensions?: Record<string, string>) => {
return {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
import {
addPersistentContextToChildLogger,
createSingleMetric,
logger,
} from '@terraform-aws-github-runner/aws-powertools-util';
import { addPersistentContextToChildLogger, createSingleMetric, logger } from '@aws-github-runner/aws-powertools-util';
import { publishMessage } from '../aws/sqs';
import { ActionRequestMessage, ActionRequestMessageRetry, getGitHubEnterpriseApiUrl, isJobQueued } from './scale-up';
import { getOctokit } from '../github/octokit';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { createChildLogger } from '@terraform-aws-github-runner/aws-powertools-util';
import { createChildLogger } from '@aws-github-runner/aws-powertools-util';
import parser from 'cron-parser';
import moment from 'moment';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Octokit } from '@octokit/rest';
import { createChildLogger } from '@terraform-aws-github-runner/aws-powertools-util';
import { createChildLogger } from '@aws-github-runner/aws-powertools-util';
import moment from 'moment';

import { createGithubAppAuth, createGithubInstallationAuth, createOctokitClient } from '../github/auth';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { createRunner, listEC2Runners } from './../aws/runners';
import { RunnerInputParameters } from './../aws/runners.d';
import ScaleError from './ScaleError';
import * as scaleUpModule from './scale-up';
import { getParameter } from '@terraform-aws-github-runner/aws-ssm-util';
import { getParameter } from '@aws-github-runner/aws-ssm-util';

const mockOctokit = {
paginate: jest.fn(),
Expand Down Expand Up @@ -40,8 +40,8 @@ jest.mock('@octokit/rest', () => ({
jest.mock('./../aws/runners');
jest.mock('./../github/auth');

jest.mock('@terraform-aws-github-runner/aws-ssm-util', () => ({
...jest.requireActual('@terraform-aws-github-runner/aws-ssm-util'),
jest.mock('@aws-github-runner/aws-ssm-util', () => ({
...jest.requireActual('@aws-github-runner/aws-ssm-util'),
getParameter: jest.fn(),
}));

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Octokit } from '@octokit/rest';
import { addPersistentContextToChildLogger, createChildLogger } from '@terraform-aws-github-runner/aws-powertools-util';
import { getParameter, putParameter } from '@terraform-aws-github-runner/aws-ssm-util';
import { addPersistentContextToChildLogger, createChildLogger } from '@aws-github-runner/aws-powertools-util';
import { getParameter, putParameter } from '@aws-github-runner/aws-ssm-util';
import yn from 'yn';

import { createGithubAppAuth, createGithubInstallationAuth, createOctokitClient } from '../github/auth';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { DeleteParameterCommand, GetParametersByPathCommand, SSMClient } from '@aws-sdk/client-ssm';
import { logger } from '@terraform-aws-github-runner/aws-powertools-util';
import { getTracedAWSV3Client } from '@terraform-aws-github-runner/aws-powertools-util';
import { logger } from '@aws-github-runner/aws-powertools-util';
import { getTracedAWSV3Client } from '@aws-github-runner/aws-powertools-util';

export interface SSMCleanupOptions {
dryRun: boolean;
Expand Down
4 changes: 2 additions & 2 deletions lambdas/functions/gh-agent-syncer/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "@terraform-aws-github-runner/gh-agent-syncer",
"name": "@aws-github-runner/gh-agent-syncer",
"version": "1.0.0",
"main": "lambda.ts",
"license": "MIT",
Expand Down Expand Up @@ -36,12 +36,12 @@
"typescript": "^5.5.4"
},
"dependencies": {
"@aws-github-runner/aws-powertools-util": "*",
"@aws-sdk/client-s3": "^3.637.0",
"@aws-sdk/lib-storage": "^3.637.0",
"@aws-sdk/types": "^3.609.0",
"@middy/core": "^4.7.0",
"@octokit/rest": "20.1.1",
"@terraform-aws-github-runner/aws-powertools-util": "*",
"axios": "^1.7.5"
},
"nx": {
Expand Down
4 changes: 2 additions & 2 deletions lambdas/functions/gh-agent-syncer/src/lambda.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import middy from '@middy/core';
import { logger, setContext } from '@terraform-aws-github-runner/aws-powertools-util';
import { captureLambdaHandler, tracer } from '@terraform-aws-github-runner/aws-powertools-util';
import { logger, setContext } from '@aws-github-runner/aws-powertools-util';
import { captureLambdaHandler, tracer } from '@aws-github-runner/aws-powertools-util';
import { Context } from 'aws-lambda';

import { sync } from './syncer/syncer';
Expand Down
2 changes: 1 addition & 1 deletion lambdas/functions/gh-agent-syncer/src/local.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { logger } from '@terraform-aws-github-runner/aws-powertools-util';
import { logger } from '@aws-github-runner/aws-powertools-util';

import { sync } from './syncer/syncer';

Expand Down
4 changes: 2 additions & 2 deletions lambdas/functions/gh-agent-syncer/src/syncer/syncer.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { GetObjectTaggingCommand, S3Client, ServerSideEncryption, Tag } from '@aws-sdk/client-s3';
import { Upload } from '@aws-sdk/lib-storage';
import { Octokit } from '@octokit/rest';
import { createChildLogger } from '@terraform-aws-github-runner/aws-powertools-util';
import { getTracedAWSV3Client } from '@terraform-aws-github-runner/aws-powertools-util';
import { createChildLogger } from '@aws-github-runner/aws-powertools-util';
import { getTracedAWSV3Client } from '@aws-github-runner/aws-powertools-util';
import axios from 'axios';
import { Stream } from 'stream';

Expand Down
4 changes: 2 additions & 2 deletions lambdas/functions/termination-watcher/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "@terraform-aws-github-runner/termination-watcher",
"name": "@aws-github-runner/termination-watcher",
"version": "1.0.0",
"main": "lambda.ts",
"license": "MIT",
Expand Down Expand Up @@ -35,10 +35,10 @@
"ts-node-dev": "^2.0.0"
},
"dependencies": {
"@aws-github-runner/aws-powertools-util": "*",
"@aws-sdk/client-ec2": "^3.637.0",
"@aws-sdk/types": "^3.609.0",
"@middy/core": "^4.7.0",
"@terraform-aws-github-runner/aws-powertools-util": "*",
"typescript": "^5.5.4"
},
"nx": {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { createChildLogger } from '@terraform-aws-github-runner/aws-powertools-util';
import { createChildLogger } from '@aws-github-runner/aws-powertools-util';

export class Config {
createSpotWarningMetric: boolean;
Expand Down
2 changes: 1 addition & 1 deletion lambdas/functions/termination-watcher/src/lambda.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { logger } from '@terraform-aws-github-runner/aws-powertools-util';
import { logger } from '@aws-github-runner/aws-powertools-util';
import { Context } from 'aws-lambda';
import { mocked } from 'jest-mock';

Expand Down
8 changes: 1 addition & 7 deletions lambdas/functions/termination-watcher/src/lambda.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
import middy from '@middy/core';
import {
captureLambdaHandler,
logger,
metrics,
setContext,
tracer,
} from '@terraform-aws-github-runner/aws-powertools-util';
import { captureLambdaHandler, logger, metrics, setContext, tracer } from '@aws-github-runner/aws-powertools-util';
import { logMetrics } from '@aws-lambda-powertools/metrics/middleware';
import { Context } from 'aws-lambda';

Expand Down
Loading