forked from hyperledger-iroha/iroha-dco
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Uploading of the build artifacts (hyperledger-iroha#1170)
* upload artifacts on successful build Signed-off-by: Artyom Bakhtin <[email protected]> * temporarily disable mac coverage Signed-off-by: Artyom Bakhtin <[email protected]> * remove WIP Signed-off-by: Artyom Bakhtin <[email protected]> * replace artifacts.groovy paths concat with a more elegant version Signed-off-by: Artyom Bakhtin <[email protected]>
- Loading branch information
Showing
5 changed files
with
154 additions
and
77 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
#!/usr/bin/env groovy | ||
|
||
def uploadArtifacts(filePaths, uploadPath, artifactServers=['artifact.soramitsu.co.jp']) { | ||
def baseUploadPath = 'files' | ||
def filePathsConverted = [] | ||
agentType = sh(script: 'uname', returnStdout: true).trim() | ||
uploadPath = baseUploadPath + uploadPath | ||
filePaths.each { | ||
fp = sh(script: "ls -d ${it} | tr '\n' ','", returnStdout: true).trim() | ||
filePathsConverted.addAll(fp.split(',')) | ||
} | ||
def shaSumBinary = 'sha256sum' | ||
def md5SumBinary = 'md5sum' | ||
if (agentType == 'Darwin') { | ||
shaSumBinary = 'shasum -a 256' | ||
md5SumBinary = 'md5 -r' | ||
} | ||
sh "> \$(pwd)/batch.txt" | ||
filePathsConverted.each { | ||
sh "echo put ${it} $uploadPath >> \$(pwd)/batch.txt;" | ||
sh "$shaSumBinary ${it} | cut -d' ' -f1 > \$(pwd)/\$(basename ${it}).sha256" | ||
sh "$md5SumBinary ${it} | cut -d' ' -f1 > \$(pwd)/\$(basename ${it}).md5" | ||
sh "echo put \$(pwd)/\$(basename ${it}).sha256 $uploadPath >> \$(pwd)/batch.txt;" | ||
sh "echo put \$(pwd)/\$(basename ${it}).md5 $uploadPath >> \$(pwd)/batch.txt;" | ||
} | ||
// mkdirs recursively | ||
uploadPath = uploadPath.split('/') | ||
def p = '' | ||
sh "> \$(pwd)/mkdirs.txt" | ||
uploadPath.each { | ||
p += "/${it}" | ||
sh("echo -mkdir $p >> \$(pwd)/mkdirs.txt") | ||
} | ||
|
||
sshagent(['jenkins-artifact']) { | ||
sh "ssh-agent" | ||
artifactServers.each { | ||
sh "sftp -b \$(pwd)/mkdirs.txt jenkins@${it} || true" | ||
sh "sftp -b \$(pwd)/batch.txt jenkins@${it}" | ||
} | ||
} | ||
} | ||
|
||
return this |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
def linuxPostStep() { | ||
timeout(time: 600, unit: "SECONDS") { | ||
try { | ||
if (currentBuild.result != "UNSTABLE" && BRANCH_NAME ==~ /(master|develop)/) { | ||
def artifacts = load ".jenkinsci/artifacts.groovy" | ||
def commit = env.GIT_COMMIT | ||
def platform = sh(script: 'uname -m', returnStdout: true).trim() | ||
filePaths = [ '/tmp/${GIT_COMMIT}-${BUILD_NUMBER}/*' ] | ||
artifacts.uploadArtifacts(filePaths, sprintf('/iroha/linux/%4%s/%1$s-%2$s-%3$s', [BRANCH_NAME, sh(script: 'date "+%Y%m%d"', returnStdout: true).trim(), commit.substring(0,6), platform])) | ||
} | ||
} | ||
finally { | ||
if (env.BUILD_TYPE == 'Debug') { | ||
def cleanup = load ".jenkinsci/docker-cleanup.groovy" | ||
cleanup.doDockerCleanup() | ||
} | ||
cleanWs() | ||
} | ||
} | ||
} | ||
|
||
return this |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
#!/usr/bin/env groovy | ||
|
||
def doReleaseBuild(coverageEnabled=false) { | ||
def scmVars = checkout scm | ||
env.IROHA_VERSION = "0x${scmVars.GIT_COMMIT}" | ||
env.IROHA_HOME = "/opt/iroha" | ||
env.IROHA_BUILD = "${env.IROHA_HOME}/build" | ||
|
||
sh """ | ||
export CCACHE_DIR=${CCACHE_RELEASE_DIR} | ||
ccache --version | ||
ccache --show-stats | ||
ccache --zero-stats | ||
ccache --max-size=1G | ||
cmake -H. \ | ||
-Bbuild \ | ||
-DCOVERAGE=OFF \ | ||
-DPACKAGE_TGZ=ON \ | ||
-DCMAKE_BUILD_TYPE=Release \ | ||
-DIROHA_VERSION=${env.IROHA_VERSION} | ||
cmake --build build --target package -- -j${params.PARALLELISM} | ||
ccache --show-stats | ||
""" | ||
} | ||
|
||
return this |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters