Skip to content

Commit 27ec801

Browse files
author
claudfuen
committed
Simplify buildspec.yml to test YAML parsing
- Minimal buildspec to isolate YAML syntax issue - Remove complex commands to identify root cause
1 parent 803ab18 commit 27ec801

File tree

1 file changed

+4
-50
lines changed

1 file changed

+4
-50
lines changed

apps/web/buildspec.yml

Lines changed: 4 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -3,58 +3,12 @@ version: 0.2
33
phases:
44
pre_build:
55
commands:
6-
- echo Logging in to Amazon ECR...
6+
- echo "Logging in to Amazon ECR..."
77
- aws --version
8-
- aws ecr get-login-password --region $AWS_DEFAULT_REGION | docker login --username AWS --password-stdin $AWS_ACCOUNT_ID.dkr.ecr.$AWS_DEFAULT_REGION.amazonaws.com
9-
- REPOSITORY_URI=$AWS_ACCOUNT_ID.dkr.ecr.$AWS_DEFAULT_REGION.amazonaws.com/$IMAGE_REPO_NAME
10-
- COMMIT_HASH=$(echo $CODEBUILD_RESOLVED_SOURCE_VERSION | cut -c 1-7)
11-
- IMAGE_TAG=${COMMIT_HASH:=latest}
12-
- echo Repository URI is $REPOSITORY_URI
13-
- echo Image tag is $IMAGE_TAG
14-
- echo DATABASE_URL is configured for build-time access
158
build:
169
commands:
17-
- echo "Build started on $(date)"
18-
- echo "=== PHASE 1: Building and pushing migration image ==="
19-
- cd apps/web # Navigate to the web app directory from repo root
20-
- docker build -f Dockerfile.migration -t $IMAGE_REPO_NAME:migration-$IMAGE_TAG .
21-
- docker tag $IMAGE_REPO_NAME:migration-$IMAGE_TAG $REPOSITORY_URI:migration-$IMAGE_TAG
22-
- docker tag $IMAGE_REPO_NAME:migration-$IMAGE_TAG $REPOSITORY_URI:migration-latest
23-
- docker push $REPOSITORY_URI:migration-$IMAGE_TAG
24-
- docker push $REPOSITORY_URI:migration-latest
25-
- echo "=== PHASE 2: Running database migrations ==="
26-
- |
27-
TASK_ARN=$(aws ecs run-task \
28-
--cluster $CLUSTER_NAME \
29-
--task-definition pathfinder-migration \
30-
--network-configuration "awsvpcConfiguration={subnets=[$SUBNET_ID],securityGroups=[$SECURITY_GROUP_ID],assignPublicIp=ENABLED}" \
31-
--launch-type FARGATE \
32-
--query 'tasks[0].taskArn' \
33-
--output text)
34-
echo "Migration task started: $TASK_ARN"
35-
aws ecs wait tasks-stopped --cluster $CLUSTER_NAME --tasks $TASK_ARN
36-
EXIT_CODE=$(aws ecs describe-tasks --cluster $CLUSTER_NAME --tasks $TASK_ARN --query 'tasks[0].containers[0].exitCode' --output text)
37-
if [ "$EXIT_CODE" != "0" ]; then
38-
echo "Migration failed with exit code: $EXIT_CODE"
39-
exit 1
40-
fi
41-
echo "Migrations completed successfully!"
42-
- echo "=== PHASE 3: Building main app image with database access ==="
43-
- docker build --build-arg DATABASE_URL=$DATABASE_URL -t $IMAGE_REPO_NAME:$IMAGE_TAG .
44-
- docker tag $IMAGE_REPO_NAME:$IMAGE_TAG $REPOSITORY_URI:$IMAGE_TAG
45-
- docker tag $IMAGE_REPO_NAME:$IMAGE_TAG $REPOSITORY_URI:latest
10+
- echo "Build started"
11+
- echo "Test build phase"
4612
post_build:
4713
commands:
48-
- echo "Build completed on $(date)"
49-
- echo Pushing the Docker images...
50-
- docker push $REPOSITORY_URI:migration-$IMAGE_TAG
51-
- docker push $REPOSITORY_URI:migration-latest
52-
- docker push $REPOSITORY_URI:$IMAGE_TAG
53-
- docker push $REPOSITORY_URI:latest
54-
- echo Writing image definitions file...
55-
- printf '[{"name":"pathfinder-app","imageUri":"%s"}]' $REPOSITORY_URI:$IMAGE_TAG > imagedefinitions.json
56-
57-
artifacts:
58-
files:
59-
- imagedefinitions.json
60-
name: pathfinder-build-$(date +%Y-%m-%d)
14+
- echo "Build completed"

0 commit comments

Comments
 (0)