vlsi / vlsi-release-plugins

A set of plugins to simplify Gradle release tasks
Apache License 2.0
41 stars 13 forks source link

[stage-vote-release-plugin] Execution failed for task ':releaseRepository' due to missing nexus.txt file #64

Open zabetak opened 1 year ago

zabetak commented 1 year ago

Trying to publish the RC0 for calcite the :releaseRepository task failed.

While I was waiting for the vote duration to pass, I was working on other stuff switching/building/cleaning branches along the way. Unsurprisingly the build/stagingRepositories/nexus.txt was deleted leading to the error below.

./gradlew publishDist -Prc=0 -Pasf --no-parallel
...
Build calcite FAILURE reason:                                
    Execution failed for task ':releaseRepository':
        org.gradle.api.internal.provider.AbstractProperty$PropertyQueryException: Failed to calculate the value of task ':releaseRepository' property 'stagingRepositoryId'.
            at org.gradle.api.internal.provider.AbstractProperty.finalizeNow(AbstractProperty.java:239)
            at org.gradle.api.internal.provider.AbstractProperty.beforeRead(AbstractProperty.java:230)
            at org.gradle.api.internal.provider.AbstractProperty.calculateOwnValue(AbstractProperty.java:126)
            at org.gradle.api.internal.provider.AbstractMinimalProvider.getOrNull(AbstractMinimalProvider.java:93)
            at org.gradle.api.internal.provider.ProviderResolutionStrategy$1.resolve(ProviderResolutionStrategy.java:27)
            at org.gradle.util.internal.DeferredUtil.unpack(DeferredUtil.java:59)
            at org.gradle.util.internal.DeferredUtil.unpackOrNull(DeferredUtil.java:49)
            at org.gradle.api.internal.tasks.properties.AbstractValidatingProperty.validate(AbstractValidatingProperty.java:53)
            at org.gradle.api.internal.tasks.properties.DefaultTaskProperties.validate(DefaultTaskProperties.java:134)
            at org.gradle.api.internal.tasks.execution.TaskExecution.validate(TaskExecution.java:472)
            at org.gradle.internal.execution.steps.ValidateStep.execute(ValidateStep.java:78)
            at org.gradle.internal.execution.steps.ValidateStep.execute(ValidateStep.java:57)
            at org.gradle.internal.execution.steps.CaptureStateBeforeExecutionStep.execute(CaptureStateBeforeExecutionStep.java:76)
            at org.gradle.internal.execution.steps.CaptureStateBeforeExecutionStep.execute(CaptureStateBeforeExecutionStep.java:50)
            at org.gradle.internal.execution.steps.SkipEmptyWorkStep.executeWithNoEmptySources(SkipEmptyWorkStep.java:249)
            at org.gradle.internal.execution.steps.SkipEmptyWorkStep.execute(SkipEmptyWorkStep.java:86)
            at org.gradle.internal.execution.steps.SkipEmptyWorkStep.execute(SkipEmptyWorkStep.java:54)
            at org.gradle.internal.execution.steps.RemoveUntrackedExecutionStateStep.execute(RemoveUntrackedExecutionStateStep.java:32)
            at org.gradle.internal.execution.steps.RemoveUntrackedExecutionStateStep.execute(RemoveUntrackedExecutionStateStep.java:21)
            at org.gradle.internal.execution.steps.legacy.MarkSnapshottingInputsStartedStep.execute(MarkSnapshottingInputsStartedStep.java:38)
            at org.gradle.internal.execution.steps.LoadPreviousExecutionStateStep.execute(LoadPreviousExecutionStateStep.java:43)
            at org.gradle.internal.execution.steps.LoadPreviousExecutionStateStep.execute(LoadPreviousExecutionStateStep.java:31)
            at org.gradle.internal.execution.steps.AssignWorkspaceStep.lambda$execute$0(AssignWorkspaceStep.java:40)
            at org.gradle.api.internal.tasks.execution.TaskExecution$4.withWorkspace(TaskExecution.java:287)
            at org.gradle.internal.execution.steps.AssignWorkspaceStep.execute(AssignWorkspaceStep.java:40)
            at org.gradle.internal.execution.steps.AssignWorkspaceStep.execute(AssignWorkspaceStep.java:30)
            at org.gradle.internal.execution.steps.IdentityCacheStep.execute(IdentityCacheStep.java:37)
            at org.gradle.internal.execution.steps.IdentityCacheStep.execute(IdentityCacheStep.java:27)
            at org.gradle.internal.execution.steps.IdentifyStep.execute(IdentifyStep.java:44)
            at org.gradle.internal.execution.steps.IdentifyStep.execute(IdentifyStep.java:33)
            Caused by: org.gradle.api.internal.provider.AbstractProperty$PropertyQueryException: Failed to query the value of extension 'nexusStaging' property 'stagingRepositoryId'.
                at org.gradle.api.internal.provider.AbstractProperty.doCalculateValue(AbstractProperty.java:136)
                at org.gradle.api.internal.provider.AbstractProperty.calculateOwnValue(AbstractProperty.java:127)
                at org.gradle.api.internal.provider.AbstractMinimalProvider.calculateValue(AbstractMinimalProvider.java:103)
                at org.gradle.api.internal.provider.AbstractMinimalProvider.withFinalValue(AbstractMinimalProvider.java:159)
                at org.gradle.api.internal.provider.DefaultProperty.finalValue(DefaultProperty.java:133)
                at org.gradle.api.internal.provider.DefaultProperty.finalValue(DefaultProperty.java:26)
                at org.gradle.api.internal.provider.AbstractProperty.finalizeNow(AbstractProperty.java:236)
                ... 29 more
                Caused by: java.io.FileNotFoundException: /home/stamatis/Projects/Apache/calcite/build/stagingRepositories/nexus.txt (No such file or directory)
                    at kotlin.io.FilesKt__FileReadWriteKt.readText(FileReadWrite.kt:125)
                    at kotlin.io.FilesKt__FileReadWriteKt.readText$default(FileReadWrite.kt:125)
                    at com.github.vlsi.gradle.release.NexusRepositoryIdStore.load(NexusRepositoryIdStore.kt:44)
                    at com.github.vlsi.gradle.release.NexusRepositoryIdStore.getOrLoad(NexusRepositoryIdStore.kt:41)
                    at com.github.vlsi.gradle.release.StageVoteReleasePlugin$configureNexusStaging$2$1$2.call(StageVoteReleasePlugin.kt:546)
                    at com.github.vlsi.gradle.release.StageVoteReleasePlugin$configureNexusStaging$2$1$2.call(StageVoteReleasePlugin.kt:63)
                    at org.gradle.api.internal.provider.DefaultProvider.calculateOwnValue(DefaultProvider.java:72)
                    at org.gradle.api.internal.provider.AbstractMinimalProvider.calculateValue(AbstractMinimalProvider.java:103)
                    at org.gradle.api.internal.provider.DefaultProperty.calculateValueFrom(DefaultProperty.java:128)
                    at org.gradle.api.internal.provider.DefaultProperty.calculateValueFrom(DefaultProperty.java:26)
                    at org.gradle.api.internal.provider.AbstractProperty.doCalculateValue(AbstractProperty.java:133)
