-
Notifications
You must be signed in to change notification settings - Fork 30
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
Add FindStagingRepository task to find staging repository by its description #145
Conversation
@szpak , @marcphilipp , any thoughts? |
I'm "out of office" and I will not be able to review that before August :-/. |
src/e2eTest/kotlin/io/github/gradlenexus/publishplugin/e2e/NexusPublishE2ETests.kt
Outdated
Show resolved
Hide resolved
@szpak , @marcphilipp , do you think you could have some cycles for reviewing the change? |
src/e2eTest/kotlin/io/github/gradlenexus/publishplugin/e2e/NexusPublishE2ETests.kt
Outdated
Show resolved
Hide resolved
src/main/kotlin/io/github/gradlenexus/publishplugin/NexusPublishPlugin.kt
Show resolved
Hide resolved
src/main/kotlin/io/github/gradlenexus/publishplugin/FindStagingRepository.kt
Outdated
Show resolved
Hide resolved
src/compatTest/kotlin/io/github/gradlenexus/publishplugin/NexusPublishPluginTests.kt
Show resolved
Hide resolved
src/main/kotlin/io/github/gradlenexus/publishplugin/FindStagingRepository.kt
Outdated
Show resolved
Hide resolved
src/main/kotlin/io/github/gradlenexus/publishplugin/internal/NexusClient.kt
Outdated
Show resolved
Hide resolved
Sorry for delay with reviewing @vlsi :-/. I gave it a try today and planned to finish it and merge. However, after I wrote mocked integration tests and I've found some things to discuss (commented inline). Of course, if you are still interested in getting it done. |
We should probably define what happens if multiple repositories match. We might add an enum like: FAIL (default), USE_LATEST |
src/main/kotlin/io/github/gradlenexus/publishplugin/internal/NexusClient.kt
Outdated
Show resolved
Hide resolved
src/compatTest/kotlin/io/github/gradlenexus/publishplugin/NexusPublishPluginTests.kt
Show resolved
Hide resolved
src/compatTest/kotlin/io/github/gradlenexus/publishplugin/NexusPublishPluginTests.kt
Outdated
Show resolved
Hide resolved
|
||
@ParameterizedTest(name = "{0}") | ||
@ValueSource(strings = ["nexus-publish-e2e-minimal", "nexus-publish-e2e-multi-project"]) | ||
fun `release project to real Sonatype Nexus in two executions`(projectName: String) { |
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.
- It will most likely fails, as the version is timestamp based to avoid problem described in [OSSRH-86532] Use different version numbers in e2e on CI #153 (in addition the version is not properly set in the multi-module e2e project as I mentioned in the comment a few days ago).
- I can run it from a side branch to verify (if you think
1.
is wrong or once there is a workaround - what do you propose?), but in general, I'm still not sure, if we should call it on every merge/push to master, as e2e tests (despite their name) are rather smoke/sanity tests for critical scenarios.
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.
as the version is timestamp based to avoid problem described
What do you think of passing the version on the command line instead?
I'm still not sure, if we should call it on every merge/push to master, as e2e tests (despite their name) are rather smoke/sanity tests for critical scenarios.
There are only 2 merges to master per year. Is adding a test really a problem?
If you absolutely want to reduce the number of interactions with Central, you might consider launching a random subset of tests every time.
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.
There are only 2 merges to master per year. Is adding a test really a problem?
It depends of a time window. I see 17 commits to master in 2 weeks :). With 2x30+ projects releases released to Nexus.
In general, this is not a big problem right now (especially that I plan to reduce number of e2e tests execution #181 to mainly master and cron), but I'm really happy being able to perform the real e2e testing with the real Sonatype Nexus and it would be problematic to get banned (or something). E2E test should cover the main/critical scenarios and from my experience, especially in the "enterprise stuff", they tend to grow (with all the maintenance issues). I'm really curious, how many project will use the new mode (and publishing performed in two phases).
Anyway, let's see how many build it trigger in the coming weeks. In the worst case, we could add a switch to just call them (the new one) from cron, not for every master build.
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 do you think of passing the version on the command line instead?
Yes, give me a moment, I'm playing with some idea.
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.
Would adding -PoverriddenVersion=somethingUnique
twice with the same (unique) value generated in given
be enough?
gradle-nexus/nexus-publish-e2e-minimal@6a6fbdb
gradle-nexus/nexus-publish-e2e-multi-project@a2de98f
(just update the submodules and later commit changes switching the pointers in the main repo in your PR)
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.
Btw, how would you approach the issue with:
:nexus-publish-e2e-multi-project:unspecified
reported for the root project? Here, in the multi-module Kotlin project, the things are slightly complicated as the version is set in buildSrc/library-publishing-conventions.gradle.kts
just for submodules?
|
||
@ParameterizedTest(name = "{0}") | ||
@ValueSource(strings = ["nexus-publish-e2e-minimal", "nexus-publish-e2e-multi-project"]) | ||
fun `release project to real Sonatype Nexus in two executions`(projectName: String) { |
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.
There are only 2 merges to master per year. Is adding a test really a problem?
It depends of a time window. I see 17 commits to master in 2 weeks :). With 2x30+ projects releases released to Nexus.
In general, this is not a big problem right now (especially that I plan to reduce number of e2e tests execution #181 to mainly master and cron), but I'm really happy being able to perform the real e2e testing with the real Sonatype Nexus and it would be problematic to get banned (or something). E2E test should cover the main/critical scenarios and from my experience, especially in the "enterprise stuff", they tend to grow (with all the maintenance issues). I'm really curious, how many project will use the new mode (and publishing performed in two phases).
Anyway, let's see how many build it trigger in the coming weeks. In the worst case, we could add a switch to just call them (the new one) from cron, not for every master build.
src/compatTest/kotlin/io/github/gradlenexus/publishplugin/NexusPublishPluginTests.kt
Outdated
Show resolved
Hide resolved
@@ -76,6 +76,16 @@ class NexusPublishPlugin : Plugin<Project> { | |||
repository, | |||
registry | |||
) | |||
val findStagingRepository = rootProject.tasks.register<FindStagingRepository>( |
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.
Btw, we need to document it somewhere, to let people know. Would you see it in README or we should just mention it in the README, but provide sample used on the wiki?
With -PoverriddenVersion=... However, that version still has to be unique. For e2e tests of releasing in two executions with findStagingRepository: gradle-nexus/publish-plugin#145
With -PoverriddenVersion=... However, that version still has to be unique. For e2e tests of releasing in two executions with findStagingRepository: gradle-nexus/publish-plugin#145
After having some more thought, I incline to a different design: what if Then it would handle cases like Well, it might worth adding an extra property to
WDYT? Then:
Then it would be just fine to execute any command individually without mentioning
Well, apparently, the staging repository is created after the repository description of the root project. So there are two approaches here: |
I've unified the code and added the description. |
stagingRepositoryId.isPresent -> dummyDetachedConfiguration | ||
else -> findStagingRepositoryTask | ||
} | ||
} |
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 we could extract it with "meaningful name" and use twice?
E.g.
findStagingRepositoryTaskIfStagingRepositoryIdIsNotPresentProvider(project)
|
||
@Internal | ||
val stagingRepositoryId = objects.property<String>() | ||
|
||
@TaskAction | ||
fun createStagingRepo() { |
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.
That name would be no longer valid
} | ||
} | ||
} | ||
} |
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.
Sorry, but that is too complex as a "one-liner" assigning a value to descriptor
. 5 levels of nested statement and clumsy conditional logic. It would need to be refactored into smaller pieces, however, please take a look at the "general comment" to new approach before doing any actions here.
In general, changing the behavior of the init task (and effectively also Talking about the feature itself, I might imagine a situation when, someone calls I wonder if switching |
I am afraid we go in circles, and there's no way it could be merged. I would rather close the pr and fork gnpp |
Sorry @vlsi, but this time I really don't get you. Please take a look at the open comment yesterday:
Otherwise, I liked the version and wanted to merge it (with working e2e tests and docs). Are those two comments above ridiculous? And today, suddenly, you completely (really) reworked the whole concept. I put the two main comments:
I believe that for also for some other people reading that code it could be "not so straightforward" in that form. If that "is getting nowhere", well, I don't know what to response. |
What bothers me the most is:
My expectations are:
What I see is pure unpredictability. I have absolutely no idea what could be merged and what not. Of course, you are free to do whatever you want with the project, however, based on the reviews above I lost interest in contributing further. |
You closed that one and in the other thread I proposed to generate a unique version in Gradle and call it twice in the e2e test (at least for single-module project it should work right now).
That's not true. They are separate projects. You can clone it and release with a regular Gradle command from your console. Just provide your own staging profile and credentials. There were separated to have that freedom. Having them (just the one with the single module, unless you already fixed the issue with the multi-module one) green locally (or feeling it should be), I can trigger them manually from CI, after the recent changes - #183. Neverhtless, if you feel overwhelmed by the submodules, I can do that myself in this branch. No problem. Just let me know. |
I see and regret. You were a valuable contributor. In that case, I will probably take the previous version of this PR, which - as I wrote - is fine for me to merge (the one before you unexpectedly proposed revolutionary changes, which I had some doubts about and suggested an important case which could be broken, but you didn't even try to comment it), add one e2e test, write some documentation to allow people to find that feature and put it into the next release. Thanks for all your contribution (in code and comments) so far (in that project and many others!). Maybe you will find this project interesting to contribution in the future again. |
Superseded by #201. |
The task would be helpful when "publish staged repository" is implemented as a separate step.
See #19