Browse Source

fix: use sh instead of docker plugin

develop
Apostolos Fanakis 4 years ago
parent
commit
19e3fb1f0a
Signed by: Apostolof GPG Key ID: 8600B4C4163B3269
  1. 64
      jenkins/Jenkinsfile

64
jenkins/Jenkinsfile

@ -19,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
@ -113,44 +111,46 @@ 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(
"ecentrics/concordia-ganache",
"-f docker/ganache/Dockerfile \
./"
)
def ganacheTestImage = docker.build( docker.build(
"ecentrics/concordia-ganache", "ecentrics/concordia-contracts-tests:${sanitizedBranchName}-v${contractsPackageVersion}-b${BUILD_NUMBER}-tests",
"-f docker/ganache/Dockerfile \ "-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 \
--env-file=./jenkins/env/ganache.test.jenkins.env \ --env-file=./jenkins/env/ganache.test.jenkins.env \
--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:${sanitizedBranchName}-v${contractsPackageVersion}-b${BUILD_NUMBER}-tests", sh """docker run \
"-f docker/concordia-contracts/Dockerfile \ --rm \
./ \ -v ecentrics_janus_common:/mnt/concordia/test-reports/ \
--target test \ --env-file=./jenkins/env/contracts.test.jenkins.env \
--build-arg TZ=Europe/Athens" -e WEB3_HOST=concordia-ganache-test-6${ganacheTestPort} \
) -e WEB3_PORT=6${ganacheTestPort} \
--net=concordia_ganache_test_network \
contractsTestsImage.run("""--rm \ ecentrics/concordia-contracts-tests:${sanitizedBranchName}-v${contractsPackageVersion}-b${BUILD_NUMBER}-tests"""
-v ecentrics_janus_common:/mnt/concordia/test-reports/ \ } catch (e) {
--env-file=./jenkins/env/contracts.test.jenkins.env \ error('Some tests failed!')
-e WEB3_HOST=concordia-ganache-test-6${ganacheTestPort} \ error('Aborting the build.')
-e WEB3_PORT=6${ganacheTestPort} \ throw e
--net=concordia_ganache_test_network""") } finally {
sh 'mkdir -p ./reports/${BUILD_NUMBER}/contracts'
sh 'find /mnt/janus/common/ -name "concordia-contracts-*" -exec cp \'{}\' ./reports/${BUILD_NUMBER}/contracts/ \\;'
} }
} catch (e) {
error('Some tests failed!')
error('Aborting the build.')
throw e
} finally {
sh 'mkdir -p ./reports/${BUILD_NUMBER}/contracts'
sh 'find /mnt/janus/common/ -name "concordia-contracts-*" -exec cp \'{}\' ./reports/${BUILD_NUMBER}/contracts/ \\;'
} }
} }
} }

Loading…
Cancel
Save