wildfly icon indicating copy to clipboard operation
wildfly copied to clipboard

[WFLY-19221] Incorporate channel metadata in the download zips

Open jmesnil opened this issue 1 year ago • 11 comments

  • WildFly full distribution is built using the wildfly-maven-plugin based on the org.wildfly.channels:wildfly channel.
  • WildFly ee distribution is built using the wildfly-maven-plugin based on the org.wildfly.channels:wildfly-ee channel.
  • WildFly Preview distribution is built based on the org.wildfly.channels:wildfly-preview channel

preview/dist and dist poms depends on the channels artifacts to ensure that they are build first so that the distributions can use them during provisioning.

This is required for https://github.com/wildfly/wildfly-proposals/pull/577

JIRA: https://issues.redhat.com/browse/WFLY-19221

jmesnil avatar Jun 06 '24 12:06 jmesnil

I manually verified that the new distributions content is identical to the existing ones with additional metadata in .installation:

$ diff -r ~/tmp/wildfly-33.0.0.Beta1-SNAPSHOT-galleon-maven-plugin/ ~/tmp/wildfly-33.0.0.Beta1-SNAPSHOT-wildfly-maven-plugin/
Only in /Users/jmesnil/tmp/wildfly-33.0.0.Beta1-SNAPSHOT-wildfly-maven-plugin/.installation: README.txt
Only in /Users/jmesnil/tmp/wildfly-33.0.0.Beta1-SNAPSHOT-wildfly-maven-plugin/.installation: installer-channels.yaml
Only in /Users/jmesnil/tmp/wildfly-33.0.0.Beta1-SNAPSHOT-wildfly-maven-plugin/.installation: manifest.yaml
Only in /Users/jmesnil/tmp/wildfly-33.0.0.Beta1-SNAPSHOT-wildfly-maven-plugin/.installation: manifest_version.yaml
Only in /Users/jmesnil/tmp/wildfly-33.0.0.Beta1-SNAPSHOT-wildfly-maven-plugin/.installation: provisioning_record.xml

jmesnil avatar Jun 06 '24 12:06 jmesnil

I also updated the docs module to provision with the WildFly Maven plugin for consistency sake.

@bstansberry I did not update the ee-dist distributions that we are not publishing but for consistency, I can do it if you want.

jmesnil avatar Jun 06 '24 12:06 jmesnil

@bstansberry Thanks for the review, I incorporated your changes in https://github.com/wildfly/wildfly/commit/a3b0ccd2959d05205291ee8a97ee131bb361cf91 (including ee-dist and the manual mode test)

jmesnil avatar Jun 10 '24 12:06 jmesnil

@spyrkob Something I'm not sure about... The current distribution is provisioned with the universe's feature pack locations for our feature packs:

cat ./.installation/provisioning_record.xml
<?xml version="1.0" ?>

<installation xmlns="urn:jboss:galleon:provisioning:3.0">
    <transitive>
        <feature-pack location="wildfly-ee@maven(org.jboss.universe:community-universe):current#33.0.0.Beta1-SNAPSHOT">
            <packages>
                <include name="docs.examples.configs"/>
            </packages>
        </feature-pack>
    </transitive>
    <feature-pack location="wildfly@maven(org.jboss.universe:community-universe):current#33.0.0.Beta1-SNAPSHOT"/>
    <options>
        <option name="jboss-fork-embedded" value="true"/>
    </options>
</installation>

(this file is identical to .galleon/provisioning.xml)

When I try to update it with Prospero, it fails with the error:

$ ./prospero update perform -vv --debug  --dir=/Users/jmesnil/Developer/wildfly/dist/target/wildfly-33.0.0.Beta1-SNAPSHOT --use-default-local-cache

Updating server: /Users/jmesnil/Developer/wildfly/dist/target/wildfly-33.0.0.Beta1-SNAPSHOT

18:06:06,122 INFO  [prospero] PRSP000012: Checking available updates
18:06:06,122 INFO  [prospero] PRSP000012: Checking available updates
Jun 10, 2024 6:06:06 PM java.lang.System$LoggerFinder lambda$accessProvider$0
WARNING: Failed to instantiate LoggerFinder provider; Using default.


ERROR: org.jboss.galleon.universe.maven.MavenUniverseException: Failed to resolve Maven universe org.jboss.universe:community-universe

