Skip to content
Draft
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
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,24 @@ export interface ArtifactManifest {
/**
* Associated metadata.
*
* Metadata can be stored directly in the assembly manifest, as well as in a
* separate file (see `additionalMetadataFile`). It should prefer to be stored
* in the additional file, as that will reduce the size of the assembly
* manifest in cases of a lot of metdata (which CDK does emit by default).
*
* @default - no metadata.
*/
readonly metadata?: { [path: string]: MetadataEntry[] };

/**
* A file with additional metadata entries.
*
* The schema of this file is exactly the same as the type of the `metadata` field.
*
* @default - no additional metadata
*/
readonly additionalMetadataFile?: string;

/**
* IDs of artifacts that must be deployed before this artifact.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
"type": "string"
},
"metadata": {
"description": "Associated metadata. (Default - no metadata.)",
"description": "Associated metadata.\n\nMetadata can be stored directly in the assembly manifest, as well as in a\nseparate file (see `additionalMetadataFile`). It should prefer to be stored\nin the additional file, as that will reduce the size of the assembly\nmanifest in cases of a lot of metdata (which CDK does emit by default). (Default - no metadata.)",
"type": "object",
"additionalProperties": {
"type": "array",
Expand All @@ -58,6 +58,10 @@
}
}
},
"additionalMetadataFile": {
"description": "A file with additional metadata entries.\n\nThe schema of this file is exactly the same as the type of the `metadata` field. (Default - no additional metadata)",
"type": "string"
},
"dependencies": {
"description": "IDs of artifacts that must be deployed before this artifact. (Default - no dependencies.)",
"type": "array",
Expand Down
4 changes: 2 additions & 2 deletions packages/@aws-cdk/cloud-assembly-schema/schema/version.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"schemaHash": "96958a4c40e0a00e850f0c14dd6e9c0fc8db0b075f1f155cea41ab198c0514be",
"revision": 43
"schemaHash": "e03b716ea6f59e089369ce279c03a194917456d466994d434e5f9f366b745f12",
"revision": 44
}
1 change: 1 addition & 0 deletions packages/@aws-cdk/toolkit-lib/lib/api/utilities/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './manifest-reading';
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import * as fs from 'fs';
import * as path from 'path';
import type { ArtifactManifest, MetadataEntry } from '@aws-cdk/cloud-assembly-schema';

/**
* Read the metadata for the given artifact
*
* You must use this instead of accessing `ArtifactManifest.metadata`
* directly; this can also deal with the case of where the metadata
* has been written to a file.
*/
export function readArtifactMetadata(assemblyDirectory: string, x: ArtifactManifest): Record<string, MetadataEntry[]> {
const ret = {};
if (x.additionalMetadataFile) {
Object.assign(ret, JSON.parse(fs.readFileSync(path.join(assemblyDirectory, x.additionalMetadataFile), 'utf-8')));
}
// FIXME: Conflicting paths
// FIXME: Rewrite stack tags
Object.assign(ret, x.metadata);
return ret;
}
Loading