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

feat: add table of modules for a libraries-bom version to README #6083

Merged
merged 10 commits into from Jul 21, 2023

Conversation

alicejli
Copy link
Contributor

Follow up from #6069

Publishing the table of included artifacts for a libraries-bom to the README

@product-auto-label product-auto-label bot added the size: xl Pull request size is extra large. label Jul 11, 2023
@alicejli alicejli marked this pull request as ready for review July 11, 2023 14:50
@alicejli alicejli requested a review from a team as a code owner July 11, 2023 14:50
Copy link
Member

@meltsufin meltsufin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it make sense to consolidate all of the scripts into just one script, or at least a single entry-point that updates the readme so that it can be easily executed locally without having to think which scripts have to run in what order and with what arguments?

@meltsufin
Copy link
Member

@alicejli Have you tried using the Maven flatten plugin?
Add the following configuration to libraries-bom/pom.xml:

      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>flatten-maven-plugin</artifactId>
        <configuration>
          <updatePomFile>true</updatePomFile>
          <pomElements>
            <dependencyManagement>expand</dependencyManagement>
          </pomElements>
        </configuration>
      </plugin>

Then run mvn flatten:flatten. You should get the .flattened-pom.xml that should list all of the artifacts and versions contained in the lbraries-bom.

@alicejli
Copy link
Contributor Author

@alicejli Have you tried using the Maven flatten plugin? Add the following configuration to libraries-bom/pom.xml:

      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>flatten-maven-plugin</artifactId>
        <configuration>
          <updatePomFile>true</updatePomFile>
          <pomElements>
            <dependencyManagement>expand</dependencyManagement>
          </pomElements>
        </configuration>
      </plugin>

Then run mvn flatten:flatten. You should get the .flattened-pom.xml that should list all of the artifacts and versions contained in the lbraries-bom.

Ah that's very handy! Thanks for showing. That is much simpler.
Are there any concerns with adding this configuration to the libraries-bom/pom.xml? I don't think I need the <updatePomFile>true</updatePomFile> line for it to work.

It seems like if I have:

  1. A github actions workflow that runs mvn flatten:flatten
  2. a script that parses the .flattened-pom.xml and updates the README, and discards the created .flattened-pom.xml files.

that would be a neat way to create the table.

@alicejli
Copy link
Contributor Author

@meltsufin I've updated the scripts to use the maven flatten plugin which reduces a lot of the complexity - thanks for the idea!

cc @burkedavison as we chatted about this a bit this morning

The main challenge that I'm curious to get your thoughts on how to solve is getting the latest/updated client documentation/product reference links.
Those links are contained within each module's .repo-metadata.json file, and the previous iteration of this PR was grabbing those links when checking out each repo.
The .repo-metadata.json files are not updated frequently (if ever), so it seems a bit much to re-introduce checking out the repos for just those links. The main thing that would get out of date is whenever a new client library is generated.

The most ongoing toilsome method (which I don't think would be too toilsome given that we don't generate new client libraries that frequently) would be to do nothing and have it as a documented step as part of new client library generation to manually update the links for the product/client reference in this repo.

Do you have any thoughts on the best approach to keeping those links updated?

@burkedavison
Copy link
Contributor

have it as a documented step as part of new client library generation to manually update the links for the product/client reference in this repo

