Skip to content

fix(deploymentstore): return oldest uncompleted deployment as head#6921

Open
AruneshDwivedi wants to merge 1 commit into
pipe-cd:masterfrom
AruneshDwivedi:fix/deployment-store-head-order
Open

fix(deploymentstore): return oldest uncompleted deployment as head#6921
AruneshDwivedi wants to merge 1 commit into
pipe-cd:masterfrom
AruneshDwivedi:fix/deployment-store-head-order

Conversation

@AruneshDwivedi

Copy link
Copy Markdown

The head deployment selection in ListAppHeadDeployments was returning the newest instead of the oldest uncompleted deployment.

The previous loop order (pendings -> planneds -> runnings) caused newer statuses to overwrite older ones. For an app with both a pending and a running deployment, the running one won -- the opposite of what the Lister interface docstring promises.

Fix: iterate runnings first (oldest status), then planneds and pendings only if no entry already exists for that application ID.

Both piped and pipedv1 stores are fixed. Fixes #6780

The head deployment selection in ListAppHeadDeployments was inverted.
The previous loop order (pendings -> planneds -> runnings) caused newer
statuses to overwrite older ones, so the newest uncompleted deployment
was returned instead of the oldest.

Fix: iterate runnings first (oldest), then planneds and pendings only
if no entry exists for that application ID. This matches the Lister
interface docstring: 'Head deployment is same with the oldest
uncompleted one.'

Fixes pipe-cd#6780

Signed-off-by: Arunesh Dwivedi <arunesh.devops@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug: pipedv1 deployment store returns newest deployment as head, not oldest

1 participant