I have a bucket deployment that builds an Angular application like below.
new BucketDeployment(this, `AngularAppDeployment`, {
destinationBucket: bucket,
distribution: distro,
sources: [
Source.asset('lib/web/app', {
assetHashType: cdk.AssetHashType.OUTPUT,
bundling: {
image: cdk.DockerImage.fromRegistry("public.ecr.aws/docker/library/node:lts"),
local: {
tryBundle(outputDir) {
try {
execSync(
`cd lib/web/app && npm run build:${props.stage} -- --output-path ${outputDir}`,
{
stdio: "inherit",
}
);
return true;
} catch {
return false;
}
},
}
},
})
]
})
My app is also comprised of multiple stacks.
const app = new cdk.App();
const stage = app.node.tryGetContext("stage");
if (!stage) {
throw new Error("missing stage. Pass on command line using '--context stage=dev|prod'");
}
const tags = {
stage,
}
const env = {
account: process.env.CDK_DEFAULT_ACCOUNT,
region: process.env.CDK_DEFAULT_REGION
}
new WebStack(app, `${stage}-web`, { stage, env, tags });
new ProcessEventStack(app, `${stage}-process`, { stage, env, tags });
Every time i try to deploy just the dev-process
stack it also compiles the angular assets in the web stack. This takes a long time and if there is an error there, it will fail the stack deployment entirely.
Is there any way to prevent it?
I’ve tried looking into other context properties, but none of them indicate the stack that is being deployed.