Despite updates to .repo-metadata.json being rare, they do happen; and solving this situation by manual-process would set up a second source of truth for that data with inevitable desyncing issues that must be discovered each time before we can fix them. (One example source of concern: We don't review changes made to handwritten repos, so we'd be trusting that every Java SDK developer knows about this table's implementation needs.)

This may be a departure from the current direction we've been discussing; but I'd rather see logic that fetches the source of truth, and regenerates the client-library portion of the table from scratch each time rather than in-place updating. In the end, I think the goal should be that this table doesn't need any special handling when adding, removing, or updating client libraries.

@meltsufin
Copy link
Member

The main challenge that I'm curious to get your thoughts on how to solve is getting the latest/updated client documentation/product reference links. Those links are contained within each module's .repo-metadata.json file, and the previous iteration of this PR was grabbing those links when checking out each repo. The .repo-metadata.json files are not updated frequently (if ever), so it seems a bit much to re-introduce checking out the repos for just those links. The main thing that would get out of date is whenever a new client library is generated.

We certainly should not create another manually maintained source of truth for library metadata. However, I don't like getting this information from the .repo-metadata.json either. It's seems error-prone. I think the best place to get this information is from the pom.xml metadata. It already supports things like project name and URL. If we are currently not providing this information in the POM, let's update our generation scripts to do that. In the meantime the table can just be missing this information.

@alicejli
Copy link
Contributor Author

The main challenge that I'm curious to get your thoughts on how to solve is getting the latest/updated client documentation/product reference links. Those links are contained within each module's .repo-metadata.json file, and the previous iteration of this PR was grabbing those links when checking out each repo. The .repo-metadata.json files are not updated frequently (if ever), so it seems a bit much to re-introduce checking out the repos for just those links. The main thing that would get out of date is whenever a new client library is generated.

We certainly should not create another manually maintained source of truth for library metadata. However, I don't like getting this information from the .repo-metadata.json either. It's seems error-prone. I think the best place to get this information is from the pom.xml metadata. It already supports things like project name and URL. If we are currently not providing this information in the POM, let's update our generation scripts to do that. In the meantime the table can just be missing this information.

Cool. We don't currently provide the links to the client/product documentation in the POM, but I can create an issue to do so (with a follow-up issue to update this table with the links from the POM once they exist).

I did some testing and I don't believe there's a way to use the maven flatten plugin to get the metadata for the dependencies as well as it only includes the info here: https://maven.apache.org/ref/2.2.1/maven-model/maven.html#class_dependency. So to get the links from the pom.xml metadata, it would involve a script to ping Maven Central. This is all doable, but just want to point out that I don't think we can create the full table from just using the flatten plugin.

One question before I update this PR - @meltsufin would it be okay to keep the current links? I feel like the table is much more useful with them and even if they get stale/new library links won't exist, I think it's better to have them than not. I can add a footnote to the table saying links may be out of date in the meantime.

@meltsufin
Copy link
Member

@alicejli Correct, the flatten plugin is not going to give us that metadata from the POMs and we would have to fetch them from Maven Central, which I still think is more robust than the .repo-metadata.json.

Regarding the links, I assume you're talking about the product links, I'm OK with keeping them temporarily.

@alicejli
Copy link
Contributor Author

@alicejli Correct, the flatten plugin is not going to give us that metadata from the POMs and we would have to fetch them from Maven Central, which I still think is more robust than the .repo-metadata.json.

Regarding the links, I assume you're talking about the product links, I'm OK with keeping them temporarily.

Yep, I agree on the point about getting the metadata from Maven Central. And yes, I'm talking about the links to the product documentation as well as the Cloud RAD client reference info. I will update the PR accordingly and then re-request review.

@meltsufin
Copy link
Member

Yep, I agree on the point about getting the metadata from Maven Central. And yes, I'm talking about the links to the product documentation as well as the Cloud RAD client reference info. I will update the PR accordingly and then re-request review.

Can Cloud RAD links be automatically calculated on the fly?

@alicejli
Copy link
Contributor Author

Yep, I agree on the point about getting the metadata from Maven Central. And yes, I'm talking about the links to the product documentation as well as the Cloud RAD client reference info. I will update the PR accordingly and then re-request review.

Can Cloud RAD links be automatically calculated on the fly?

Good point. Will auto-generate those.

@product-auto-label product-auto-label bot added size: l Pull request size is large. and removed size: xl Pull request size is extra large. labels Jul 18, 2023
@alicejli alicejli requested a review from meltsufin July 18, 2023 18:32
@alicejli alicejli merged commit c1df19d into main Jul 21, 2023
24 checks passed
@alicejli alicejli deleted the updateREADME branch July 21, 2023 14:19
@release-please release-please bot mentioned this pull request Jul 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
size: l Pull request size is large.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants