mirror of
https://github.com/dashpay/dash.git
synced 2024-12-24 11:32:46 +01:00
Perform Jenkins builds in /dash-src all the time to fix caching issues (#2242)
This commit is contained in:
parent
40eee1775f
commit
799e3c3126
70
Jenkinsfile
vendored
70
Jenkinsfile
vendored
@ -25,29 +25,9 @@ for(int i = 0; i < targets.size(); i++) {
|
||||
def UID = sh(returnStdout: true, script: 'id -u').trim()
|
||||
def HOME = sh(returnStdout: true, script: 'echo $HOME').trim()
|
||||
def pwd = sh(returnStdout: true, script: 'pwd').trim()
|
||||
def hasCache = false
|
||||
|
||||
checkout scm
|
||||
|
||||
// restore cache
|
||||
try {
|
||||
copyArtifacts(projectName: "dashpay-dash/${BRANCH_NAME}", optional: true, selector: lastSuccessful(), filter: "ci-cache-${target}.tar.gz")
|
||||
} catch (Exception e) {
|
||||
}
|
||||
if (fileExists("ci-cache-${target}.tar.gz")) {
|
||||
hasCache = true
|
||||
echo "Using cache from dashpay-dash/${BRANCH_NAME}"
|
||||
} else {
|
||||
try {
|
||||
copyArtifacts(projectName: 'dashpay-dash/develop', optional: true, selector: lastSuccessful(), filter: "ci-cache-${target}.tar.gz");
|
||||
} catch (Exception e) {
|
||||
}
|
||||
if (fileExists("ci-cache-${target}.tar.gz")) {
|
||||
hasCache = true
|
||||
echo "Using cache from dashpay-dash/develop"
|
||||
}
|
||||
}
|
||||
|
||||
def env = [
|
||||
"BUILD_TARGET=${target}",
|
||||
"PULL_REQUEST=false",
|
||||
@ -61,29 +41,55 @@ for(int i = 0; i < targets.size(); i++) {
|
||||
builderImage = docker.build("${builderImageName}", "--build-arg BUILD_TARGET=${target} ci -f ci/Dockerfile.builder")
|
||||
}
|
||||
|
||||
if (hasCache) {
|
||||
sh "cd ${pwd} && tar xzfv ci-cache-${target}.tar.gz"
|
||||
} else {
|
||||
sh "mkdir -p ${pwd}/ci-cache-${target}"
|
||||
}
|
||||
|
||||
builderImage.inside("-t") {
|
||||
// copy source into fixed path
|
||||
// we must build under the same path everytime as otherwise caches won't work properly
|
||||
sh "cp -ra ${pwd}/. /dash-src/"
|
||||
|
||||
// restore cache
|
||||
def hasCache = false
|
||||
try {
|
||||
copyArtifacts(projectName: "dashpay-dash/${BRANCH_NAME}", optional: true, selector: lastSuccessful(), filter: "ci-cache-${target}.tar.gz")
|
||||
} catch (Exception e) {
|
||||
}
|
||||
if (fileExists("ci-cache-${target}.tar.gz")) {
|
||||
hasCache = true
|
||||
echo "Using cache from dashpay-dash/${BRANCH_NAME}"
|
||||
} else {
|
||||
try {
|
||||
copyArtifacts(projectName: 'dashpay-dash/develop', optional: true, selector: lastSuccessful(), filter: "ci-cache-${target}.tar.gz");
|
||||
} catch (Exception e) {
|
||||
}
|
||||
if (fileExists("ci-cache-${target}.tar.gz")) {
|
||||
hasCache = true
|
||||
echo "Using cache from dashpay-dash/develop"
|
||||
}
|
||||
}
|
||||
|
||||
if (hasCache) {
|
||||
sh "cd /dash-src && tar xzf ${pwd}/ci-cache-${target}.tar.gz"
|
||||
} else {
|
||||
sh "mkdir -p /dash-src/ci-cache-${target}"
|
||||
}
|
||||
|
||||
stage("${target}/depends") {
|
||||
sh './ci/build_depends.sh'
|
||||
sh 'cd /dash-src && ./ci/build_depends.sh'
|
||||
}
|
||||
stage("${target}/build") {
|
||||
sh './ci/build_src.sh'
|
||||
sh 'cd /dash-src && ./ci/build_src.sh'
|
||||
}
|
||||
stage("${target}/test") {
|
||||
sh './ci/test_unittests.sh'
|
||||
sh 'cd /dash-src && ./ci/test_unittests.sh'
|
||||
}
|
||||
stage("${target}/test") {
|
||||
sh './ci/test_integrationtests.sh'
|
||||
sh 'cd /dash-src && ./ci/test_integrationtests.sh'
|
||||
}
|
||||
|
||||
// archive cache and copy it into the jenkins workspace
|
||||
sh "cd /dash-src && tar czfv ci-cache-${target}.tar.gz ci-cache-${target} && cp ci-cache-${target}.tar.gz ${pwd}/"
|
||||
}
|
||||
|
||||
// archive cache
|
||||
sh "tar czfv ci-cache-${target}.tar.gz ci-cache-${target}"
|
||||
// upload cache
|
||||
archiveArtifacts artifacts: "ci-cache-${target}.tar.gz", fingerprint: true
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user