-
Notifications
You must be signed in to change notification settings - Fork 13
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
Splitting channel metadata into Channel and Manifest files #109
Conversation
I'm not sure. When we specified the channel, we decided that the maven repositories were not a part of its model: https://github.com/wildfly-extras/wildfly-channel/blob/main/doc/spec.adoc#channel-model. When the provisioning tool is a Maven-based, the maven repositories naturally comes from the pom.xml settings. When the provisioning tool is not based on Maven, such as Prospero, we would need another way to specify them. You have e.g. https://github.com/wildfly-extras/prospero/blob/main/prospero-cli/src/test/resources/prospero-known-combinations.yaml that would combine the channel GAV with the maven repositories that hosts the artifacts streams. |
I highlighted a couple of times the implementation was using wrong definitions. Now we're at the point we need to clean this up and correctly state that 'channel definition' = 'manifest'. So far the implementation has been using As for how provisioning works in a Maven environment this is inherently tricky. Having any form of latest strategy active means you can not blindly combine the repositories. Each repository is tied to a certain channel definition / manifest which in essence then forms the channel. You can combine channels, but not repositories. (This is why I said configuration is skewed at the moment.) A Maven project can only use 1 channel with its repositories inherently defined. To be able to use multiple channels it needs to use different means (aka the same means as prospero). |
The library is providing the
Definitely! That's why "stable" channels should use fixed versions and curate them instead of blinding relying on untrusted / unaligned versions coming from different Maven repositories. For Prospero, we can definitely do it but that's a tool-specific configuration as I see it. |
Right, and what it describes is a way to describe the contents of a channel. The actual contents live in the backing repositories. Without the repositories there is only the manifest.
Irrespective of the tool being used (Prospero, Maven plugins or whatever) the provisioning result must be the same. Yes, you can use untrusted Maven repositories as a backing content repository for a channel, but that is only in Maven land. Our channel repositories are fully trusted and aligned to individual product streams. To be able to provide the exact same result the input must be the same and thus any tool doing provisioning would need proper channel configuration. As I said, you can use a single channel in a Maven project but combining multiple and then mixing the repositories leads to trouble. What would you call the combination of repositories + manifest(s)? And then what would you call a collection of those combinations? |
|
||
public VersionResolverFactory(RepositorySystem system, | ||
RepositorySystemSession session, | ||
List<RemoteRepository> repositories) { | ||
RepositorySystemSession session) { |
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.
Why did you change the signature?
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.
The list of repositories needs to be passed to the VersionResolverFactory
when the Channel is initialised (via VersionResolverFactory#create). So I think there is no need for a shared list of repositories in VersionResolverFactory
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.
from the wildfly-maven-plugin, the current API is fine (we call the constructor and then the create
) https://github.com/wildfly/wildfly-maven-plugin/blob/fc8fcd02ad07e2217f4dffa288f5ad74c3819ba9/plugin/src/main/java/org/wildfly/plugin/provision/ChannelMavenArtifactRepositoryManager.java#L59-L61
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.
Yes, but create
is also called from the Channel#init
(https://github.com/wildfly-extras/wildfly-channel/blob/main/core/src/main/java/org/wildfly/channel/Channel.java#L179)
This call would have to disregard the repository list from the Factory's constructor and pass a different list for each channel, right?
btw. is the ChannelMavenArtifactRepositoryManager #resolver
used anywhere in the wildfly-maven-plugin?
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.
Yes, but create is also called from the Channel#init (https://github.com/wildfly-extras/wildfly-channel/blob/main/core/src/main/java/org/wildfly/channel/Channel.java#L179)
gotcha. I missed that usage.
btw. is the ChannelMavenArtifactRepositoryManager #resolver used anywhere in the wildfly-maven-plugin?
mmh, that seems to be old code that can be removed. thanks for spotting it
* Streams of components that are provided by this channel. | ||
*/ | ||
private Set<Stream> streams; | ||
private Manifest manifest; |
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.
could you please add Javadoc
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.
Sure, I'll update the docs as well, just wanted to settle on the definition first
import static com.fasterxml.jackson.annotation.JsonInclude.Include.NON_EMPTY; | ||
import static com.fasterxml.jackson.annotation.JsonInclude.Include.NON_NULL; | ||
|
||
public class Manifest implements AutoCloseable { |
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.
Maybe rename to ChannelManifest
?
public static final String CLASSIFIER="manifest"; | ||
public static final String EXTENSION="yaml"; | ||
|
||
private final String schemaVersion; |
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.
could you add javadoc please?
|
||
import static com.fasterxml.jackson.annotation.JsonInclude.Include.NON_NULL; | ||
|
||
public class ManifestRef { |
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.
Maybe rename it to ManifestCoordinate
and create a superclass common to https://github.com/wildfly-extras/wildfly-channel/blob/main/maven-resolver/src/main/java/org/wildfly/channel/maven/ChannelCoordinate.java
We want to be able to locate a channel or a manifest using either an URL or a GA(V)
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.
I added ChannelMetadataCoordinate
as superclass to both ChannelCoordinate
and ChannelManifestCoordinate
private String url; | ||
|
||
@JsonCreator | ||
public Repository(@JsonProperty(value = "id") String id, @JsonProperty(value = "url") String url) { |
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.
is the id
required?
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.
I'm not sure. I guess we could auto-generate the id if it's not provided. But I think it might possibly cause some maven cache issue if the ids collide
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.
In the Maven world repository id
is used to track the state in the local cache. So if you allow resolution to go through a Maven cache the id
s must match.
When I look at the Channel file I can see
That means that the channel library should only use the "test" maven repository to resolve any artifact that the manifest bound to this channel has a stream for. @wolfc @spyrkob am I correct with this assumption? Based on this, we can have the wildfly-maven-plugin to expose a list of "restricted maven repositories" that would, in this case, contain a single entry: "test". Obviously the settings.xml or pom.xml (the enabled current profiles(s)), would have to contain a repository with the "test" id. This list is global to all configured channels. All configured channels would receive the same list. Each channel would only use a subset of the repositories according to its configuration. Each channel having the knowledge of the ids it trusts. 2 channel files referencing the id "mrrc" identify the same repository. We can't imagine "mrrc" having a meaning for channel1 and another for channel2. When the plugin runs, it conveys the global list of "restricted repositories" to all the configured channels. The channel, when a "restricted list" is provided, only uses the ids that it knows (if any) repository from the list of maven repositories instances that the plugin has injected in the channel (could contain central, nexus, mrrc, repos, custom, test, ...). If the expected ids are not found, then it aborts. |
@jfdenise I think that makes sense. What would be the expectation if channel defines two repositories, but only one of them is in the restricted list? Aborted run? |
@spyrkob , I would say that, when a restricted list is provided, all repositories known by the channel must be present. Aborting if one is missing. |
added the manifest information to the spec |
9048f3d
to
9590bf7
Compare
There are scenarii when the users will configure a Maven proxy to pull Maven dependencies. The lib must respect their settings. For example, with the Given that we can not necessarily assert the sources of the components provisioned by a Channel, it becomes more important to verify their integrity (as tracked by #112). |
@jmesnil how about adding following constructor to the
User can then provide their own mapping from channel's repository to maven repository |
@jmesnil should I add the constructor above? Will it solve the use case you outlined? |
@jmesnil do you know when this change might be included? |
Should the The use case I'm thinking about is, for example, Wildfly feature packs where the Currently that's represented by two separate manifests - |
@spyrkob I've created a |
@jmesnil done |
|
||
public String getClassifier() { | ||
return classifier; | ||
}; |
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.
unnecessary semicolon.
if (gav != null) { | ||
final String[] parsedGav = gav.split(":"); | ||
if (parsedGav.length < 2 || parsedGav.length > 3) { | ||
throw new IllegalArgumentException("Illegal GAV experession: " + gav); |
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.
spelling expression
} | ||
|
||
void init(MavenVersionsResolver factory) { | ||
resolver = resolver; |
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.
should be resolver = factory;
@@ -18,10 +18,15 @@ | |||
|
|||
import java.io.Closeable; | |||
import java.io.File; | |||
import java.net.MalformedURLException; |
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.
unused import
7ac35f9
to
76babb5
Compare
94eb18b
to
c1e18e6
Compare
@jfdenise updated |
018821c
to
a3003f8
Compare
@spyrkob , I integrated these changes with wildfly-maven-plugin, and all is fine. I am approving this PR. |
… spec changes - channel/manifest split, blocklist and resolve strategies
Splitting the Channel definition into Channel and Manifest files. Adding blockList and advanced resolution strategies.
Channel contains static information - repositories, vendor, etc while Manifest contains streams definition
Example Channel file:
Example Manifest file: