From 1dd9bcf65212e841a8b03ee38a8cb15f4e0dd1b4 Mon Sep 17 00:00:00 2001 From: diogo-nogueira-freiheit Date: Fri, 29 Nov 2024 13:40:45 +0000 Subject: [PATCH 1/2] Removed revision parsing from transaction. --- services/cd-service/pkg/service/version.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/services/cd-service/pkg/service/version.go b/services/cd-service/pkg/service/version.go index f0556611c..32a93c9fb 100644 --- a/services/cd-service/pkg/service/version.go +++ b/services/cd-service/pkg/service/version.go @@ -54,6 +54,13 @@ func (o *VersionServiceServer) GetVersion( state := o.Repository.State() dbHandler := state.DBHandler if dbHandler.ShouldUseOtherTables() { + // The gitRevision field is actually not a proper git revision. + // Instead, it has the release number stored with leading zeroes. + releaseVersion, err := reposerver.FromRevision(in.GitRevision) + if err != nil { + return nil, fmt.Errorf("could not parse GitRevision '%s' for app '%s' in env '%s': %w", + in.GitRevision, in.Application, in.Environment, err) + } res, err := db.WithTransactionT[api.GetVersionResponse](dbHandler, ctx, 1, true, func(ctx context.Context, tx *sql.Tx) (*api.GetVersionResponse, error) { // The gitRevision field is actually not a proper git revision. // Instead, it has the release number stored with leading zeroes. From c7eb42d77d3b299dfd2c1becc719b424a281d0e1 Mon Sep 17 00:00:00 2001 From: diogo-nogueira-freiheit Date: Fri, 29 Nov 2024 13:43:06 +0000 Subject: [PATCH 2/2] Removed old operation --- services/cd-service/pkg/service/version.go | 7 ------- 1 file changed, 7 deletions(-) diff --git a/services/cd-service/pkg/service/version.go b/services/cd-service/pkg/service/version.go index 32a93c9fb..90533ae73 100644 --- a/services/cd-service/pkg/service/version.go +++ b/services/cd-service/pkg/service/version.go @@ -62,13 +62,6 @@ func (o *VersionServiceServer) GetVersion( in.GitRevision, in.Application, in.Environment, err) } res, err := db.WithTransactionT[api.GetVersionResponse](dbHandler, ctx, 1, true, func(ctx context.Context, tx *sql.Tx) (*api.GetVersionResponse, error) { - // The gitRevision field is actually not a proper git revision. - // Instead, it has the release number stored with leading zeroes. - releaseVersion, err := reposerver.FromRevision(in.GitRevision) - if err != nil { - return nil, fmt.Errorf("could not parse GitRevision '%s' for app '%s' in env '%s': %w", - in.GitRevision, in.Application, in.Environment, err) - } deployment, err := dbHandler.DBSelectSpecificDeployment(ctx, tx, in.Environment, in.Application, releaseVersion) if err != nil || deployment == nil { return nil, fmt.Errorf("no deployment found for env='%s' and app='%s': %w", in.Environment, in.Application, err)