Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -325,8 +325,9 @@ in existing-bundle mode: normal uploads rebuild and re-sign artifacts, so an ear
digest generally cannot match. Digest properties also come from project/user
`gradle.properties` and `ORG_GRADLE_PROJECT_*` environment variables; remove or clear them
before a normal release. Upload evidence is ignored when `releaseAll` is absent from the
task graph, including plain checks, signing checks and bundle-only runs. Source/version
and saved manifest hashes are rechecked.
task graph, including plain checks, signing checks and bundle-only runs; when such a run
schedules `releaseAllGuard`, an info-level message (`--info`) says the evidence was not
checked. Source/version and saved manifest hashes are rechecked.

The uploader hashes and parses the same manifest bytes, and sends a private ZIP snapshot
checked against the verified digest. The bundle directory must be writable for snapshot
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,15 @@ final class CombinedReleaseRegistrar {
String planPath = project.absoluteProjectPath('releaseAllPlan')
String releasePath = project.absoluteProjectPath('releaseAll')
String bundlePath = project.absoluteProjectPath('bundleAll')
String guardPath = project.absoluteProjectPath('releaseAllGuard')
project.gradle.taskGraph.whenReady { TaskExecutionGraph graph ->
if (!graph.hasTask(releasePath) && graph.hasTask(guardPath)) {
// Only release-preparation graphs realize releaseAll for this diagnostic.
ReleaseAllTask release = releaseAllTask.get()
if (release.expectedBundleSha256.getOrElse('') || release.expectedManifestSha256.getOrElse('')) {
project.logger.info('Upload evidence ignored: releaseAll is not scheduled, so expectedBundleSha256 and expectedManifestSha256 are not checked')
}
}
if (graph.hasTask(planPath) && graph.hasTask(releasePath)) {
throw new GradleException('Do not request releaseAllPlan and releaseAll in the same invocation; review the saved manifest, then run :releaseAll separately')
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import org.junit.jupiter.api.Timeout
import org.junit.jupiter.api.io.TempDir
import org.junit.jupiter.params.ParameterizedTest
import org.junit.jupiter.params.provider.ValueSource
import org.gradle.testkit.runner.TaskOutcome
import java.util.zip.ZipFile
import static org.junit.jupiter.api.Assertions.*

Expand Down Expand Up @@ -727,16 +728,22 @@ nexusReleasePlugin {
}

@ParameterizedTest
@ValueSource(strings = ['bundleAll', 'releaseAllSigningCheck', 'releaseAllGuard', ':core:check'])
@ValueSource(strings = ['bundleAll', 'releaseAllSigningCheck', 'releaseAllGuard'])
void nonUploadGraphsIgnoreExportedUploadEvidence(String task) {
withServer { String base, List requests ->
existingFixture(base)
run('releaseAllPlan')
String[] args = ['-Pexisting', '-Pexpected=not-an-upload-digest', '-PexpectedManifest=not-a-manifest-digest']
// Every case schedules the guard, so passing proves it ignored the malformed evidence.
String[] args = ['-Pexisting', '-Pexpected=not-an-upload-digest', '-PexpectedManifest=not-a-manifest-digest', '--info']
def first = run(task, *args)
assertNull(first.task(':releaseAll'))
assertEquals(TaskOutcome.SUCCESS, first.task(':releaseAllGuard')?.outcome)
// bundleAll stages modules, whose check tasks depend on the guard.
if (task == 'bundleAll') assertEquals(TaskOutcome.SUCCESS, first.task(':core:check')?.outcome)
assertTrue(first.output.contains('Upload evidence ignored: releaseAll is not scheduled'), first.output)
def cached = run(task, *args)
assertNull(cached.task(':releaseAll'))
assertEquals(TaskOutcome.SUCCESS, cached.task(':releaseAllGuard')?.outcome)
assertTrue(cached.output.contains('Reusing configuration cache.'))
assertFalse(requests.any { it.contains('/publisher/upload') })
}
Expand Down
Loading