Skip to content
Closed
Show file tree
Hide file tree
Changes from all 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
128 changes: 47 additions & 81 deletions src/data/schemas/v0/pipeline.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66624,7 +66624,6 @@ const schema: Record<string, any> = {
"provider": {
"type": "string",
"enum": [
"smi",
"istio"
]
},
Expand All @@ -66633,22 +66632,6 @@ const schema: Record<string, any> = {
}
},
"allOf": [
{
"if": {
"properties": {
"provider": {
"const": "smi"
}
}
},
"then": {
"properties": {
"spec": {
"$ref": "#/definitions/pipeline/steps/cd/SMIProviderSpec"
}
}
}
},
{
"if": {
"properties": {
Expand All @@ -66667,17 +66650,60 @@ const schema: Record<string, any> = {
}
]
},
"SMIProviderSpec": {
"title": "SMIProviderSpec",
"IstioProviderSpec": {
"title": "IstioProviderSpec",
"allOf": [
{
"$ref": "#/definitions/pipeline/steps/cd/K8sTrafficRoutingProviderBaseSpec"
},
{
"type": "object",
"properties": {
"rootService": {
"type": "string"
"gateways": {
"oneOf": [
{
"type": "array",
"items": {
"type": "string",
"minLength": 1
},
"minItems": 1
},
{
"type": "string",
"pattern": "^<\\+input>((\\.)((executionInput\\(\\))|(allowedValues|selectOneFrom|selectManyFrom|default|regex)\\(.+?\\)))*$",
"minLength": 1
}
]
},
"hosts": {
"oneOf": [
{
"type": "array",
"items": {
"type": "string",
"minLength": 1
},
"minItems": 1
},
{
"type": "string",
"pattern": "(<\\+.+>.*)",
"minLength": 1
}
]
},
"delegateService": {
"oneOf": [
{
"type": "boolean"
},
{
"type": "string",
"pattern": "(<\\+.+>.*)",
"minLength": 1
}
]
}
}
}
Expand Down Expand Up @@ -67179,66 +67205,6 @@ const schema: Record<string, any> = {
}
]
},
"IstioProviderSpec": {
"title": "IstioProviderSpec",
"allOf": [
{
"$ref": "#/definitions/pipeline/steps/cd/K8sTrafficRoutingProviderBaseSpec"
},
{
"type": "object",
"properties": {
"gateways": {
"oneOf": [
{
"type": "array",
"items": {
"type": "string",
"minLength": 1
},
"minItems": 1
},
{
"type": "string",
"pattern": "^<\\+input>((\\.)((executionInput\\(\\))|(allowedValues|selectOneFrom|selectManyFrom|default|regex)\\(.+?\\)))*$",
"minLength": 1
}
]
},
"hosts": {
"oneOf": [
{
"type": "array",
"items": {
"type": "string",
"minLength": 1
},
"minItems": 1
},
{
"type": "string",
"pattern": "(<\\+.+>.*)",
"minLength": 1
}
]
},
"delegateService": {
"oneOf": [
{
"type": "boolean"
},
{
"type": "string",
"pattern": "(<\\+.+>.*)",
"minLength": 1
}
]
}
}
}
],
"$schema": "http://json-schema.org/draft-07/schema#"
},
"TerraformRollbackStepNode": {
"title": "TerraformRollbackStepNode",
"type": "object",
Expand Down
131 changes: 49 additions & 82 deletions src/data/schemas/v0/template.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1342,7 +1342,8 @@ const schema: Record<string, any> = {
"PipelineTimeout",
"AllowStageExecutions",
"FixedInputsOnRerun",
"DelegateSelectors"
"DelegateSelectors",
"NotificationRules"
]
}
},
Expand Down Expand Up @@ -20100,7 +20101,6 @@ const schema: Record<string, any> = {
"provider": {
"type": "string",
"enum": [
"smi",
"istio"
]
},
Expand All @@ -20109,22 +20109,6 @@ const schema: Record<string, any> = {
}
},
"allOf": [
{
"if": {
"properties": {
"provider": {
"const": "smi"
}
}
},
"then": {
"properties": {
"spec": {
"$ref": "#/definitions/pipeline/steps/cd/SMIProviderSpec"
}
}
}
},
{
"if": {
"properties": {
Expand All @@ -20143,17 +20127,60 @@ const schema: Record<string, any> = {
}
]
},
"SMIProviderSpec": {
"title": "SMIProviderSpec",
"IstioProviderSpec": {
"title": "IstioProviderSpec",
"allOf": [
{
"$ref": "#/definitions/pipeline/steps/cd/K8sTrafficRoutingProviderBaseSpec"
},
{
"type": "object",
"properties": {
"rootService": {
"type": "string"
"gateways": {
"oneOf": [
{
"type": "array",
"items": {
"type": "string",
"minLength": 1
},
"minItems": 1
},
{
"type": "string",
"pattern": "^<\\+input>((\\.)((executionInput\\(\\))|(allowedValues|selectOneFrom|selectManyFrom|default|regex)\\(.+?\\)))*$",
"minLength": 1
}
]
},
"hosts": {
"oneOf": [
{
"type": "array",
"items": {
"type": "string",
"minLength": 1
},
"minItems": 1
},
{
"type": "string",
"pattern": "(<\\+.+>.*)",
"minLength": 1
}
]
},
"delegateService": {
"oneOf": [
{
"type": "boolean"
},
{
"type": "string",
"pattern": "(<\\+.+>.*)",
"minLength": 1
}
]
}
}
}
Expand Down Expand Up @@ -20655,66 +20682,6 @@ const schema: Record<string, any> = {
}
]
},
"IstioProviderSpec": {
"title": "IstioProviderSpec",
"allOf": [
{
"$ref": "#/definitions/pipeline/steps/cd/K8sTrafficRoutingProviderBaseSpec"
},
{
"type": "object",
"properties": {
"gateways": {
"oneOf": [
{
"type": "array",
"items": {
"type": "string",
"minLength": 1
},
"minItems": 1
},
{
"type": "string",
"pattern": "^<\\+input>((\\.)((executionInput\\(\\))|(allowedValues|selectOneFrom|selectManyFrom|default|regex)\\(.+?\\)))*$",
"minLength": 1
}
]
},
"hosts": {
"oneOf": [
{
"type": "array",
"items": {
"type": "string",
"minLength": 1
},
"minItems": 1
},
{
"type": "string",
"pattern": "(<\\+.+>.*)",
"minLength": 1
}
]
},
"delegateService": {
"oneOf": [
{
"type": "boolean"
},
{
"type": "string",
"pattern": "(<\\+.+>.*)",
"minLength": 1
}
]
}
}
}
],
"$schema": "http://json-schema.org/draft-07/schema#"
},
"K8sCanaryDeleteStepNode_template": {
"title": "K8sCanaryDeleteStepNode_template",
"type": "object",
Expand Down
56 changes: 56 additions & 0 deletions tests/schemas/schema-bundle-contract.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -220,4 +220,60 @@ describe("schema bundle contract", () => {
expect(dynamicStage.properties.dynamic.properties).toHaveProperty("source-config");
}
});

it("drops the removed smi provider from K8sTrafficRoutingSpec in v0 pipeline and template", () => {
for (const key of ["pipeline", "template"] as const) {
const cdSteps = (SCHEMAS[key].definitions as Record<string, Record<string, unknown>>).pipeline
.steps.cd as Record<string, unknown>;
const routingSpec = cdSteps.K8sTrafficRoutingSpec as {
properties: { provider: { enum: string[] } };
allOf: Array<{
if: { properties: { provider: { const: string } } };
then: { properties: { spec: { $ref: string } } };
}>;
};

expect(routingSpec.properties.provider.enum).toEqual(["istio"]);
expect(cdSteps).not.toHaveProperty("SMIProviderSpec");

const istioBranch = routingSpec.allOf.find(
(rule) => rule.if?.properties?.provider?.const === "istio",
);
expect(istioBranch?.then.properties.spec.$ref).toContain("IstioProviderSpec");
}
});

it("includes upstream IstioProviderSpec traffic-routing fields in v0 pipeline and template", () => {
for (const key of ["pipeline", "template"] as const) {
const cdSteps = (SCHEMAS[key].definitions as Record<string, Record<string, unknown>>).pipeline
.steps.cd as Record<string, unknown>;
const istioSpec = cdSteps.IstioProviderSpec as {
title: string;
allOf: Array<{ properties?: Record<string, unknown> }>;
};

expect(istioSpec.title).toBe("IstioProviderSpec");

const props = istioSpec.allOf.find((part) => part.properties?.gateways)?.properties;
expect(props).toHaveProperty("gateways");
expect(props).toHaveProperty("hosts");
expect(props).toHaveProperty("delegateService");
expect(props).not.toHaveProperty("rootService");
}
});

it("includes NotificationRules in pipeline template allowedOverrides", () => {
const templateDefs = SCHEMAS.template.definitions as Record<string, Record<string, unknown>>;
const pipelineTemplate = templateDefs.template.pipeline as {
template: { properties: { allowedOverrides: { items: { enum: string[] } } } };
};

expect(pipelineTemplate.template.properties.allowedOverrides.items.enum).toEqual([
"PipelineTimeout",
"AllowStageExecutions",
"FixedInputsOnRerun",
"DelegateSelectors",
"NotificationRules",
]);
});
});
Loading