Skip to content

Commit

Permalink
Revert "[SW-2785] Fix release process ignoring Nexus upload errors (#…
Browse files Browse the repository at this point in the history
…2878)" (#5685)

This reverts commit 072cf31.
  • Loading branch information
krasinski committed Oct 31, 2023
1 parent 1722e00 commit 56f8bed
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 23 deletions.
35 changes: 13 additions & 22 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}
2 changes: 1 addition & 1 deletion gradle/publish/uploadToNexus.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 56f8bed

Please sign in to comment.