ctron / package-drone

An OSGI first software artifact repository – Moved to the Eclipse Foundation
https://github.com/eclipse/packagedrone
Eclipse Public License 1.0
39 stars 13 forks source link

channel: list shows multiple entries for same name #56

Open maggu2810 opened 9 years ago

maggu2810 commented 9 years ago

I used mvn deplo-file to deploy artifacts to a channel of my package-drone (0.4.0) instance. I called this multiple times (at least twice, don't know if it was started more often. The plain view / list shows multiple entries for the same name. URL: http://127.0.0.1:8080/channel/09EF1289-54C1-4B9F-BE9B-F890EDE2481B/viewPlain

Here a short excerpt:

disruptor-3.3.0-p2artifacts.xml    481 bytes   18.03.2015 10:02:45 Download        Details View
disruptor-3.3.0-p2artifacts.xml 481 bytes   18.03.2015 10:02:45 Download        Details View
disruptor-3.3.0-p2artifacts.xml 481 bytes   18.03.2015 10:02:45 Download        Details View
disruptor-3.3.0-p2metadata.xml  1.6 KiB 18.03.2015 10:02:45 Download        Details View
disruptor-3.3.0-p2metadata.xml  1.6 KiB 18.03.2015 10:02:45 Download        Details View
disruptor-3.3.0-p2metadata.xml  1.6 KiB 18.03.2015 10:02:45 Download        Details View
disruptor-3.3.0.jar 77.7 KiB    18.03.2015 09:48:23 Download    Delete  Details View
disruptor-3.3.0.jar 77.7 KiB    18.03.2015 09:47:58 Download    Delete  Details View
disruptor-3.3.0.jar 77.7 KiB    18.03.2015 09:52:44 Download    Delete  Details View
disruptor-3.3.0.pom 1.6 KiB 18.03.2015 09:52:44 Download    Delete  Details View
disruptor-3.3.0.pom 1.6 KiB 18.03.2015 09:47:58 Download    Delete  Details View
disruptor-3.3.0.pom 1.6 KiB 18.03.2015 09:48:24 Download    Delete  Details View
hamcrest-core-1.1.jar   74.8 KiB    18.03.2015 09:48:26 Download    Delete  Details View
hamcrest-core-1.1.jar   74.8 KiB    18.03.2015 09:52:47 Download    Delete  Details View
hamcrest-core-1.1.pom   481 bytes   18.03.2015 09:48:27 Download    Delete  Details View
hamcrest-core-1.1.pom   481 bytes   18.03.2015 09:52:48 Download    Delete  Details View
maggu2810 commented 9 years ago

database entries for hamcrest-core artifacts

mysql> select id,channel_id,type,parent,name,size,creation_ts from pd.ARTIFACTS where NAME LIKE '%hamcrest-core%';
+--------------------------------------+--------------------------------------+------+--------------------------------------+-----------------------+-------+---------------------+
| id                                   | channel_id                           | type | parent                               | name                  | size  | creation_ts         |
+--------------------------------------+--------------------------------------+------+--------------------------------------+-----------------------+-------+---------------------+
| 33358237-B099-49DD-A88C-340D75594484 | 09EF1289-54C1-4B9F-BE9B-F890EDE2481B | S    | NULL                                 | hamcrest-core-1.1.pom |   481 | 2015-03-18 09:48:27 |
| 54904780-FD23-472E-8407-4742EC8AB886 | 09EF1289-54C1-4B9F-BE9B-F890EDE2481B | S    | NULL                                 | hamcrest-core-1.1.jar | 76643 | 2015-03-18 09:48:26 |
| 58E44E13-DE38-4E0E-914A-EC330473D1C7 | 09EF1289-54C1-4B9F-BE9B-F890EDE2481B | A    | 54904780-FD23-472E-8407-4742EC8AB886 | hamcrest-core-1.1.jar | 76643 | 2015-03-18 09:52:47 |
| 7FFFA2F4-5972-4712-9CC0-EAB6490D1DCF | 09EF1289-54C1-4B9F-BE9B-F890EDE2481B | A    | 33358237-B099-49DD-A88C-340D75594484 | hamcrest-core-1.1.pom |   481 | 2015-03-18 09:52:48 |
+--------------------------------------+--------------------------------------+------+--------------------------------------+-----------------------+-------+---------------------+
4 rows in set (0.00 sec)
maggu2810 commented 9 years ago

Should we prevent the same "name" for the same "channel_id"? So create a constraint for artifacts for (channel_id,name) and replace the previous entry or if we need a new ID, delete the old one and then insert the new?

ctron commented 9 years ago

This is OK from the view of Package Drone. Each channel can have the same artifact multiple times.

If you like you can setup up the cleaner aspect with a maximum count of 1 (one), so that only the last artifact survives.

In the future there should be three ways to handle this (as @toshovski described somewhere else for the case of maven artifacts): a) ignore duplicates b) overwrite duplicates c) enforce (fail) when a duplicate is uploaded.

However this later channel policy is not yet implemented, since the detection of duplicates should not only be the name. The name should be one option.

maggu2810 commented 9 years ago

I realized the cleaner yesterday. Good stuff. I just realized the multiple entries and did not know, that this is ok for package drone. In my situation this is also the same file (same MD5). But what should be happen if the files of the jar differs but the group id, artifact id and version keeps the same. Shouldn't the deploy fail or an update of the existing one be done?

If another pom contains a dependency using group id, artifact id and version which file package-drone will offer the maven client if I build this (the other) project?

maggu2810 commented 9 years ago

Is this what you stated with your two last paragraphs?

ctron commented 9 years ago

Yes ;-)

I don't think you can make a general assumption on what people prefer (fail, update, ignore). So it should be a choice. At the moment, using the cleaner, it is possible to update & ignore .. failure is not an option :wink: (at least for now.

afischer211 commented 9 years ago

In the new validation part package-drone detects different artifacts with different md5sums but the same osgi-version. How can I suppress the deployment of such artifacts, but keep more than one (but limited count) of snapshot artifacts? If I group for osgi:version, the differrent snapshot-artifacts are handled as different versions, with group by mvn:version I also get multiple artifacts with the same osgi:version, but different md5sum (because of different attributes in manifest like build-time). May be an option would be to suppress artifacts, which fails the validation.