Skip to content
This repository has been archived by the owner on Jul 2, 2024. It is now read-only.

Commit

Permalink
DEVPROD-5133: Make vars unique (#2291)
Browse files Browse the repository at this point in the history
  • Loading branch information
sophstad authored Mar 11, 2024
1 parent 098a9e3 commit 0b233e5
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 33 deletions.
26 changes: 13 additions & 13 deletions .evergreen.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ functions:
assume-ec2-role:
command: ec2.assume_role
params:
role_arn: ${ASSUME_ROLE_ARN}
role_arn: ${SPRUCE_ASSUME_ROLE_ARN}

get-project:
command: git.get_project
Expand Down Expand Up @@ -254,9 +254,9 @@ functions:
# Only record to cypress cloud if this is a pr, mainline commit or an intentional patch.
# And only allow spec filtering for an intentional patch.
if [[ "${requester}" == "github_pr" || "${requester}" == "commit" ]]; then
yarn cy:run --record --key "${cypress_record_key}" --reporter junit
yarn cy:run --record --key "${spruce_cypress_record_key}" --reporter junit
elif [[ "${requester}" == "patch" ]]; then
yarn cy:run --record --key "${cypress_record_key}" --reporter junit --spec "${cypress_spec}"
yarn cy:run --record --key "${spruce_cypress_record_key}" --reporter junit --spec "${cypress_spec}"
else
yarn cy:run --reporter junit
fi
Expand Down Expand Up @@ -419,18 +419,18 @@ functions:
content_type: text/plain
permissions: public-read

setup-credentials:
spruce-setup-credentials:
command: shell.exec
params:
working_dir: spruce
env:
REACT_APP_SENTRY_AUTH_TOKEN: ${REACT_APP_SENTRY_AUTH_TOKEN}
REACT_APP_SENTRY_DSN: ${REACT_APP_SENTRY_DSN}
REACT_APP_NEW_RELIC_ACCOUNT_ID: ${REACT_APP_NEW_RELIC_ACCOUNT_ID}
REACT_APP_NEW_RELIC_AGENT_ID: ${REACT_APP_NEW_RELIC_AGENT_ID}
REACT_APP_NEW_RELIC_APPLICATION_ID: ${REACT_APP_NEW_RELIC_APPLICATION_ID}
REACT_APP_NEW_RELIC_LICENSE_KEY: ${REACT_APP_NEW_RELIC_LICENSE_KEY}
REACT_APP_NEW_RELIC_TRUST_KEY: ${REACT_APP_NEW_RELIC_TRUST_KEY}
SPRUCE_SENTRY_AUTH_TOKEN: ${SPRUCE_SENTRY_AUTH_TOKEN}
REACT_APP_SPRUCE_SENTRY_DSN: ${REACT_APP_SPRUCE_SENTRY_DSN}
NEW_RELIC_ACCOUNT_ID: ${NEW_RELIC_ACCOUNT_ID}
NEW_RELIC_LICENSE_KEY: ${NEW_RELIC_LICENSE_KEY}
NEW_RELIC_TRUST_KEY: ${NEW_RELIC_TRUST_KEY}
SPRUCE_NEW_RELIC_AGENT_ID: ${SPRUCE_NEW_RELIC_AGENT_ID}
SPRUCE_NEW_RELIC_APPLICATION_ID: ${SPRUCE_NEW_RELIC_APPLICATION_ID}
REACT_APP_DEPLOYS_EMAIL: ${REACT_APP_DEPLOYS_EMAIL}
REACT_APP_HONEYCOMB_BASE_URL: ${REACT_APP_HONEYCOMB_BASE_URL}
EVERGREEN_API_SERVER_HOST: ${evergreen_api_server_host}
Expand All @@ -452,7 +452,7 @@ functions:
working_dir: spruce
shell: bash
env:
BUCKET: ${bucket}
BUCKET: ${spruce_bucket}
AWS_ACCESS_KEY_ID: ${AWS_ACCESS_KEY_ID}
AWS_SECRET_ACCESS_KEY: ${AWS_SECRET_ACCESS_KEY}
AWS_SESSION_TOKEN: ${AWS_SESSION_TOKEN}
Expand Down Expand Up @@ -518,7 +518,7 @@ tasks:
- name: deploy_to_prod
commands:
- func: assume-ec2-role
- func: setup-credentials
- func: spruce-setup-credentials
- func: sym-link
- func: prod-deploy

Expand Down
4 changes: 2 additions & 2 deletions index.html

Large diffs are not rendered by default.

15 changes: 7 additions & 8 deletions scripts/setup-credentials.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,13 @@ const production = {
REACT_APP_PARSLEY_URL: "https://parsley.mongodb.com",
REACT_APP_SPRUCE_URL: "https://spruce.mongodb.com",
REACT_APP_RELEASE_STAGE: "production",
REACT_APP_SENTRY_AUTH_TOKEN: process.env.REACT_APP_SENTRY_AUTH_TOKEN,
REACT_APP_SENTRY_DSN: process.env.REACT_APP_SENTRY_DSN,
REACT_APP_NEW_RELIC_ACCOUNT_ID: process.env.REACT_APP_NEW_RELIC_ACCOUNT_ID,
REACT_APP_NEW_RELIC_AGENT_ID: process.env.REACT_APP_NEW_RELIC_AGENT_ID,
REACT_APP_NEW_RELIC_APPLICATION_ID:
process.env.REACT_APP_NEW_RELIC_APPLICATION_ID,
REACT_APP_NEW_RELIC_LICENSE_KEY: process.env.REACT_APP_NEW_RELIC_LICENSE_KEY,
REACT_APP_NEW_RELIC_TRUST_KEY: process.env.REACT_APP_NEW_RELIC_TRUST_KEY,
SPRUCE_SENTRY_AUTH_TOKEN: process.env.SPRUCE_SENTRY_AUTH_TOKEN,
REACT_APP_SPRUCE_SENTRY_DSN: process.env.REACT_APP_SPRUCE_SENTRY_DSN,
NEW_RELIC_ACCOUNT_ID: process.env.NEW_RELIC_ACCOUNT_ID,
NEW_RELIC_LICENSE_KEY: process.env.NEW_RELIC_LICENSE_KEY,
NEW_RELIC_TRUST_KEY: process.env.NEW_RELIC_TRUST_KEY,
SPRUCE_NEW_RELIC_AGENT_ID: process.env.SPRUCE_NEW_RELIC_AGENT_ID,
SPRUCE_NEW_RELIC_APPLICATION_ID: process.env.SPRUCE_NEW_RELIC_APPLICATION_ID,
DEPLOYS_EMAIL: process.env.DEPLOYS_EMAIL,
REACT_APP_HONEYCOMB_BASE_URL: process.env.REACT_APP_HONEYCOMB_BASE_URL,
};
Expand Down
6 changes: 3 additions & 3 deletions src/components/ErrorHandling/initialize.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ describe("should initialize error handlers according to release stage", () => {
mockEnv("NODE_ENV", "production");
mockEnv("REACT_APP_VERSION", "1.0.0");
mockEnv("REACT_APP_RELEASE_STAGE", "production");
mockEnv("REACT_APP_SENTRY_DSN", "fake-sentry-key");
mockEnv("REACT_APP_SPRUCE_SENTRY_DSN", "fake-sentry-key");
initializeErrorHandling();

expect(Sentry.init).toHaveBeenCalledWith({
Expand All @@ -48,7 +48,7 @@ describe("should initialize error handlers according to release stage", () => {
mockEnv("REACT_APP_RELEASE_STAGE", "beta");
mockEnv("NODE_ENV", "production");
mockEnv("REACT_APP_VERSION", "1.0.0");
mockEnv("REACT_APP_SENTRY_DSN", "fake-sentry-key");
mockEnv("REACT_APP_SPRUCE_SENTRY_DSN", "fake-sentry-key");
initializeErrorHandling();

expect(Sentry.init).toHaveBeenCalledWith({
Expand All @@ -66,7 +66,7 @@ describe("should initialize error handlers according to release stage", () => {
mockEnv("NODE_ENV", "production");
mockEnv("REACT_APP_VERSION", "1.0.0");
mockEnv("REACT_APP_RELEASE_STAGE", "staging");
mockEnv("REACT_APP_SENTRY_DSN", "fake-sentry-key");
mockEnv("REACT_APP_SPRUCE_SENTRY_DSN", "fake-sentry-key");
initializeErrorHandling();

expect(Sentry.init).toHaveBeenCalledWith({
Expand Down
2 changes: 1 addition & 1 deletion src/utils/environmentVariables.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export const getApiUrl: () => string = () =>
* @returns - The application's DSN
*/
export const getSentryDSN: () => string = () =>
process.env.REACT_APP_SENTRY_DSN;
process.env.REACT_APP_SPRUCE_SENTRY_DSN;

/**
* `getUiUrl()` - Get the backing evergreen URL from the environment variables
Expand Down
12 changes: 6 additions & 6 deletions vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,11 @@ export default defineConfig({
"%APP_VERSION%",
"%GIT_SHA%",
"%REACT_APP_RELEASE_STAGE%",
"%REACT_APP_NEW_RELIC_ACCOUNT_ID%",
"%REACT_APP_NEW_RELIC_TRUST_KEY%",
"%REACT_APP_NEW_RELIC_AGENT_ID%",
"%REACT_APP_NEW_RELIC_LICENSE_KEY%",
"%REACT_APP_NEW_RELIC_APPLICATION_ID%",
"%NEW_RELIC_ACCOUNT_ID%",
"%NEW_RELIC_LICENSE_KEY%",
"%NEW_RELIC_TRUST_KEY%",
"%SPRUCE_NEW_RELIC_AGENT_ID%",
"%SPRUCE_NEW_RELIC_APPLICATION_ID%",
],
}),
],
Expand Down Expand Up @@ -135,7 +135,7 @@ export default defineConfig({
sentryVitePlugin({
org: "mongodb-org",
project: "spruce",
authToken: process.env.REACT_APP_SENTRY_AUTH_TOKEN,
authToken: process.env.SPRUCE_SENTRY_AUTH_TOKEN,
release: {
name: process.env.npm_package_version,
},
Expand Down

0 comments on commit 0b233e5

Please sign in to comment.