|
1 | 1 | import * as fs from 'fs'; |
2 | 2 | import * as path from 'path'; |
3 | 3 | import * as ecr from '@aws-cdk/aws-ecr'; |
4 | | -import { Annotations, FeatureFlags, IgnoreMode, Stack, Token } from '@aws-cdk/core'; |
| 4 | +import { Annotations, AssetStaging, FeatureFlags, FileFingerprintOptions, IgnoreMode, Stack, SymlinkFollowMode, Token } from '@aws-cdk/core'; |
5 | 5 | import * as cxapi from '@aws-cdk/cx-api'; |
6 | 6 | import { Construct } from 'constructs'; |
7 | 7 |
|
8 | 8 | // keep this import separate from other imports to reduce chance for merge conflicts with v2-main |
9 | 9 | // eslint-disable-next-line |
10 | | -import { FingerprintOptions, IAsset, Staging } from '@aws-cdk/assets'; |
| 10 | +import { FingerprintOptions, FollowMode, IAsset } from '@aws-cdk/assets'; |
11 | 11 | // keep this import separate from other imports to reduce chance for merge conflicts with v2-main |
12 | 12 | // eslint-disable-next-line no-duplicate-imports, import/order |
13 | 13 | import { Construct as CoreConstruct } from '@aws-cdk/core'; |
14 | 14 |
|
15 | 15 | /** |
16 | 16 | * Options for DockerImageAsset |
17 | 17 | */ |
18 | | -export interface DockerImageAssetOptions extends FingerprintOptions { |
| 18 | +export interface DockerImageAssetOptions extends FingerprintOptions, FileFingerprintOptions { |
19 | 19 | /** |
20 | 20 | * ECR repository name |
21 | 21 | * |
@@ -156,8 +156,9 @@ export class DockerImageAsset extends CoreConstruct implements IAsset { |
156 | 156 | // deletion of the ECR repository the app used). |
157 | 157 | extraHash.version = '1.21.0'; |
158 | 158 |
|
159 | | - const staging = new Staging(this, 'Staging', { |
| 159 | + const staging = new AssetStaging(this, 'Staging', { |
160 | 160 | ...props, |
| 161 | + follow: props.followSymlinks ?? toSymlinkFollow(props.follow), |
161 | 162 | exclude, |
162 | 163 | ignoreMode, |
163 | 164 | sourcePath: dir, |
@@ -200,3 +201,13 @@ function validateBuildArgs(buildArgs?: { [key: string]: string }) { |
200 | 201 | } |
201 | 202 | } |
202 | 203 | } |
| 204 | + |
| 205 | +function toSymlinkFollow(follow?: FollowMode): SymlinkFollowMode | undefined { |
| 206 | + switch (follow) { |
| 207 | + case undefined: return undefined; |
| 208 | + case FollowMode.NEVER: return SymlinkFollowMode.NEVER; |
| 209 | + case FollowMode.ALWAYS: return SymlinkFollowMode.ALWAYS; |
| 210 | + case FollowMode.BLOCK_EXTERNAL: return SymlinkFollowMode.BLOCK_EXTERNAL; |
| 211 | + case FollowMode.EXTERNAL: return SymlinkFollowMode.EXTERNAL; |
| 212 | + } |
| 213 | +} |
0 commit comments