Skip to content

Commit

Permalink
Fix upload issues
Browse files Browse the repository at this point in the history
  • Loading branch information
donat committed Nov 9, 2021
1 parent a1f2cd1 commit f2d9ecf
Showing 1 changed file with 21 additions and 7 deletions.
28 changes: 21 additions & 7 deletions org.eclipse.buildship.site/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -160,9 +160,9 @@ artifact.repository.factory.order=compositeArtifacts.xml,\\!
execute "rm -rf $compositeFolder/compositeContent.xml"

// update composite repo metadate
put from: new File(compositeArtifactsFile.parentFile, 'compositeArtifacts.jar'), into: compositeFolder
put from: new File(compositeContentFile.parentFile, 'compositeContent.jar'), into: compositeFolder
put from: p2indexFile, into: compositeFolder
uploadFileWithScp(new File(compositeArtifactsFile.parentFile, 'compositeArtifacts.jar'), compositeFolder)
uploadFileWithScp(new File(compositeContentFile.parentFile, 'compositeContent.jar'), compositeFolder)
uploadFileWithScp(p2indexFile, compositeFolder)
}
}
}
Expand All @@ -174,7 +174,7 @@ artifact.repository.factory.order=compositeArtifacts.xml,\\!
// wipe the previous release and replace it with the new one
execute "rm -rf $latestFolder"
execute "mkdir -p $latestFolder"
put from: files { file("$buildDir/repository").listFiles() }, into: latestFolder
file("$buildDir/repository").listFiles().each { uploadDirWithScp(it, latestFolder) }
}
}
}
Expand Down Expand Up @@ -247,10 +247,10 @@ private void signByEclipseService(signedFolder, unsignedFolder) {
println "$remoteFolder/$source.name"

// ssh plugin cannot download artifacts from rojects-storage.eclipse.org. To work around the issue we scp from the command line
//get from: "$remoteFolder/$source.name", into: target.path
def cmd = "sshpass -p $ECLIPSE_ORG_FTP_PASSWORD scp $ECLIPSE_ORG_FTP_USER@$ECLIPSE_ORG_FTP_HOST:$remoteFolder/$source.name ${target.path}"
// get from: "$remoteFolder/$source.name", into: target.path
def cmd = "sshpass -p $ECLIPSE_ORG_FTP_PASSWORD scp -o UserKnownHostsFile=${project.rootProject.file('gradle/ssh/known_hosts')} $ECLIPSE_ORG_FTP_USER@$ECLIPSE_ORG_FTP_HOST:$remoteFolder/$source.name ${target.path}"
def process = cmd.execute()
process.in.eachLine { println it }
process.waitFor()
}
}

Expand All @@ -260,6 +260,20 @@ private void signByEclipseService(signedFolder, unsignedFolder) {
}
}

private void uploadFileWithScp(File source, String targetPath) {
def sourcePath = source.absolutePath
def cmd = "sshpass -p $ECLIPSE_ORG_FTP_PASSWORD scp -o UserKnownHostsFile=${project.rootProject.file('gradle/ssh/known_hosts')} $source $ECLIPSE_ORG_FTP_USER@$ECLIPSE_ORG_FTP_HOST:${targetPath}/"
def process = cmd.execute()
process.waitFor()
}

private void uploadDirWithScp(File source, String targetPath) {
def sourcePath = source.absolutePath
def cmd = "sshpass -p $ECLIPSE_ORG_FTP_PASSWORD scp -r -o UserKnownHostsFile=${project.rootProject.file('gradle/ssh/known_hosts')} $source $ECLIPSE_ORG_FTP_USER@$ECLIPSE_ORG_FTP_HOST:${targetPath}/"
def process = cmd.execute()
process.waitFor()
}

private void signLocally(File unsignedFolder, File signedFolder) {
def unsignedPluginsDir = new File(unsignedFolder, "plugins")
def unsignedFeaturesDir = new File(unsignedFolder, "features")
Expand Down

0 comments on commit f2d9ecf

Please sign in to comment.