athieriot / drone-artifactory

Drone plugin for publishing build artifacts to Artifactory
Apache License 2.0
10 stars 12 forks source link

Replace dots with slashes in group id #9

Closed mircobordoni closed 8 years ago

mircobordoni commented 8 years ago

The issue

We noticed that the drone-artifactory plugin was failing to upload artifacts into our Artifactory instance when:

The version of Artifactory used is Pro Power Pack 3.3.0.1 (rev. 30106).

To reproduce the issue I have run the drone-artifactory plugin with the following config:

node index.js <<EOF
{
    "repo": {
        "clone_url": "git://github.com/drone/drone",
        "owner": "drone",
        "name": "drone",
        "full_name": "drone/drone"
    },
    "system": {
        "link_url": "https://beta.drone.io"
    },
    "build": {
        "number": 22,
        "status": "success",
        "started_at": 1421029603,
        "finished_at": 1421029813,
        "message": "Testing Drone Artifactory",
        "author": "john doe",
        "author_email": "john.doe@gmail.com"
    },
    "workspace": {
        "root": "/drone/src",
        "path": "/Users/johndoe/drone-artifactory"
    },
    "vargs": {
        "url": "http://artifactory:8081",
        "username": "username",
        "password": "password",
        "repo_key": "release-repo",
    "pom": "pom.xml",
    "force_upload": "true",
        "files": [
            "pom.xml",
            "target/snapshot/*.jar"
        ]
    }
}
EOF

and the result was:

info: Project groupId: net.skyscanner.schemas
info: Project artifactId: schemas
info: Project version: testDrone
info: Uploading /Users/johndoe/drone-artifactory/pom.xml as testDrone.pom into release-repo
info: Uploading /Users/johndoe/drone-artifactory/target/release/testDrone.jar as testDrone.jar into release-repo
error: An error happened while trying to publish the file Users/johndoe/drone-artifactory/pom.xml: HTTP Status Code from server was: 409

Same thing happened specifying the group id, artifact id and version explicitly in the configuration:

node index.js <<EOF
{
    "repo": {
        "clone_url": "git://github.com/drone/drone",
        "owner": "drone",
        "name": "drone",
        "full_name": "drone/drone"
    },
    "system": {
        "link_url": "https://beta.drone.io"
    },
    "build": {
        "number": 22,
        "status": "success",
        "started_at": 1421029603,
        "finished_at": 1421029813,
        "message": "Testing Drone Artifactory",
        "author": "john doe",
        "author_email": "john.doe@gmail.com"
    },
    "workspace": {
        "root": "/drone/src",
        "path": "/Users/johndoe/drone-artifactory"
    },
    "vargs": {
        "url": "http://artifactory:8081",
        "username": "username",
        "password": "password",
        "repo_key": "release-repo",
    "group_id": "com.example.xyz",
    "artifact_id": "testDrone",
    "version": "1.0",
    "force_upload": "true",
        "files": [
            "pom.xml",
            "target/snapshot/*.jar"
        ]
    }
}
EOF

The proposed solution

The proposed solution is to replace the dots into the group id with slashes. In this way the upload of both the pom and jar files is succeeding and the files are placed into the right path in Artifactory.

athieriot commented 8 years ago

LGTM

jackspirou commented 8 years ago

LGTM