Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(cd-service): removed revision parsing from transaction. #2149

Merged
merged 2 commits into from
Nov 29, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions services/cd-service/pkg/service/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,14 +54,14 @@ 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.
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)
Expand Down
Loading