zabetak commented 1 year ago

At the moment, I am trying to see if there is a graceful way to recover and continue with the publishDist task. Simply adding the missing nexus.txt in the appropriate place and re-running ./gradlew publishDist will not work cause it will fail trying to move/cp the svn artifacts.

zabetak commented 1 year ago

Finally, I decided to manually perform the remaining steps (hopefully I didn't miss anything):

  1. Login to https://repository.apache.org/
  2. Select the staging repository mentioned in the VOTE email thread:orgapachecalcite-1200
  3. Click release (and check drop as well)
  4. Checkout the main branch: git checkout main
  5. Merge the current release candidate to main: git merge calcite-1.34.0-rc0
  6. Push the main branch to the ASF remote: git push origin main
  7. Create a tag without rc suffix: git tag -a calcite-1.34.0 7dfd641baeb0e1b26dec04da5241c3999fe0ac6a -m "Tag explicitly 1.34.0 release without -rc suffix"
  8. Push the new tag to ASF remote: git push origin calcite-1.34.0
vlsi commented 1 year ago

The best way to handle this would be using Nexus server itself for associating "release candidates" with "staging repositories".

I did try contributing the feature to gradle-nexus/publish-plugin, unfortunately, the authors were not responsive: https://github.com/gradle-nexus/publish-plugin/pull/145

zabetak commented 1 year ago

According to the comments there some part of the change was merged in https://github.com/gradle-nexus/publish-plugin/pull/201 Do you think that we could build on top of that or we are missing more things?

vlsi commented 1 year ago

They went with a separate FindStagingRepository task rather than teaching the existing InitializeStagingRepository task to lookup the repository.

Apparently, if initializeStagingRepository was able to do both "find if exists" and "create if missing", then it would be way easier to use.

It might be something like https://github.com/vlsi/vlsi-release-plugins/pull/41 + findStagingRepository would do the trick, however, I'm not willing to spend more time time on reverse-engineering GNPP code.

nexus.txt is not a pressing issue for me at the moment, and I'm balancing between: