Skip to content

Commit

Permalink
DEVPROD-1008 Add new oldest allowed merge base field (#27)
Browse files Browse the repository at this point in the history
  • Loading branch information
hadjri authored Apr 4, 2024
1 parent edb9f31 commit 6cda10b
Show file tree
Hide file tree
Showing 10 changed files with 59 additions and 0 deletions.
4 changes: 4 additions & 0 deletions apps/parsley/src/gql/generated/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1696,6 +1696,7 @@ export type Project = {
isFavorite: Scalars["Boolean"]["output"];
manualPrTestingEnabled?: Maybe<Scalars["Boolean"]["output"]>;
notifyOnBuildFailure?: Maybe<Scalars["Boolean"]["output"]>;
oldestAllowedMergeBase: Scalars["String"]["output"];
owner: Scalars["String"]["output"];
parsleyFilters?: Maybe<Array<ParsleyFilter>>;
patchTriggerAliases?: Maybe<Array<PatchTriggerAlias>>;
Expand Down Expand Up @@ -1832,6 +1833,7 @@ export type ProjectInput = {
identifier?: InputMaybe<Scalars["String"]["input"]>;
manualPrTestingEnabled?: InputMaybe<Scalars["Boolean"]["input"]>;
notifyOnBuildFailure?: InputMaybe<Scalars["Boolean"]["input"]>;
oldestAllowedMergeBase?: InputMaybe<Scalars["String"]["input"]>;
owner?: InputMaybe<Scalars["String"]["input"]>;
parsleyFilters?: InputMaybe<Array<ParsleyFilterInput>>;
patchTriggerAliases?: InputMaybe<Array<PatchTriggerAliasInput>>;
Expand Down Expand Up @@ -2168,6 +2170,7 @@ export type RepoRef = {
id: Scalars["String"]["output"];
manualPrTestingEnabled: Scalars["Boolean"]["output"];
notifyOnBuildFailure: Scalars["Boolean"]["output"];
oldestAllowedMergeBase: Scalars["String"]["output"];
owner: Scalars["String"]["output"];
parsleyFilters?: Maybe<Array<ParsleyFilter>>;
patchTriggerAliases?: Maybe<Array<PatchTriggerAlias>>;
Expand Down Expand Up @@ -2211,6 +2214,7 @@ export type RepoRefInput = {
id: Scalars["String"]["input"];
manualPrTestingEnabled?: InputMaybe<Scalars["Boolean"]["input"]>;
notifyOnBuildFailure?: InputMaybe<Scalars["Boolean"]["input"]>;
oldestAllowedMergeBase?: InputMaybe<Scalars["String"]["input"]>;
owner?: InputMaybe<Scalars["String"]["input"]>;
parsleyFilters?: InputMaybe<Array<ParsleyFilterInput>>;
patchTriggerAliases?: InputMaybe<Array<PatchTriggerAliasInput>>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ fragment ProjectGithubSettings on Project {
gitTagAuthorizedUsers
gitTagVersionsEnabled
manualPrTestingEnabled
oldestAllowedMergeBase
prTestingEnabled
}

Expand All @@ -27,6 +28,7 @@ fragment RepoGithubSettings on RepoRef {
gitTagAuthorizedUsers
gitTagVersionsEnabled
manualPrTestingEnabled
oldestAllowedMergeBase
prTestingEnabled
}

Expand Down
18 changes: 18 additions & 0 deletions apps/spruce/src/gql/generated/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1696,6 +1696,7 @@ export type Project = {
isFavorite: Scalars["Boolean"]["output"];
manualPrTestingEnabled?: Maybe<Scalars["Boolean"]["output"]>;
notifyOnBuildFailure?: Maybe<Scalars["Boolean"]["output"]>;
oldestAllowedMergeBase: Scalars["String"]["output"];
owner: Scalars["String"]["output"];
parsleyFilters?: Maybe<Array<ParsleyFilter>>;
patchTriggerAliases?: Maybe<Array<PatchTriggerAlias>>;
Expand Down Expand Up @@ -1832,6 +1833,7 @@ export type ProjectInput = {
identifier?: InputMaybe<Scalars["String"]["input"]>;
manualPrTestingEnabled?: InputMaybe<Scalars["Boolean"]["input"]>;
notifyOnBuildFailure?: InputMaybe<Scalars["Boolean"]["input"]>;
oldestAllowedMergeBase?: InputMaybe<Scalars["String"]["input"]>;
owner?: InputMaybe<Scalars["String"]["input"]>;
parsleyFilters?: InputMaybe<Array<ParsleyFilterInput>>;
patchTriggerAliases?: InputMaybe<Array<PatchTriggerAliasInput>>;
Expand Down Expand Up @@ -2168,6 +2170,7 @@ export type RepoRef = {
id: Scalars["String"]["output"];
manualPrTestingEnabled: Scalars["Boolean"]["output"];
notifyOnBuildFailure: Scalars["Boolean"]["output"];
oldestAllowedMergeBase: Scalars["String"]["output"];
owner: Scalars["String"]["output"];
parsleyFilters?: Maybe<Array<ParsleyFilter>>;
patchTriggerAliases?: Maybe<Array<PatchTriggerAlias>>;
Expand Down Expand Up @@ -2211,6 +2214,7 @@ export type RepoRefInput = {
id: Scalars["String"]["input"];
manualPrTestingEnabled?: InputMaybe<Scalars["Boolean"]["input"]>;
notifyOnBuildFailure?: InputMaybe<Scalars["Boolean"]["input"]>;
oldestAllowedMergeBase?: InputMaybe<Scalars["String"]["input"]>;
owner?: InputMaybe<Scalars["String"]["input"]>;
parsleyFilters?: InputMaybe<Array<ParsleyFilterInput>>;
patchTriggerAliases?: InputMaybe<Array<PatchTriggerAliasInput>>;
Expand Down Expand Up @@ -3585,6 +3589,7 @@ export type ProjectGithubSettingsFragment = {
gitTagAuthorizedUsers?: Array<string> | null;
gitTagVersionsEnabled?: boolean | null;
manualPrTestingEnabled?: boolean | null;
oldestAllowedMergeBase: string;
prTestingEnabled?: boolean | null;
commitQueue: {
__typename?: "CommitQueueParams";
Expand All @@ -3603,6 +3608,7 @@ export type RepoGithubSettingsFragment = {
gitTagAuthorizedUsers?: Array<string> | null;
gitTagVersionsEnabled: boolean;
manualPrTestingEnabled: boolean;
oldestAllowedMergeBase: string;
prTestingEnabled: boolean;
commitQueue: {
__typename?: "RepoCommitQueueParams";
Expand All @@ -3624,6 +3630,7 @@ export type ProjectGithubCommitQueueFragment = {
gitTagAuthorizedUsers?: Array<string> | null;
gitTagVersionsEnabled?: boolean | null;
manualPrTestingEnabled?: boolean | null;
oldestAllowedMergeBase: string;
prTestingEnabled?: boolean | null;
commitQueue: {
__typename?: "CommitQueueParams";
Expand All @@ -3646,6 +3653,7 @@ export type RepoGithubCommitQueueFragment = {
gitTagAuthorizedUsers?: Array<string> | null;
gitTagVersionsEnabled: boolean;
manualPrTestingEnabled: boolean;
oldestAllowedMergeBase: string;
prTestingEnabled: boolean;
commitQueue: {
__typename?: "RepoCommitQueueParams";
Expand All @@ -3668,6 +3676,7 @@ export type ProjectEventGithubCommitQueueFragment = {
gitTagAuthorizedUsers?: Array<string> | null;
gitTagVersionsEnabled?: boolean | null;
manualPrTestingEnabled?: boolean | null;
oldestAllowedMergeBase: string;
prTestingEnabled?: boolean | null;
commitQueue: {
__typename?: "CommitQueueParams";
Expand Down Expand Up @@ -3727,6 +3736,7 @@ export type ProjectSettingsFieldsFragment = {
gitTagAuthorizedUsers?: Array<string> | null;
gitTagVersionsEnabled?: boolean | null;
manualPrTestingEnabled?: boolean | null;
oldestAllowedMergeBase: string;
prTestingEnabled?: boolean | null;
containerSizeDefinitions?: Array<{
__typename?: "ContainerResources";
Expand Down Expand Up @@ -3933,6 +3943,7 @@ export type RepoSettingsFieldsFragment = {
gitTagAuthorizedUsers?: Array<string> | null;
gitTagVersionsEnabled: boolean;
manualPrTestingEnabled: boolean;
oldestAllowedMergeBase: string;
prTestingEnabled: boolean;
containerSizeDefinitions?: Array<{
__typename?: "ContainerResources";
Expand Down Expand Up @@ -4335,6 +4346,7 @@ export type ProjectEventSettingsFragment = {
gitTagAuthorizedUsers?: Array<string> | null;
gitTagVersionsEnabled?: boolean | null;
manualPrTestingEnabled?: boolean | null;
oldestAllowedMergeBase: string;
prTestingEnabled?: boolean | null;
taskSync: {
__typename?: "TaskSyncOptions";
Expand Down Expand Up @@ -6806,6 +6818,7 @@ export type ProjectEventLogsQuery = {
gitTagAuthorizedUsers?: Array<string> | null;
gitTagVersionsEnabled?: boolean | null;
manualPrTestingEnabled?: boolean | null;
oldestAllowedMergeBase: string;
prTestingEnabled?: boolean | null;
taskSync: {
__typename?: "TaskSyncOptions";
Expand Down Expand Up @@ -7019,6 +7032,7 @@ export type ProjectEventLogsQuery = {
gitTagAuthorizedUsers?: Array<string> | null;
gitTagVersionsEnabled?: boolean | null;
manualPrTestingEnabled?: boolean | null;
oldestAllowedMergeBase: string;
prTestingEnabled?: boolean | null;
taskSync: {
__typename?: "TaskSyncOptions";
Expand Down Expand Up @@ -7305,6 +7319,7 @@ export type ProjectSettingsQuery = {
gitTagAuthorizedUsers?: Array<string> | null;
gitTagVersionsEnabled?: boolean | null;
manualPrTestingEnabled?: boolean | null;
oldestAllowedMergeBase: string;
prTestingEnabled?: boolean | null;
containerSizeDefinitions?: Array<{
__typename?: "ContainerResources";
Expand Down Expand Up @@ -7572,6 +7587,7 @@ export type RepoEventLogsQuery = {
gitTagAuthorizedUsers?: Array<string> | null;
gitTagVersionsEnabled?: boolean | null;
manualPrTestingEnabled?: boolean | null;
oldestAllowedMergeBase: string;
prTestingEnabled?: boolean | null;
taskSync: {
__typename?: "TaskSyncOptions";
Expand Down Expand Up @@ -7785,6 +7801,7 @@ export type RepoEventLogsQuery = {
gitTagAuthorizedUsers?: Array<string> | null;
gitTagVersionsEnabled?: boolean | null;
manualPrTestingEnabled?: boolean | null;
oldestAllowedMergeBase: string;
prTestingEnabled?: boolean | null;
taskSync: {
__typename?: "TaskSyncOptions";
Expand Down Expand Up @@ -8002,6 +8019,7 @@ export type RepoSettingsQuery = {
gitTagAuthorizedUsers?: Array<string> | null;
gitTagVersionsEnabled: boolean;
manualPrTestingEnabled: boolean;
oldestAllowedMergeBase: string;
prTestingEnabled: boolean;
containerSizeDefinitions?: Array<{
__typename?: "ContainerResources";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,7 @@ const projectSettingsMock: ApolloMock<
batchTime: 60,
remotePath: ".arst.yml",
spawnHostScriptPath: "",
oldestAllowedMergeBase: "",
dispatchingDisabled: false,
versionControlEnabled: false,
deactivatePrevious: true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ const projectEventsQuery: ProjectEventLogsQuery = {
displayName: "Spruce",
batchTime: 60,
remotePath: ".evergreen.yml",
oldestAllowedMergeBase: "",
spawnHostScriptPath: "",
dispatchingDisabled: false,
versionControlEnabled: false,
Expand Down Expand Up @@ -182,6 +183,7 @@ const projectEventsQuery: ProjectEventLogsQuery = {
batchTime: 30,
remotePath: ".srat.yml",
spawnHostScriptPath: "",
oldestAllowedMergeBase: "",
dispatchingDisabled: false,
versionControlEnabled: false,
deactivatePrevious: true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,10 @@ export const getFormSchema = (
repoData?.github?.manualPrTestingEnabled,
),
},
oldestAllowedMergeBase: {
type: "string" as "string",
title: "Oldest Allowed Merge Base",
},
prTesting: {
type: "object" as "object",
title: "GitHub Patch Definitions",
Expand Down Expand Up @@ -342,6 +346,22 @@ export const getFormSchema = (
"PR Testing",
),
},
oldestAllowedMergeBase: {
"ui:description":
"Specify the oldest commit SHA on your project branch that is allowed to be a merge base for a PR",
"ui:optional": true,
...placeholderIf(repoData?.github?.oldestAllowedMergeBase),
...hideIf(
fieldDisabled(
formData?.github?.prTestingEnabled,
repoData?.github?.prTestingEnabled,
) &&
fieldDisabled(
formData?.github?.manualPrTestingEnabled,
repoData?.github?.manualPrTestingEnabled,
),
),
},
prTesting: {
...hideIf(
fieldDisabled(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ const projectForm: GCQFormState = {
github: {
prTestingEnabled: null,
manualPrTestingEnabled: null,
oldestAllowedMergeBase: "abc",
prTesting: {
githubPrAliasesOverride: true,
githubPrAliases: [
Expand Down Expand Up @@ -150,6 +151,7 @@ const projectResult: Pick<
id: "project",
prTestingEnabled: null,
manualPrTestingEnabled: null,
oldestAllowedMergeBase: "abc",
githubChecksEnabled: null,
gitTagVersionsEnabled: null,
gitTagAuthorizedUsers: ["privileged"],
Expand Down Expand Up @@ -205,6 +207,7 @@ const repoForm: GCQFormState = {
github: {
prTestingEnabled: false,
manualPrTestingEnabled: false,
oldestAllowedMergeBase: "abc",
prTesting: {
githubPrAliasesOverride: true,
githubPrAliases: [],
Expand Down Expand Up @@ -292,6 +295,7 @@ const repoResult: Pick<RepoSettingsInput, "repoId" | "projectRef" | "aliases"> =
gitTagVersionsEnabled: false,
gitTagAuthorizedUsers: ["admin"],
gitTagAuthorizedTeams: [],
oldestAllowedMergeBase: "abc",
commitQueue: {
enabled: true,
message: "Commit Queue Message",
Expand Down Expand Up @@ -319,6 +323,7 @@ const mergedForm: GCQFormState = {
github: {
prTestingEnabled: null,
manualPrTestingEnabled: null,
oldestAllowedMergeBase: "abc",
prTesting: {
githubPrAliasesOverride: true,
githubPrAliases: [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ export const gqlToForm = ((data, options) => {
gitTagVersionsEnabled,
githubChecksEnabled,
manualPrTestingEnabled,
oldestAllowedMergeBase,
prTestingEnabled,
} = projectRef;

Expand Down Expand Up @@ -75,6 +76,7 @@ export const gqlToForm = ((data, options) => {
githubCheckAliases,
},
gitTagVersionsEnabled,
oldestAllowedMergeBase,
users: {
gitTagAuthorizedUsersOverride:
projectType !== ProjectType.AttachedProject ||
Expand Down Expand Up @@ -121,6 +123,7 @@ export const formToGql = ((
githubChecks,
githubChecksEnabled,
manualPrTestingEnabled,
oldestAllowedMergeBase,
prTesting,
prTestingEnabled,
teams: { gitTagAuthorizedTeams, gitTagAuthorizedTeamsOverride },
Expand All @@ -136,6 +139,7 @@ export const formToGql = ((
manualPrTestingEnabled,
githubChecksEnabled,
gitTagVersionsEnabled,
oldestAllowedMergeBase,
gitTagAuthorizedUsers: gitTagAuthorizedUsersOverride
? gitTagAuthorizedUsers
: null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ export interface GCQFormState {
githubPrAliases: Array<AliasFormType>;
};
};
oldestAllowedMergeBase: string;
githubTriggerAliases: ProjectPatchAliasSettingsFragment["patchTriggerAliases"];
githubChecksEnabled: boolean;
githubChecks: {
Expand Down
2 changes: 2 additions & 0 deletions apps/spruce/src/pages/projectSettings/tabs/testData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ const projectBase: ProjectSettingsQuery["projectSettings"] = {
notifyOnBuildFailure: null,
batchTime: 0,
remotePath: null,
oldestAllowedMergeBase: "abc",
spawnHostScriptPath: null,
dispatchingDisabled: null,
versionControlEnabled: true,
Expand Down Expand Up @@ -178,6 +179,7 @@ const repoBase: RepoSettingsQuery["repoSettings"] = {
batchTime: 12,
remotePath: "evergreen.yml",
spawnHostScriptPath: "/test/path",
oldestAllowedMergeBase: "abc",
dispatchingDisabled: true,
versionControlEnabled: false,
deactivatePrevious: true,
Expand Down

0 comments on commit 6cda10b

Please sign in to comment.