blackducksoftware / hub-rest-api-python

HUB REST API Python bindings
Apache License 2.0
89 stars 105 forks source link

Added deletion of associated code locations when deleting old project versions #140

Closed nichollsdave closed 3 years ago

nichollsdave commented 3 years ago

When following the guidance in the data retention article and utilizing this script it will delete project versions but not the associated code locations. This is fine if the following properties are set to regularly tidy up unmapped code locations. BLACKDUCK_HUB_UNMAPPED_CODE_LOCATIONCLEANUP=true BLACKDUCK HUB_UNMAPPED_CODE_LOCATION_RETENTION_DAYS=X

However if this is set to default values the unmapped code locations will only be deleted after a year leaving the orphaned unmapped code location taking up space for a year.

Modified the script to delete the mapped code locations before deleting the project version.

I cannot think of a use case or reason why we would want the code location kept but not the project version.

skiyooka commented 3 years ago

As it does change the default behavior, perhaps also add a message in test-mode else clause saying codelocations will be deleted too.

nichollsdave commented 3 years ago

Thanks guys, I was a little worried about changing default behavior but have now added a warning when the script runs to that effect, think it worth being shown regardless of test-mode.