Dropping staging repository after promotion

161 views
Skip to first unread message

Marcin Zajączkowski

unread,
Feb 14, 2017, 8:20:36 PM2/14/17
to ossrh...@glists.sonatype.com
Hi,

Writing my gradle-nexus-staging-plugin [1] I assumed that successful
promotion the staging repository is automatically dropped.

However, I've got reports from the users that the repository stays there
for some time and it complicats releasing from a CI/CD server more than
one project (Gradle doesn't return the information about the repository
ID where the artifacts have been uploaded and I expect to have just one
staging repository in a given state in a given moment).
In addition in the UI, after promotion there is a message:
> Staging repository has been released and can be safely dropped.

Therefore, would dropping (via REST) a staging repository just after
promotion is completed (when the operation is effectively completed - is
not "in progress" anymore) be faster than waiting for dropping performed
automatically by Nexus?


[1] - https://github.com/Codearte/gradle-nexus-staging-plugin/

Marcin

--
http://blog.solidsoft.info/ - Working code is not enough

Peter Lynch

unread,
Feb 15, 2017, 1:05:05 PM2/15/17
to Marcin Zajączkowski, OSSRH Users
On Tue, Feb 14, 2017 at 9:20 PM, Marcin Zajączkowski <msz...@wp.pl> wrote:
Hi,

Writing my gradle-nexus-staging-plugin [1] I assumed that successful
promotion the staging repository is automatically dropped.

By promotion you must mean release, which accesses a resource called 'promote'?

Promoted repositories to build promotion profiles would never delete the underlying repo(s) that were promoted.
 
Since Nexus 2.3, there is a configurable option to not drop a released repository. By default, all released repositories before Nexus 2.3 were dropped automatically after release.

Basically, as long as the release operation tells nexus to drop after release, I would not try to artificially encourage it by sending additional requests. This is just going to put a bunch of ERROR messages in the nexus log ( because state will be transitioning) and raise even more suspicion something is wrong, when really it is not.


However, I've got reports from the users that the repository stays there
for some time and it complicats releasing from a CI/CD server more than
one project (Gradle doesn't return the information about the repository
ID where the artifacts have been uploaded and I expect to have just one
staging repository in a given state in a given moment).
 
In addition in the UI, after promotion there is a message:
> Staging repository has been released and can be safely dropped.


This means they didn't choose to automatically drop the released repo. In the UI they would have seen this option:

Inline image 1

If selected when released, this translates to sending an "autoDropAfterRelease":true value in the POSTED JSON payload.

{"data":{"autoDropAfterRelease":true,"description":"drop this after release","stagedRepositoryIds":["example-1005"]}}

A quick look at your plugin source seems to indicate you don't set this to true, which is going to mean the repository is not automatically dropped.

 -Peter

Therefore, would dropping (via REST) a staging repository just after
promotion is completed (when the operation is effectively completed - is
not "in progress" anymore) be faster than waiting for dropping performed
automatically by Nexus?


[1] - https://github.com/Codearte/gradle-nexus-staging-plugin/

Marcin

--
http://blog.solidsoft.info/ - Working code is not enough

--
You received this message because you are subscribed to the Google Groups "OSSRH Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ossrh-users+unsubscribe@glists.sonatype.com.
To post to this group, send email to ossrh...@glists.sonatype.com.
To view this discussion on the web visit https://groups.google.com/a/glists.sonatype.com/d/msgid/ossrh-users/3ea2073c-73fa-da30-fc69-095ed87e26fc%40wp.pl.

Marcin Zajączkowski

unread,
Feb 15, 2017, 4:10:19 PM2/15/17
to OSSRH Users
Thanks Peter for your detailed reply.

(...)
> Since Nexus 2.3, there is a configurable option to not drop a released
> repository. By default, all released repositories before Nexus 2.3 were
> dropped automatically after release.

When I was implementing my plugin 2 years ago OSSRH had been probably
hosted by Nexus <2.3 and it wasn't a problem.

