diff --git a/Dockerfile b/Dockerfile index d17c98250c..df73ed7f3d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -66,7 +66,7 @@ FROM alpine:3.21 AS sbom WORKDIR / ADD . /SBOM RUN apk add --no-cache curl -RUN curl -sfL https://raw.githubusercontent.com/aquasecurity/trivy/main/contrib/install.sh | sh -s -- -b /usr/local/bin v0.48.3 +RUN curl -sfL https://raw.githubusercontent.com/aquasecurity/trivy/main/contrib/install.sh | sh -s -- -b /usr/local/bin v0.68.1 RUN trivy fs --format spdx-json --output /sbom.spdx.json /SBOM RUN trivy sbom /sbom.spdx.json --severity UNKNOWN,HIGH,CRITICAL --db-repository public.ecr.aws/aquasecurity/trivy-db --exit-code 1 diff --git a/internal/operations/operation_updater.go b/internal/operations/operation_updater.go index 0def75ea2d..ed87f67696 100644 --- a/internal/operations/operation_updater.go +++ b/internal/operations/operation_updater.go @@ -270,7 +270,9 @@ func (ou *operationUpdater) doBatchUpdate(ctx context.Context, updates []*core.O if err != nil { return err } - transactions = append(transactions, transaction) + if transaction != nil { + transactions = append(transactions, transaction) + } } } @@ -310,21 +312,33 @@ func (ou *operationUpdater) doUpdate(ctx context.Context, update *core.Operation } // Match a TX we already retrieved, if found add a specified Blockchain Transaction ID to it + var txnIDStr string + var idempotencyKeyStr string var tx *core.Transaction - if op.Transaction != nil && update.BlockchainTXID != "" { + if op.Transaction != nil { for _, candidate := range transactions { if op.Transaction.Equals(candidate.ID) { tx = candidate + txnIDStr = candidate.ID.String() + idempotencyKeyStr = string(candidate.IdempotencyKey) break } } } - if tx != nil { + if tx != nil && update.BlockchainTXID != "" { if err := ou.txHelper.AddBlockchainTX(ctx, tx, update.BlockchainTXID); err != nil { return err } } + // This is a key log line, where we can provide all pieces of correlation data a user needs: + // - The type of the operation + // - The plugin/connector + // - The idempotencyKey + // - The FF Transaction ID + // - The Operation ID + log.L(ctx).Infof("FF_OPERATION_UPDATE: namespace=%s plugin=%s type=%s status=%s operationId=%s transactionId=%s idempotencyKey='%s'", op.Namespace, op.Plugin, op.Type, update.Status, op.ID, txnIDStr, idempotencyKeyStr) + if handler, ok := ou.manager.handlers[op.Type]; ok { if err := handler.OnOperationUpdate(ctx, op, update); err != nil { return err diff --git a/internal/txwriter/txwriter.go b/internal/txwriter/txwriter.go index 4b68d02bc3..9367cb6074 100644 --- a/internal/txwriter/txwriter.go +++ b/internal/txwriter/txwriter.go @@ -212,6 +212,14 @@ func (tw *txWriter) processBatch(ctx context.Context, batch *txWriterBatch) erro for _, op := range req.operations { op.Transaction = txn.ID operations = append(operations, op) + + // This is a key log line, where we can provide all pieces of correlation data a user needs: + // - The type of the operation + // - The plugin/connector + // - The idempotencyKey + // - The FF Transaction ID + // - The Operation ID + log.L(ctx).Infof("FF_NEW_TRANSACTION_OPERATION: namespace=%s plugin=%s type=%s operationId=%s transactionId=%s idempotencyKey='%s'", op.Namespace, op.Plugin, op.Type, op.ID, txn.ID, txn.IdempotencyKey) } } }