Skip to content
Draft
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
68 changes: 67 additions & 1 deletion src/data/schemas/v0/trigger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2822,7 +2822,8 @@ const schema: Record<string, any> = {
"IssueComment",
"Release",
"Delete",
"Create"
"Create",
"PullRequestReview"
]
}
}
Expand Down Expand Up @@ -2922,6 +2923,22 @@ const schema: Record<string, any> = {
}
}
}
},
{
"if": {
"properties": {
"type": {
"const": "PullRequestReview"
}
}
},
"then": {
"properties": {
"spec": {
"$ref": "#/definitions/trigger/webhook_trigger/github_pr_review_spec"
}
}
}
}
],
"$schema": "http://json-schema.org/draft-07/schema#"
Expand Down Expand Up @@ -3196,6 +3213,55 @@ const schema: Record<string, any> = {
],
"$schema": "http://json-schema.org/draft-07/schema#"
},
"github_pr_review_spec": {
"title": "github_pr_review_spec",
"allOf": [
{
"$ref": "#/definitions/trigger/webhook_trigger/github_event_spec"
},
{
"type": "object",
"properties": {
"actions": {
"type": "array",
"items": {
"type": "string",
"enum": [
"Submitted",
"Edited",
"Dismissed"
]
}
},
"autoAbortPreviousExecutions": {
"type": "boolean"
},
"connectorRef": {
"type": "string"
},
"headerConditions": {
"type": "array",
"items": {
"$ref": "#/definitions/trigger/trigger_event_data"
}
},
"jexlCondition": {
"type": "string"
},
"payloadConditions": {
"type": "array",
"items": {
"$ref": "#/definitions/trigger/trigger_event_data"
}
},
"repoName": {
"type": "string"
}
}
}
],
"$schema": "http://json-schema.org/draft-07/schema#"
},
"gitlab_spec": {
"title": "gitlab_spec",
"allOf": [
Expand Down
2 changes: 1 addition & 1 deletion src/data/schemas/v1/pipeline.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4545,7 +4545,7 @@ const schema: Record<string, any> = {
"description": "Image registry connector. Supports expressions.",
"type": "string"
},
"registryRef": {
"registry": {
"description": "Harness Artifact Registry reference for the image. Supports expressions.",
"type": "string"
},
Expand Down
2 changes: 1 addition & 1 deletion src/data/schemas/v1/template.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4733,7 +4733,7 @@ const schema: Record<string, any> = {
"description": "Image registry connector. Supports expressions.",
"type": "string"
},
"registryRef": {
"registry": {
"description": "Harness Artifact Registry reference for the image. Supports expressions.",
"type": "string"
},
Expand Down
57 changes: 57 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,61 @@ describe("schema bundle contract", () => {
expect(dynamicStage.properties.dynamic.properties).toHaveProperty("source-config");
}
});

it("includes upstream PullRequestReview GitHub webhook trigger type in v0 trigger", () => {
const webhook = (SCHEMAS.trigger.definitions as Record<string, Record<string, unknown>>).trigger
.webhook_trigger as Record<string, unknown>;
const githubSpec = webhook.github_spec as {
allOf: Array<{
if?: { properties: { type: { const: string } } };
then?: { properties: { spec: { $ref: string } } };
properties?: { type: { enum: string[] } };
}>;
};

const typeEnum = githubSpec.allOf.find((branch) => branch.properties?.type?.enum)?.properties?.type
.enum;
expect(typeEnum).toContain("PullRequestReview");

const reviewBranch = githubSpec.allOf.find(
(branch) => branch.if?.properties?.type?.const === "PullRequestReview",
);
expect(reviewBranch?.then?.properties?.spec.$ref).toBe(
"#/definitions/trigger/webhook_trigger/github_pr_review_spec",
);
});

it("includes upstream github_pr_review_spec actions in v0 trigger", () => {
const webhook = (SCHEMAS.trigger.definitions as Record<string, Record<string, unknown>>).trigger
.webhook_trigger as Record<string, unknown>;
const reviewSpec = webhook.github_pr_review_spec as {
allOf: Array<{
properties?: {
actions?: { items: { enum: string[] } };
connectorRef?: { type: string };
repoName?: { type: string };
};
}>;
};

const properties = reviewSpec.allOf.find((branch) => branch.properties?.actions)?.properties;
expect(properties?.actions?.items.enum).toEqual(
expect.arrayContaining(["Submitted", "Edited", "Dismissed"]),
);
expect(properties?.connectorRef?.type).toBe("string");
expect(properties?.repoName?.type).toBe("string");
});

it("uses registry (not registryRef) for HAR image references in v1 Container definitions", () => {
for (const key of ["pipeline_v1", "template_v1"] as const) {
const defs = SCHEMAS[key].definitions as Record<string, Record<string, unknown>>;
const container = defs[key].steps.unified.Container as {
properties: Record<string, { description?: string }>;
};

expect(container.properties).toHaveProperty("registry");
expect(container.properties).not.toHaveProperty("registryRef");
expect(container.properties.registry.description).toContain("Harness Artifact Registry");
}
});
});
Loading