-
-
Notifications
You must be signed in to change notification settings - Fork 6.9k
CI: Rework publish pipeline for "openapi-generator-gradle-plugin" #411
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
Comments
Some notes about publishing the gradle plugin during releases: If the build is not failing (green build) then you might be able to just redo the publication. (This was the case for Go to: https://oss.sonatype.org/#stagingRepositories Collect the items:
There is more file Put them in a folder /org/openapitools/openapi-generator-gradle-plugin/{version} Edit the repositories {
mavenCentral()
maven {
url "file://<path to folder>"
}
} Then run:
Example for the
In the
In Nexus Select “Staging Upload” https://oss.sonatype.org/#staging-upload Select:
Wait until the upload is complete. When it is successful you see something like this: Test it again locally, edit the repositories {
mavenCentral()
maven {
url "https://oss.sonatype.org/content/repositories/orgopenapitools-1034"
}
} Then run again:
If the gradle build is successful you can go to |
@jmini I'd brought this up on Gitter, but you may not have seen it. The Travis timeout is because Travis defaults to 10 min of timeout. We can increase this ad hoc per command using The issue of splitting repositories is because Travis CI is apparently proxying requests and reporting multiple IP addresses. We can reach out to the Travis team to understand if there's a workaround. |
I sent an email to Travis CI support and CC'd the OpenAPI Tools team. I'll report back here when I have a response. |
We got an answer, they stick to not changing anything on there side as indicated in https://issues.sonatype.org/browse/OSSRH-37302 We can still work on one of the solution exposed in my first message here. I also spoke with @wing328 about it. For the moment it is a low prio. Republishing the gradle plugin manually is not such a big deal. |
PR for this approach: #902 |
Revisiting this as requested recently. The issue we're seeing is caused by:
What this means: When file upload requests are passed through Travis CI's load balancer, they have a different IP address and Sonatype ends up creating a new staging repository for each new IP. So as each jar is uploaded, it may or may not end up in the same staging repository as the previously uploaded jar. There's a feature request open on gradle (gradle/gradle#5711) to support adding staging repository id for Nexus repos (Sonatype). Apparently, some users have workarounds (taken from the gradle issue above): https://github.com/h2oai/sparkling-water/blob/master/gradle/publish/createStagingId.sh I have seen other attempts at resolution with disabling sudo on Travis configuration. That doesn't seem to work. As Jérémie suggested, we could publish to Bintray and then sync to Maven Central. Grails does this, and they also use Travis (see grails-core). DiscussionThe workarounds aren't really ideal because they end up coupling our deployments to the Sonatype API, and those types of workarounds are arguably more difficult to reason about than just publishing locally until there's a better solution. I would think that Sonatype could easily support tracking a unique series of request by a trace id HTTP header, and that the uploader in Gradle could then support that trace header. But, I don't know if Sonatype's strategy for creating new staging repositories per IP address regardless of the user/pass/repo/artifact version defined in the publish has some other meaning that we're unaware of. That is, if I'm publishing openapi-generator-gradle-plugin-3.3.1 artifacts and my requests have authenticated successfully, I don't see reason that these multiple artifacts should be shuffled to separate staging repositories. I'll be moving in a couple weeks, so hopefully my free time to investigate further will pick up afterward. I would suggest publishing manually for now. We could discuss potential solutions in one of the linked issues as well. |
I've found what appears to be a solid approach to publishing the Gradle artifact as part of the travis ci build. @jmini https://github.com/osmlab/atlas/wiki/Gradle,-Travis-CI-and-Maven-Central looks like an approach that I'd be more comfortable evaluating than the link to the sparkling-water repo above. Would you have any concerns with evaluating this approach? If not, I'll work on integrating it over the next week or two. |
If I understood the article correctly, they perform the "upload to nexus" part not with normal gradle publish task but with a custom Why not... but it sounds complicated to me. Following the links and the issues, I have the feeling that a gradle solution exists: I think that the
Is no longer recommended with newer version of gradle. the |
@jmini the plugin you've linked only closes and promotes the repository. Our issue is one phase earlier, where the upload splits into multiple repositories. The scripted solution just uses Sonatype's API to upload the artifacts. It's not too different from what the plugin is doing, except that it supports creating the repository where the plugin does not. Three are two maven plugins, we're using the only one that works, unfortunately. The other doesn't support code signing or javadocs. I forget which one isn't supported, but it is one of the required artifacts for Sonatype's deployment. I'll try to find the time to POC this. I think 4.0.0 isn't the right time to try out a new publish workflow. |
I have observed the problem that multiple distant repository are created on the maven-central nexus, when I publish from my company network (no idea how the infrastructure). You are right But there is an other one: Both plugins
At the beginning the signing plugin was only working with |
…-schematics-8.x chore(deps): update dependency @nestjs/schematics to v8
The automated deploy of the
openapi-generator-gradle-plugin
is not working.With
3.0.1
and3.0.2
there was a TravisCI timeout in the job.With
3.0.3
the TravisCI Job is OK.Log: https://api.travis-ci.org/v3/job/397359374/log.txt
Maven deploy:
Source:
openapi-generator/.travis.yml
Lines 108 to 109 in 9b909df
Log Extract: end of the maven deploy step:
Gradle Uplaoad:
Source:
openapi-generator/.travis.yml
Lines 112 to 113 in 9b909df
Log Extract for the
uploadArchives
task:The artefacts were uploaded to Nexus. But a look in the Staging repository show multiple staging repo:
https://oss.sonatype.org/#stagingRepositories
Content of the different repos:
openapitools-1031
contains only:/org/openapitools/openapi-generator-gradle-plugin/3.0.3/openapi-generator-gradle-plugin-3.0.3.pom.asc.md5
openapitools-1030
contains:/org/openapitools/openapi-generator-gradle-plugin/3.0.3/openapi-generator-gradle-plugin-3.0.3-javadoc.jar.sha1
/org/openapitools/openapi-generator-gradle-plugin/3.0.3/openapi-generator-gradle-plugin-3.0.3-sources.jar
/org/openapitools/openapi-generator-gradle-plugin/3.0.3/openapi-generator-gradle-plugin-3.0.3.jar.asc.md5
openapitools-1024
This is a known issue:
https://issues.sonatype.org/browse/OSSRH-37302?attachmentViewMode=list
I see multiple solutions:
1/ Use the nexus-staging-maven-plugin:
My understanding (see also #366) is that if we manage to install the artifacts (jars, pom, signature files) to
<root repo>/target/nexus-staging/deferred/
during the maven build (as a regular step of theopenapi-generator-gradle-plugin-mvn-wrapper
project) then it will be uploaded in one step at the end of the build.This is more or less what is recommended in OSSRH-37302
2/ Switch CI Server. According to @jimschubert there is no problem with GitLab-CI
3/ Switch Staging server.
Bintray is free for Open Source project.
I think that a lot of projects using gradle are using Bintray. I think that AsciidoctorJ is doing it like this.
The text was updated successfully, but these errors were encountered: