From 618632be50875e020e8a59eaff00c49993ee0acf Mon Sep 17 00:00:00 2001 From: krasinski <8573352+krasinski@users.noreply.github.com> Date: Mon, 30 Oct 2023 23:21:18 +0100 Subject: [PATCH] Revert "[SW-2785] Fix release process ignoring Nexus upload errors (#2878)" This reverts commit 072cf31d40d774cf6a4c97e56ff9d07b268a3152. --- build.gradle | 35 ++++++++++++--------------------- gradle/publish/uploadToNexus.sh | 2 +- 2 files changed, 14 insertions(+), 23 deletions(-) diff --git a/build.gradle b/build.gradle index f350314a1f..8874ef9a7c 100644 --- a/build.gradle +++ b/build.gradle @@ -246,36 +246,27 @@ clean.doFirst { delete file("metastore_db/") } -static String waitForExitCode0AndReturnOutput(String scriptName, Process proc) { - int oneHour = 60 * 60 * 1000 - if (proc.waitForOrKill(oneHour) != 0) { - throw new IllegalStateException("Running script $scriptName failed! Output: ${proc.text}") - } +def createStagingId(def username, def password) { + def proc = ['./createStagingId.sh', username, password].execute([], file("${rootDir.toString()}/gradle/publish")) return proc.text } -String createStagingId(String username, String password) { - String script = './createStagingId.sh' - Process proc = [script, username, password].execute([], file("${rootDir.toString()}/gradle/publish")) - return waitForExitCode0AndReturnOutput(script, proc) -} - -void uploadFiles(String username, String password, String repoDir, String stagingId) { - String script = './uploadToNexus.sh' - Process proc = [script, username, password, repoDir, stagingId].execute([], file("${rootDir.toString()}/gradle/publish")) - waitForExitCode0AndReturnOutput(script, proc) +def uploadFiles(def username, def password, def repoDir, def stagingId) { + def proc = ['./uploadToNexus.sh' + , username, password, repoDir, stagingId].execute([], file("${rootDir.toString()}/gradle/publish")) + proc.waitFor() } -void closeBucket(String username, String password, String stagingId) { - String script = './closeBucket.sh' - Process proc = [script, username, password, stagingId].execute([], file("${rootDir.toString()}/gradle/publish")) - waitForExitCode0AndReturnOutput(script, proc) +def closeBucket(def username, def password, def stagingId) { + def proc = ['./closeBucket.sh' + , username, password, stagingId].execute([], file("${rootDir.toString()}/gradle/publish")) + proc.waitFor() } task publishToNexus { doLast { - String stagingId = createStagingId(project.findProperty('nexusUsername') as String, project.findProperty('nexusPassword') as String).replace('\n', '') - uploadFiles(project.findProperty('nexusUsername') as String, project.findProperty('nexusPassword') as String, "${rootDir}/dist/build/dist/maven/repo", stagingId) - closeBucket(project.findProperty('nexusUsername') as String, project.findProperty('nexusPassword') as String, stagingId) + def stagingId = createStagingId(project.findProperty('nexusUsername'), project.findProperty('nexusPassword')).replace('\n', '') + uploadFiles(project.findProperty('nexusUsername'), project.findProperty('nexusPassword'), "${rootDir}/dist/build/dist/maven/repo", stagingId) + closeBucket(project.findProperty('nexusUsername'), project.findProperty('nexusPassword'), stagingId) } } diff --git a/gradle/publish/uploadToNexus.sh b/gradle/publish/uploadToNexus.sh index c4b1643a54..3d94c05eb1 100755 --- a/gradle/publish/uploadToNexus.sh +++ b/gradle/publish/uploadToNexus.sh @@ -8,5 +8,5 @@ stagingId=$4 find $repodir -type f | while read f; do suffix=$(echo $f | sed "s%^$repodir/%%") echo "x${stagingId}x" - curl -v -u $name:$password -H "Content-type: application/x-rpm" --upload-file $f https://oss.sonatype.org/service/local/staging/deployByRepositoryId/${stagingId}/${suffix} 2>&1 + curl -v -u $name:$password -H "Content-type: application/x-rpm" --upload-file $f https://oss.sonatype.org/service/local/staging/deployByRepositoryId/${stagingId}/${suffix} 2>> out.txt done