(...)
> If selected when released, this translates to sending an
> "autoDropAfterRelease":true
> value in the POSTED JSON payload.
>
> {"data":{"autoDropAfterRelease":true,"description":"drop this after
> release","stagedRepositoryIds":["example-1005"]}}
>
> A quick look at your plugin source
> <https://github.com/Codearte/gradle-nexus-staging-plugin/blob/master/src/main/groovy/io/codearte/gradle/nexus/logic/AbstractStagingOperationExecutor.groovy#L11>
> seems to indicate you don't set this to true, which is going to mean the
> repository is not automatically dropped.

That's something I needed. Much better than waiting for the promotion
operation to stop being "in transition". I will add it in the next
version of my plugin.

Thanks
Marcin
> <https://github.com/Codearte/gradle-nexus-staging-plugin/blob/master/src/main/groovy/io/codearte/gradle/nexus/logic/AbstractStagingOperationExecutor.groovy#L11>
> seems to indicate you don't set this to true, which is going to mean the
> repository is not automatically dropped.
>
> -Peter
>
> Therefore, would dropping (via REST) a staging repository just after
>> promotion is completed (when the operation is effectively completed - is
>> not "in progress" anymore) be faster than waiting for dropping performed
>> automatically by Nexus?
>>
>>
>> [1] - https://github.com/Codearte/gradle-nexus-staging-plugin/
>>
>> Marcin
>>
>> --
>> http://blog.solidsoft.info/ - Working code is not enough
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "OSSRH Users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to ossrh-users...@glists.sonatype.com.
>> To post to this group, send email to ossrh...@glists.sonatype.com.
>> To view this discussion on the web visit https://groups.google.com/a/
>> glists.sonatype.com/d/msgid/ossrh-users/3ea2073c-73fa-
>> da30-fc69-095ed87e26fc%40wp.pl.
>>
>


Marcin Zajączkowski

unread,
Feb 15, 2017, 4:37:35 PM2/15/17
to OSSRH Users
On 2017-02-15 22:10, Marcin Zajączkowski wrote:
> Thanks Peter for your detailed reply.
>
> (...)
>> Since Nexus 2.3, there is a configurable option to not drop a released
>> repository. By default, all released repositories before Nexus 2.3 were
>> dropped automatically after release.
>
> When I was implementing my plugin 2 years ago OSSRH had been probably
> hosted by Nexus <2.3 and it wasn't a problem.
>
> (...)
>> If selected when released, this translates to sending an
>> "autoDropAfterRelease":true
>> value in the POSTED JSON payload.
>>
>> {"data":{"autoDropAfterRelease":true,"description":"drop this after
>> release","stagedRepositoryIds":["example-1005"]}}
>>
>> A quick look at your plugin source
>> <https://github.com/Codearte/gradle-nexus-staging-plugin/blob/master/src/main/groovy/io/codearte/gradle/nexus/logic/AbstractStagingOperationExecutor.groovy#L11>
>> seems to indicate you don't set this to true, which is going to mean the
>> repository is not automatically dropped.
>
> That's something I needed. Much better than waiting for the promotion
> operation to stop being "in transition". I will add it in the next
> version of my plugin.

I took a look at the implementation and two more questions arose:
1. I based my plugin on the generated REST API documentation:
https://oss.sonatype.org/nexus-staging-plugin/default/docs/path__staging_profiles_-profileIdKey-_promote.html
and
https://oss.sonatype.org/nexus-staging-plugin/default/docs/el_ns0_promoteRequest.html

Unfortunately I don't see a "autoDropAfterRelease" field. Did you refer
to the same method call?

2. I would like to test it before going to production. Is there a test
Nexus instance available to test it? Or I need to request a trial of
Nexus Pro to setup one locally?

Peter Lynch

unread,
Feb 16, 2017, 7:49:01 AM2/16/17
to Marcin Zajączkowski, OSSRH Users
Don't rely on that REST documentation. A better approach in your case since you are not a Pro licensed customer is to execute Maven commands invoked with the nexus-staging-maven-plugin and use an intercepting proxy like Charles to examine the payloads being sent.


2. I would like to test it before going to production. Is there a test
Nexus instance available to test it? Or I need to request a trial of
Nexus Pro to setup one locally?


You can request a trial - getting one should not be a problem.


>>> To post to this group, send email to ossrh...@glists.sonatype.com.
>>> To view this discussion on the web visit https://groups.google.com/a/
>>> glists.sonatype.com/d/msgid/ossrh-users/3ea2073c-73fa-
>>> da30-fc69-095ed87e26fc%40wp.pl.
>>>
>>
>
>


--
http://blog.solidsoft.info/ - Working code is not enough

--
You received this message because you are subscribed to the Google Groups "OSSRH Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ossrh-users+unsubscribe@glists.sonatype.com.

To post to this group, send email to ossrh...@glists.sonatype.com.

Marcin Zajączkowski

unread,
Feb 16, 2017, 8:28:01 AM2/16/17
to OSSRH Users
On 2017-02-16 13:49, Peter Lynch wrote:
>> I took a look at the implementation and two more questions arose:
>> 1. I based my plugin on the generated REST API documentation:
>> https://oss.sonatype.org/nexus-staging-plugin/default/
>> docs/path__staging_profiles_-profileIdKey-_promote.html
>> and
>> https://oss.sonatype.org/nexus-staging-plugin/default/
>> docs/el_ns0_promoteRequest.html
>>
>> Unfortunately I don't see a "autoDropAfterRelease" field. Did you refer
>> to the same method call?
>
> Don't rely on that REST documentation. A better approach in your case since
> you are not a Pro licensed customer is to execute Maven commands invoked
> with the nexus-staging-maven-plugin and use an intercepting proxy like
> Charles <https://charlesproxy.com> to examine the payloads being sent.

Intercepting proxy is some option, however in a case of "promote"
command it is quite ugly to test it in production - I don't want to have
a pack of dummy artifacts in The Central Repository.

It is possible to disable sync with Maven Central/TCR (e.g. via Jira)
for one particular project from my staging profile and use it for
testing purpose (or create a separate staging profile with sync
permanently disabled)? What would then happen with promoted artifacts then?


I was searching "autoDropAfterRelease" in nexus-maven-plugins code (to
see how it is done there) and it seems to be only used in a very generic
form (e.g. in Parameters.java). Is building a JSON/XML performed in the
another project?


Would you consider to publish somewhere an updated documentation of the
public Nexus API?


>> 2. I would like to test it before going to production. Is there a test
>> Nexus instance available to test it? Or I need to request a trial of
>> Nexus Pro to setup one locally?
>>
> You can request a trial - getting one should not be a problem.

Unfortunately I would be one-shot action to get a trial. During
development of the next feature I would need it again. The best for me
as an external plugin developer would be to have an instance (own - e.g.
using Docker or shared hosted by Sonatype) to be able to run acceptance
tests on a regular basis. If it is not available as an alternative I
would probably approach a creation a "fake" staging profile on the
production Nexus (as mentioned above) to release "dummy" artifacts from
time to time (unless you see a better option).
>>>>> email to ossrh-users...@glists.sonatype.com.
>>>>> To post to this group, send email to ossrh...@glists.sonatype.com.
>>>>> To view this discussion on the web visit https://groups.google.com/a/
>>>>> glists.sonatype.com/d/msgid/ossrh-users/3ea2073c-73fa-
>>>>> da30-fc69-095ed87e26fc%40wp.pl.
>>>>>
>>>>
>>>
>>>
>>
>>
>> --
>> http://blog.solidsoft.info/ - Working code is not enough
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "OSSRH Users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to ossrh-users...@glists.sonatype.com.
>> To post to this group, send email to ossrh...@glists.sonatype.com.
>> To view this discussion on the web visit https://groups.google.com/a/
>> glists.sonatype.com/d/msgid/ossrh-users/74a7644c-e724-
>> 373f-f06d-5bc11e5b1238%40wp.pl.

Marcin Zajączkowski

unread,
Feb 28, 2017, 6:17:16 PM2/28/17
to OSSRH Users
(...)
> I was searching "autoDropAfterRelease" in nexus-maven-plugins code (to
> see how it is done there) and it seems to be only used in a very generic
> form (e.g. in Parameters.java). Is building a JSON/XML performed in the
> another project?
>
>
> Would you consider to publish somewhere an updated documentation of the
> public Nexus API?

Can you consider exposing Nexus promotion REST API somewhere in any
usable form to make it easier to create thirt-party tools co-operating
with Nexus (such as my Gradle plugin)?

Marcin
Reply all
Reply to author
Forward
0 new messages