org.jboss.galleon.ProvisioningException: org.jboss.galleon.universe.maven.MavenUniverseException: Failed to resolve Maven universe org.jboss.universe:community-universe
        at org.jboss.galleon.impl.ProvisioningUtil.getCoreVersion(ProvisioningUtil.java:113)
        at org.jboss.galleon.impl.ProvisioningUtil.getCoreVersion(ProvisioningUtil.java:89)
        at org.jboss.galleon.api.GalleonBuilder.newProvisioningBuilder(GalleonBuilder.java:101)
        at org.wildfly.prospero.galleon.GalleonUtils.newProvisioning(GalleonUtils.java:197)
        at org.wildfly.prospero.galleon.GalleonEnvironment.<init>(GalleonEnvironment.java:140)
        at org.wildfly.prospero.galleon.GalleonEnvironment$Builder.build(GalleonEnvironment.java:328)
        at org.wildfly.prospero.actions.UpdateAction.getGalleonEnv(UpdateAction.java:157)
        at org.wildfly.prospero.actions.UpdateAction.findUpdates(UpdateAction.java:143)
        at org.wildfly.prospero.cli.commands.UpdateCommand.buildUpdate(UpdateCommand.java:434)
        at org.wildfly.prospero.cli.commands.UpdateCommand$PerformCommand.performUpdate(UpdateCommand.java:136)
        at org.wildfly.prospero.cli.commands.UpdateCommand$PerformCommand.call(UpdateCommand.java:122)
        at org.wildfly.prospero.cli.commands.UpdateCommand$PerformCommand.call(UpdateCommand.java:83)
        at picocli.CommandLine.executeUserObject(CommandLine.java:2045)
        at picocli.CommandLine.access$1500(CommandLine.java:148)
        at picocli.CommandLine$RunLast.executeUserObjectOfLastSubcommandWithSameParent(CommandLine.java:2465)
        at picocli.CommandLine$RunLast.handle(CommandLine.java:2457)
        at picocli.CommandLine$RunLast.handle(CommandLine.java:2419)
        at picocli.CommandLine$AbstractParseResultHandler.execute(CommandLine.java:2277)
        at picocli.CommandLine$RunLast.execute(CommandLine.java:2421)
        at picocli.CommandLine.execute(CommandLine.java:2174)
        at org.wildfly.prospero.cli.CliMain.execute(CliMain.java:132)
        at org.wildfly.prospero.cli.CliMain.main(CliMain.java:60)
Caused by: org.jboss.galleon.universe.maven.MavenUniverseException: Failed to resolve Maven universe org.jboss.universe:community-universe
        at org.jboss.galleon.universe.maven.MavenUniverseFactory.getUniverse(MavenUniverseFactory.java:65)
        at org.jboss.galleon.universe.UniverseFactoryLoader.getUniverse(UniverseFactoryLoader.java:110)
        at org.jboss.galleon.universe.UniverseResolver.getUniverse(UniverseResolver.java:87)
        at org.jboss.galleon.universe.UniverseResolver.getUniverse(UniverseResolver.java:81)
        at org.jboss.galleon.universe.UniverseResolver.resolve(UniverseResolver.java:127)
        at org.jboss.galleon.impl.ProvisioningUtil.getCoreVersion(ProvisioningUtil.java:101)
        ... 21 more
Caused by: org.jboss.galleon.universe.maven.MavenUniverseException: Can not resolve latest Maven artifact (no stream found) : org.jboss.universe:community-universe:jar:
        at org.wildfly.prospero.galleon.ChannelMavenArtifactRepositoryManager.resolve(ChannelMavenArtifactRepositoryManager.java:79)
        at org.wildfly.prospero.galleon.ChannelMavenArtifactRepositoryManager.resolveLatestVersion(ChannelMavenArtifactRepositoryManager.java:306)
        at org.jboss.galleon.universe.maven.repo.MavenRepoManager.resolveLatestVersion(MavenRepoManager.java:68)
        at org.jboss.galleon.universe.maven.MavenUniverse.resolveUniverseArtifact(MavenUniverse.java:64)
        at org.jboss.galleon.universe.maven.MavenUniverse.<init>(MavenUniverse.java:101)
        at org.jboss.galleon.universe.maven.MavenUniverseFactory.getUniverse(MavenUniverseFactory.java:63)
        ... 26 more
Caused by: org.wildfly.channel.NoStreamFoundException: Can not resolve latest Maven artifact (no stream found) : org.jboss.universe:community-universe:jar:
        at org.wildfly.channel.ChannelSession.lambda$findChannelWithLatestVersion$5(ChannelSession.java:282)
        at java.base/java.util.Optional.orElseThrow(Optional.java:408)
        at org.wildfly.channel.ChannelSession.findChannelWithLatestVersion(ChannelSession.java:274)
        at org.wildfly.channel.ChannelSession.resolveMavenArtifact(ChannelSession.java:118)
        at org.wildfly.prospero.galleon.ChannelMavenArtifactRepositoryManager.resolve(ChannelMavenArtifactRepositoryManager.java:73)
        ... 31 more

Prospero is looking for a steam inside the channel to get the version of org.jboss.universe:community-universe:jar but this GAV is not part of the server and will not be in the channel.

I tried to generate the distributions by using Maven GAVs for the feature packs (eg org.wildfly:widfly-galleon-pack:33.0.0.Beta1-SNAPSHOT instead of their universe feature pack locations (wildfly@maven(org.jboss.universe:community-universe):current#33.0.0.Beta1-SNAPSHOT) and Prospero was able to succeeds:

$ cat .installation/provisioning_record.xml
<?xml version="1.0" ?>

<installation xmlns="urn:jboss:galleon:provisioning:3.0">
    <transitive>
        <feature-pack location="org.wildfly:wildfly-ee-galleon-pack:33.0.0.Beta1-SNAPSHOT">
            <packages>
                <include name="docs.examples.configs"/>
            </packages>
        </feature-pack>
    </transitive>
    <feature-pack location="org.wildfly:wildfly-galleon-pack:33.0.0.Beta1-SNAPSHOT"/>
    <options>
        <option name="jboss-fork-embedded" value="true"/>
    </options>
</installation>

./prospero update perform -vv --debug  --dir=/Users/jmesnil/Developer/wildfly/dist/target/wildfly-33.0.0.Beta1-SNAPSHOT --use-default-local-cache
Updating server: /Users/jmesnil/Developer/wildfly/dist/target/wildfly-33.0.0.Beta1-SNAPSHOT

18:15:40,430 INFO  [prospero] PRSP000012: Checking available updates
18:15:40,430 INFO  [prospero] PRSP000012: Checking available updates
Jun 10, 2024 6:15:40 PM java.lang.System$LoggerFinder lambda$accessProvider$0
WARNING: Failed to instantiate LoggerFinder provider; Using default.
18:15:43,842 INFO  [prospero] PRSP000013: Found 0 updates
18:15:43,842 INFO  [prospero] PRSP000013: Found 0 updates
No updates found.
Operation completed in 3.64 seconds.

@spyrkob Should Prospero be able to work with universe FPL? In my case, I only produced snapshots of WildFly in my local repo cache so I'm not sure if that's a correct setup.

jmesnil avatar Jun 10 '24 16:06 jmesnil

@jmesnil we should probably find a way to support the FPL in Prospero. The easiest approach would be to add the community-universe and wildfly-producers to the WildFly channel, but like you said they're not part of the server and don't really belong there. Maybe we can create a universe channel that the WildFly channel would depend on?

spyrkob avatar Jun 11 '24 08:06 spyrkob

I see 3 possible solutions:

  1. Do not use Galleon FPL when we store the provisioning info and record instead the Maven artefact GAV directly. There is a galleon options for this (store-input-provisioning-config)
  2. Add a stream in WildFly channels for the the org.jboss.universe:community-universe artifact (the latest release is 1.2.0.Final and was done 3 years ago so that seems a low maintenance solution)
  3. Make Prospero "understand" the maven(org.jboss.universe:community-universe) FPL out of the box (like the Galleon CLI tool is doing)

@jfdenise As you filed GAL-341, what do you think we should use to store the provisioning metadata in WildFly. We need to have a solution that would not break any usage of galleon.sh.

jmesnil avatar Jun 12 '24 07:06 jmesnil

@jmesnil , you should not have the transitive feature-pack wildfly-ee, the package 'docs.examples.configs' should be directly resolved from wildfly feature-pack. In addition you should remove the feature-pack versions from the plugin configuration. This versionshould not be set in a channel context.

galleon.sh update expects the usage of its own channels: current, 32.0, ... in the form of wildfly@maven(org.jboss.universe:community-universe):current and doesn't work well with GAV

If we want an installation to be updated from the 2 different tools, we should have the community universe in the channel. As you said that is not a big deal. The channel contains feature-pack, galleon-plugins that are not part of the server either, just used at provisioning time.

jfdenise avatar Jun 13 '24 11:06 jfdenise

you should not have the transitive feature-pack wildfly-ee, the package 'docs.examples.configs' should be directly resolved from wildfly feature-pack. In addition you should remove the feature-pack versions from the plugin configuration.

The .galleon/provisioning.xml is identical to the one generated by the galleon-maven-plugin. The changes you suggest should be done in our existing setup, right?

jmesnil avatar Jun 13 '24 14:06 jmesnil

@jmesnil yes.

jfdenise avatar Jun 13 '24 15:06 jfdenise

retest this please

jmesnil avatar Sep 18 '24 07:09 jmesnil

@bstansberry Failing tests have been fixed and the PR should be ready to merge

jmesnil avatar Sep 19 '24 11:09 jmesnil

Thanks @jmesnil @spyrkob

bstansberry avatar Dec 03 '24 23:12 bstansberry