Skip to content

Commit

Permalink
DEVPROD-1661 add distro setting for mountpoints (evergreen-ci#2157)
Browse files Browse the repository at this point in the history
  • Loading branch information
ybrill authored Dec 11, 2023
1 parent 0ea2b7b commit d19d2bd
Show file tree
Hide file tree
Showing 8 changed files with 52 additions and 0 deletions.
14 changes: 14 additions & 0 deletions cypress/integration/distroSettings/host_section.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,20 @@ describe("host section", () => {
save();
cy.validateToast("success", "Updated distro.");
});

it("updates mountpoints", () => {
cy.contains("button", "Add Mountpoint").click();
cy.getInputByLabel("Mountpoint").type("/data");

save();
cy.validateToast("success", "Updated distro.");

// Reset fields
cy.dataCy("delete-item-button").click();

save();
cy.validateToast("success", "Updated distro.");
});
});

describe("using User Data bootstrap method", () => {
Expand Down
1 change: 1 addition & 0 deletions src/gql/generated/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5719,6 +5719,7 @@ export type DistroQuery = {
disableShallowClone: boolean;
isCluster: boolean;
isVirtualWorkStation: boolean;
mountpoints?: Array<string | null> | null;
name: string;
note: string;
provider: Provider;
Expand Down
1 change: 1 addition & 0 deletions src/gql/queries/distro.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ query Distro($distroId: String!) {
}
isCluster
isVirtualWorkStation
mountpoints
name
note
plannerSettings {
Expand Down
23 changes: 23 additions & 0 deletions src/pages/distroSettings/tabs/HostTab/schemaFields.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,27 @@ export const rootDir = {
uiSchema: {},
};

export const mountpoints = {
schema: {
type: "array" as "array",
title: "Mountpoints",
items: {
type: "string" as "string",
title: "Mountpoint",
default: "",
minLength: 1,
},
},
uiSchema: {
"ui:addButtonText": "Add Mountpoint",
"ui:description": "Mointpoints configured on the host.",
"ui:orderable": false,
items: {
"ui:placeholder": "/data",
},
},
};

const serviceUser = {
schema: {
type: "string" as "string",
Expand Down Expand Up @@ -548,6 +569,7 @@ export const setup = {
workDir: workDir.schema,
setupAsSudo: setupAsSudo.schema,
setupScript: setupScript.schema,
mountpoints: mountpoints.schema,
userSpawnAllowed: userSpawnAllowed.schema,
},
uiSchema: (architecture: Arch, hasStaticProvider: boolean) => ({
Expand All @@ -558,6 +580,7 @@ export const setup = {
setupAsSudo: setupAsSudo.uiSchema,
workDir: workDir.uiSchema,
setupScript: setupScript.uiSchema,
mountpoints: mountpoints.uiSchema,
userSpawnAllowed: userSpawnAllowed.uiSchema(hasStaticProvider),
isVirtualWorkStation: isVirtualWorkStation.uiSchema(architecture),
icecreamSchedulerHost: icecreamSchedulerHost.uiSchema,
Expand Down
8 changes: 8 additions & 0 deletions src/pages/distroSettings/tabs/HostTab/transformers.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,13 @@ describe("host tab", () => {
it("correctly converts from a form to GQL", () => {
expect(formToGql(form, distroData)).toStrictEqual(gql);
});

it("correctly converts from GQL to a form when mountpoints is null", () => {
expect(gqlToForm({ ...distroData, mountpoints: null })).toStrictEqual({
...form,
setup: { ...form.setup, mountpoints: [] },
});
});
});

const form: HostFormState = {
Expand All @@ -35,6 +42,7 @@ const form: HostFormState = {
isVirtualWorkStation: false,
icecreamSchedulerHost: "",
icecreamConfigPath: "",
mountpoints: ["/"],
},
bootstrapSettings: {
jasperBinaryDir: "/home/evg/jasper",
Expand Down
3 changes: 3 additions & 0 deletions src/pages/distroSettings/tabs/HostTab/transformers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ export const gqlToForm = ((data) => {
hostAllocatorSettings,
iceCreamSettings,
isVirtualWorkStation,
mountpoints,
setup,
setupAsSudo,
sshKey,
Expand All @@ -48,6 +49,7 @@ export const gqlToForm = ((data) => {
isVirtualWorkStation,
icecreamSchedulerHost: iceCreamSettings.schedulerHost,
icecreamConfigPath: iceCreamSettings.configPath,
mountpoints: mountpoints ?? [],
},
bootstrapSettings: {
jasperBinaryDir,
Expand Down Expand Up @@ -101,6 +103,7 @@ export const formToGql = ((
isVirtualWorkStation: setup.isVirtualWorkStation,
setupAsSudo: setup.setupAsSudo,
setup: setup.setupScript,
mountpoints: setup.mountpoints,
sshKey: sshConfig.sshKey,
sshOptions: sshConfig.sshOptions,
user: sshConfig.user,
Expand Down
1 change: 1 addition & 0 deletions src/pages/distroSettings/tabs/HostTab/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ export interface HostFormState {
isVirtualWorkStation: boolean;
icecreamSchedulerHost: string;
icecreamConfigPath: string;
mountpoints: string[];
};
bootstrapSettings: {
jasperBinaryDir: string;
Expand Down
1 change: 1 addition & 0 deletions src/pages/distroSettings/tabs/testData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ const distroData: DistroQuery["distro"] = {
userSpawnAllowed: false,
validProjects: [],
workDir: "/data/evg",
mountpoints: ["/"],
};

export { distroData };

0 comments on commit d19d2bd

Please sign in to comment.