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

EVG-20692: Indicate if a version has been ignored #2095

Merged
merged 5 commits into from
Oct 10, 2023
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 23 additions & 4 deletions cypress/integration/version/banners.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ describe("banners", () => {
const versionWithBanners =
"/version/logkeeper_e864cf934194c161aa044e4599c8c81cee7b6237/tasks?sorts=STATUS%3AASC%3BBASE_STATUS%3ADESC";

beforeEach(() => {
cy.visit(versionWithBanners);
});

describe("errors", () => {
beforeEach(() => {
cy.visit(versionWithBanners);
});

it("should display the number of configuration errors", () => {
cy.dataCy("configuration-errors-banner").should("be.visible");
cy.contains("4 errors in configuration file").should("be.visible");
Expand All @@ -19,6 +19,10 @@ describe("banners", () => {
});

describe("warnings", () => {
beforeEach(() => {
cy.visit(versionWithBanners);
});

it("should display the number of configuration warnings", () => {
cy.dataCy("configuration-warnings-banner").should("be.visible");
cy.contains("3 warnings in configuration file").should("be.visible");
Expand All @@ -29,4 +33,19 @@ describe("banners", () => {
cy.get("ol").find("li").should("have.length", 3);
});
});

describe("ignored", () => {
it("should display a banner", () => {
cy.visit("/version/spruce_e695f654c8b4b959d3e12e71696c3e318bcd4c33");
cy.dataCy("ignored-banner").should("be.visible");
});

it("should indicate if a version is ignored in the inactive commits tooltip", () => {
cy.visit("/commits/spruce");
cy.dataCy("ignored-version-icon").should("not.exist");
cy.dataCy("inactive-commits-button").click();
cy.dataCy("inactive-commits-tooltip").should("be.visible");
cy.dataCy("ignored-version-icon").should("be.visible");
});
});
});
2 changes: 2 additions & 0 deletions src/constants/externalResources.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ export const githubChecksAliasesDocumentationUrl = `${projectDistroSettingsDocum

export const githubMergeQueueDocumentationUrl = `${wikiBaseUrl}/Project-Configuration/Merge-Queue`;

export const ignoredFilesDocumentationUrl = `${wikiBaseUrl}/Project-Configuration/Project-Configuration-Files#ignoring-changes-to-certain-files`;

export const cliDocumentationUrl = `${wikiBaseUrl}/CLI`;

export const windowsPasswordRulesURL =
Expand Down
2 changes: 2 additions & 0 deletions src/gql/generated/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6182,6 +6182,7 @@ export type MainlineCommitsQuery = {
author: string;
createTime: Date;
id: string;
ignored: boolean;
message: string;
order: number;
revision: string;
Expand Down Expand Up @@ -8739,6 +8740,7 @@ export type VersionQuery = {
errors: Array<string>;
finishTime?: Date | null;
id: string;
ignored: boolean;
isPatch: boolean;
message: string;
order: number;
Expand Down
1 change: 1 addition & 0 deletions src/gql/queries/mainline-commits.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ query MainlineCommits(
author
createTime
id
ignored
message
order
revision
Expand Down
1 change: 1 addition & 0 deletions src/gql/queries/version.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ query Version($id: String!) {
tag
}
id
ignored
isPatch
manifest {
branch
Expand Down
4 changes: 3 additions & 1 deletion src/pages/Version.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import { PageDoesNotExist } from "pages/404";
import { isPatchUnconfigured } from "utils/patch";
import { shortenGithash, githubPRLinkify } from "utils/string";
import { jiraLinkify } from "utils/string/jiraLinkify";
import { WarningBanner, ErrorBanner } from "./version/Banners";
import { WarningBanner, ErrorBanner, IgnoredBanner } from "./version/Banners";
import VersionPageBreadcrumbs from "./version/Breadcrumbs";
import BuildVariantCard from "./version/BuildVariantCard";
import { ActionButtons, Metadata, VersionTabs } from "./version/index";
Expand Down Expand Up @@ -133,6 +133,7 @@ export const VersionPage: React.FC = () => {
const { version } = versionData || {};
const {
errors,
ignored,
isPatch,
message,
order,
Expand Down Expand Up @@ -165,6 +166,7 @@ export const VersionPage: React.FC = () => {
<ProjectBanner projectIdentifier={projectIdentifier} />
{errors && errors.length > 0 && <ErrorBanner errors={errors} />}
{warnings && warnings.length > 0 && <WarningBanner warnings={warnings} />}
{ignored && <IgnoredBanner />}
{version && (
<VersionPageBreadcrumbs
patchNumber={patchNumber}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { CustomStoryObj, CustomMeta } from "test_utils/types";
import { CommitRolledUpVersions } from "types/commits";
import { InactiveCommitButton as InactiveCommits } from ".";

export default {
Expand All @@ -12,14 +13,15 @@ export const Default: CustomStoryObj<typeof InactiveCommits> = {
},
};

const versions = [
const versions: CommitRolledUpVersions = [
{
id: "123",
createTime: new Date("2021-06-16T23:38:13Z"),
message: "SERVER-57332 Create skeleton InternalDocumentSourceDensify",
order: 39365,
author: "Mohamed Khelif",
revision: "4337c33fa4a0d5c747a1115f0853b5f70e46f112",
ignored: false,
upstreamProject: {
triggerID: "123",
triggerType: "task",
Expand All @@ -38,6 +40,7 @@ const versions = [
order: 39366,
author: "Arjun Patel",
revision: "4337c33fa4a0d5c747a1115f0853b5f70e46f112",
ignored: false,
},
{
id: "123",
Expand All @@ -46,6 +49,7 @@ const versions = [
order: 39365,
author: "Mohamed Khelif",
revision: "4337c33fa4a0d5c747a1115f0853b5f70e46f112",
ignored: false,
},
{
id: "123",
Expand All @@ -54,6 +58,7 @@ const versions = [
order: 39366,
author: "Arjun Patel",
revision: "4337c33fa4a0d5c747a1115f0853b5f70e46f112",
ignored: false,
},
{
id: "123",
Expand All @@ -62,6 +67,7 @@ const versions = [
order: 39365,
author: "Elena Chen",
revision: "4337c33fa4a0d5c747a1115f0853b5f70e46f112",
ignored: true,
},
{
id: "123",
Expand All @@ -70,5 +76,6 @@ const versions = [
order: 39366,
author: "Sophie Stadler",
revision: "4337c33fa4a0d5c747a1115f0853b5f70e46f112",
ignored: false,
},
];
8 changes: 7 additions & 1 deletion src/pages/commits/InactiveCommits/InactiveCommits.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -107,14 +107,15 @@ describe("inactiveCommitButton", () => {
});

const time = new Date("2021-06-16T23:38:13Z");
const versions = [
const versions: CommitRolledUpVersions = [
{
id: "1",
createTime: time,
message: "SERVER-57332 Create skeleton InternalDocumentSourceDensify",
order: 39365,
author: "Mohamed Khelif",
revision: "4137c33fa4a0d5c747a1115f0853b5f70e46f112",
ignored: false,
},
{
id: "2",
Expand All @@ -123,6 +124,7 @@ const versions = [
order: 39366,
author: "Arjun Patel",
revision: "4237c33fa4a0d5c747a1115f0853b5f70e46f113",
ignored: false,
},
{
id: "3",
Expand All @@ -131,6 +133,7 @@ const versions = [
order: 39365,
author: "Mohamed Khelif",
revision: "4337c33fa4a0d5c747a1115f0853b5f70e46f114",
ignored: false,
},
{
id: "4",
Expand All @@ -139,6 +142,7 @@ const versions = [
order: 39366,
author: "Arjun Patel",
revision: "4437c33fa4a0d5c747a1115f0853b5f70e46f115",
ignored: false,
},
{
id: "5",
Expand All @@ -147,6 +151,7 @@ const versions = [
order: 39365,
author: "Elena Chen",
revision: "4537c33fa4a0d5c747a1115f0853b5f70e46f116",
ignored: false,
},
{
id: "6",
Expand All @@ -155,5 +160,6 @@ const versions = [
order: 39366,
author: "Sophie Stadler",
revision: "4637c33fa4a0d5c747a1115f0853b5f70e46f117",
ignored: false,
},
];
13 changes: 13 additions & 0 deletions src/pages/commits/InactiveCommits/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import Tooltip from "@leafygreen-ui/tooltip";
import { Disclaimer } from "@leafygreen-ui/typography";
import { useProjectHealthAnalytics } from "analytics/projectHealth/useProjectHealthAnalytics";
import { DisplayModal } from "components/DisplayModal";
import Icon from "components/Icon";
import { StyledRouterLink } from "components/styles";
import { getVersionRoute, getTaskRoute } from "constants/routes";
import { size, zIndex, fontSize } from "constants/tokens";
Expand Down Expand Up @@ -167,6 +168,13 @@ const CommitCopy: React.FC<CommitCopyProps> = ({ isTooltip, v }) => {
</>
)}
<CommitBodyText>
{v.ignored && (
<StyledIcon
data-cy="ignored-version-icon"
glyph="VisibilityOff"
size="small"
/>
)}
{v.author} -{" "}
{jiraLinkify(message, jiraHost, () => {
sendEvent({
Expand All @@ -181,6 +189,11 @@ const CommitCopy: React.FC<CommitCopyProps> = ({ isTooltip, v }) => {
);
};

const StyledIcon = styled(Icon)`
margin-right: ${size.xxs};
vertical-align: text-bottom;
`;

const InactiveCommitContainer = styled.div`
display: flex;
justify-content: center;
Expand Down
1 change: 1 addition & 0 deletions src/pages/commits/ProjectHealth.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,7 @@ const versions: Commits = [
order: 927,
message: "v2.11.1",
revision: "a77bd39ccf515b63327dc2355a8444955043c66a",
ignored: false,
},
],
},
Expand Down
18 changes: 18 additions & 0 deletions src/pages/version/Banners/IgnoredBanner/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import Banner, { Variant } from "@leafygreen-ui/banner";
import { StyledLink } from "components/styles";
import { ignoredFilesDocumentationUrl } from "constants/externalResources";
import { BannerContainer } from "../styles";

const IgnoredBanner: React.FC = () => (
<BannerContainer data-cy="ignored-banner">
<Banner variant={Variant.Info}>
This revision will not be automatically scheduled, because only{" "}
<StyledLink href={ignoredFilesDocumentationUrl} target="_blank">
ignored files
</StyledLink>{" "}
are changed. It may still be scheduled manually, or on failure stepback.
</Banner>
</BannerContainer>
);

export default IgnoredBanner;
3 changes: 2 additions & 1 deletion src/pages/version/Banners/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import ErrorBanner from "./ErrorBanner";
import IgnoredBanner from "./IgnoredBanner";
import WarningBanner from "./WarningBanner";

export { WarningBanner, ErrorBanner };
export { WarningBanner, ErrorBanner, IgnoredBanner };