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

Ability to create and release staging repository in separate calls (e.g. after manual verification) #19

Closed
szpak opened this issue Mar 18, 2020 · 5 comments
Labels
enhancement New feature or request
Milestone

Comments

@szpak
Copy link
Contributor

szpak commented Mar 18, 2020


Proposal by @vlsi placed originally here, extracted to a separate (this) issue.


I propose the following workflow:

Stage release artifacts

  1. As release manager starts the release, they decide release version. For instance, it could be v1.0-rc1. The version could be configured in the sources or passed via parameters (it does not matter)
  2. initializeStagingRepository takes that version number, and puts it to the staging repository metadata. I'm not sure what are the possibilities, however, I'm sure the version can be put to the "comment" field
  3. initializeStagingRepository produces an @Output with stagingRepositoryId. It could save the id to file (files are commonly expected task inputs and outputs). It could provide the id via Property<String>.

Verify release

  1. Everybody might want to verify the artifacts. They know "release candidate index", and they can pass it to the build script, so it locates the relevant staging repository, dowloads the artifacts, and validates them.

Publish release

The release manager remembers "release candidate version" to be released, and it passes that parameter to the build script.
4) findStagingRepository(version=...) task queries Nexus, and it detects the staging repository id. Then regular closeRepositoryOrWhatever task could be used to close&promote the repository.

^^^ Note: the above is not something that must be used by everybody. It is just a sample.
Of course, one could combine all the tasks into a single Gradle execution.

In other words, I suggest using Nexus Server for storage of "repository id" rather than "repository extension".


The subsequent comment by @visi:


In 99.42% of the cases, users want reasonable comments for their staging repositories.
For instance, I have the following:
Nexus staging repositories

It corresponds to ~5 or so "release candidates".
The version tree between them looks as follows:
git version tree

I have multiple "closed" repositories, and I can easily test each version individually, and later I can decide which one is better.

What if I want to promote v3.0-rc5 as the final release?
There's no clear way to tell which staging repository belongs to each RC number :(


On the other hand, if staging repositories did include user-provided reference (e.g. version number, git sha, or whatever else), then end user would be able to promote the relevant repository.

In other words, it would be possible to promote the release candidate by specifying a single rc index: ./gradlew publishDist -Prc=5

Note: as you might guess, I have built a lot of different release candidates, and I probably did ./gradlew clean in between. So I keeping rc index <-> staging repo id link in the build folder is not really an option.

@szpak
Copy link
Contributor Author

szpak commented Feb 8, 2021

I think we could add a stagingRepositoryId property to the InitializeNexusStagingRepository task and write it to a file. I don't see this as must-have for the initial release, though.

An output property sounds good for me. I'm not sure about the file. Where should it be kept (in build/)? How about the cleaning policy? Do you think that outdated id file could be problematic?

@vlsi
Copy link
Contributor

vlsi commented Feb 8, 2021

Ideally, the plugin should be able to infer the staging repository id based on the comment.

In other words: if user wants to release v3.0-rc5, then the plugin should enumerate the closed repositories, detect v3.0-rc5 there, and use its id.

I believe that is the best approach as it won't add an accidental dependency on the local filesystem.

@rwinch
Copy link

rwinch commented Feb 18, 2021

I'd like to see this implemented as well. Ideally it would be implemented using the entire GAV (group:artifact:version) and not just the version. The reason is that some projects have a single account to publish more than one artifact. This would avoid problems for scenarios where two teams are publishing the same version but different artifacts at the same time.

@rwinch
Copy link

rwinch commented Feb 19, 2021

Thinking about it a bit more it is likely that the strategy needs to be able to be customized for a multi-module build to work. Perhaps it should default to group:version instead.

gcf-merge-on-green bot pushed a commit to googleapis/gax-java that referenced this issue Oct 13, 2021
…ven central (#1512)

Until [this issue](gradle-nexus/publish-plugin#19) is resolved, gax cannot use nexus-publish to publish to maven central because the plugin do not persist stagingProfile information between command runs. Thus both the staging command and publish command has to be run in a single command. But, since gax has multiple modules(each modules gets staged in separate run) this is not a workable approach.

So currently, the library gets staged to sonatype. Publish it manually from there(Get permission to publish if you frequently publish gax-java or @Neenu1995  can publish). A possible move to maven pom might be a better solution also.
@vlsi
Copy link
Contributor

vlsi commented Jun 30, 2022

I just noticed #36 added ability to configure repository description.

So the missing bit is to add API to lookup the staging repository based on the description.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants