diff --git a/apps/parsley/src/gql/generated/types.ts b/apps/parsley/src/gql/generated/types.ts index 24e9b8eb8..22f56ae77 100644 --- a/apps/parsley/src/gql/generated/types.ts +++ b/apps/parsley/src/gql/generated/types.ts @@ -1696,6 +1696,7 @@ export type Project = { isFavorite: Scalars["Boolean"]["output"]; manualPrTestingEnabled?: Maybe; notifyOnBuildFailure?: Maybe; + oldestAllowedMergeBase: Scalars["String"]["output"]; owner: Scalars["String"]["output"]; parsleyFilters?: Maybe>; patchTriggerAliases?: Maybe>; @@ -1832,6 +1833,7 @@ export type ProjectInput = { identifier?: InputMaybe; manualPrTestingEnabled?: InputMaybe; notifyOnBuildFailure?: InputMaybe; + oldestAllowedMergeBase?: InputMaybe; owner?: InputMaybe; parsleyFilters?: InputMaybe>; patchTriggerAliases?: InputMaybe>; @@ -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>; patchTriggerAliases?: Maybe>; @@ -2211,6 +2214,7 @@ export type RepoRefInput = { id: Scalars["String"]["input"]; manualPrTestingEnabled?: InputMaybe; notifyOnBuildFailure?: InputMaybe; + oldestAllowedMergeBase?: InputMaybe; owner?: InputMaybe; parsleyFilters?: InputMaybe>; patchTriggerAliases?: InputMaybe>; diff --git a/apps/spruce/src/gql/fragments/projectSettings/githubCommitQueue.graphql b/apps/spruce/src/gql/fragments/projectSettings/githubCommitQueue.graphql index bd29f8813..2409f0627 100644 --- a/apps/spruce/src/gql/fragments/projectSettings/githubCommitQueue.graphql +++ b/apps/spruce/src/gql/fragments/projectSettings/githubCommitQueue.graphql @@ -11,6 +11,7 @@ fragment ProjectGithubSettings on Project { gitTagAuthorizedUsers gitTagVersionsEnabled manualPrTestingEnabled + oldestAllowedMergeBase prTestingEnabled } @@ -27,6 +28,7 @@ fragment RepoGithubSettings on RepoRef { gitTagAuthorizedUsers gitTagVersionsEnabled manualPrTestingEnabled + oldestAllowedMergeBase prTestingEnabled } diff --git a/apps/spruce/src/gql/generated/types.ts b/apps/spruce/src/gql/generated/types.ts index 1d4f15717..c32300857 100644 --- a/apps/spruce/src/gql/generated/types.ts +++ b/apps/spruce/src/gql/generated/types.ts @@ -1696,6 +1696,7 @@ export type Project = { isFavorite: Scalars["Boolean"]["output"]; manualPrTestingEnabled?: Maybe; notifyOnBuildFailure?: Maybe; + oldestAllowedMergeBase: Scalars["String"]["output"]; owner: Scalars["String"]["output"]; parsleyFilters?: Maybe>; patchTriggerAliases?: Maybe>; @@ -1832,6 +1833,7 @@ export type ProjectInput = { identifier?: InputMaybe; manualPrTestingEnabled?: InputMaybe; notifyOnBuildFailure?: InputMaybe; + oldestAllowedMergeBase?: InputMaybe; owner?: InputMaybe; parsleyFilters?: InputMaybe>; patchTriggerAliases?: InputMaybe>; @@ -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>; patchTriggerAliases?: Maybe>; @@ -2211,6 +2214,7 @@ export type RepoRefInput = { id: Scalars["String"]["input"]; manualPrTestingEnabled?: InputMaybe; notifyOnBuildFailure?: InputMaybe; + oldestAllowedMergeBase?: InputMaybe; owner?: InputMaybe; parsleyFilters?: InputMaybe>; patchTriggerAliases?: InputMaybe>; @@ -3585,6 +3589,7 @@ export type ProjectGithubSettingsFragment = { gitTagAuthorizedUsers?: Array | null; gitTagVersionsEnabled?: boolean | null; manualPrTestingEnabled?: boolean | null; + oldestAllowedMergeBase: string; prTestingEnabled?: boolean | null; commitQueue: { __typename?: "CommitQueueParams"; @@ -3603,6 +3608,7 @@ export type RepoGithubSettingsFragment = { gitTagAuthorizedUsers?: Array | null; gitTagVersionsEnabled: boolean; manualPrTestingEnabled: boolean; + oldestAllowedMergeBase: string; prTestingEnabled: boolean; commitQueue: { __typename?: "RepoCommitQueueParams"; @@ -3624,6 +3630,7 @@ export type ProjectGithubCommitQueueFragment = { gitTagAuthorizedUsers?: Array | null; gitTagVersionsEnabled?: boolean | null; manualPrTestingEnabled?: boolean | null; + oldestAllowedMergeBase: string; prTestingEnabled?: boolean | null; commitQueue: { __typename?: "CommitQueueParams"; @@ -3646,6 +3653,7 @@ export type RepoGithubCommitQueueFragment = { gitTagAuthorizedUsers?: Array | null; gitTagVersionsEnabled: boolean; manualPrTestingEnabled: boolean; + oldestAllowedMergeBase: string; prTestingEnabled: boolean; commitQueue: { __typename?: "RepoCommitQueueParams"; @@ -3668,6 +3676,7 @@ export type ProjectEventGithubCommitQueueFragment = { gitTagAuthorizedUsers?: Array | null; gitTagVersionsEnabled?: boolean | null; manualPrTestingEnabled?: boolean | null; + oldestAllowedMergeBase: string; prTestingEnabled?: boolean | null; commitQueue: { __typename?: "CommitQueueParams"; @@ -3727,6 +3736,7 @@ export type ProjectSettingsFieldsFragment = { gitTagAuthorizedUsers?: Array | null; gitTagVersionsEnabled?: boolean | null; manualPrTestingEnabled?: boolean | null; + oldestAllowedMergeBase: string; prTestingEnabled?: boolean | null; containerSizeDefinitions?: Array<{ __typename?: "ContainerResources"; @@ -3933,6 +3943,7 @@ export type RepoSettingsFieldsFragment = { gitTagAuthorizedUsers?: Array | null; gitTagVersionsEnabled: boolean; manualPrTestingEnabled: boolean; + oldestAllowedMergeBase: string; prTestingEnabled: boolean; containerSizeDefinitions?: Array<{ __typename?: "ContainerResources"; @@ -4335,6 +4346,7 @@ export type ProjectEventSettingsFragment = { gitTagAuthorizedUsers?: Array | null; gitTagVersionsEnabled?: boolean | null; manualPrTestingEnabled?: boolean | null; + oldestAllowedMergeBase: string; prTestingEnabled?: boolean | null; taskSync: { __typename?: "TaskSyncOptions"; @@ -6806,6 +6818,7 @@ export type ProjectEventLogsQuery = { gitTagAuthorizedUsers?: Array | null; gitTagVersionsEnabled?: boolean | null; manualPrTestingEnabled?: boolean | null; + oldestAllowedMergeBase: string; prTestingEnabled?: boolean | null; taskSync: { __typename?: "TaskSyncOptions"; @@ -7019,6 +7032,7 @@ export type ProjectEventLogsQuery = { gitTagAuthorizedUsers?: Array | null; gitTagVersionsEnabled?: boolean | null; manualPrTestingEnabled?: boolean | null; + oldestAllowedMergeBase: string; prTestingEnabled?: boolean | null; taskSync: { __typename?: "TaskSyncOptions"; @@ -7305,6 +7319,7 @@ export type ProjectSettingsQuery = { gitTagAuthorizedUsers?: Array | null; gitTagVersionsEnabled?: boolean | null; manualPrTestingEnabled?: boolean | null; + oldestAllowedMergeBase: string; prTestingEnabled?: boolean | null; containerSizeDefinitions?: Array<{ __typename?: "ContainerResources"; @@ -7572,6 +7587,7 @@ export type RepoEventLogsQuery = { gitTagAuthorizedUsers?: Array | null; gitTagVersionsEnabled?: boolean | null; manualPrTestingEnabled?: boolean | null; + oldestAllowedMergeBase: string; prTestingEnabled?: boolean | null; taskSync: { __typename?: "TaskSyncOptions"; @@ -7785,6 +7801,7 @@ export type RepoEventLogsQuery = { gitTagAuthorizedUsers?: Array | null; gitTagVersionsEnabled?: boolean | null; manualPrTestingEnabled?: boolean | null; + oldestAllowedMergeBase: string; prTestingEnabled?: boolean | null; taskSync: { __typename?: "TaskSyncOptions"; @@ -8002,6 +8019,7 @@ export type RepoSettingsQuery = { gitTagAuthorizedUsers?: Array | null; gitTagVersionsEnabled: boolean; manualPrTestingEnabled: boolean; + oldestAllowedMergeBase: string; prTestingEnabled: boolean; containerSizeDefinitions?: Array<{ __typename?: "ContainerResources"; diff --git a/apps/spruce/src/pages/projectSettings/CopyProjectModal.test.tsx b/apps/spruce/src/pages/projectSettings/CopyProjectModal.test.tsx index 431a2038c..2b111109a 100644 --- a/apps/spruce/src/pages/projectSettings/CopyProjectModal.test.tsx +++ b/apps/spruce/src/pages/projectSettings/CopyProjectModal.test.tsx @@ -300,6 +300,7 @@ const projectSettingsMock: ApolloMock< batchTime: 60, remotePath: ".arst.yml", spawnHostScriptPath: "", + oldestAllowedMergeBase: "", dispatchingDisabled: false, versionControlEnabled: false, deactivatePrevious: true, diff --git a/apps/spruce/src/pages/projectSettings/tabs/EventLogTab/EventLogTab.test.tsx b/apps/spruce/src/pages/projectSettings/tabs/EventLogTab/EventLogTab.test.tsx index b28061c8c..b06d166b5 100644 --- a/apps/spruce/src/pages/projectSettings/tabs/EventLogTab/EventLogTab.test.tsx +++ b/apps/spruce/src/pages/projectSettings/tabs/EventLogTab/EventLogTab.test.tsx @@ -94,6 +94,7 @@ const projectEventsQuery: ProjectEventLogsQuery = { displayName: "Spruce", batchTime: 60, remotePath: ".evergreen.yml", + oldestAllowedMergeBase: "", spawnHostScriptPath: "", dispatchingDisabled: false, versionControlEnabled: false, @@ -182,6 +183,7 @@ const projectEventsQuery: ProjectEventLogsQuery = { batchTime: 30, remotePath: ".srat.yml", spawnHostScriptPath: "", + oldestAllowedMergeBase: "", dispatchingDisabled: false, versionControlEnabled: false, deactivatePrevious: true, diff --git a/apps/spruce/src/pages/projectSettings/tabs/GithubCommitQueueTab/getFormSchema.tsx b/apps/spruce/src/pages/projectSettings/tabs/GithubCommitQueueTab/getFormSchema.tsx index 339c68ebd..ae97604d6 100644 --- a/apps/spruce/src/pages/projectSettings/tabs/GithubCommitQueueTab/getFormSchema.tsx +++ b/apps/spruce/src/pages/projectSettings/tabs/GithubCommitQueueTab/getFormSchema.tsx @@ -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", @@ -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( diff --git a/apps/spruce/src/pages/projectSettings/tabs/GithubCommitQueueTab/transformers.test.ts b/apps/spruce/src/pages/projectSettings/tabs/GithubCommitQueueTab/transformers.test.ts index 7f2378cd2..c4fc5f30c 100644 --- a/apps/spruce/src/pages/projectSettings/tabs/GithubCommitQueueTab/transformers.test.ts +++ b/apps/spruce/src/pages/projectSettings/tabs/GithubCommitQueueTab/transformers.test.ts @@ -45,6 +45,7 @@ const projectForm: GCQFormState = { github: { prTestingEnabled: null, manualPrTestingEnabled: null, + oldestAllowedMergeBase: "abc", prTesting: { githubPrAliasesOverride: true, githubPrAliases: [ @@ -150,6 +151,7 @@ const projectResult: Pick< id: "project", prTestingEnabled: null, manualPrTestingEnabled: null, + oldestAllowedMergeBase: "abc", githubChecksEnabled: null, gitTagVersionsEnabled: null, gitTagAuthorizedUsers: ["privileged"], @@ -205,6 +207,7 @@ const repoForm: GCQFormState = { github: { prTestingEnabled: false, manualPrTestingEnabled: false, + oldestAllowedMergeBase: "abc", prTesting: { githubPrAliasesOverride: true, githubPrAliases: [], @@ -292,6 +295,7 @@ const repoResult: Pick = gitTagVersionsEnabled: false, gitTagAuthorizedUsers: ["admin"], gitTagAuthorizedTeams: [], + oldestAllowedMergeBase: "abc", commitQueue: { enabled: true, message: "Commit Queue Message", @@ -319,6 +323,7 @@ const mergedForm: GCQFormState = { github: { prTestingEnabled: null, manualPrTestingEnabled: null, + oldestAllowedMergeBase: "abc", prTesting: { githubPrAliasesOverride: true, githubPrAliases: [ diff --git a/apps/spruce/src/pages/projectSettings/tabs/GithubCommitQueueTab/transformers.ts b/apps/spruce/src/pages/projectSettings/tabs/GithubCommitQueueTab/transformers.ts index 2d23f813c..6ecaf46ce 100644 --- a/apps/spruce/src/pages/projectSettings/tabs/GithubCommitQueueTab/transformers.ts +++ b/apps/spruce/src/pages/projectSettings/tabs/GithubCommitQueueTab/transformers.ts @@ -40,6 +40,7 @@ export const gqlToForm = ((data, options) => { gitTagVersionsEnabled, githubChecksEnabled, manualPrTestingEnabled, + oldestAllowedMergeBase, prTestingEnabled, } = projectRef; @@ -75,6 +76,7 @@ export const gqlToForm = ((data, options) => { githubCheckAliases, }, gitTagVersionsEnabled, + oldestAllowedMergeBase, users: { gitTagAuthorizedUsersOverride: projectType !== ProjectType.AttachedProject || @@ -121,6 +123,7 @@ export const formToGql = (( githubChecks, githubChecksEnabled, manualPrTestingEnabled, + oldestAllowedMergeBase, prTesting, prTestingEnabled, teams: { gitTagAuthorizedTeams, gitTagAuthorizedTeamsOverride }, @@ -136,6 +139,7 @@ export const formToGql = (( manualPrTestingEnabled, githubChecksEnabled, gitTagVersionsEnabled, + oldestAllowedMergeBase, gitTagAuthorizedUsers: gitTagAuthorizedUsersOverride ? gitTagAuthorizedUsers : null, diff --git a/apps/spruce/src/pages/projectSettings/tabs/GithubCommitQueueTab/types.ts b/apps/spruce/src/pages/projectSettings/tabs/GithubCommitQueueTab/types.ts index e64311469..102599b26 100644 --- a/apps/spruce/src/pages/projectSettings/tabs/GithubCommitQueueTab/types.ts +++ b/apps/spruce/src/pages/projectSettings/tabs/GithubCommitQueueTab/types.ts @@ -16,6 +16,7 @@ export interface GCQFormState { githubPrAliases: Array; }; }; + oldestAllowedMergeBase: string; githubTriggerAliases: ProjectPatchAliasSettingsFragment["patchTriggerAliases"]; githubChecksEnabled: boolean; githubChecks: { diff --git a/apps/spruce/src/pages/projectSettings/tabs/testData.ts b/apps/spruce/src/pages/projectSettings/tabs/testData.ts index 386f221cb..f439d09e8 100644 --- a/apps/spruce/src/pages/projectSettings/tabs/testData.ts +++ b/apps/spruce/src/pages/projectSettings/tabs/testData.ts @@ -44,6 +44,7 @@ const projectBase: ProjectSettingsQuery["projectSettings"] = { notifyOnBuildFailure: null, batchTime: 0, remotePath: null, + oldestAllowedMergeBase: "abc", spawnHostScriptPath: null, dispatchingDisabled: null, versionControlEnabled: true, @@ -178,6 +179,7 @@ const repoBase: RepoSettingsQuery["repoSettings"] = { batchTime: 12, remotePath: "evergreen.yml", spawnHostScriptPath: "/test/path", + oldestAllowedMergeBase: "abc", dispatchingDisabled: true, versionControlEnabled: false, deactivatePrevious: true,