Skip to content

Commit 540cb53

Browse files
authored
Merge branch 'main' into feat/grpc-configurable-size-limit
Signed-off-by: Jordan McClintock <jordan@defenseunicorns.com>
2 parents 561ae62 + 81e188c commit 540cb53

28 files changed

Lines changed: 413 additions & 370 deletions

.chainloop.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# This indicates the [current version]+next
22
# to indicate that we are building a new version of the project
3-
projectVersion: v1.93.2+next
3+
projectVersion: v1.93.3+next
44

55
# Experimental feature used by Chainloop labs shared workflow https://github.com/chainloop-dev/labs
66
# It maps the material names with location in disk so they get automatically attested

app/cli/cmd/errors.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,6 @@ func isRetriableAPIError(err error) bool {
6363
retriableCodes := []codes.Code{
6464
codes.Unavailable,
6565
codes.Internal,
66-
codes.ResourceExhausted,
6766
codes.DeadlineExceeded,
6867
}
6968

app/cli/pkg/action/attestation_push.go

Lines changed: 3 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ import (
2525
"time"
2626

2727
pb "github.com/chainloop-dev/chainloop/app/controlplane/api/controlplane/v1"
28-
"github.com/chainloop-dev/chainloop/pkg/attestation"
2928
"github.com/chainloop-dev/chainloop/pkg/attestation/crafter"
3029
v1 "github.com/chainloop-dev/chainloop/pkg/attestation/crafter/api/attestation/v1"
3130
"github.com/chainloop-dev/chainloop/pkg/attestation/renderer"
@@ -263,7 +262,7 @@ func (action *AttestationPush) Run(ctx context.Context, attestationID string, ru
263262

264263
workflow := crafter.CraftingState.Attestation.GetWorkflow()
265264

266-
attestationResult.Digest, err = pushToControlPlane(ctx, action.CPConnection, envelope, bundle, workflow.GetWorkflowRunId(), workflow.GetVersion().GetMarkAsReleased())
265+
attestationResult.Digest, err = pushToControlPlane(ctx, action.CPConnection, bundle, workflow.GetWorkflowRunId(), workflow.GetVersion().GetMarkAsReleased())
267266
if err != nil {
268267
return nil, fmt.Errorf("pushing to control plane: %w", err)
269268
}
@@ -303,32 +302,15 @@ func (action *AttestationPush) saveBundle(bundle *protobundle.Bundle) error {
303302
return nil
304303
}
305304

306-
func pushToControlPlane(ctx context.Context, conn *grpc.ClientConn, envelope *dsse.Envelope, bundle *protobundle.Bundle, workflowRunID string, markVersionAsReleased bool) (string, error) {
305+
func pushToControlPlane(ctx context.Context, conn *grpc.ClientConn, bundle *protobundle.Bundle, workflowRunID string, markVersionAsReleased bool) (string, error) {
307306
encodedBundle, err := encodeBundle(bundle)
308307
if err != nil {
309308
return "", fmt.Errorf("encoding attestation: %w", err)
310309
}
311310

312311
client := pb.NewAttestationServiceClient(conn)
313-
314-
// if endpoint doesn't accept the bundle, we still send the plain attestation for backwards compatibility
315-
encodedAttestation, err := encodeEnvelope(envelope)
316-
if err != nil {
317-
return "", fmt.Errorf("encoding attestation: %w", err)
318-
}
319-
320-
// remove additional base64 encoding in signature. See https://github.com/chainloop-dev/chainloop/issues/1832
321-
attestation.FixSignatureInBundle(bundle)
322-
encodedFixedBundle, err := encodeBundle(bundle)
323-
if err != nil {
324-
return "", fmt.Errorf("encoding attestation: %w", err)
325-
}
326-
327-
// Store bundle next versions will perform this in a single call)
328312
resp, err := client.Store(ctx, &pb.AttestationServiceStoreRequest{
329-
Attestation: encodedAttestation,
330-
Bundle: encodedBundle,
331-
AttestationBundle: encodedFixedBundle,
313+
AttestationBundle: encodedBundle,
332314
WorkflowRunId: workflowRunID,
333315
MarkVersionAsReleased: &markVersionAsReleased,
334316
})
@@ -339,10 +321,6 @@ func pushToControlPlane(ctx context.Context, conn *grpc.ClientConn, envelope *ds
339321
return resp.Result.Digest, nil
340322
}
341323

342-
func encodeEnvelope(e *dsse.Envelope) ([]byte, error) {
343-
return json.Marshal(e)
344-
}
345-
346324
func encodeBundle(b *protobundle.Bundle) ([]byte, error) {
347325
return protojson.Marshal(b)
348326
}

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

Lines changed: 4 additions & 30 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_run.proto

Lines changed: 4 additions & 5 deletions
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.
@@ -157,16 +157,15 @@ message AttestationServiceInitResponse {
157157
}
158158

159159
message AttestationServiceStoreRequest {
160-
// encoded DSEE envelope
161-
bytes attestation = 1 [deprecated = true];
162-
// deprecated because of https://github.com/chainloop-dev/chainloop/issues/1832
163-
bytes bundle = 4 [deprecated = true];
164160
// encoded Sigstore attestation bundle
165161
bytes attestation_bundle = 5;
166162

167163
string workflow_run_id = 2 [(buf.validate.field).string = {min_len: 1}];
168164
// mark the associated version as released
169165
optional bool mark_version_as_released = 3;
166+
167+
reserved 1, 4;
168+
reserved "attestation", "bundle";
170169
}
171170

172171
message AttestationServiceStoreResponse {

app/controlplane/api/controlplane/v1/workflow_run_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_run.ts

Lines changed: 1 addition & 47 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.AttestationServiceStoreRequest.jsonschema.json

Lines changed: 0 additions & 10 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.AttestationServiceStoreRequest.schema.json

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

app/controlplane/cmd/main.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,12 @@ func main() {
146146

147147
app, cleanup, err := wireApp(ctx, &bc, credsWriter, logger, availablePlugins)
148148
if err != nil {
149-
panic(err)
149+
_ = logger.Log(log.LevelError, "msg", "failed to initialize control plane", "error", err.Error())
150+
// Invoke critical deferred cleanups explicitly since os.Exit skips defers.
151+
cancel()
152+
availablePlugins.Cleanup()
153+
flush()
154+
os.Exit(1) //nolint:gocritic // deferred cleanups called explicitly above
150155
}
151156
defer cleanup()
152157

0 commit comments

Comments
 (0)