Skip to content

Commit

Permalink
Merge branch 'main' into bobertzh/logging
Browse files Browse the repository at this point in the history
  • Loading branch information
HBobertz committed Dec 26, 2024
2 parents 39b52b6 + faa688e commit 2860f8d
Show file tree
Hide file tree
Showing 11 changed files with 2,213 additions and 1,276 deletions.
4 changes: 4 additions & 0 deletions .projen/deps.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 8 additions & 3 deletions .projen/tasks.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions .projenrc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -144,4 +144,7 @@ project.eslint?.addRules({
// Allow PR backports to all releasable branches
new github.PullRequestBackport(project);

project.addDevDeps('madge');
project.postCompileTask.exec('madge lib/index.js --circular');

project.synth();
11 changes: 11 additions & 0 deletions lib/private/handlers/client-options.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import type { AwsDestination } from '@aws-cdk/cloud-assembly-schema';
import type { ClientOptions } from '../../aws';

export function destinationToClientOptions(destination: AwsDestination): ClientOptions {
return {
assumeRoleArn: destination.assumeRoleArn,
assumeRoleExternalId: destination.assumeRoleExternalId,
assumeRoleAdditionalOptions: destination.assumeRoleAdditionalOptions,
region: destination.region,
};
}
2 changes: 1 addition & 1 deletion lib/private/handlers/container-images.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as path from 'path';
import { DockerImageDestination } from '@aws-cdk/cloud-assembly-schema';
import { destinationToClientOptions } from '.';
import { destinationToClientOptions } from './client-options';
import { DockerImageManifestEntry } from '../../asset-manifest';
import type { IECRClient } from '../../aws';
import { EventType } from '../../progress';
Expand Down
2 changes: 1 addition & 1 deletion lib/private/handlers/files.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { createReadStream, promises as fs } from 'fs';
import * as path from 'path';
import { FileAssetPackaging, FileSource } from '@aws-cdk/cloud-assembly-schema';
import * as mime from 'mime';
import { destinationToClientOptions } from '.';
import { destinationToClientOptions } from './client-options';
import { FileManifestEntry } from '../../asset-manifest';
import { IS3Client } from '../../aws';
import { PutObjectCommandInput } from '../../aws-types';
Expand Down
11 changes: 0 additions & 11 deletions lib/private/handlers/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import type { AwsDestination } from '@aws-cdk/cloud-assembly-schema';
import { ContainerImageAssetHandler } from './container-images';
import { FileAssetHandler } from './files';
import {
Expand All @@ -7,7 +6,6 @@ import {
FileManifestEntry,
type IManifestEntry,
} from '../../asset-manifest';
import type { ClientOptions } from '../../aws';
import type { IAssetHandler, IHandlerHost, IHandlerOptions } from '../asset-handler';

export function makeAssetHandler(
Expand All @@ -25,12 +23,3 @@ export function makeAssetHandler(

throw new Error(`Unrecognized asset type: '${asset}'`);
}

export function destinationToClientOptions(destination: AwsDestination): ClientOptions {
return {
assumeRoleArn: destination.assumeRoleArn,
assumeRoleExternalId: destination.assumeRoleExternalId,
assumeRoleAdditionalOptions: destination.assumeRoleAdditionalOptions,
region: destination.region,
};
}
25 changes: 13 additions & 12 deletions package.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions test/docker-images.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -297,10 +297,11 @@ test('logging in twice for two repository domains (containing account id & regio
});

mockEcr.on(DescribeRepositoriesCommand).callsFake((input) => {
const url = {
const repos: Record<string, string> = {
repo: '12345.amazonaws.com/repo',
repo2: '12346.amazonaws.com/repo2',
}[input.repositoryNames[0]];
};
const url = repos[input.repositoryNames[0]];
if (!url) {
throw new Error(`Unexpected repo: ${JSON.stringify(input)}`);
}
Expand Down
Loading

0 comments on commit 2860f8d

Please sign in to comment.