@@ -60,12 +60,12 @@ func NewAttestationPush(cfg *AttestationPushOpts) (*AttestationPush, error) {
6060 }, nil
6161}
6262
63- func (action * AttestationPush ) Run (attestationID string , runtimeAnnotations map [string ]string ) (* AttestationResult , error ) {
64- if initialized := action .c .AlreadyInitialized (attestationID ); ! initialized {
63+ func (action * AttestationPush ) Run (ctx context. Context , attestationID string , runtimeAnnotations map [string ]string ) (* AttestationResult , error ) {
64+ if initialized := action .c .AlreadyInitialized (ctx , attestationID ); ! initialized {
6565 return nil , ErrAttestationNotInitialized
6666 }
6767
68- if err := action .c .LoadCraftingState (attestationID ); err != nil {
68+ if err := action .c .LoadCraftingState (ctx , attestationID ); err != nil {
6969 action .Logger .Err (err ).Msg ("loading existing attestation" )
7070 return nil , err
7171 }
@@ -133,36 +133,36 @@ func (action *AttestationPush) Run(attestationID string, runtimeAnnotations map[
133133 if action .c .CraftingState .DryRun {
134134 action .Logger .Info ().Msg ("dry-run completed, push skipped" )
135135 // We are done, remove the existing att state
136- if err := action .c .Reset (attestationID ); err != nil {
136+ if err := action .c .Reset (ctx , attestationID ); err != nil {
137137 return nil , err
138138 }
139139
140140 return attestationResult , nil
141141 }
142142
143- attestationResult .Digest , err = pushToControlPlane (action .ActionsOpts .CPConnection , envelope , action .c .CraftingState .Attestation .GetWorkflow ().GetWorkflowRunId ())
143+ attestationResult .Digest , err = pushToControlPlane (ctx , action .ActionsOpts .CPConnection , envelope , action .c .CraftingState .Attestation .GetWorkflow ().GetWorkflowRunId ())
144144 if err != nil {
145145 return nil , fmt .Errorf ("pushing to control plane: %w" , err )
146146 }
147147
148148 action .Logger .Info ().Msg ("push completed" )
149149
150150 // We are done, remove the existing att state
151- if err := action .c .Reset (attestationID ); err != nil {
151+ if err := action .c .Reset (ctx , attestationID ); err != nil {
152152 return nil , err
153153 }
154154
155155 return attestationResult , nil
156156}
157157
158- func pushToControlPlane (conn * grpc.ClientConn , envelope * dsse.Envelope , workflowRunID string ) (string , error ) {
158+ func pushToControlPlane (ctx context. Context , conn * grpc.ClientConn , envelope * dsse.Envelope , workflowRunID string ) (string , error ) {
159159 encodedAttestation , err := encodeEnvelope (envelope )
160160 if err != nil {
161161 return "" , fmt .Errorf ("encoding attestation: %w" , err )
162162 }
163163
164164 client := pb .NewAttestationServiceClient (conn )
165- resp , err := client .Store (context . Background () , & pb.AttestationServiceStoreRequest {
165+ resp , err := client .Store (ctx , & pb.AttestationServiceStoreRequest {
166166 Attestation : encodedAttestation ,
167167 WorkflowRunId : workflowRunID ,
168168 })
0 commit comments