From bb3452561c94ba60a8c6f0e026c219413c96273d Mon Sep 17 00:00:00 2001 From: Miguel Martinez Trivino Date: Tue, 5 Nov 2024 14:04:16 +0100 Subject: [PATCH] fix: add remote version compatibility (#1474) Signed-off-by: Miguel Martinez --- app/cli/internal/action/attestation_init.go | 4 +- app/cli/internal/action/attestation_push.go | 2 +- app/cli/internal/action/attestation_status.go | 6 +- .../frontend/attestation/v1/crafting_state.ts | 41 ++++-- ...tation.v1.WorkflowMetadata.jsonschema.json | 10 +- ...ttestation.v1.WorkflowMetadata.schema.json | 10 +- .../api/attestation/v1/crafting_state.pb.go | 132 ++++++++++-------- .../api/attestation/v1/crafting_state.proto | 6 +- 8 files changed, 130 insertions(+), 81 deletions(-) diff --git a/app/cli/internal/action/attestation_init.go b/app/cli/internal/action/attestation_init.go index a60b831c1..d70fa2f96 100644 --- a/app/cli/internal/action/attestation_init.go +++ b/app/cli/internal/action/attestation_init.go @@ -125,7 +125,7 @@ func (action *AttestationInit) Run(ctx context.Context, opts *AttestationInitRun Project: workflow.GetProject(), Team: workflow.GetTeam(), SchemaRevision: strconv.Itoa(int(contractVersion.GetRevision())), - ProjectVersion: &clientAPI.ProjectVersion{ + Version: &clientAPI.ProjectVersion{ Version: opts.ProjectVersion, MarkAsReleased: opts.ProjectVersionMarkAsReleased, }, @@ -169,7 +169,7 @@ func (action *AttestationInit) Run(ctx context.Context, opts *AttestationInitRun workflowRun := runResp.GetResult().GetWorkflowRun() workflowMeta.WorkflowRunId = workflowRun.GetId() workflowMeta.Organization = runResp.GetResult().GetOrganization() - workflowMeta.ProjectVersion.Prerelease = runResp.GetResult().GetWorkflowRun().Version.GetPrerelease() + workflowMeta.Version.Prerelease = runResp.GetResult().GetWorkflowRun().Version.GetPrerelease() action.Logger.Debug().Str("workflow-run-id", workflowRun.GetId()).Msg("attestation initialized in the control plane") attestationID = workflowRun.GetId() } diff --git a/app/cli/internal/action/attestation_push.go b/app/cli/internal/action/attestation_push.go index a6dad91ea..047a4f31e 100644 --- a/app/cli/internal/action/attestation_push.go +++ b/app/cli/internal/action/attestation_push.go @@ -177,7 +177,7 @@ func (action *AttestationPush) Run(ctx context.Context, attestationID string, ru workflow := crafter.CraftingState.Attestation.GetWorkflow() - attestationResult.Digest, err = pushToControlPlane(ctx, action.ActionsOpts.CPConnection, envelope, workflow.GetWorkflowRunId(), workflow.GetProjectVersion().GetMarkAsReleased()) + attestationResult.Digest, err = pushToControlPlane(ctx, action.ActionsOpts.CPConnection, envelope, workflow.GetWorkflowRunId(), workflow.GetVersion().GetMarkAsReleased()) if err != nil { return nil, fmt.Errorf("pushing to control plane: %w", err) } diff --git a/app/cli/internal/action/attestation_status.go b/app/cli/internal/action/attestation_status.go index e508ad37a..321474982 100644 --- a/app/cli/internal/action/attestation_status.go +++ b/app/cli/internal/action/attestation_status.go @@ -104,7 +104,7 @@ func (action *AttestationStatus) Run(ctx context.Context, attestationID string) Team: workflowMeta.GetTeam(), ContractRevision: workflowMeta.GetSchemaRevision(), ProjectVersion: &ProjectVersion{ - Version: workflowMeta.GetProjectVersion().GetVersion(), + Version: workflowMeta.GetVersion().GetVersion(), }, }, InitializedAt: toTimePtr(att.InitializedAt.AsTime()), @@ -113,8 +113,8 @@ func (action *AttestationStatus) Run(ctx context.Context, attestationID string) } if !action.skipReleaseInfo { - res.WorkflowMeta.ProjectVersion.Prerelease = workflowMeta.ProjectVersion.Prerelease - res.WorkflowMeta.ProjectVersion.MarkAsReleased = workflowMeta.ProjectVersion.MarkAsReleased + res.WorkflowMeta.ProjectVersion.Prerelease = workflowMeta.Version.Prerelease + res.WorkflowMeta.ProjectVersion.MarkAsReleased = workflowMeta.Version.MarkAsReleased } // Let's perform the following steps in order to show all possible materials: diff --git a/app/controlplane/api/gen/frontend/attestation/v1/crafting_state.ts b/app/controlplane/api/gen/frontend/attestation/v1/crafting_state.ts index e0237c072..08c1f190b 100644 --- a/app/controlplane/api/gen/frontend/attestation/v1/crafting_state.ts +++ b/app/controlplane/api/gen/frontend/attestation/v1/crafting_state.ts @@ -183,7 +183,14 @@ export interface CraftingState { export interface WorkflowMetadata { name: string; project: string; - projectVersion?: ProjectVersion; + /** + * kept for backwards compatibility with remote state storage + * + * @deprecated + */ + projectVersion: string; + /** project version */ + version?: ProjectVersion; team: string; workflowId: string; /** Not required since we might be doing a dry-run */ @@ -2080,7 +2087,8 @@ function createBaseWorkflowMetadata(): WorkflowMetadata { return { name: "", project: "", - projectVersion: undefined, + projectVersion: "", + version: undefined, team: "", workflowId: "", workflowRunId: "", @@ -2097,8 +2105,11 @@ export const WorkflowMetadata = { if (message.project !== "") { writer.uint32(18).string(message.project); } - if (message.projectVersion !== undefined) { - ProjectVersion.encode(message.projectVersion, writer.uint32(74).fork()).ldelim(); + if (message.projectVersion !== "") { + writer.uint32(74).string(message.projectVersion); + } + if (message.version !== undefined) { + ProjectVersion.encode(message.version, writer.uint32(82).fork()).ldelim(); } if (message.team !== "") { writer.uint32(26).string(message.team); @@ -2144,7 +2155,14 @@ export const WorkflowMetadata = { break; } - message.projectVersion = ProjectVersion.decode(reader, reader.uint32()); + message.projectVersion = reader.string(); + continue; + case 10: + if (tag !== 82) { + break; + } + + message.version = ProjectVersion.decode(reader, reader.uint32()); continue; case 3: if (tag !== 26) { @@ -2194,7 +2212,8 @@ export const WorkflowMetadata = { return { name: isSet(object.name) ? String(object.name) : "", project: isSet(object.project) ? String(object.project) : "", - projectVersion: isSet(object.projectVersion) ? ProjectVersion.fromJSON(object.projectVersion) : undefined, + projectVersion: isSet(object.projectVersion) ? String(object.projectVersion) : "", + version: isSet(object.version) ? ProjectVersion.fromJSON(object.version) : undefined, team: isSet(object.team) ? String(object.team) : "", workflowId: isSet(object.workflowId) ? String(object.workflowId) : "", workflowRunId: isSet(object.workflowRunId) ? String(object.workflowRunId) : "", @@ -2207,8 +2226,9 @@ export const WorkflowMetadata = { const obj: any = {}; message.name !== undefined && (obj.name = message.name); message.project !== undefined && (obj.project = message.project); - message.projectVersion !== undefined && - (obj.projectVersion = message.projectVersion ? ProjectVersion.toJSON(message.projectVersion) : undefined); + message.projectVersion !== undefined && (obj.projectVersion = message.projectVersion); + message.version !== undefined && + (obj.version = message.version ? ProjectVersion.toJSON(message.version) : undefined); message.team !== undefined && (obj.team = message.team); message.workflowId !== undefined && (obj.workflowId = message.workflowId); message.workflowRunId !== undefined && (obj.workflowRunId = message.workflowRunId); @@ -2225,8 +2245,9 @@ export const WorkflowMetadata = { const message = createBaseWorkflowMetadata(); message.name = object.name ?? ""; message.project = object.project ?? ""; - message.projectVersion = (object.projectVersion !== undefined && object.projectVersion !== null) - ? ProjectVersion.fromPartial(object.projectVersion) + message.projectVersion = object.projectVersion ?? ""; + message.version = (object.version !== undefined && object.version !== null) + ? ProjectVersion.fromPartial(object.version) : undefined; message.team = object.team ?? ""; message.workflowId = object.workflowId ?? ""; diff --git a/app/controlplane/api/gen/jsonschema/attestation.v1.WorkflowMetadata.jsonschema.json b/app/controlplane/api/gen/jsonschema/attestation.v1.WorkflowMetadata.jsonschema.json index 9bbe9cb50..ab4473f20 100644 --- a/app/controlplane/api/gen/jsonschema/attestation.v1.WorkflowMetadata.jsonschema.json +++ b/app/controlplane/api/gen/jsonschema/attestation.v1.WorkflowMetadata.jsonschema.json @@ -4,7 +4,8 @@ "additionalProperties": false, "patternProperties": { "^(project_version)$": { - "$ref": "attestation.v1.ProjectVersion.jsonschema.json" + "description": "kept for backwards compatibility with remote state storage", + "type": "string" }, "^(schema_revision)$": { "type": "string" @@ -28,7 +29,8 @@ "type": "string" }, "projectVersion": { - "$ref": "attestation.v1.ProjectVersion.jsonschema.json" + "description": "kept for backwards compatibility with remote state storage", + "type": "string" }, "schemaRevision": { "type": "string" @@ -36,6 +38,10 @@ "team": { "type": "string" }, + "version": { + "$ref": "attestation.v1.ProjectVersion.jsonschema.json", + "description": "project version" + }, "workflowId": { "type": "string" }, diff --git a/app/controlplane/api/gen/jsonschema/attestation.v1.WorkflowMetadata.schema.json b/app/controlplane/api/gen/jsonschema/attestation.v1.WorkflowMetadata.schema.json index f5fceff3c..cddb5abca 100644 --- a/app/controlplane/api/gen/jsonschema/attestation.v1.WorkflowMetadata.schema.json +++ b/app/controlplane/api/gen/jsonschema/attestation.v1.WorkflowMetadata.schema.json @@ -4,7 +4,8 @@ "additionalProperties": false, "patternProperties": { "^(projectVersion)$": { - "$ref": "attestation.v1.ProjectVersion.schema.json" + "description": "kept for backwards compatibility with remote state storage", + "type": "string" }, "^(schemaRevision)$": { "type": "string" @@ -28,7 +29,8 @@ "type": "string" }, "project_version": { - "$ref": "attestation.v1.ProjectVersion.schema.json" + "description": "kept for backwards compatibility with remote state storage", + "type": "string" }, "schema_revision": { "type": "string" @@ -36,6 +38,10 @@ "team": { "type": "string" }, + "version": { + "$ref": "attestation.v1.ProjectVersion.schema.json", + "description": "project version" + }, "workflow_id": { "type": "string" }, diff --git a/pkg/attestation/crafter/api/attestation/v1/crafting_state.pb.go b/pkg/attestation/crafter/api/attestation/v1/crafting_state.pb.go index 8c9f85685..dbdea998f 100644 --- a/pkg/attestation/crafter/api/attestation/v1/crafting_state.pb.go +++ b/pkg/attestation/crafter/api/attestation/v1/crafting_state.pb.go @@ -480,9 +480,14 @@ type WorkflowMetadata struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - Project string `protobuf:"bytes,2,opt,name=project,proto3" json:"project,omitempty"` - ProjectVersion *ProjectVersion `protobuf:"bytes,9,opt,name=project_version,json=projectVersion,proto3" json:"project_version,omitempty"` + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + Project string `protobuf:"bytes,2,opt,name=project,proto3" json:"project,omitempty"` + // kept for backwards compatibility with remote state storage + // + // Deprecated: Marked as deprecated in attestation/v1/crafting_state.proto. + ProjectVersion string `protobuf:"bytes,9,opt,name=project_version,json=projectVersion,proto3" json:"project_version,omitempty"` + // project version + Version *ProjectVersion `protobuf:"bytes,10,opt,name=version,proto3" json:"version,omitempty"` Team string `protobuf:"bytes,3,opt,name=team,proto3" json:"team,omitempty"` WorkflowId string `protobuf:"bytes,5,opt,name=workflow_id,json=workflowId,proto3" json:"workflow_id,omitempty"` WorkflowRunId string `protobuf:"bytes,6,opt,name=workflow_run_id,json=workflowRunId,proto3" json:"workflow_run_id,omitempty"` // Not required since we might be doing a dry-run @@ -537,10 +542,18 @@ func (x *WorkflowMetadata) GetProject() string { return "" } -func (x *WorkflowMetadata) GetProjectVersion() *ProjectVersion { +// Deprecated: Marked as deprecated in attestation/v1/crafting_state.proto. +func (x *WorkflowMetadata) GetProjectVersion() string { if x != nil { return x.ProjectVersion } + return "" +} + +func (x *WorkflowMetadata) GetVersion() *ProjectVersion { + if x != nil { + return x.Version + } return nil } @@ -1477,65 +1490,66 @@ var file_attestation_v1_crafting_state_proto_rawDesc = []byte{ 0x74, 0x65, 0x73, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x76, 0x31, 0x2e, 0x41, 0x74, 0x74, 0x65, 0x73, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x0b, 0x61, 0x74, 0x74, 0x65, 0x73, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x17, 0x0a, 0x07, 0x64, 0x72, 0x79, 0x5f, 0x72, 0x75, 0x6e, - 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, 0x64, 0x72, 0x79, 0x52, 0x75, 0x6e, 0x22, 0xd7, + 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, 0x64, 0x72, 0x79, 0x52, 0x75, 0x6e, 0x22, 0xf5, 0x02, 0x0a, 0x10, 0x57, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x12, 0x1b, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x07, 0xba, 0x48, 0x04, 0x72, 0x02, 0x10, 0x01, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x07, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x12, 0x47, 0x0a, 0x0f, 0x70, 0x72, + 0x09, 0x52, 0x07, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x12, 0x2b, 0x0a, 0x0f, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x5f, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x09, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x61, 0x74, 0x74, 0x65, 0x73, 0x74, 0x61, 0x74, 0x69, 0x6f, - 0x6e, 0x2e, 0x76, 0x31, 0x2e, 0x50, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x56, 0x65, 0x72, 0x73, - 0x69, 0x6f, 0x6e, 0x52, 0x0e, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x56, 0x65, 0x72, 0x73, - 0x69, 0x6f, 0x6e, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x65, 0x61, 0x6d, 0x18, 0x03, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x04, 0x74, 0x65, 0x61, 0x6d, 0x12, 0x28, 0x0a, 0x0b, 0x77, 0x6f, 0x72, 0x6b, 0x66, - 0x6c, 0x6f, 0x77, 0x5f, 0x69, 0x64, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x42, 0x07, 0xba, 0x48, - 0x04, 0x72, 0x02, 0x10, 0x01, 0x52, 0x0a, 0x77, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x49, - 0x64, 0x12, 0x26, 0x0a, 0x0f, 0x77, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x5f, 0x72, 0x75, - 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x77, 0x6f, 0x72, 0x6b, - 0x66, 0x6c, 0x6f, 0x77, 0x52, 0x75, 0x6e, 0x49, 0x64, 0x12, 0x30, 0x0a, 0x0f, 0x73, 0x63, 0x68, - 0x65, 0x6d, 0x61, 0x5f, 0x72, 0x65, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x07, 0x20, 0x01, - 0x28, 0x09, 0x42, 0x07, 0xba, 0x48, 0x04, 0x72, 0x02, 0x10, 0x01, 0x52, 0x0e, 0x73, 0x63, 0x68, - 0x65, 0x6d, 0x61, 0x52, 0x65, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x2b, 0x0a, 0x0c, 0x6f, - 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x08, 0x20, 0x01, 0x28, - 0x09, 0x42, 0x07, 0xba, 0x48, 0x04, 0x72, 0x02, 0x10, 0x01, 0x52, 0x0c, 0x6f, 0x72, 0x67, 0x61, - 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x7d, 0x0a, 0x0e, 0x50, 0x72, 0x6f, 0x6a, - 0x65, 0x63, 0x74, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x21, 0x0a, 0x07, 0x76, 0x65, - 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x07, 0xba, 0x48, 0x04, - 0x72, 0x02, 0x10, 0x01, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x1e, 0x0a, - 0x0a, 0x70, 0x72, 0x65, 0x72, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x08, 0x52, 0x0a, 0x70, 0x72, 0x65, 0x72, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x12, 0x28, 0x0a, - 0x10, 0x6d, 0x61, 0x72, 0x6b, 0x5f, 0x61, 0x73, 0x5f, 0x72, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, - 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0e, 0x6d, 0x61, 0x72, 0x6b, 0x41, 0x73, 0x52, - 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x64, 0x22, 0xde, 0x02, 0x0a, 0x12, 0x52, 0x65, 0x73, 0x6f, - 0x75, 0x72, 0x63, 0x65, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x12, 0x12, - 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, - 0x6d, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x72, 0x69, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x03, 0x75, 0x72, 0x69, 0x12, 0x46, 0x0a, 0x06, 0x64, 0x69, 0x67, 0x65, 0x73, 0x74, 0x18, 0x03, - 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2e, 0x2e, 0x61, 0x74, 0x74, 0x65, 0x73, 0x74, 0x61, 0x74, 0x69, - 0x6f, 0x6e, 0x2e, 0x76, 0x31, 0x2e, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x44, 0x65, - 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x2e, 0x44, 0x69, 0x67, 0x65, 0x73, 0x74, 0x45, - 0x6e, 0x74, 0x72, 0x79, 0x52, 0x06, 0x64, 0x69, 0x67, 0x65, 0x73, 0x74, 0x12, 0x18, 0x0a, 0x07, - 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, 0x63, - 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x12, 0x2b, 0x0a, 0x11, 0x64, 0x6f, 0x77, 0x6e, 0x6c, 0x6f, - 0x61, 0x64, 0x5f, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x05, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x10, 0x64, 0x6f, 0x77, 0x6e, 0x6c, 0x6f, 0x61, 0x64, 0x4c, 0x6f, 0x63, 0x61, 0x74, - 0x69, 0x6f, 0x6e, 0x12, 0x1d, 0x0a, 0x0a, 0x6d, 0x65, 0x64, 0x69, 0x61, 0x5f, 0x74, 0x79, 0x70, - 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x6d, 0x65, 0x64, 0x69, 0x61, 0x54, 0x79, - 0x70, 0x65, 0x12, 0x39, 0x0a, 0x0b, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, - 0x73, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, - 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x53, 0x74, 0x72, 0x75, 0x63, 0x74, - 0x52, 0x0b, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x1a, 0x39, 0x0a, - 0x0b, 0x44, 0x69, 0x67, 0x65, 0x73, 0x74, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, - 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, - 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, - 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x42, 0x4f, 0x5a, 0x4d, 0x67, 0x69, 0x74, 0x68, - 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x6c, 0x6f, 0x6f, 0x70, - 0x2d, 0x64, 0x65, 0x76, 0x2f, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x6c, 0x6f, 0x6f, 0x70, 0x2f, 0x70, - 0x6b, 0x67, 0x2f, 0x61, 0x74, 0x74, 0x65, 0x73, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x63, - 0x72, 0x61, 0x66, 0x74, 0x65, 0x72, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x61, 0x74, 0x74, 0x65, 0x73, - 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x76, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x33, + 0x01, 0x28, 0x09, 0x42, 0x02, 0x18, 0x01, 0x52, 0x0e, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, + 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x38, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, + 0x6f, 0x6e, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x61, 0x74, 0x74, 0x65, 0x73, + 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x76, 0x31, 0x2e, 0x50, 0x72, 0x6f, 0x6a, 0x65, 0x63, + 0x74, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, + 0x6e, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x65, 0x61, 0x6d, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x04, 0x74, 0x65, 0x61, 0x6d, 0x12, 0x28, 0x0a, 0x0b, 0x77, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, + 0x77, 0x5f, 0x69, 0x64, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x42, 0x07, 0xba, 0x48, 0x04, 0x72, + 0x02, 0x10, 0x01, 0x52, 0x0a, 0x77, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x49, 0x64, 0x12, + 0x26, 0x0a, 0x0f, 0x77, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x5f, 0x72, 0x75, 0x6e, 0x5f, + 0x69, 0x64, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x77, 0x6f, 0x72, 0x6b, 0x66, 0x6c, + 0x6f, 0x77, 0x52, 0x75, 0x6e, 0x49, 0x64, 0x12, 0x30, 0x0a, 0x0f, 0x73, 0x63, 0x68, 0x65, 0x6d, + 0x61, 0x5f, 0x72, 0x65, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, + 0x42, 0x07, 0xba, 0x48, 0x04, 0x72, 0x02, 0x10, 0x01, 0x52, 0x0e, 0x73, 0x63, 0x68, 0x65, 0x6d, + 0x61, 0x52, 0x65, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x2b, 0x0a, 0x0c, 0x6f, 0x72, 0x67, + 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x42, + 0x07, 0xba, 0x48, 0x04, 0x72, 0x02, 0x10, 0x01, 0x52, 0x0c, 0x6f, 0x72, 0x67, 0x61, 0x6e, 0x69, + 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x7d, 0x0a, 0x0e, 0x50, 0x72, 0x6f, 0x6a, 0x65, 0x63, + 0x74, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x21, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, + 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x07, 0xba, 0x48, 0x04, 0x72, 0x02, + 0x10, 0x01, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x1e, 0x0a, 0x0a, 0x70, + 0x72, 0x65, 0x72, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, + 0x0a, 0x70, 0x72, 0x65, 0x72, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x12, 0x28, 0x0a, 0x10, 0x6d, + 0x61, 0x72, 0x6b, 0x5f, 0x61, 0x73, 0x5f, 0x72, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x64, 0x18, + 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0e, 0x6d, 0x61, 0x72, 0x6b, 0x41, 0x73, 0x52, 0x65, 0x6c, + 0x65, 0x61, 0x73, 0x65, 0x64, 0x22, 0xde, 0x02, 0x0a, 0x12, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, + 0x63, 0x65, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x12, 0x12, 0x0a, 0x04, + 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, + 0x12, 0x10, 0x0a, 0x03, 0x75, 0x72, 0x69, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, + 0x72, 0x69, 0x12, 0x46, 0x0a, 0x06, 0x64, 0x69, 0x67, 0x65, 0x73, 0x74, 0x18, 0x03, 0x20, 0x03, + 0x28, 0x0b, 0x32, 0x2e, 0x2e, 0x61, 0x74, 0x74, 0x65, 0x73, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, + 0x2e, 0x76, 0x31, 0x2e, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x44, 0x65, 0x73, 0x63, + 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x2e, 0x44, 0x69, 0x67, 0x65, 0x73, 0x74, 0x45, 0x6e, 0x74, + 0x72, 0x79, 0x52, 0x06, 0x64, 0x69, 0x67, 0x65, 0x73, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x6f, + 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, 0x63, 0x6f, 0x6e, + 0x74, 0x65, 0x6e, 0x74, 0x12, 0x2b, 0x0a, 0x11, 0x64, 0x6f, 0x77, 0x6e, 0x6c, 0x6f, 0x61, 0x64, + 0x5f, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x10, 0x64, 0x6f, 0x77, 0x6e, 0x6c, 0x6f, 0x61, 0x64, 0x4c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0x12, 0x1d, 0x0a, 0x0a, 0x6d, 0x65, 0x64, 0x69, 0x61, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, + 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x6d, 0x65, 0x64, 0x69, 0x61, 0x54, 0x79, 0x70, 0x65, + 0x12, 0x39, 0x0a, 0x0b, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, + 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x53, 0x74, 0x72, 0x75, 0x63, 0x74, 0x52, 0x0b, + 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x1a, 0x39, 0x0a, 0x0b, 0x44, + 0x69, 0x67, 0x65, 0x73, 0x74, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, + 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, + 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, + 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x42, 0x4f, 0x5a, 0x4d, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, + 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x6c, 0x6f, 0x6f, 0x70, 0x2d, 0x64, + 0x65, 0x76, 0x2f, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x6c, 0x6f, 0x6f, 0x70, 0x2f, 0x70, 0x6b, 0x67, + 0x2f, 0x61, 0x74, 0x74, 0x65, 0x73, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x63, 0x72, 0x61, + 0x66, 0x74, 0x65, 0x72, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x61, 0x74, 0x74, 0x65, 0x73, 0x74, 0x61, + 0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x76, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -1596,7 +1610,7 @@ var file_attestation_v1_crafting_state_proto_depIdxs = []int32{ 18, // 14: attestation.v1.Commit.remotes:type_name -> attestation.v1.Commit.Remote 23, // 15: attestation.v1.CraftingState.input_schema:type_name -> workflowcontract.v1.CraftingSchema 0, // 16: attestation.v1.CraftingState.attestation:type_name -> attestation.v1.Attestation - 5, // 17: attestation.v1.WorkflowMetadata.project_version:type_name -> attestation.v1.ProjectVersion + 5, // 17: attestation.v1.WorkflowMetadata.version:type_name -> attestation.v1.ProjectVersion 19, // 18: attestation.v1.ResourceDescriptor.digest:type_name -> attestation.v1.ResourceDescriptor.DigestEntry 24, // 19: attestation.v1.ResourceDescriptor.annotations:type_name -> google.protobuf.Struct 9, // 20: attestation.v1.Attestation.MaterialsEntry.value:type_name -> attestation.v1.Attestation.Material diff --git a/pkg/attestation/crafter/api/attestation/v1/crafting_state.proto b/pkg/attestation/crafter/api/attestation/v1/crafting_state.proto index 8e2936a84..497cdc423 100644 --- a/pkg/attestation/crafter/api/attestation/v1/crafting_state.proto +++ b/pkg/attestation/crafter/api/attestation/v1/crafting_state.proto @@ -177,7 +177,10 @@ message CraftingState { message WorkflowMetadata { string name = 1 [(buf.validate.field).string.min_len = 1]; string project = 2; - ProjectVersion project_version = 9; + // kept for backwards compatibility with remote state storage + string project_version = 9 [deprecated = true]; + // project version + ProjectVersion version = 10; string team = 3; string workflow_id = 5 [(buf.validate.field).string.min_len = 1]; string workflow_run_id = 6; // Not required since we might be doing a dry-run @@ -185,7 +188,6 @@ message WorkflowMetadata { // organization name string organization = 8 [(buf.validate.field).string.min_len = 1]; } - message ProjectVersion { string version = 1 [(buf.validate.field).string.min_len = 1]; // if it's pre-release