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

Found multiple staging repositories #83

Closed
jamesward opened this issue Jun 20, 2019 · 12 comments

Comments

@jamesward
Copy link

commented Jun 20, 2019

I'd like to do this:

sbt +publishSigned sonatypeRelease

But I often run into issues because there are multiple staging repos (due to other releases going on). This also prevents me from using sonatypeReleaseAll. Is there any way for sonatypeRelease to know what staging repo was created by publishSigned and use that? Or maybe a new task that can publish and release?

@xerial

This comment has been minimized.

Copy link
Owner

commented Jun 20, 2019

Hi. Currently we can explicitly open a staging repository using sonatypeOpen ..., but it’s not convenient to use as we need to check the name of the staging repository created at Sonatype by looking at the display logs.

I’ve been thinking re-designing sbt-sonatype so that we can seamlessly support concurrent releases and idempotent executions (upon any failures).

@jamesward

This comment has been minimized.

Copy link
Author

commented Jun 20, 2019

Thanks! Wish I had some cycles to help. I'm so thankful for your plugin!

@tpolecat

This comment has been minimized.

Copy link

commented Aug 11, 2019

Yep, would also love to see a fix for this. A short-term solution might be to improve the error message and add sonatypeDropAll so there's an easy way to clean up and try again.

@pshirshov

This comment has been minimized.

Copy link

commented Aug 17, 2019

So, guys. Those who have issues with sbt publishing (like low speed, multiple repositories and non-transactional behaviour)may drastically improve their experience by using this simple ant script (which utilizes nexus-specific APIs):

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns:staging="antlib:org.sonatype.nexus.ant.staging">
    <property environment="env"/>
    <!-- https://oss.sonatype.org/ -->
    <property name="nexus.uri" value="${env.NEXUS_URI}" />
    <property name="nexus.user" value="${env.NEXUS_USER}" />
    <property name="nexus.pass" value="${env.NEXUS_PASS}" />
    <property name="dir.repo" value="${env.DIR_REPO}" />
    <property name="nexus.profile" value="${env.NEXUS_PROFILE}" />

    <taskdef uri="antlib:org.sonatype.nexus.ant.staging"
            resource="org/sonatype/nexus/ant/staging/antlib.xml">
    <classpath>
        <fileset dir="tasks" includes="nexus-staging-ant-tasks-*uber.jar" />
    </classpath>
    </taskdef>

    <staging:nexusStagingInfo id="target-nexus" stagingDirectory="target/staging">
        <staging:projectInfo
                groupId="org.sonatype.nexus.ant"
                artifactId="nexus-staging-ant-tasks"
                stagingProfileId="${nexus.profile}"
                version="1.0" />
        <staging:connectionInfo
            baseUrl="${nexus.uri}">
            <staging:authentication
            username="${nexus.user}"
            password="${nexus.pass}" />
        </staging:connectionInfo>
    </staging:nexusStagingInfo>

    <target name="deploy" description="Deploy: Local and Remote Staging">
        <staging:stageLocally>
            <staging:nexusStagingInfo refid="target-nexus" />
            <fileset dir="${dir.repo}" includes="**/*.*" />
        </staging:stageLocally>

        <staging:stageRemotely>
            <staging:nexusStagingInfo refid="target-nexus" />
        </staging:stageRemotely>

        <staging:releaseStagingRepository>
            <staging:nexusStagingInfo refid="target-nexus" />
        </staging:releaseStagingRepository>

        <staging:dropStagingRepository>
            <staging:nexusStagingInfo refid="target-nexus" />
        </staging:dropStagingRepository>
    </target>

</project>

More instructions here

In order to prepare your artifacts for this script you would need the following sbt setting:

   publishTo := Some(Resolver.file("file", new File("/path/to/repo"))), 

Use ant deploy to run.

In my case this simple trick allowed to decrease publishing time from ~40..80 minutes to 2 minutes...

@xerial

This comment has been minimized.

Copy link
Owner

commented Sep 5, 2019

@tpolecat sonatypeDropAll is added.

@jamesward sbt-sonatype 3.0 can support idempotent release with:
; sonatypePrepare; publishSigned; sonatypeRelease

Let me close the issue.

@xerial xerial closed this Sep 5, 2019

@pshirshov

This comment has been minimized.

Copy link

commented Sep 5, 2019

@xerial : it should fix the most annoying integrity issue, though it does not address insanely slow uploads. Maybe it's a good idea to incorporate a fast uploader into your plugin as well?..

@xerial

This comment has been minimized.

Copy link
Owner

commented Sep 5, 2019

@pshirshov I'd like to add such a feature to reduce my pain to upload artifacts. I still don't fully understand what your ant script does (rather what org.sonatype.nexus.ant.staging does) behind the scene. If I can understand the trick it would be possible to improve sbt-sonatype plugin.

@xerial

This comment has been minimized.

@pshirshov

This comment has been minimized.

Copy link

commented Sep 5, 2019

Yeah, that's correct.

The ant script, essentially, just sends a zip file of the full maven layout to sonatype trough nexus-specific API.

@pshirshov

This comment has been minimized.

@xerial

This comment has been minimized.

Copy link
Owner

commented Sep 5, 2019

Nice. So instead of using publishSigned directly to sonatype repo:

  1. Create a bundle (= the artifacts of publishLocalSigned) locally
  2. Upload it using the bundle upload API
  3. Do the regular close/promote step at Sonatype API
@xerial

This comment has been minimized.

Copy link
Owner

commented Sep 5, 2019

@pshirshov I'll move the discussion to #89 as the issue title doesn't match the conversation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants
You can’t perform that action at this time.