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

Commit

Permalink
Merge branch 'main' of github.com:evergreen-ci/spruce into EVG-20983
Browse files Browse the repository at this point in the history
  • Loading branch information
SupaJoon committed Oct 31, 2023
2 parents d4075a8 + 3d00742 commit 7cbe8a2
Show file tree
Hide file tree
Showing 38 changed files with 713 additions and 735 deletions.
2 changes: 0 additions & 2 deletions .evergreen.yml
Original file line number Diff line number Diff line change
Expand Up @@ -391,7 +391,6 @@ functions:
working_dir: spruce
script: |
echo "Generating .env-cmdrc.json"
REACT_APP_BUGSNAG_API_KEY=${REACT_APP_BUGSNAG_API_KEY} \
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} \
Expand Down Expand Up @@ -420,7 +419,6 @@ functions:
shell: bash
script: |
${PREPARE_SHELL}
REACT_APP_BUGSNAG_API_KEY=${REACT_APP_BUGSNAG_API_KEY} \
BUCKET=${bucket} \
AWS_ACCESS_KEY_ID=${aws_key} \
AWS_SECRET_ACCESS_KEY=${aws_secret} \
Expand Down
3 changes: 2 additions & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
<head>
<meta charset="utf-8" />
<meta name="theme-color" content="#000000" />
<meta name="ui-version" content="%GIT_SHA%">
<meta name="git-hash" content="%GIT_SHA%" />
<meta name="package-version" content="%APP_VERSION%" />
<script type="text/javascript">
if ("%REACT_APP_RELEASE_STAGE%" === "production" || "%REACT_APP_RELEASE_STAGE%" === "beta") {
;window.NREUM||(NREUM={});NREUM.init={privacy:{cookies_enabled:true}};
Expand Down
20 changes: 8 additions & 12 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "spruce",
"version": "3.0.158",
"version": "3.0.162",
"private": true,
"scripts": {
"bootstrap-logkeeper": "./scripts/bootstrap-logkeeper.sh",
Expand All @@ -9,7 +9,7 @@
"build:local": "env-cmd -e local -r .env-cmdrc.local.json yarn build",
"build:prod": "env-cmd -e production yarn build",
"build:staging": "env-cmd -e staging yarn build",
"build": "GIT_SHA=`git rev-parse HEAD` vite build",
"build": "GIT_SHA=`git rev-parse HEAD` APP_VERSION=$npm_package_version vite build",
"check-types": "tsc -p tsconfig.json --noEmit",
"clean": "rm -rf node_modules && rm -rf build && yarn install",
"codegen": "graphql-codegen --config codegen.ts",
Expand All @@ -35,7 +35,6 @@
"storybook": "storybook dev -p 6006",
"test:watch": "node scripts/test.js --verbose",
"test": "node scripts/test.js --watchAll=false",
"upload-source-maps": "env-cmd -e production node ./scripts/deploy/upload-bugsnag-sourcemaps",
"postversion": "scripts/push-version.sh"
},
"browserslist": {
Expand All @@ -55,8 +54,6 @@
},
"dependencies": {
"@apollo/client": "3.8.4",
"@bugsnag/js": "7.20.2",
"@bugsnag/plugin-react": "7.18.0",
"@emotion/css": "11.11.2",
"@emotion/react": "11.11.1",
"@emotion/styled": "11.11.0",
Expand All @@ -67,9 +64,9 @@
"@leafygreen-ui/card": "10.0.5",
"@leafygreen-ui/checkbox": "12.0.5",
"@leafygreen-ui/code": "14.0.1",
"@leafygreen-ui/combobox": "5.0.7",
"@leafygreen-ui/combobox": "7.0.1",
"@leafygreen-ui/confirmation-modal": "5.0.6",
"@leafygreen-ui/emotion": "4.0.3",
"@leafygreen-ui/emotion": "4.0.7",
"@leafygreen-ui/expandable-card": "3.0.5",
"@leafygreen-ui/guide-cue": "3.0.0",
"@leafygreen-ui/icon": "11.12.1",
Expand Down Expand Up @@ -112,7 +109,7 @@
"deep-object-diff": "1.1.9",
"env-cmd": "10.1.0",
"graphql": "16.8.1",
"html-react-parser": "4.2.1",
"html-react-parser": "4.2.9",
"js-cookie": "3.0.5",
"linkify-html": "4.1.1",
"linkifyjs": "4.1.0",
Expand All @@ -133,7 +130,6 @@
"@babel/plugin-proposal-private-property-in-object": "^7.17.12",
"@babel/preset-react": "^7.12.13",
"@babel/preset-typescript": "7.21.5",
"@bugsnag/source-maps": "^2.3.0",
"@emotion/babel-plugin": "11.11.0",
"@emotion/eslint-plugin": "11.11.0",
"@emotion/jest": "11.11.0",
Expand All @@ -154,7 +150,7 @@
"@styled/typescript-styled-plugin": "1.0.0",
"@testing-library/jest-dom": "6.1.3",
"@testing-library/react": "14.0.0",
"@testing-library/user-event": "14.4.3",
"@testing-library/user-event": "14.5.1",
"@types/jest": "29.4.0",
"@types/js-cookie": "^3.0.4",
"@types/lodash.debounce": "4.0.7",
Expand All @@ -168,7 +164,7 @@
"@typescript-eslint/eslint-plugin": "5.57.1",
"@typescript-eslint/parser": "5.57.1",
"@vitejs/plugin-react": "4.0.0",
"babel-jest": "29.5.0",
"babel-jest": "29.7.0",
"babel-loader": "^9.1.3",
"babel-plugin-import": "^1.13.6",
"babel-plugin-import-graphql": "^2.8.1",
Expand All @@ -182,7 +178,7 @@
"eslint-plugin-import": "2.26.0",
"eslint-plugin-jest": "27.2.1",
"eslint-plugin-jsdoc": "^46.2.6",
"eslint-plugin-jsx-a11y": "6.6.0",
"eslint-plugin-jsx-a11y": "6.7.1",
"eslint-plugin-prettier": "4.2.1",
"eslint-plugin-react": "7.30.1",
"eslint-plugin-react-hooks": "4.6.0",
Expand Down
18 changes: 0 additions & 18 deletions scripts/deploy/app-version.sh

This file was deleted.

6 changes: 0 additions & 6 deletions scripts/deploy/deploy.sh
Original file line number Diff line number Diff line change
@@ -1,14 +1,8 @@
#!/bin/sh

# This script runs the aws cli command to deploy the app to s3
# It also uploads source maps to bugsnag

# Try this step and throw an error if it fails
echo "Deploying to S3"
aws s3 sync build/ s3://"${BUCKET}"/ --acl public-read --follow-symlinks --delete --exclude .env-cmdrc.json
echo "Deployed to S3"

# If the above step succeeds, run this step
echo "Uploading source maps to Bugsnag"
./scripts/deploy/app-version.sh && node ./scripts/deploy/upload-bugsnag-sourcemaps.js
echo "Source maps uploaded to Bugsnag"
9 changes: 0 additions & 9 deletions scripts/deploy/upload-bugsnag-sourcemaps.js

This file was deleted.

1 change: 0 additions & 1 deletion scripts/setup-credentials.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ 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_BUGSNAG_API_KEY: process.env.REACT_APP_BUGSNAG_API_KEY,
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,
Expand Down
21 changes: 14 additions & 7 deletions src/analytics/task/useTaskAnalytics.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { useQuery } from "@apollo/client";
import { useParams, useLocation } from "react-router-dom";
import { useParams } from "react-router-dom";
import { useAnalyticsRoot } from "analytics/useAnalyticsRoot";
import {
SaveSubscriptionForUserMutationVariables,
Expand All @@ -9,11 +9,9 @@ import {
TestSortCategory,
} from "gql/generated/types";
import { TASK } from "gql/queries";
import { useQueryParam } from "hooks/useQueryParam";
import { CommitType } from "pages/task/actionButtons/previousCommits/types";
import { RequiredQueryParams, LogTypes } from "types/task";
import { queryString } from "utils";

const { parseQueryString } = queryString;

type LogViewer = "raw" | "html" | "parsley" | "lobster";
type Action =
Expand Down Expand Up @@ -61,16 +59,23 @@ type Action =
| { name: "Click Display Task Link" }
| { name: "Click Project Link" }
| { name: "Click See History Button" }
| {
name: "Click Task File Link";
parsleyAvailable: boolean;
fileName: string;
}
| {
name: "Click Task File Parsley Link";
fileName: string;
}
| { name: "Click Trace Link" }
| { name: "Click Trace Metrics Link" }
| { name: "Submit Previous Commit Selector"; type: CommitType };

export const useTaskAnalytics = () => {
const { id } = useParams<{ id: string }>();
const location = useLocation();

const parsed = parseQueryString(location.search);
const execution = Number(parsed[RequiredQueryParams.Execution]);
const [execution] = useQueryParam(RequiredQueryParams.Execution, 0);
const { data: eventData } = useQuery<TaskQuery, TaskQueryVariables>(TASK, {
variables: { taskId: id, execution },
fetchPolicy: "cache-first",
Expand All @@ -79,6 +84,7 @@ export const useTaskAnalytics = () => {
const {
failedTestCount,
latestExecution,
project: { identifier } = { identifier: null },
status: taskStatus,
} = eventData?.task || {};
const isLatestExecution = latestExecution === execution;
Expand All @@ -89,5 +95,6 @@ export const useTaskAnalytics = () => {
isLatestExecution: isLatestExecution.toString(),
taskId: id,
failedTestCount,
projectIdentifier: identifier,
});
};
19 changes: 12 additions & 7 deletions src/components/CommitChartLabel/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,10 @@ import { Body, BodyProps, InlineCode } from "@leafygreen-ui/typography";
import { Link } from "react-router-dom";
import ExpandedText from "components/ExpandedText";
import { StyledRouterLink } from "components/styles";
import { getVersionRoute, getTaskRoute } from "constants/routes";
import { getVersionRoute, getTriggerRoute } from "constants/routes";
import { size, zIndex } from "constants/tokens";
import { UpstreamProjectFragment, GitTag } from "gql/generated/types";
import { useSpruceConfig, useDateFormat } from "hooks";
import { ProjectTriggerLevel } from "types/triggers";
import { shortenGithash } from "utils/string";
import { jiraLinkify } from "utils/string/jiraLinkify";

Expand Down Expand Up @@ -46,7 +45,10 @@ const CommitChartLabel: React.FC<Props> = ({
const spruceConfig = useSpruceConfig();
const jiraHost = spruceConfig?.jira?.host;
const {
owner: upstreamOwner,
project: upstreamProjectIdentifier,
repo: upstreamRepo,
revision: upstreamRevision,
task: upstreamTask,
triggerType,
version: upstreamVersion,
Expand All @@ -72,11 +74,14 @@ const CommitChartLabel: React.FC<Props> = ({
Triggered from:{" "}
<StyledRouterLink
onClick={onClickUpstreamProject}
to={
triggerType === ProjectTriggerLevel.TASK
? getTaskRoute(upstreamTask.id)
: getVersionRoute(upstreamVersion.id)
}
to={getTriggerRoute({
triggerType,
upstreamTask,
upstreamVersion,
upstreamRevision,
upstreamOwner,
upstreamRepo,
})}
>
{upstreamProjectIdentifier}
</StyledRouterLink>
Expand Down
65 changes: 0 additions & 65 deletions src/components/ErrorHandling/Bugsnag.tsx

This file was deleted.

6 changes: 3 additions & 3 deletions src/components/ErrorHandling/ErrorBoundary.test.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import Bugsnag from "@bugsnag/js";
import * as Sentry from "@sentry/react";
import { render, screen } from "test_utils";
import { mockEnvironmentVariables } from "test_utils/utils";
Expand All @@ -9,13 +8,14 @@ const { cleanup } = mockEnvironmentVariables();
describe("default error boundary", () => {
beforeEach(() => {
jest.spyOn(console, "error").mockImplementation(() => {});
jest.spyOn(Bugsnag, "notify");
jest.spyOn(Sentry, "captureException");
});

afterEach(() => {
cleanup();
jest.restoreAllMocks();
});

it("should render the passed in component", () => {
const TestComponent = () => <div>Hello</div>;
const TestErrorBoundary = () => (
Expand All @@ -26,6 +26,7 @@ describe("default error boundary", () => {
render(<TestErrorBoundary />);
expect(screen.getByText("Hello")).toBeInTheDocument();
});

it("should display the fallback when an error occurs", () => {
const err = new Error("Test error");

Expand All @@ -45,7 +46,6 @@ describe("default error boundary", () => {
componentStack: expect.any(String),
}),
});
expect(Bugsnag.notify).not.toHaveBeenCalled();
expect(Sentry.captureException).not.toHaveBeenCalled();
});
});
Loading

0 comments on commit 7cbe8a2

Please sign in to comment.