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' into EVG-20186
Browse files Browse the repository at this point in the history
  • Loading branch information
khelif96 committed Jul 11, 2023
2 parents 081c26e + 10037a6 commit bcf84a3
Show file tree
Hide file tree
Showing 50 changed files with 1,066 additions and 2,224 deletions.
11 changes: 10 additions & 1 deletion .evergreen.yml
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,16 @@ functions:
working_dir: spruce
script: |
echo "Generating .cmdrc.json"
REACT_APP_BUGSNAG_API_KEY=${REACT_APP_BUGSNAG_API_KEY} 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} REACT_APP_DEPLOYS_EMAIL=${REACT_APP_DEPLOYS_EMAIL} node scripts/setup-credentials.js
REACT_APP_BUGSNAG_API_KEY=${REACT_APP_BUGSNAG_API_KEY} \
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} \
REACT_APP_DEPLOYS_EMAIL=${REACT_APP_DEPLOYS_EMAIL} \
REACT_APP_HONEYCOMB_BASE_URL=${REACT_APP_HONEYCOMB_BASE_URL} \
node scripts/setup-credentials.js
echo "populating evergreen.yml"
cat <<EOF > .evergreen.yml
Expand Down
2 changes: 1 addition & 1 deletion cypress/integration/projectSettings/project_settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ describe("Repo Settings", { testIsolation: false }, () => {

countCQFields(2);
cy.dataCy("cq-enabled-radio-box").children().first().click();
countCQFields(4);
countCQFields(7);

cy.dataCy("error-banner")
.contains(
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "spruce",
"version": "3.0.104",
"version": "3.0.106",
"private": true,
"scripts": {
"bootstrap-logkeeper": "./scripts/bootstrap-logkeeper.sh",
Expand Down Expand Up @@ -125,7 +125,7 @@
"react-dom": "17.0.1",
"react-router-dom": "6.11.1",
"react-string-replace": "1.1.1",
"react-virtuoso": "^4.3.8",
"react-virtuoso": "^4.3.11",
"react-window": "^1.8.9"
},
"devDependencies": {
Expand Down
1 change: 1 addition & 0 deletions scripts/setup-credentials.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ const production = {
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,
REACT_APP_DEPLOYS_EMAIL: process.env.REACT_APP_DEPLOYS_EMAIL,
REACT_APP_HONEYCOMB_BASE_URL: process.env.REACT_APP_HONEYCOMB_BASE_URL,
};
fs.writeFile(file, JSON.stringify({ production }), (err) => {
if (err) {
Expand Down
2 changes: 2 additions & 0 deletions src/analytics/task/useTaskAnalytics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@ type Action =
| { name: "Click Display Task Link" }
| { name: "Click Project Link" }
| { name: "Click See History Button" }
| { name: "Click Trace Link" }
| { name: "Click Trace Metrics Link" }
| { name: "Submit Previous Commit Selector"; type: CommitType };

interface P extends Properties {
Expand Down
1 change: 1 addition & 0 deletions src/constants/cookies.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ export const COMMIT_CHART_TYPE_VIEW_OPTIONS_ACCORDION =
"commit-chart-view-options-accordion";
export const DISABLE_QUERY_POLLING = "disable-query-polling";
export const SEEN_MIGRATE_GUIDE_CUE = "seen-migrate-guide-cue";
export const SEEN_HONEYCOMB_GUIDE_CUE = "seen-honeycomb-guide-cue";
export const INCLUDE_COMMIT_QUEUE_PROJECT_PATCHES =
"include-commit-queue-project-patches";
export const INCLUDE_COMMIT_QUEUE_USER_PATCHES =
Expand Down
26 changes: 26 additions & 0 deletions src/constants/externalResources.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ import {
getLobsterTestLogCompleteUrl,
getParsleyBuildLogURL,
getParsleyTestLogURL,
getHoneycombTraceUrl,
getHoneycombSystemMetricsUrl,
} from "./externalResources";

describe("getLobsterTestLogCompleteUrl", () => {
Expand Down Expand Up @@ -48,3 +50,27 @@ describe("getParsleyBuildLogURL", () => {
expect(getParsleyBuildLogURL("myBuildId")).toBe("/resmoke/myBuildId/all");
});
});

describe("getTaskTraceUrl", () => {
it("generates the correct url", () => {
expect(
getHoneycombTraceUrl("abcdef", new Date("2023-07-07T19:08:41"))
).toBe(
"/datasets/evergreen-agent/trace?trace_id=abcdef&trace_start_ts=1688756921"
);
});
});

describe("getTaskSystemMetricsUrl", () => {
it("generates the correct url", () => {
expect(
getHoneycombSystemMetricsUrl(
"task_12345",
new Date("2023-07-07T19:08:41"),
new Date("2023-07-07T20:00:00")
)
).toBe(
`/datasets/evergreen?query={"calculations":[{"op":"AVG","column":"system.memory.usage.used"},{"op":"AVG","column":"system.cpu.utilization"},{"op":"AVG","column":"system.network.io.transmit"},{"op":"AVG","column":"system.network.io.receive"}],"filters":[{"op":"=","column":"evergreen.task.id","value":"task_12345"}],"start_time":1688756921,"end_time":1688760000,"granularity":15}&omitMissingValues`
);
});
});
35 changes: 34 additions & 1 deletion src/constants/externalResources.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import { getUnixTime } from "date-fns";
import { LogTypes } from "types/task";
import { environmentVariables } from "utils";

const { getLobsterURL, getParsleyUrl, getUiUrl } = environmentVariables;
const { getLobsterURL, getParsleyUrl, getUiUrl, getHoneycombBaseURL } =
environmentVariables;

export const wikiBaseUrl =
"https://docs.devprod.prod.corp.mongodb.com/evergreen";
Expand Down Expand Up @@ -36,6 +38,9 @@ export const getJiraImprovementUrl = (jiraHost: string) =>
export const konamiSoundTrackUrl =
"https://www.myinstants.com/media/sounds/mvssf-win.mp3";

export const githubMergeQueueUrl =
"https://github.blog/changelog/2023-02-08-pull-request-merge-queue-public-beta";

export const legacyRoutes = {
distros: "/distros",
hosts: "/spawn",
Expand Down Expand Up @@ -102,3 +107,31 @@ export const getParsleyBuildLogURL = (buildId: string) =>

export const getDistroPageUrl = (distroId: string) =>
`${getUiUrl()}/distros##${distroId}`;

export const getHoneycombTraceUrl = (traceId: string, startTs: Date) =>
`${getHoneycombBaseURL()}/datasets/evergreen-agent/trace?trace_id=${traceId}&trace_start_ts=${getUnixTime(
new Date(startTs)
)}`;

export const getHoneycombSystemMetricsUrl = (
taskId: string,
startTs: Date,
endTs: Date
): string => {
const query = {
calculations: [
{ op: "AVG", column: "system.memory.usage.used" },
{ op: "AVG", column: "system.cpu.utilization" },
{ op: "AVG", column: "system.network.io.transmit" },
{ op: "AVG", column: "system.network.io.receive" },
],
filters: [{ op: "=", column: "evergreen.task.id", value: taskId }],
start_time: getUnixTime(new Date(startTs)),
end_time: getUnixTime(new Date(endTs)),
granularity: 15,
};

return `${getHoneycombBaseURL()}/datasets/evergreen?query=${JSON.stringify(
query
)}&omitMissingValues`;
};
2 changes: 2 additions & 0 deletions src/gql/fragments/projectSettings/githubCommitQueue.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ fragment ProjectGithubSettings on Project {
commitQueue {
enabled
mergeMethod
mergeQueue
message
}
githubChecksEnabled
Expand All @@ -17,6 +18,7 @@ fragment RepoGithubSettings on RepoRef {
commitQueue {
enabled
mergeMethod
mergeQueue
message
}
githubChecksEnabled
Expand Down
15 changes: 15 additions & 0 deletions src/gql/generated/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3098,6 +3098,7 @@ export type ProjectGithubSettingsFragment = {
__typename?: "CommitQueueParams";
enabled?: boolean | null;
mergeMethod: string;
mergeQueue: MergeQueue;
message: string;
};
};
Expand All @@ -3115,6 +3116,7 @@ export type RepoGithubSettingsFragment = {
__typename?: "RepoCommitQueueParams";
enabled: boolean;
mergeMethod: string;
mergeQueue: MergeQueue;
message: string;
};
};
Expand All @@ -3135,6 +3137,7 @@ export type ProjectGithubCommitQueueFragment = {
__typename?: "CommitQueueParams";
enabled?: boolean | null;
mergeMethod: string;
mergeQueue: MergeQueue;
message: string;
};
} | null;
Expand All @@ -3156,6 +3159,7 @@ export type RepoGithubCommitQueueFragment = {
__typename?: "RepoCommitQueueParams";
enabled: boolean;
mergeMethod: string;
mergeQueue: MergeQueue;
message: string;
};
} | null;
Expand All @@ -3177,6 +3181,7 @@ export type ProjectEventGithubCommitQueueFragment = {
__typename?: "CommitQueueParams";
enabled?: boolean | null;
mergeMethod: string;
mergeQueue: MergeQueue;
message: string;
};
} | null;
Expand Down Expand Up @@ -3321,6 +3326,7 @@ export type ProjectSettingsFieldsFragment = {
__typename?: "CommitQueueParams";
enabled?: boolean | null;
mergeMethod: string;
mergeQueue: MergeQueue;
message: string;
};
} | null;
Expand Down Expand Up @@ -3510,6 +3516,7 @@ export type RepoSettingsFieldsFragment = {
__typename?: "RepoCommitQueueParams";
enabled: boolean;
mergeMethod: string;
mergeQueue: MergeQueue;
message: string;
};
} | null;
Expand Down Expand Up @@ -3901,6 +3908,7 @@ export type ProjectEventSettingsFragment = {
__typename?: "CommitQueueParams";
enabled?: boolean | null;
mergeMethod: string;
mergeQueue: MergeQueue;
message: string;
};
} | null;
Expand Down Expand Up @@ -6109,6 +6117,7 @@ export type ProjectEventLogsQuery = {
__typename?: "CommitQueueParams";
enabled?: boolean | null;
mergeMethod: string;
mergeQueue: MergeQueue;
message: string;
};
} | null;
Expand Down Expand Up @@ -6312,6 +6321,7 @@ export type ProjectEventLogsQuery = {
__typename?: "CommitQueueParams";
enabled?: boolean | null;
mergeMethod: string;
mergeQueue: MergeQueue;
message: string;
};
} | null;
Expand Down Expand Up @@ -6530,6 +6540,7 @@ export type ProjectSettingsQuery = {
__typename?: "CommitQueueParams";
enabled?: boolean | null;
mergeMethod: string;
mergeQueue: MergeQueue;
message: string;
};
} | null;
Expand Down Expand Up @@ -6772,6 +6783,7 @@ export type RepoEventLogsQuery = {
__typename?: "CommitQueueParams";
enabled?: boolean | null;
mergeMethod: string;
mergeQueue: MergeQueue;
message: string;
};
} | null;
Expand Down Expand Up @@ -6975,6 +6987,7 @@ export type RepoEventLogsQuery = {
__typename?: "CommitQueueParams";
enabled?: boolean | null;
mergeMethod: string;
mergeQueue: MergeQueue;
message: string;
};
} | null;
Expand Down Expand Up @@ -7177,6 +7190,7 @@ export type RepoSettingsQuery = {
__typename?: "RepoCommitQueueParams";
enabled: boolean;
mergeMethod: string;
mergeQueue: MergeQueue;
message: string;
};
} | null;
Expand Down Expand Up @@ -7616,6 +7630,7 @@ export type TaskQuery = {
status: string;
timedOut?: boolean | null;
timeoutType?: string | null;
traceID?: string | null;
type: string;
oomTracker: {
__typename?: "OomTrackerInfo";
Expand Down
1 change: 1 addition & 0 deletions src/gql/queries/get-task.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ query Task($taskId: String!, $execution: Int) {
status
timedOut
timeoutType
traceID
type
}
displayTask {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
import { MockedProvider } from "@apollo/client/testing";
import {
injectGlobalDimStyle,
removeGlobalDimStyle,
} from "pages/commits/ActiveCommits/utils";
import {
renderWithRouterMatch as render,
screen,
userEvent,
waitFor,
} from "test_utils";
import { BuildVariantCard } from ".";
import { injectGlobalDimStyle, removeGlobalDimStyle } from "../utils";

jest.mock("../utils");

Expand Down
2 changes: 1 addition & 1 deletion src/pages/commits/ActiveCommits/BuildVariantCard/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ import VisibilityContainer from "components/VisibilityContainer";
import { getVariantHistoryRoute } from "constants/routes";
import { size } from "constants/tokens";
import { StatusCount } from "gql/generated/types";
import { VariantGroupedTaskStatusBadges } from "pages/commits/ActiveCommits/BuildVariantCard/VariantGroupedTaskStatusBadges";
import {
injectGlobalDimStyle,
removeGlobalDimStyle,
} from "pages/commits/ActiveCommits/utils";
import { TASK_ICON_PADDING } from "pages/commits/constants";
import { VariantGroupedTaskStatusBadges } from "./VariantGroupedTaskStatusBadges";
import { WaterfallTaskStatusIcon } from "./WaterfallTaskStatusIcon";

type taskList = {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
import styled from "@emotion/styled";
import { CustomStoryObj, CustomMeta } from "test_utils/types";
import { ChartTypes, Commits } from "types/commits";
import { CommitChart } from ".";
import { StoryObj } from "@storybook/react";
import {
findMaxGroupedTaskStats,
getAllTaskStatsGroupedByColor,
} from "../utils";
} from "pages/commits/utils";
import { ChartTypes, Commits } from "types/commits";
import { CommitBarChart } from ".";

export default {
title: "Pages/Commits/Charts",
component: CommitChart,
} satisfies CustomMeta<typeof CommitChart>;
title: "Pages/Commits/Charts/ActiveCommit/CommitBarChart",
component: CommitBarChart,
};

export const Default: CustomStoryObj<typeof CommitChart> = {
export const Default: StoryObj<typeof CommitBarChart> = {
render: ({ chartType }) => (
<FlexRowContainer>
{versions.map((item) => (
<CommitChart
<CommitBarChart
key={item.version.id}
groupedTaskStats={groupedTaskData[item.version.id].stats}
total={groupedTaskData[item.version.id].total}
Expand Down
Loading

0 comments on commit bcf84a3

Please sign in to comment.