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 a few bugs in delete pipeline version that are discovered in integration test #2611

Merged
merged 1 commit into from
Nov 14, 2019
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
5 changes: 4 additions & 1 deletion backend/src/apiserver/storage/pipeline_store.go
Original file line number Diff line number Diff line change
Expand Up @@ -715,6 +715,7 @@ func (s *PipelineStore) DeletePipelineVersion(versionId string) error {
err.Error())
}
}
r.Close()
if len(pipelineId) == 0 {
// The deleted version is not used as a default version. So no extra
// work is needed. We commit the deletion now.
Expand All @@ -724,6 +725,7 @@ func (s *PipelineStore) DeletePipelineVersion(versionId string) error {
"Failed to delete pipeline version: %v",
err.Error())
}
return nil
}

// (3) find a new default version.
Expand Down Expand Up @@ -751,11 +753,12 @@ func (s *PipelineStore) DeletePipelineVersion(versionId string) error {
err.Error())
}
}
r.Close()
if len(newDefaultVersionId) == 0 {
// No new default version. The pipeline's default version id will be
// null.
_, err = tx.Exec(
"update pipelines set DefaultVerionId = null where UUID = ?",
"update pipelines set DefaultVersionId = null where UUID = ?",
pipelineId)
if err != nil {
tx.Rollback()
Expand Down