Skip to content

Commit

Permalink
Merge branch 'main' into andrew/validation-improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrew-Dickinson authored Dec 3, 2024
2 parents 87d5edf + a08c67f commit f9748d0
Show file tree
Hide file tree
Showing 12 changed files with 59 additions and 125 deletions.
7 changes: 6 additions & 1 deletion .github/workflows/deploy-to-k8s.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,12 @@ jobs:
--set image.tag="${{ inputs.environment }}" \
--set ingress.hosts[0].host="${{ vars.INGRESS_HOST }}",ingress.hosts[0].paths[0].path=/,ingress.hosts[0].paths[0].pathType=Prefix \
--set meshforms.recaptcha_v2_key="${{ secrets.RECAPTCHA_V2_KEY }}" \
--set meshforms.recaptcha_v3_key="${{ secrets.RECAPTCHA_V3_KEY }}"
--set meshforms.recaptcha_v3_key="${{ secrets.RECAPTCHA_V3_KEY }}" \
--set meshforms.rum_application_id="${{ secrets.RUM_APPLICATION_ID }}" \
--set meshforms.rum_client_token="${{ secrets.RUM_CLIENT_TOKEN }}"
# Rolling restart
kubectl --kubeconfig ./config --server https://${{ secrets.SSH_TARGET_IP }}:6443 -n ${{ vars.APP_NAMESPACE }} rollout restart deploy
# Wait for deploy to complete
kubectl --kubeconfig ./config --server https://${{ secrets.SSH_TARGET_IP }}:6443 -n ${{ vars.APP_NAMESPACE }} rollout status deployment --timeout 30m
2 changes: 2 additions & 0 deletions .github/workflows/playwright-captcha.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ jobs:
# This is an invisible key that says the user is a robot
RECAPTCHA_V3_KEY: ${{ secrets.TESTING_RECAPTCHA_V3_KEY }}
RECAPTCHA_V2_KEY: ${{ secrets.TESTING_RECAPTCHA_V2_KEY }}
RUM_APPLICATION_ID: fake
RUM_CLIENT_TOKEN: alsofake

- uses: actions/upload-artifact@v4
if: always()
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/playwright-no-s3.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ jobs:
AWS_ACCESS_KEY_ID: sampleaccesskey
AWS_SECRET_ACCESS_KEY: samplesecretkey
AWS_REGION: us-east-1
RUM_APPLICATION_ID: fake
RUM_CLIENT_TOKEN: alsofake
- uses: actions/upload-artifact@v4
if: always()
with:
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/playwright.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ jobs:
AWS_ACCESS_KEY_ID: sampleaccesskey
AWS_SECRET_ACCESS_KEY: samplesecretkey
AWS_REGION: us-east-1
RUM_APPLICATION_ID: fake
RUM_CLIENT_TOKEN: alsofake
- uses: actions/upload-artifact@v4
if: always()
with:
Expand Down
2 changes: 2 additions & 0 deletions infra/helm/meshforms/templates/secrets.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,5 @@ data:
MESHDB_URL: {{ .Values.meshforms.meshdb_url | b64enc | quote }}
RECAPTCHA_V2_KEY: {{ .Values.meshforms.recaptcha_v2_key | default "" | b64enc | quote }}
RECAPTCHA_V3_KEY: {{ .Values.meshforms.recaptcha_v3_key | default "" | b64enc | quote }}
RUM_APPLICATION_ID: {{ .Values.meshforms.rum_application_id | default "" | b64enc | quote }}
RUM_CLIENT_TOKEN: {{ .Values.meshforms.rum_client_token | default "" | b64enc | quote }}
120 changes: 0 additions & 120 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

32 changes: 32 additions & 0 deletions src/app/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
import "@/app/global.css";
import {
getEnvironment,
getRumApplicationID,
getRumClientToken,
} from "@/lib/endpoint";
import { AppRouterCacheProvider } from "@mui/material-nextjs/v13-appRouter";
import Script from "next/script";
import * as React from "react";

export const metadata = {
Expand All @@ -14,6 +20,32 @@ export default async function RootLayout({
}) {
return (
<html>
<Script id="datadog-rum">
{`
(function(h,o,u,n,d) {
h=h[d]=h[d]||{q:[],onReady:function(c){h.q.push(c)}}
d=o.createElement(u);d.async=1;d.src=n
n=o.getElementsByTagName(u)[0];n.parentNode.insertBefore(d,n)
})(window,document,'script','https://www.datadoghq-browser-agent.com/us1/v5/datadog-rum.js','DD_RUM')
window.DD_RUM.onReady(function() {
window.DD_RUM.init({
clientToken: '${await getRumClientToken()}',
applicationId: '${await getRumApplicationID()}',
site: 'us5.datadoghq.com',
service: 'meshforms',
env: '${await getEnvironment()}',
// Specify a version number to identify the deployed version of your application in Datadog
// version: '1.0.0',
sessionSampleRate: 100,
sessionReplaySampleRate: 100,
trackUserInteractions: true,
trackResources: true,
trackLongTasks: true,
});
})
`}
</Script>

<body>
<AppRouterCacheProvider>{children}</AppRouterCacheProvider>
</body>
Expand Down
2 changes: 1 addition & 1 deletion src/components/JoinForm/JoinForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ export default function JoinForm() {
let record: JoinRecord = Object.assign(
structuredClone(joinFormSubmission),
{
version: 2,
version: 3,
uuid: self.crypto.randomUUID(),
submission_time: new Date().toISOString(),
code: null,
Expand Down
9 changes: 9 additions & 0 deletions src/lib/endpoint.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,12 @@ export async function getRecaptchaKeys() {
export async function getEnvironment() {
return process.env.MESHFORMS_ENVIRONMENT ?? "";
}

// Get RUM environment variables
export async function getRumApplicationID() {
return process.env.RUM_APPLICATION_ID ?? "";
}

export async function getRumClientToken() {
return process.env.RUM_CLIENT_TOKEN ?? "";
}
2 changes: 1 addition & 1 deletion src/lib/join_record.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ class JoinRecordS3 {
// - dev vs prod join record
// - pre vs post-join form submission
// - 2nd quartet of join record UUID (random but not too long)
const key = `${this.PREFIX}${preSubmission ? "/pre" : "/post"}/${joinRecord.uuid.split("-")[1]}/${submissionKey}.json`;
const key = `${this.PREFIX}/v3/${preSubmission ? "pre" : "post"}/${submissionKey}/${joinRecord.uuid.split("-")[1]}.json`;

let body = JSON.stringify(joinRecord);

Expand Down
2 changes: 1 addition & 1 deletion tests/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export const sampleJoinRecord: JoinRecord = {
referral: "Mock Sample Data",
ncl: true,
trust_me_bro: false,
version: 2,
version: 3,
uuid: "1a55b949-0490-4b78-a2e8-10aea41d6f1d",
submission_time: "2024-11-01T08:24:24",
code: 201,
Expand Down
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"compilerOptions": {
"target": "es5",
"target": "es2017",
"lib": ["dom", "dom.iterable", "esnext"],
"allowJs": true,
"skipLibCheck": true,
Expand Down

0 comments on commit f9748d0

Please sign in to comment.