|
@ -1,6 +1,7 @@ |
|
|
#!groovy |
|
|
#!groovy |
|
|
|
|
|
|
|
|
def cleanSlateEnabled |
|
|
def cleanSlateEnabled |
|
|
|
|
|
def sanitizedBranchName |
|
|
|
|
|
|
|
|
// Package change state |
|
|
// Package change state |
|
|
def appPackageChanged |
|
|
def appPackageChanged |
|
@ -18,9 +19,7 @@ def sharedPackageVersion |
|
|
|
|
|
|
|
|
// Docker images |
|
|
// Docker images |
|
|
def appImage |
|
|
def appImage |
|
|
def appTestsImage |
|
|
|
|
|
def contractsImage |
|
|
def contractsImage |
|
|
def contractsTestsImage |
|
|
|
|
|
def contractsProviderImage |
|
|
def contractsProviderImage |
|
|
def pinnerImage |
|
|
def pinnerImage |
|
|
|
|
|
|
|
@ -84,6 +83,7 @@ pipeline { |
|
|
steps { |
|
|
steps { |
|
|
script { |
|
|
script { |
|
|
cleanSlateEnabled = sh (script: "git log -1 | grep -qE 'ci: force'", returnStatus: true) |
|
|
cleanSlateEnabled = sh (script: "git log -1 | grep -qE 'ci: force'", returnStatus: true) |
|
|
|
|
|
sanitizedBranchName = sh(script: 'echo $GIT_BRANCH | sed -e "s:.*/::g"', returnStdout: true).trim() |
|
|
|
|
|
|
|
|
appPackageChanged = sh(script: 'bash ./jenkins/check_package_changed.sh app "$GIT_COMMIT" "$GIT_PREVIOUS_COMMIT"', returnStdout: true).trim() |
|
|
appPackageChanged = sh(script: 'bash ./jenkins/check_package_changed.sh app "$GIT_COMMIT" "$GIT_PREVIOUS_COMMIT"', returnStdout: true).trim() |
|
|
contractsPackageChanged = sh(script: 'bash ./jenkins/check_package_changed.sh contracts "$GIT_COMMIT" "$GIT_PREVIOUS_COMMIT"', returnStdout: true).trim() |
|
|
contractsPackageChanged = sh(script: 'bash ./jenkins/check_package_changed.sh contracts "$GIT_COMMIT" "$GIT_PREVIOUS_COMMIT"', returnStdout: true).trim() |
|
@ -111,7 +111,6 @@ pipeline { |
|
|
stage('TEST CONTRACTS') { |
|
|
stage('TEST CONTRACTS') { |
|
|
steps { |
|
|
steps { |
|
|
script { |
|
|
script { |
|
|
try { |
|
|
|
|
|
def ganacheTestPort = sh(script: "bash ./jenkins/hash_build_properties.sh ${BRANCH_NAME} ${BUILD_NUMBER} | xargs bash ./jenkins/map_to_thousand.sh", returnStdout: true).trim() |
|
|
def ganacheTestPort = sh(script: "bash ./jenkins/hash_build_properties.sh ${BRANCH_NAME} ${BUILD_NUMBER} | xargs bash ./jenkins/map_to_thousand.sh", returnStdout: true).trim() |
|
|
|
|
|
|
|
|
def ganacheTestImage = docker.build( |
|
|
def ganacheTestImage = docker.build( |
|
@ -120,6 +119,14 @@ pipeline { |
|
|
./" |
|
|
./" |
|
|
) |
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
docker.build( |
|
|
|
|
|
"ecentrics/concordia-contracts-tests:${sanitizedBranchName}-v${contractsPackageVersion}-b${BUILD_NUMBER}-tests", |
|
|
|
|
|
"-f docker/concordia-contracts/Dockerfile \ |
|
|
|
|
|
./ \ |
|
|
|
|
|
--target test \ |
|
|
|
|
|
--build-arg TZ=Europe/Athens" |
|
|
|
|
|
) |
|
|
|
|
|
|
|
|
sh 'docker network create --driver bridge concordia_ganache_test_network || true' |
|
|
sh 'docker network create --driver bridge concordia_ganache_test_network || true' |
|
|
|
|
|
|
|
|
ganacheTestImage.withRun("""-d -p 6${ganacheTestPort}:8546 \ |
|
|
ganacheTestImage.withRun("""-d -p 6${ganacheTestPort}:8546 \ |
|
@ -127,28 +134,23 @@ pipeline { |
|
|
--name concordia-ganache-test-6${ganacheTestPort} \ |
|
|
--name concordia-ganache-test-6${ganacheTestPort} \ |
|
|
--net=concordia_ganache_test_network""") { concordiaGanacheTest -> |
|
|
--net=concordia_ganache_test_network""") { concordiaGanacheTest -> |
|
|
|
|
|
|
|
|
contractsTestsImage = docker.build( |
|
|
try { |
|
|
"ecentrics/concordia-contracts-tests:v${contractsPackageVersion}-b${BUILD_NUMBER}-tests", |
|
|
sh """docker run \ |
|
|
"-f docker/concordia-contracts/Dockerfile \ |
|
|
--rm \ |
|
|
./ \ |
|
|
|
|
|
--target test \ |
|
|
|
|
|
--build-arg TZ=Europe/Athens" |
|
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
contractsTestsImage.run("""--rm \ |
|
|
|
|
|
-v ecentrics_janus_common:/mnt/concordia/test-reports/ \ |
|
|
-v ecentrics_janus_common:/mnt/concordia/test-reports/ \ |
|
|
--env-file=./jenkins/env/contracts.test.jenkins.env \ |
|
|
--env-file=./jenkins/env/contracts.test.jenkins.env \ |
|
|
-e WEB3_HOST=concordia-ganache-test-6${ganacheTestPort} \ |
|
|
-e WEB3_HOST=concordia-ganache-test-6${ganacheTestPort} \ |
|
|
-e WEB3_PORT=6${ganacheTestPort} \ |
|
|
-e WEB3_PORT=6${ganacheTestPort} \ |
|
|
--net=concordia_ganache_test_network""") |
|
|
--net=concordia_ganache_test_network \ |
|
|
|
|
|
ecentrics/concordia-contracts-tests:${sanitizedBranchName}-v${contractsPackageVersion}-b${BUILD_NUMBER}-tests""" |
|
|
sh 'mkdir -p ./reports/${BUILD_NUMBER}/contracts' |
|
|
|
|
|
sh 'find /mnt/janus/common/ -name "concordia-contracts-*" -exec cp \'{}\' ./reports/${BUILD_NUMBER}/contracts/ \\;' |
|
|
|
|
|
} |
|
|
|
|
|
} catch (e) { |
|
|
} catch (e) { |
|
|
error('Some tests failed!') |
|
|
error('Some tests failed!') |
|
|
error('Aborting the build.') |
|
|
error('Aborting the build.') |
|
|
throw e |
|
|
throw e |
|
|
|
|
|
} finally { |
|
|
|
|
|
sh 'mkdir -p ./reports/${BUILD_NUMBER}/contracts' |
|
|
|
|
|
sh 'find /mnt/janus/common/ -name "concordia-contracts-*" -exec cp \'{}\' ./reports/${BUILD_NUMBER}/contracts/ \\;' |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
@ -157,8 +159,8 @@ pipeline { |
|
|
stage('TEST APP') { |
|
|
stage('TEST APP') { |
|
|
steps { |
|
|
steps { |
|
|
script { |
|
|
script { |
|
|
appTestsImage = docker.build( |
|
|
docker.build( |
|
|
"ecentrics/concordia-app:v${appPackageVersion}-b${BUILD_NUMBER}-tests", |
|
|
"ecentrics/concordia-app:${sanitizedBranchName}-v${appPackageVersion}-b${BUILD_NUMBER}-tests", |
|
|
"-f docker/concordia-app/Dockerfile \ |
|
|
"-f docker/concordia-app/Dockerfile \ |
|
|
./ \ |
|
|
./ \ |
|
|
--target test \ |
|
|
--target test \ |
|
@ -166,15 +168,17 @@ pipeline { |
|
|
) |
|
|
) |
|
|
|
|
|
|
|
|
try { |
|
|
try { |
|
|
appTestsImage.run('--rm \ |
|
|
sh """docker run \ |
|
|
-v ecentrics_janus_common:/mnt/concordia/test-reports/') |
|
|
--rm \ |
|
|
|
|
|
-v ecentrics_janus_common:/mnt/concordia/test-reports/ \ |
|
|
sh 'mkdir -p ./reports/${BUILD_NUMBER}/app' |
|
|
ecentrics/concordia-app:${sanitizedBranchName}-v${appPackageVersion}-b${BUILD_NUMBER}-tests""" |
|
|
sh 'find /mnt/janus/common/ -name "concordia-app-*" -exec cp \'{}\' ./reports/${BUILD_NUMBER}/app/ \\;' |
|
|
|
|
|
} catch (e) { |
|
|
} catch (e) { |
|
|
error('Some tests failed!') |
|
|
error('Some tests failed!') |
|
|
error('Aborting the build.') |
|
|
error('Aborting the build.') |
|
|
throw e |
|
|
throw e |
|
|
|
|
|
} finally { |
|
|
|
|
|
sh 'mkdir -p ./reports/${BUILD_NUMBER}/app' |
|
|
|
|
|
sh 'find /mnt/janus/common/ -name "concordia-app-*" -exec cp \'{}\' ./reports/${BUILD_NUMBER}/app/ \\;' |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|