From 76bc1de608541dc67e985ed7159fb3e1bbdaccf1 Mon Sep 17 00:00:00 2001 From: Mate Vago Date: Mon, 25 Nov 2024 15:21:39 +0100 Subject: [PATCH] fix: build --- golang/pkg/dagent/utils/docker.go | 4 +- golang/pkg/dagent/utils/prefix_file.go | 2 +- .../common-editor.spec.ts | 0 .../common-json.spec.ts | 0 .../container-config-filters.spec.ts} | 0 .../docker-editor.spec.ts | 0 .../docker-json.spec.ts | 0 .../image-config-view-state.spec.ts | 0 .../kubernetes-editor.spec.ts | 0 .../kubernetes-json.spec.ts | 0 web/crux-ui/i18n.json | 2 - web/crux-ui/playwright.config.ts | 4 +- .../config-bundles/config-bundle-card.tsx | 33 +++++++-------- .../common-config-section.tsx | 4 +- .../extendable-item-list.tsx | 4 +- .../deployments/deployment-view-list.tsx | 2 +- .../projects/versions/version-view-list.tsx | 2 + .../shared/secret-key-value-input.tsx | 1 - web/crux-ui/src/models/container.ts | 13 ------ .../src/pages/[teamSlug]/config-bundles.tsx | 1 - .../config-bundles/[configBundleId].tsx | 2 +- .../src/app/container/container.mapper.ts | 2 +- .../src/app/container/container.module.ts | 2 +- web/crux/src/app/deploy/deploy.mapper.spec.ts | 2 + web/crux/src/app/node/node.service.spec.ts | 12 ++++-- web/crux/src/domain/agent-callback.ts | 1 - web/crux/src/domain/agent.spec.ts | 37 +++++++++++------ web/crux/src/domain/container-merge.spec.ts | 10 +++-- web/crux/src/domain/validation.ts | 41 +++++++++++-------- 29 files changed, 94 insertions(+), 87 deletions(-) rename web/crux-ui/e2e/with-login/{image-config => container-config}/common-editor.spec.ts (100%) rename web/crux-ui/e2e/with-login/{image-config => container-config}/common-json.spec.ts (100%) rename web/crux-ui/e2e/with-login/{image-config/image-config-filters.spec.ts => container-config/container-config-filters.spec.ts} (100%) rename web/crux-ui/e2e/with-login/{image-config => container-config}/docker-editor.spec.ts (100%) rename web/crux-ui/e2e/with-login/{image-config => container-config}/docker-json.spec.ts (100%) rename web/crux-ui/e2e/with-login/{image-config => container-config}/image-config-view-state.spec.ts (100%) rename web/crux-ui/e2e/with-login/{image-config => container-config}/kubernetes-editor.spec.ts (100%) rename web/crux-ui/e2e/with-login/{image-config => container-config}/kubernetes-json.spec.ts (100%) diff --git a/golang/pkg/dagent/utils/docker.go b/golang/pkg/dagent/utils/docker.go index a43220ef0e..f1bd2859cb 100644 --- a/golang/pkg/dagent/utils/docker.go +++ b/golang/pkg/dagent/utils/docker.go @@ -323,7 +323,7 @@ func DeploySharedSecrets(ctx context.Context, ) error { cfg := grpc.GetConfigFromContext(ctx).(*config.Configuration) - pf := NewSecretsFile(cfg.InternalMountPath, prefix) + pf := NewSecretsPrefixFile(cfg.InternalMountPath, prefix) err := pf.WriteVariables(secrets) if err != nil { return fmt.Errorf("could not write secrets, aborting: %w", err) @@ -728,7 +728,7 @@ func SecretList(ctx context.Context, prefix string, name string) ([]string, erro if name == "" { cfg := grpc.GetConfigFromContext(ctx).(*config.Configuration) - pf := NewSecretsFile(cfg.InternalMountPath, prefix) + pf := NewSecretsPrefixFile(cfg.InternalMountPath, prefix) secrets, err := pf.ReadVariables() if err != nil { return []string{}, fmt.Errorf("could not read secrets, aborting: %w", err) diff --git a/golang/pkg/dagent/utils/prefix_file.go b/golang/pkg/dagent/utils/prefix_file.go index f23aa11ef0..1f5a1587fc 100644 --- a/golang/pkg/dagent/utils/prefix_file.go +++ b/golang/pkg/dagent/utils/prefix_file.go @@ -38,7 +38,7 @@ func NewSharedEnvPrefixFile(dataRoot, prefix string) prefixFile { } } -func NewSecretsFile(dataRoot, prefix string) prefixFile { +func NewSecretsPrefixFile(dataRoot, prefix string) prefixFile { return prefixFile{ DataRoot: dataRoot, Prefix: prefix, diff --git a/web/crux-ui/e2e/with-login/image-config/common-editor.spec.ts b/web/crux-ui/e2e/with-login/container-config/common-editor.spec.ts similarity index 100% rename from web/crux-ui/e2e/with-login/image-config/common-editor.spec.ts rename to web/crux-ui/e2e/with-login/container-config/common-editor.spec.ts diff --git a/web/crux-ui/e2e/with-login/image-config/common-json.spec.ts b/web/crux-ui/e2e/with-login/container-config/common-json.spec.ts similarity index 100% rename from web/crux-ui/e2e/with-login/image-config/common-json.spec.ts rename to web/crux-ui/e2e/with-login/container-config/common-json.spec.ts diff --git a/web/crux-ui/e2e/with-login/image-config/image-config-filters.spec.ts b/web/crux-ui/e2e/with-login/container-config/container-config-filters.spec.ts similarity index 100% rename from web/crux-ui/e2e/with-login/image-config/image-config-filters.spec.ts rename to web/crux-ui/e2e/with-login/container-config/container-config-filters.spec.ts diff --git a/web/crux-ui/e2e/with-login/image-config/docker-editor.spec.ts b/web/crux-ui/e2e/with-login/container-config/docker-editor.spec.ts similarity index 100% rename from web/crux-ui/e2e/with-login/image-config/docker-editor.spec.ts rename to web/crux-ui/e2e/with-login/container-config/docker-editor.spec.ts diff --git a/web/crux-ui/e2e/with-login/image-config/docker-json.spec.ts b/web/crux-ui/e2e/with-login/container-config/docker-json.spec.ts similarity index 100% rename from web/crux-ui/e2e/with-login/image-config/docker-json.spec.ts rename to web/crux-ui/e2e/with-login/container-config/docker-json.spec.ts diff --git a/web/crux-ui/e2e/with-login/image-config/image-config-view-state.spec.ts b/web/crux-ui/e2e/with-login/container-config/image-config-view-state.spec.ts similarity index 100% rename from web/crux-ui/e2e/with-login/image-config/image-config-view-state.spec.ts rename to web/crux-ui/e2e/with-login/container-config/image-config-view-state.spec.ts diff --git a/web/crux-ui/e2e/with-login/image-config/kubernetes-editor.spec.ts b/web/crux-ui/e2e/with-login/container-config/kubernetes-editor.spec.ts similarity index 100% rename from web/crux-ui/e2e/with-login/image-config/kubernetes-editor.spec.ts rename to web/crux-ui/e2e/with-login/container-config/kubernetes-editor.spec.ts diff --git a/web/crux-ui/e2e/with-login/image-config/kubernetes-json.spec.ts b/web/crux-ui/e2e/with-login/container-config/kubernetes-json.spec.ts similarity index 100% rename from web/crux-ui/e2e/with-login/image-config/kubernetes-json.spec.ts rename to web/crux-ui/e2e/with-login/container-config/kubernetes-json.spec.ts diff --git a/web/crux-ui/i18n.json b/web/crux-ui/i18n.json index 93449db909..6bb23b694e 100644 --- a/web/crux-ui/i18n.json +++ b/web/crux-ui/i18n.json @@ -20,7 +20,6 @@ "/[teamSlug]/projects": ["projects"], "/[teamSlug]/projects/[projectId]": ["projects", "versions", "images", "deployments"], "/[teamSlug]/projects/[projectId]/versions/[versionId]": ["versions", "images", "deployments"], - "/[teamSlug]/projects/[projectId]/versions/[versionId]/images/[imageId]": ["images", "container"], "/[teamSlug]/nodes": ["nodes", "tokens"], "/[teamSlug]/nodes/[nodeId]": ["nodes", "images", "tokens", "deployments"], "/[teamSlug]/nodes/[nodeId]/log": [], @@ -38,7 +37,6 @@ "/[teamSlug]/deployments/[deploymentId]": ["images", "deployments", "nodes", "tokens", "container"], "/[teamSlug]/deployments/[deploymentId]/deploy": ["deployments"], "/[teamSlug]/deployments/[deploymentId]/log": [], - "/[teamSlug]/deployments/[deploymentId]/instances/[instanceId]": ["images", "deployments", "container"], "/status": ["status"], "/templates": ["templates", "projects"], "/composer": ["compose", "versions", "container"], diff --git a/web/crux-ui/playwright.config.ts b/web/crux-ui/playwright.config.ts index 3a26f30d37..136121d0f7 100644 --- a/web/crux-ui/playwright.config.ts +++ b/web/crux-ui/playwright.config.ts @@ -93,8 +93,8 @@ const config: PlaywrightTestConfig = { createProject('template', 'with-login/template.spec.ts'), createProject('project', 'with-login/project.spec.ts'), createProject('version', 'with-login/version.spec.ts'), - createProject('image-config', /with-login\/image-config\/(.*)/, ['registry', 'template', 'version']), - createProject('deployment', /with-login\/deployment(.*)\.spec\.ts/, ['image-config', 'nodes']), + createProject('container-config', /with-login\/container-config\/(.*)/, ['registry', 'template', 'version']), + createProject('deployment', /with-login\/deployment(.*)\.spec\.ts/, ['container-config', 'nodes']), createProject('dagent-deploy', 'with-login/nodes-deploy.spec.ts', ['deployment']), createProject('resource-copy', 'with-login/resource-copy.spec.ts', ['template', 'version', 'deployment', 'nodes']), createProject('dashboard', 'with-login/dashboard.spec.ts'), diff --git a/web/crux-ui/src/components/config-bundles/config-bundle-card.tsx b/web/crux-ui/src/components/config-bundles/config-bundle-card.tsx index 61b567fa42..ef67f8048c 100644 --- a/web/crux-ui/src/components/config-bundles/config-bundle-card.tsx +++ b/web/crux-ui/src/components/config-bundles/config-bundle-card.tsx @@ -12,11 +12,10 @@ import Image from 'next/image' type ConfigBundleCardProps = { className?: string configBundle: ConfigBundle - showConfigIcon?: boolean } const ConfigBundleCard = (props: ConfigBundleCardProps) => { - const { configBundle, className, showConfigIcon } = props + const { configBundle, className } = props const { t } = useTranslation('config-bundles') const routes = useTeamRoutes() @@ -41,22 +40,20 @@ const ConfigBundleCard = (props: ConfigBundleCardProps) => { modalTitle={configBundle.name} /> - {showConfigIcon && ( -
- -
- {t('common:config')} - {t('common:config')} -
-
-
- )} +
+ +
+ {t('common:config')} + {t('common:config')} +
+
+
) } diff --git a/web/crux-ui/src/components/container-configs/common-config-section.tsx b/web/crux-ui/src/components/container-configs/common-config-section.tsx index 3d3e0ea6e3..77bc0c7ae3 100644 --- a/web/crux-ui/src/components/container-configs/common-config-section.tsx +++ b/web/crux-ui/src/components/container-configs/common-config-section.tsx @@ -15,9 +15,7 @@ import { CONTAINER_EXPOSE_STRATEGY_VALUES, CONTAINER_VOLUME_TYPE_VALUES, CommonConfigKey, - ConcreteCommonConfigData, ConcreteContainerConfigData, - ConcreteCraneConfigData, ContainerConfigData, ContainerConfigErrors, ContainerConfigExposeStrategy, @@ -105,7 +103,7 @@ const CommonConfigSection = (props: CommonConfigSectionProps) => { }) const onPortsChanged = (ports: Port[]) => { - let patch: Partial> = { + let patch: ConcreteContainerConfigData = { ports, } diff --git a/web/crux-ui/src/components/container-configs/extendable-item-list.tsx b/web/crux-ui/src/components/container-configs/extendable-item-list.tsx index d39ddb10ca..be707c6e37 100644 --- a/web/crux-ui/src/components/container-configs/extendable-item-list.tsx +++ b/web/crux-ui/src/components/container-configs/extendable-item-list.tsx @@ -122,7 +122,7 @@ const ExtendableItemList = (props: ExtendableItemListProps) = onResetSection, emptyItemFactory, itemClassName, - error, + error: sectionLabelError, } = props const [state, dispatch] = useRepatch>({ @@ -153,7 +153,7 @@ const ExtendableItemList = (props: ExtendableItemListProps) = labelClassName="text-bright font-semibold tracking-wide" disabled={!hasValue || disabled || !onResetSection} onResetSection={onResetSection} - error={error} + error={sectionLabelError} > {label.toUpperCase()} diff --git a/web/crux-ui/src/components/deployments/deployment-view-list.tsx b/web/crux-ui/src/components/deployments/deployment-view-list.tsx index 1efc23fd5c..9bf91fe5b2 100644 --- a/web/crux-ui/src/components/deployments/deployment-view-list.tsx +++ b/web/crux-ui/src/components/deployments/deployment-view-list.tsx @@ -71,7 +71,7 @@ const DeploymentViewList = (props: DeploymentViewListProps) => {
diff --git a/web/crux-ui/src/components/projects/versions/version-view-list.tsx b/web/crux-ui/src/components/projects/versions/version-view-list.tsx index a2a789df3d..d7dd768e9b 100644 --- a/web/crux-ui/src/components/projects/versions/version-view-list.tsx +++ b/web/crux-ui/src/components/projects/versions/version-view-list.tsx @@ -104,6 +104,7 @@ const VersionViewList = (props: VersionViewListProps) => { onClick={() => onOpenTagsDialog(it)} />
+
{ onClick={() => onDelete(it)} />
+ diff --git a/web/crux-ui/src/components/shared/secret-key-value-input.tsx b/web/crux-ui/src/components/shared/secret-key-value-input.tsx index 98995d5f97..d758e0c7d5 100644 --- a/web/crux-ui/src/components/shared/secret-key-value-input.tsx +++ b/web/crux-ui/src/components/shared/secret-key-value-input.tsx @@ -127,7 +127,6 @@ const SecretKeyValueInput = (props: SecretKeyValueInputProps) => { secretKeys.forEach(item => { const repeating = result.find(it => it.key === item.key) - console.log('status', item.key, secrets) result.push({ ...item, encrypted: item.encrypted ?? false, diff --git a/web/crux-ui/src/models/container.ts b/web/crux-ui/src/models/container.ts index f9546ba069..7042ee66f8 100644 --- a/web/crux-ui/src/models/container.ts +++ b/web/crux-ui/src/models/container.ts @@ -295,19 +295,6 @@ export type CraneConfigKey = (typeof CRANE_CONFIG_KEYS)[number] export type DagentConfigKey = (typeof DAGENT_CONFIG_KEYS)[number] export type ContainerConfigKey = (typeof CONTAINER_CONFIG_KEYS)[number] -export type DagentConfigData = Pick -export type CraneConfigData = Pick -export type CommonConfigData = Omit - -export type ConcreteDagentConfigData = Pick -export type ConcreteCraneConfigData = Pick -export type ConcreteCommonConfigData = Omit< - ConcreteContainerConfigData, - DagentConfigKey | CraneConfigKey | 'secrets' -> & { - secrets?: UniqueSecretKeyValue[] -} - export type ConcreteContainerConfigData = Omit & { secrets?: UniqueSecretKeyValue[] } diff --git a/web/crux-ui/src/pages/[teamSlug]/config-bundles.tsx b/web/crux-ui/src/pages/[teamSlug]/config-bundles.tsx index 113742a58d..8b0228a7d1 100644 --- a/web/crux-ui/src/pages/[teamSlug]/config-bundles.tsx +++ b/web/crux-ui/src/pages/[teamSlug]/config-bundles.tsx @@ -76,7 +76,6 @@ const ConfigBundles = (props: ConfigBundlesPageProps) => { className={clsx('max-h-72 w-full p-8 my-2', modulo3Class, modulo2Class)} key={`bundle-${index}`} configBundle={it} - showConfigIcon /> ) })} diff --git a/web/crux-ui/src/pages/[teamSlug]/config-bundles/[configBundleId].tsx b/web/crux-ui/src/pages/[teamSlug]/config-bundles/[configBundleId].tsx index 20838d0d70..134273bb00 100644 --- a/web/crux-ui/src/pages/[teamSlug]/config-bundles/[configBundleId].tsx +++ b/web/crux-ui/src/pages/[teamSlug]/config-bundles/[configBundleId].tsx @@ -76,7 +76,7 @@ const ConfigBundleDetailsPage = (props: ConfigBundleDetailsPageProps) => { {editing ? ( ) : ( - + )} TODO deployment list and config diff --git a/web/crux/src/app/container/container.mapper.ts b/web/crux/src/app/container/container.mapper.ts index af203709ed..20fbe453ff 100644 --- a/web/crux/src/app/container/container.mapper.ts +++ b/web/crux/src/app/container/container.mapper.ts @@ -16,6 +16,7 @@ import { ContainerConfigUpdatedEvent } from 'src/domain/domain-events' import { ImageDetails } from 'src/domain/image' import { toNullableBoolean, toNullableNumber, toPrismaJson } from 'src/domain/utils' import { versionIsMutable } from 'src/domain/version' +import { ListSecretsResponse } from 'src/grpc/protobuf/proto/common' import ConfigBundleMapper from '../config.bundle/config.bundle.mapper' import DeployMapper from '../deploy/deploy.mapper' import ImageMapper from '../image/image.mapper' @@ -31,7 +32,6 @@ import { ContainerConfigTypeDto, ContainerSecretsDto, } from './container.dto' -import { ListSecretsResponse } from 'src/grpc/protobuf/proto/common' @Injectable() export default class ContainerMapper { diff --git a/web/crux/src/app/container/container.module.ts b/web/crux/src/app/container/container.module.ts index b3a9416294..a98e17da1e 100644 --- a/web/crux/src/app/container/container.module.ts +++ b/web/crux/src/app/container/container.module.ts @@ -1,5 +1,6 @@ import { forwardRef, Module } from '@nestjs/common' import PrismaService from 'src/services/prisma.service' +import AgentModule from '../agent/agent.module' import AuditLoggerModule from '../audit.logger/audit.logger.module' import ConfigBundleModule from '../config.bundle/config.bundle.module' import DeployModule from '../deploy/deploy.module' @@ -12,7 +13,6 @@ import ContainerConfigHttpController from './container-config.http.service' import ContainerConfigService from './container-config.service' import ContainerConfigWebSocketGateway from './container-config.ws.gateway' import ContainerMapper from './container.mapper' -import AgentModule from '../agent/agent.module' @Module({ imports: [ diff --git a/web/crux/src/app/deploy/deploy.mapper.spec.ts b/web/crux/src/app/deploy/deploy.mapper.spec.ts index bdbb915a45..6fc9e00c38 100644 --- a/web/crux/src/app/deploy/deploy.mapper.spec.ts +++ b/web/crux/src/app/deploy/deploy.mapper.spec.ts @@ -632,6 +632,8 @@ describe('DeployMapper', () => { updatedAt: new Date(), createdBy: 'created-by', updatedBy: 'updated-by', + deployedAt: null, + deployedBy: null, node: { id: 'deployment-node-id', name: 'deployment node', diff --git a/web/crux/src/app/node/node.service.spec.ts b/web/crux/src/app/node/node.service.spec.ts index dc1473d73b..ab4e15f6e1 100644 --- a/web/crux/src/app/node/node.service.spec.ts +++ b/web/crux/src/app/node/node.service.spec.ts @@ -96,9 +96,11 @@ describe('NodeService', () => { await nodeService.deleteContainer('test-node-id', 'test-prefix', 'test-name') expect(createAgentEventMock).toHaveBeenCalledWith('test-node-id', 'containerCommand', { - container: { - prefix: 'test-prefix', - name: 'test-name', + target: { + container: { + prefix: 'test-prefix', + name: 'test-name', + }, }, operation: 'deleteContainer', }) @@ -108,7 +110,9 @@ describe('NodeService', () => { await nodeService.deleteAllContainers('test-node-id', 'test-prefix') expect(createAgentEventMock).toHaveBeenCalledWith('test-node-id', 'containerCommand', { - prefix: 'test-prefix', + target: { + prefix: 'test-prefix', + }, operation: 'deleteContainers', }) }) diff --git a/web/crux/src/domain/agent-callback.ts b/web/crux/src/domain/agent-callback.ts index b8b3b00df7..0763b87871 100644 --- a/web/crux/src/domain/agent-callback.ts +++ b/web/crux/src/domain/agent-callback.ts @@ -75,7 +75,6 @@ export default class AgentCallback { } onError(key: string, error: AgentError) { - console.log('error', key) const result = this.requests.get(key) if (!result) { return diff --git a/web/crux/src/domain/agent.spec.ts b/web/crux/src/domain/agent.spec.ts index ce9b7783f8..0dbe01be0d 100644 --- a/web/crux/src/domain/agent.spec.ts +++ b/web/crux/src/domain/agent.spec.ts @@ -200,7 +200,9 @@ describe('agent', () => { const commandChannel = firstValueFrom(agent.onConnected(jest.fn())) const deleteRequest: DeleteContainersRequest = { - prefix: 'prefix', + target: { + prefix: 'prefix', + }, } const deleteRes = agent.deleteContainers(deleteRequest) @@ -213,7 +215,7 @@ describe('agent', () => { agent.onCallback( 'deleteContainers', Agent.containerPrefixNameOf({ - prefix: deleteRequest.prefix, + prefix: deleteRequest.target.prefix, name: '', }), Empty, @@ -230,7 +232,9 @@ describe('agent', () => { const commandChannel = firstValueFrom(agent.onConnected(jest.fn())) const deleteRequest: DeleteContainersRequest = { - prefix: 'prefix', + target: { + prefix: 'prefix', + }, } const deleteRes = agent.deleteContainers(deleteRequest) @@ -306,9 +310,11 @@ describe('agent', () => { const commandChannel = firstValueFrom(agent.onConnected(jest.fn())) const req: ListSecretsRequest = { - container: { - prefix: 'prefix', - name: 'name', + target: { + container: { + prefix: 'prefix', + name: 'name', + }, }, } @@ -320,14 +326,17 @@ describe('agent', () => { }) const message: ListSecretsResponse = { - prefix: 'prefix', - name: 'name', + target: { + container: { + prefix: 'prefix', + name: 'name', + }, + }, publicKey: 'key', - hasKeys: true, keys: ['k1', 'k2', 'k3'], } - agent.onCallback('listSecrets', Agent.containerPrefixNameOf(req.container), message) + agent.onCallback('listSecrets', Agent.containerPrefixNameOf(req.target.container), message) const secretsActual = await secrets expect(secretsActual).toEqual(message) @@ -339,9 +348,11 @@ describe('agent', () => { const commandChannel = firstValueFrom(agent.onConnected(jest.fn())) const req: ListSecretsRequest = { - container: { - prefix: 'prefix', - name: 'name', + target: { + container: { + prefix: 'prefix', + name: 'name', + }, }, } diff --git a/web/crux/src/domain/container-merge.spec.ts b/web/crux/src/domain/container-merge.spec.ts index 7ab1249ef9..a85e7ad440 100644 --- a/web/crux/src/domain/container-merge.spec.ts +++ b/web/crux/src/domain/container-merge.spec.ts @@ -6,6 +6,7 @@ describe('container-merge', () => { name: 'img', capabilities: [], deploymentStrategy: 'recreate', + workingDirectory: '/app', expose: 'expose', networkMode: 'bridge', proxyHeaders: false, @@ -219,14 +220,15 @@ describe('container-merge', () => { type: 'mem', }, ], - metrics: null, - expectedState: null, + metrics: undefined, + expectedState: undefined, } const fullConcreteConfig: ConcreteContainerConfigData = { name: 'instance.img', capabilities: [], deploymentStrategy: 'recreate', + workingDirectory: '/app', expose: 'exposeWithTls', networkMode: 'host', proxyHeaders: true, @@ -443,8 +445,8 @@ describe('container-merge', () => { type: 'rwo', }, ], - metrics: null, - expectedState: null, + metrics: undefined, + expectedState: undefined, } describe('mergeConfigsWithConcreteConfig', () => { diff --git a/web/crux/src/domain/validation.ts b/web/crux/src/domain/validation.ts index 2dc9c7789c..5ae47a66b2 100644 --- a/web/crux/src/domain/validation.ts +++ b/web/crux/src/domain/validation.ts @@ -141,12 +141,15 @@ const createOverlapTest = ( // note: here yup passes reference as array const portConfigRule = yup.mixed().when('portRanges', ([portRanges]) => { if (!portRanges?.length) { - return yup.array( - yup.object().shape({ - internal: portNumberRule, - external: portNumberOptionalRule, - }), - ).nullable().optional() + return yup + .array( + yup.object().shape({ + internal: portNumberRule, + external: portNumberOptionalRule, + }), + ) + .nullable() + .optional() } return yup @@ -155,7 +158,9 @@ const portConfigRule = yup.mixed().when('portRanges', ([portRanges]) => { internal: createOverlapTest(portNumberRule, portRanges, 'internal'), external: createOverlapTest(portNumberOptionalRule, portRanges, 'external'), }), - ).nullable().optional() + ) + .nullable() + .optional() }) const portRangeConfigRule = yup.array( @@ -256,15 +261,19 @@ const createMetricsPortRule = (ports: ContainerPort[]) => { const metricsRule = yup.mixed().when(['ports'], ([ports]) => { const portRule = createMetricsPortRule(ports) - return yup.object().when({ - is: (it: Metrics) => it?.enabled, - then: schema => - schema.shape({ - enabled: yup.boolean(), - path: yup.string().nullable(), - port: portRule, - }), - }).nullable().optional() + return yup + .object() + .when({ + is: (it: Metrics) => it?.enabled, + then: schema => + schema.shape({ + enabled: yup.boolean(), + path: yup.string().nullable(), + port: portRule, + }), + }) + .nullable() + .optional() }) const expectedContainerStateRule = yup.object().shape({