Skip to content

Commit d746916

Browse files
authored
fix: provide hosted zone id for dns records (#54)
* fix: provide hosted zone id for dns records * fix: manage dns records without module * fix: restore route53 records module * review * speed up e2e * fix * fix * fix * next cache * fix flaky test * fix flaky test * fix flaky test * Revert "fix flaky test" This reverts commit 8cbdeaf. * Revert "fix flaky test" This reverts commit abf8358. * fix flaky test * fix flaky test
1 parent 800b3f3 commit d746916

File tree

5 files changed

+316
-406
lines changed

5 files changed

+316
-406
lines changed

.github/workflows/ci-cd-pipeline.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,13 +145,24 @@ jobs:
145145
- *node-checkout
146146
- *node-setup
147147
- *node-install-dependencies
148+
- &next-cache
149+
name: Cache Next.js build artifacts
150+
uses: actions/cache@v4
151+
with:
152+
path: .next/cache
153+
key: ${{ runner.os }}-next-cache-${{ hashFiles('package-lock.json') }}
154+
restore-keys: |
155+
${{ runner.os }}-next-cache-
148156
- &copy-example-env
149157
name: Copy .env.example to .env
150158
run: cp .env.example .env
151159

152160
- name: Seed database
153161
run: npm run seed
154162

163+
- name: Build application
164+
run: npm run build
165+
155166
- name: Run Playwright tests
156167
run: npm run test:e2e
157168

@@ -174,6 +185,7 @@ jobs:
174185
- *node-checkout
175186
- *node-setup
176187
- *node-install-dependencies
188+
- *next-cache
177189
- *copy-example-env
178190
- name: Build and package Lambda function
179191
run: npm run build:lambda

iac/main.tf

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -188,17 +188,20 @@ module "dns_records" {
188188
source = "terraform-aws-modules/route53/aws"
189189
version = "6.1.0"
190190

191-
create_zone = false
192-
name = var.parent_domain
191+
create = true
192+
create_zone = false
193+
name = data.aws_route53_zone.zone.name
194+
private_zone = false
193195

194196
records = {
195197
app_a = {
196198
full_name = var.app_domain
197199
type = "A"
198200
allow_overwrite = true
199201
alias = {
200-
name = module.cdn.cloudfront_distribution_domain_name
201-
zone_id = module.cdn.cloudfront_distribution_hosted_zone_id
202+
name = module.cdn.cloudfront_distribution_domain_name
203+
zone_id = module.cdn.cloudfront_distribution_hosted_zone_id
204+
evaluate_target_health = false
202205
}
203206
}
204207

@@ -207,8 +210,9 @@ module "dns_records" {
207210
type = "AAAA"
208211
allow_overwrite = true
209212
alias = {
210-
name = module.cdn.cloudfront_distribution_domain_name
211-
zone_id = module.cdn.cloudfront_distribution_hosted_zone_id
213+
name = module.cdn.cloudfront_distribution_domain_name
214+
zone_id = module.cdn.cloudfront_distribution_hosted_zone_id
215+
evaluate_target_health = false
212216
}
213217
}
214218
}

playwright.config.ts

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
import "dotenv/config";
22
import { defineConfig, devices } from "@playwright/test";
33

4-
const PORT = process.env.PORT ?? "3000";
5-
const HOST = process.env.HOST ?? "127.0.0.1";
6-
const baseURL = process.env.PLAYWRIGHT_BASE_URL ?? `http://${HOST}:${PORT}`;
4+
const BASE_URL = "http://localhost:3000";
75

86
export default defineConfig({
97
testDir: "./tests/e2e",
@@ -26,7 +24,7 @@ export default defineConfig({
2624
],
2725
],
2826
use: {
29-
baseURL,
27+
baseURL: BASE_URL,
3028
trace: "retain-on-failure",
3129
screenshot: "only-on-failure",
3230
video: "retain-on-failure",
@@ -38,9 +36,9 @@ export default defineConfig({
3836
},
3937
],
4038
webServer: {
41-
command: `npm run dev -- --hostname ${HOST} --port ${PORT}`,
42-
url: baseURL,
39+
command: "npm run start",
40+
url: BASE_URL,
4341
reuseExistingServer: !process.env.CI,
44-
timeout: 120_000,
42+
timeout: 10_000,
4543
},
4644
});

0 commit comments

Comments
 (0)