Skip to content

Commit 64fab8a

Browse files
authored
feat(controlplane): add dry-run and status/revision reporting to contract apply (#3220)
1 parent 3008630 commit 64fab8a

12 files changed

Lines changed: 686 additions & 62 deletions

app/controlplane/api/controlplane/v1/workflow_contract.pb.go

Lines changed: 151 additions & 53 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/controlplane/api/controlplane/v1/workflow_contract.proto

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
//
2-
// Copyright 2024-2025 The Chainloop Authors.
2+
// Copyright 2024-2026 The Chainloop Authors.
33
//
44
// Licensed under the Apache License, Version 2.0 (the "License");
55
// you may not use this file except in compliance with the License.
@@ -119,6 +119,8 @@ message WorkflowContractServiceDeleteResponse {}
119119
message WorkflowContractServiceApplyRequest {
120120
// Raw representation of the contract in json, yaml or cue
121121
bytes raw_schema = 1;
122+
// When true, validate and compute the result without persisting any change
123+
bool dry_run = 2;
122124
}
123125

124126
message WorkflowContractServiceApplyResponse {
@@ -127,4 +129,22 @@ message WorkflowContractServiceApplyResponse {
127129
bool unchanged = 2 [deprecated = true];
128130
// Whether the resource was changed
129131
bool changed = 3;
132+
// Detailed outcome of the apply operation
133+
ApplyStatus status = 4;
134+
// Current revision of the contract after the apply.
135+
// For a newly created contract this is the first revision; for an
136+
// unchanged contract it stays at the existing revision; for dry runs it
137+
// reflects the existing revision (0 when the contract does not exist yet).
138+
int32 current_revision = 5;
139+
140+
// ApplyStatus describes how the applied resource changed
141+
enum ApplyStatus {
142+
APPLY_STATUS_UNSPECIFIED = 0;
143+
// The resource did not exist and was created
144+
APPLY_STATUS_CREATED = 1;
145+
// The resource existed and its content changed
146+
APPLY_STATUS_UPDATED = 2;
147+
// The resource existed and its content was identical
148+
APPLY_STATUS_UNCHANGED = 3;
149+
}
130150
}

app/controlplane/api/controlplane/v1/workflow_contract_grpc.pb.go

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/controlplane/api/gen/frontend/controlplane/v1/workflow_contract.ts

Lines changed: 109 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/controlplane/api/gen/jsonschema/controlplane.v1.WorkflowContractServiceApplyRequest.jsonschema.json

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/controlplane/api/gen/jsonschema/controlplane.v1.WorkflowContractServiceApplyRequest.schema.json

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/controlplane/api/gen/jsonschema/controlplane.v1.WorkflowContractServiceApplyResponse.jsonschema.json

Lines changed: 34 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/controlplane/api/gen/jsonschema/controlplane.v1.WorkflowContractServiceApplyResponse.schema.json

Lines changed: 34 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)