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

merge-maven-repos goal is parsing tar file contents thinking it's a HTML page #9

Closed
jakub-bochenski opened this issue Dec 7, 2016 · 7 comments
Labels

Comments

@jakub-bochenski
Copy link

jakub-bochenski commented Dec 7, 2016

It starts like this:

[DEBUG] scandir: dir: com/acme/ui/29.4.0-SNAPSHOT/ vpath: com/acme/ui/29.4.0-SNAPSHOT/
https://jenkins.acme-internal.com:3000/plugin/repository/project/acme-Installer-DSL/Build/1904/repository/com/acme/ui/29.4.0-SNAPSHOT/ - Status code: 200
[DEBUG] scandir: dir: com/acme/ui/29.4.0-SNAPSHOT/ui-29.4.0-20161207.115106-1904.rpm vpath: com/acme/ui/29.4.0-SNAPSHOT/ui-29.4.0-20161207.115106-1904.rpm/
https://jenkins.acme-internal.com:3000/plugin/repository/project/acme-Installer-DSL/Build/1904/repository/com/acme/ui/29.4.0-SNAPSHOT/ui-29.4.0-20161207.115106-1904.rpm/ - Status code: 200
[DEBUG] scandir: dir: com/acme/ui/29.4.0-SNAPSHOT/ui-29.4.0-20161207.115106-1904.tar vpath: com/acme/ui/29.4.0-SNAPSHOT/ui-29.4.0-20161207.115106-1904.tar/
https://jenkins.acme-internal.com:3000/plugin/repository/project/acme-Installer-DSL/Build/1904/repository/com/acme/ui/29.4.0-SNAPSHOT/ui-29.4.0-20161207.115106-1904.tar/ - Status code: 200
[DEBUG] scandir: dir: com/acme/ui/29.4.0-SNAPSHOT/ui-29.4.0-20161207.115106-1904.tar/javascript:void(0) vpath: com/acme/ui/29.4.0-SNAPSHOT/ui-29.4.0-20161207.115106-1904.tar/javascript:void(0)/
https://jenkins.acme-internal.com:3000/plugin/repository/project/acme-Installer-DSL/Build/1904/repository/com/acme/ui/29.4.0-SNAPSHOT/ui-29.4.0-20161207.115106-1904.tar/javascript:void(0)/ - Status code: 200

After that it keeps adding more javascript:void(0)/ segments in an infinite loop, going as far as https://jenkins.acme-internal.com:3000/plugin/repository/project/acme-Installer-DSL/Build/1904/repository/com/acme/ui/29.4.0-SNAPSHOT/ui-29.4.0-20161207.115106-1904.tar/javascript:void(0)/javascript:void(0)/javascript:void(0)/javascript:void(0)/javascript:void(0)/javascript:void(0)/javascript:void(0)/javascript:void(0)/javascript:void(0)/javascript:void(0)/javascript:void(0)/javascript:void(0)/javascript:void(0)/javascript:void(0)/javascript:void(0)/javascript:void(0)/javascript:void(0)/javascript:void(0)/javascript:void(0)/javascript:void(0)/javascript:void(0)/javascript:void(0)/javascript:void(0)/javascript:void(0)/javascript:void(0)/javascript:void(0)/javascript:void(0)/javascript:void(0)/

When I break the connection it fails with

org.apache.maven.wagon.TransferFailedException: I/O error reading HTML listing of artifacts: Premature end of Content-Length delimited message body (expected: 163225600; received: 65113743
        at org.apache.maven.wagon.providers.http.wagon.shared.HtmlFileListParser.parseFileList(HtmlFileListParser.java:106)
        at org.apache.maven.wagon.providers.http.HttpWagon.getFileList(HttpWagon.java:98)
        at org.apache.maven.wagon.providers.http.HttpWagon.getFileList(HttpWagon.java:46)

It seems that the plugin is downloading and trying to parse the file as if it was a HTML page, even though the file is clearly identified as application/x-tar

< Date: Wed, 07 Dec 2016 16:17:42 GMT
< X-Content-Type-Options: nosniff
< Expires: Thu, 01 Jan 1970 00:00:00 GMT
< ETag: ""
< Last-Modified: Wed, 07 Dec 2016 11:50:08 UTC
< Content-Type: application/x-tar
< Content-Length: 163225600
< Server: Jetty(9.2.z-SNAPSHOT)
< Strict-Transport-Security: max-age=31536000; includeSubDomains

This tar file actually include some HTML pages containing javascript:void(0) links.

The remote repository actually responds to requests for paths under https://jenkins.acme-internal.com:3000/plugin/repository/project/acme-Installer-DSL/Build/1904/repository/com/acme/ui/29.4.0-SNAPSHOT/ui-29.4.0-20161207.115106-1904.tar/javascript:void(0) returning the tar file.

Also the URI is obviously interpreted wrongly -- it should read javascript: as scheme and act accordingly instead of treating it as a relative URL.

The remote repository is powered by https://wiki.jenkins-ci.org/display/JENKINS/Jenkins+Maven+Repository+Server

@jakub-bochenski
Copy link
Author

jakub-bochenski commented Dec 7, 2016

After adding a HAProxy rule returning 404 to requests ending in /javascript:void(0) the plugin is failing with:

[ERROR] Failed to execute goal org.codehaus.mojo:wagon-maven-plugin:1.1-SNAPSHOT:merge-maven-repos (default-cli) on project standalone-pom: Error during performing repository copy: Illegal character in path at index 176: https://jenkins.acme-internal.com:3000/plugin/repository/project/acme-Installer-DSL/Build/1904/repository/com/acme/ui/29.4.0-SNAPSHOT/ui-29.4.0-20161207.115106-1904.tar/' + realUrl + '/ -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.codehaus.mojo:wagon-maven-plugin:1.1-SNAPSHOT:merge-maven-repos (default-cli) on project standalone-pom: Error during performing repository copy

It's because of a javascript file within the .tar package with a line containing return '<a href="' + realUrl + '">'

@jakub-bochenski jakub-bochenski changed the title Trying to merge remote repository results in infinite loop/recursion merge-maven-repos goal is parsing tar file contents thinking it's a HTML page Dec 7, 2016
@dantran
Copy link
Contributor

dantran commented Dec 7, 2016

related to #7

wagon html support is very dumb as well

@tchemit
Copy link
Contributor

tchemit commented Apr 12, 2018

Hi @jakub-bochenski , after several months...

Do you still got the problem ? I can try to help but I would need a project to test the defect. Thanks

@jakub-bochenski
Copy link
Author

@tchemit I gave up on the wagon plugin completely in favour of the deployer pom hack

@tchemit
Copy link
Contributor

tchemit commented Apr 12, 2018 via email

@jakub-bochenski
Copy link
Author

Well it gets the job done.

This required a change from a pull (running maven on the receiving end) to a push.
First I deploy the build results to a local repository with the help of -DaltDeploymentRepository=file::default::file://$WORKSPACE/.m2repo. Then I run the deployer pom on $WORKSPACE/.m2repo

@github-actions
Copy link

This issue is stale because it has been open 365 days with no activity. Remove stale label or comment or this will be closed in 30 days.

@github-actions github-actions bot added the Stale label Oct 29, 2023
@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Nov 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants