Skip to content

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

Open
@Michaelpalacce

Description

@Michaelpalacce

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.

Metadata

Metadata

Assignees

Labels

area/artifact-managerRelates to the `artifact-manager` maven modulearea/mojoRelates to changes to some of the mvn mojoskind/refactorRefactoring of existing featurestriage/acceptedThe issue was accepted and will be doneversion/minorIntroduces a non-breaking feature or change

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions