-
Notifications
You must be signed in to change notification settings - Fork 140
Document deployment of artifacts #1588
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
Conversation
86c0641 to
1c7deb6
Compare
This closes apache#1587
1c7deb6 to
a91fab8
Compare
|
The "Maven way" of wanted topic "deploy API using PUT by default for HTTP" is true IF following conditions are true:
In that case, one can say that "deploy" call maps to HTTP PUT method for each artifact and metadata. |
| under the License. | ||
| --> | ||
|
|
||
| Deploying artifacts and related metadata to a (remote) repository can be achieved via Resolver API with method [`org.eclipse.aether.RepositorySystem.deploy(RepositorySystemSession session, DeployRequest request)`](https://github.com/apache/maven-resolver/blob/master/maven-resolver-api/src/main/java/org/eclipse/aether/RepositorySystem.java). This writes/uploads the given artifact(s) including metadata to the given repository leveraging a [`RepositoryConnector`](https://github.com/apache/maven-resolver/blob/master/maven-resolver-spi/src/main/java/org/eclipse/aether/spi/connector/RepositoryConnector.java). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about checksums? Are they treated as separate artifacts like signatures?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, checksums are feature of basic connector (check out M2 layout, that one contains the "configured" checksums), and they are opaquely (to client) being uploaded (on deploy) or being asked for (on consume) by basic connector. No client code should ever mangle with them (while deploying or resolving).
Though, as they are treated/cached in same was as artifacts and metadata, they are stored in local repository (on consume), and also, they can be explicitly resolved too by same calls as artifacts or metadata is resolved.
In short: checksums are NOT separate artifacts (even if they do behave like "separate artifacts" in some respect), but there are important differences. In general, you should NOT assume they are separate artifacts, you should leave their handling to basic connector: the role of basic connector among others, is that when it returns from a call with downloaded artifact, you KNOW the checksums are checked and are okay (according to session config like checksum policy and configured checksum algs), otherwise basic connector fails the call.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And one more important point: if you DO provide checksums, basic connector will let them pass (and deploy in opaque manner) unless configured to use same checksum algorithm. Think ASF source bundle deploys, we use a plugin to create SHA512 for them, (while Resolver is using 'standard' checksum config of MD5 and SHA1). IF Resolver would be configured to use SHA512 as well (mvn3: -Daether.checksums.algorithms=... and mvn4: aether.layout.maven2.checksumAlgorithms), it would recalculate and replace checksum with its own on deploy.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, important is the "kind" of checksum:
Lines 65 to 93 in f737339
| /** | |
| * Enum denoting origin of checksum. | |
| * | |
| * @since 1.8.0 | |
| */ | |
| enum ChecksumKind { | |
| /** | |
| * Remote external kind of checksum are retrieved from remote doing extra transport round-trip (usually by | |
| * getting "file.jar.sha1" for corresponding "file.jar" file). This kind of checksum is part of layout, and | |
| * was from beginning the "official" (and one and only) checksum used by resolver. If no external checksum | |
| * present, {@link #onNoMoreChecksums()} method is invoked that (by default) fails retrieval. | |
| */ | |
| REMOTE_EXTERNAL, | |
| /** | |
| * Included checksums may be received from remote repository during the retrieval of the main file, for example | |
| * from response headers in case of HTTP transport. They may be set with | |
| * {@link org.eclipse.aether.spi.connector.transport.GetTask#setChecksum(String, String)}. If no included | |
| * checksum present, {@link #REMOTE_EXTERNAL} is tried for. | |
| */ | |
| REMOTE_INCLUDED, | |
| /** | |
| * Provided checksums may be provided by {@link org.eclipse.aether.spi.checksums.ProvidedChecksumsSource} | |
| * components, ahead of artifact retrieval. If no provided checksum present, {@link #REMOTE_INCLUDED} is | |
| * tried for. | |
| */ | |
| PROVIDED | |
| } |
What exactly do you want me to change/add to the doc? |
|
Maybe just emphasize that "basic connector + HTTP transport" is the "most common way users are using Maven" (given Central is HTTP)? But, that is exactly NOT the typical how they deploy 😄 Unsure, what we want really to document here... as today, NOTHING aside of MRMs (that provide "internal" or "private" repositories, and usually proxies as well) support the "basic Maven deploy" (HTTP PUT artifact to remote repo) use case. |
The way deploy is implemented by standard resolver services, obviously all those standard services can be overidden/extended in which case the picture may change.
That is impossible to understand without this piece of information. |
|
Just for ref, the Slack discussion as well: So, I don't know can we go with it so simple, as for example, new mvn4 feature is this (visible with -X): Maven 4 now "pipeline" connectors, and this is final assembled pipeline in resolver 2: Roles:
Transport is implementing actual transport like HTTP, FTP, S3 etc. Also, we plan to add new connectors in pipeline, like What this doco describe is true ONLY if Resolver is layered on purpose, and at the same time due this is not quite trivial to explain how it works. Also, important distinction about "abstraction levels": connectors deals with Artifacts, while transport only about URIs. Transport is blind for "which artifact is this URI for"-like questions. |
|
@kwin is this good to go into 2.0.12? If so, pls merge |
|
Good as a starting point, I would say. Can be extended later on. |
|
@kwin Please assign appropriate label to PR according to the type of change. |
|
@kwin The PR can't be associated to a milestone, because there are multiple open milestones. Please add the text "branch: master" to the description to the milestone where this PR belongs to. |
This closes #1587
Following this checklist to help us incorporate your
contribution quickly and easily:
Note that commits might be squashed by a maintainer on merge.
This may not always be possible but is a best-practice.
mvn verifyto make sure basic checks pass.A more thorough check will be performed on your pull request automatically.
mvn -Prun-its verify).If your pull request is about ~20 lines of code you don't need to sign an
Individual Contributor License Agreement if you are unsure
please ask on the developers list.
To make clear that you license your contribution under
the Apache License Version 2.0, January 2004
you have to acknowledge this by using the following check-box.