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

vrealize:clean does not work as expected and does not clean well #319

Open
Michaelpalacce opened this issue Jul 12, 2024 · 0 comments
Open
Labels
area/artifact-manager Relates to the `artifact-manager` maven module area/mojo Relates to changes to some of the mvn mojos kind/refactor Refactoring of existing features triage/accepted The issue was accepted and will be done version/major Introduces a breaking change

Comments

@Michaelpalacce
Copy link
Collaborator

Michaelpalacce commented Jul 12, 2024

Description

This is the documentation for the command. Read through it to understand what is the purpose of vrealize:clean.

This is how vrealize:clean can be called:

mvn vrealize:clean -DincludeDependencies=true -DcleanUpOldVersions=true -DcleanUpLastVersion=false -PDevLab
mvn vrealize:clean -DincludeDependencies=true -DcleanUpOldVersions=false -DcleanUpLastVersion=true -PDevLab

The problem is that currently it doesn't work as expected. There are actually a few issues here:

  1. You can't do cleanupOldVersions and cleanUpLastVersion at the same time due to a bug
    • Take a look at GenericPackageStore.java > deletePackage
    • This section: image
    • Reason why it won't work is because pollLast will remove and return the last element (aka latest) from the array and the delete later on in the if statement will delete for (Package p : all) { but latest is actually not there
  2. You can't clean up last version in some cases...
    • image
    • if all.size === 0 we are all good, cause it deletes the latest package that was pollLast-ed before...
    • if not, we attempt to delete the previous iteration, not the latest. This is perhaps to safeguard against deleting everything on the environment, but vrealize:clean ought to be used to actually delete the latest when you want to do that.
  3. There is a case where the environment does not get fully cleaned up, perhaps a dependency of a dependency or even deeper down. Investigate this

Proposed solutions

Delete old packages

  • Fetch package, package dependencies and their dependencies and so on and so forth (up for discussion, could only go one level down?)
  • Search for them in vro
  • Whatever is found out, should be deleted with deletePackageVersion, aka deleting the package and any obsolete/deprecated/left over code.

Cleanup Environment

This will be essentially delete latest and old at the same time

  • Fetch package, package dependencies and their dependencies and so on and so forth (up for discussion, could only go one level down?)
  • Search for them in vro
  • Delete them with their content and all old versions.
@Michaelpalacce Michaelpalacce added area/artifact-manager Relates to the `artifact-manager` maven module triage/needs-clarification The issue needs further clarification from the contributor version/major Introduces a breaking change triage/needed Needs to be discussed by project maintainers kind/refactor Refactoring of existing features area/mojo Relates to changes to some of the mvn mojos labels Jul 12, 2024
@Michaelpalacce Michaelpalacce added triage/accepted The issue was accepted and will be done and removed triage/needs-clarification The issue needs further clarification from the contributor triage/needed Needs to be discussed by project maintainers labels Aug 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/artifact-manager Relates to the `artifact-manager` maven module area/mojo Relates to changes to some of the mvn mojos kind/refactor Refactoring of existing features triage/accepted The issue was accepted and will be done version/major Introduces a breaking change
Projects
None yet
Development

No branches or pull requests

1 participant