From 0a995ccefbd7e910424566e2c17169245ea520c9 Mon Sep 17 00:00:00 2001 From: AyushAgrawal-A2 Date: Sun, 22 Dec 2024 17:13:56 +0530 Subject: [PATCH] fix HostedZoneName --- .../workflows/preview-cloudformation-deploy.yml | 4 ++-- .github/workflows/preview-publish-images.yml | 4 ++-- infra/aws-cloudformation/preview.yml | 15 ++++++--------- 3 files changed, 10 insertions(+), 13 deletions(-) diff --git a/.github/workflows/preview-cloudformation-deploy.yml b/.github/workflows/preview-cloudformation-deploy.yml index 064c6de0f3..bff4f28e2e 100644 --- a/.github/workflows/preview-cloudformation-deploy.yml +++ b/.github/workflows/preview-cloudformation-deploy.yml @@ -2,7 +2,7 @@ name: Deploy CloudFormation Stack for Preview Branch on: pull_request: - types: [opened, reopened] + types: [opened, synchronize, reopened] concurrency: group: pr-${{ github.event.pull_request.number }}-deploy-cloudformation @@ -16,7 +16,7 @@ jobs: runs-on: blacksmith-2vcpu-ubuntu-2204 env: - STACK_NAME: preview-pr-${{ github.event.pull_request.number }} + STACK_NAME: pr-${{ github.event.pull_request.number }} STACK_PARAMS: >- ParameterKey=LicenseKey,ParameterValue=5a32bd8a-409e-4733-8846-1868c568a813 ParameterKey=ImageTag,ParameterValue=pr-${{ github.event.pull_request.number }} diff --git a/.github/workflows/preview-publish-images.yml b/.github/workflows/preview-publish-images.yml index 7b49f79b4c..4c4c099224 100644 --- a/.github/workflows/preview-publish-images.yml +++ b/.github/workflows/preview-publish-images.yml @@ -1,4 +1,4 @@ -name: Build Docker Images for Preview Branches +name: Build and Publish Images to ECR - Preview on: pull_request: @@ -9,7 +9,7 @@ concurrency: cancel-in-progress: true jobs: - build_images: + publish_images: permissions: contents: read diff --git a/infra/aws-cloudformation/preview.yml b/infra/aws-cloudformation/preview.yml index c7195e4bb9..32e1b142e2 100644 --- a/infra/aws-cloudformation/preview.yml +++ b/infra/aws-cloudformation/preview.yml @@ -11,9 +11,6 @@ Parameters: Default: "latest" Mappings: - EnvironmentConfig: - Preview: - DomainName: "quadratic-preview.com" RegionMap: us-west-2: AMI: "ami-05134c8ef96964280" # Example AMI for us-west-2 (Ubuntu 20.04) @@ -132,15 +129,15 @@ Resources: chmod +x /quadratic-selfhost/login.sh # Run Quadratic initialization - curl -sSf https://raw.githubusercontent.com/quadratichq/quadratic-selfhost/main/init.sh -o init.sh && bash -i init.sh ${LicenseKey} ${ImageTag}.${!FindInMap [EnvironmentConfig, Preview, DomainName]} + curl -sSf https://raw.githubusercontent.com/quadratichq/quadratic-selfhost/main/init.sh -o init.sh && bash -i init.sh ${LicenseKey} ${ImageTag}.quadratic-preview.com DnsRecords: Type: AWS::Route53::RecordSet DeletionPolicy: Delete UpdateReplacePolicy: Delete Properties: - HostedZoneName: !Sub "${!FindInMap [EnvironmentConfig, Preview, DomainName]}." - Name: !Sub "${ImageTag}.${!FindInMap [EnvironmentConfig, Preview, DomainName]}" + HostedZoneName: "quadratic-preview.com." + Name: !Sub "${ImageTag}.quadratic-preview.com" Type: A TTL: 300 ResourceRecords: @@ -151,8 +148,8 @@ Resources: DeletionPolicy: Delete UpdateReplacePolicy: Delete Properties: - HostedZoneName: !Sub "${!FindInMap [EnvironmentConfig, Preview, DomainName]}." - Name: !Sub "*.${ImageTag}.${!FindInMap [EnvironmentConfig, Preview, DomainName]}" + HostedZoneName: "quadratic-preview.com." + Name: !Sub "*.${ImageTag}.quadratic-preview.com" Type: A TTL: 300 ResourceRecords: @@ -230,4 +227,4 @@ Resources: Outputs: DomainRecord: Description: "Url of the selfhosted instance" - Value: !Sub "${ImageTag}.${!FindInMap [EnvironmentConfig, Preview, DomainName]}" \ No newline at end of file + Value: !Sub "${ImageTag}.quadratic-preview.com"