Skip to content

Open source AI coding agent. Designed for large projects and real world tasks.

 πŸ€– Plandex  πŸ“ Generate and use a unique tag for deployment ✏️ Edits: β€’ infra/deploy.sh βœ… Generate and export STACK_TAG for deployment βœ… Pass STACK_TAG to CDK deploy command via context β€’ infra/src/main.ts βœ… Use STACK_TAG environment variable if defined

Dane Schneider2d6386d15254
diff --git a/infra/deploy.sh b/infra/deploy.sh
index 0450717d..60284ff4 100644
--- a/infra/deploy.sh
+++ b/infra/deploy.sh
@@ -1,5 +1,8 @@
#!/bin/bash
+# Generate a unique tag for the deployment
+export STACK_TAG=$(uuidgen | cut -d '-' -f1)
+
# Set variables for the ECR repository and image tag
ECR_REPOSITORY=$(aws ecr describe-repositories --repository-names plandex-ecr-repository | jq -r '.repositories[0].repositoryUri')
IMAGE_TAG=$(git rev-parse --short HEAD)
@@ -11,7 +14,7 @@ deploy_or_update_stack() {
if [ -z "$STACK_NAME" ]; then
# Deploy the stack if it does not exist
- npx cdk deploy "plandex-stack-*" --require-approval never --tags stack=$STACK_TAG
+ npx cdk deploy "plandex-stack-*" --require-approval never --context stackTag=$STACK_TAG
else
# Update the stack if it exists
npx cdk deploy "$STACK_NAME" --require-approval never
diff --git a/infra/src/main.ts b/infra/src/main.ts
index 77a79865..65737f75 100644
--- a/infra/src/main.ts
+++ b/infra/src/main.ts
@@ -10,7 +10,7 @@ import * as iam from "@aws-cdk/aws-iam";
import * as acm from "@aws-cdk/aws-certificatemanager";
import { v4 as uuid } from "uuid";
-const tag = uuid().split("-")[0];
+const tag = process.env.STACK_TAG || uuid().split("-")[0];
export class PlandexStack extends cdk.Stack {
constructor(scope: cdk.Construct, id: string, props?: cdk.StackProps) {
diff --git a/prompt.txt b/prompt.txt
new file mode 100644
index 00000000..14dff525
--- /dev/null
+++ b/prompt.txt
@@ -0,0 +1,6 @@
+In 'deploy.sh' it seems that the tag will not be added on the 'px cdk deploy
+ "plandex-stack-*" line.
+
+ I'm thinking a better idea would be to generate the tag in the deploy script
+ and then pass it to the cdk script with an environment variable. Please make
+ the updates.
\ No newline at end of file