Skip to content

Commit

Permalink
Add JUnit xml to pipeline. Add python test. Add clamore libs.
Browse files Browse the repository at this point in the history
  • Loading branch information
sdelrio committed Sep 26, 2017
1 parent d7fb4b2 commit 231787d
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 6 deletions.
2 changes: 2 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ ENV FREQUENCY 1
ENV VERSION 0.49

ADD claymoreexporter.py .
ADD claymoreexporter_lib.py .
ADD test_claymoreexporter_lib.py .
ADD entrypoint.sh .
RUN chmod +x entrypoint.sh

Expand Down
26 changes: 20 additions & 6 deletions Jenkinsfile
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
node ('docker') {
try {
def TAG="$BUILD_TIMESTAMP-$BUILD_ID"

stage("Checkout") {
currentBuild.displayName = "$BUILD_TIMESTAMP-$BUILD_ID"
currentBuild.displayName = "$TAG"
// currentBuild.description = "Description $BUILD_ID"
sh 'echo Current Build: $BUILD_TIMESTAMP-$BUILD_ID'
checkout scm
}

stage("Build") {
parallel b_intel: {
def TAG="$BUILD_TIMESTAMP-$BUIlD_ID"
def BASE_X86="jfloff/alpine-python"
sh "export BASE_X86=jfloff/alpine-python"
sh "echo X86=${BASE_X86}"
Expand All @@ -17,7 +19,6 @@ node ('docker') {
sh "docker run --entrypoint uname sdelrio/claymore-exporter:${TAG} -m"
},
b_arm: {
def TAG="$BUILD_TIMESTAMP-$BUIlD_ID"
def BASE_ARM="resin/raspberry-pi-alpine-python"
sh "export BASE_ARM=resin/raspberry-pi-alpine-python"
sh "echo ARM=${BASE_ARM}"
Expand All @@ -26,23 +27,36 @@ node ('docker') {
sh "docker run --entrypoint uname sdelrio/claymore-exporter-arm:${TAG} -m"
}
}

stage("Unit Test") {
parallel u_intel: {
sh "docker run --name claymore_intel_${TAG} --entrypoint pytest sdelrio/claymore-exporter:${TAG} --junitxml TEST-unit-intel.xml"
sh "docker cp claymore_intel_${TAG}:/usr/local/bin/TEST-unit-intel.xml ."
sh "docker rm claymore_intel_${TAG}"
junit 'TEST-unit-intel.xml'
},
u_arm: {
sh "docker run --name claymore_arm_${TAG} --entrypoint pytest sdelrio/claymore-exporter-arm:${TAG} --junitxml TEST-unit-arm.xml"
sh "docker cp claymore_arm_${TAG}:/usr/local/bin/TEST-unit-arm.xml ."
sh "docker rm claymore_arm_${TAG}"
junit 'TEST-unit-arm.xml'
}
}

stage("Push") {
withCredentials([usernamePassword(
credentialsId: 'docker-hub', passwordVariable: 'DOCKER_PASS', usernameVariable: 'DOCKER_USER'
)]) {
sh "docker login --username $DOCKER_USER --password $DOCKER_PASS"
parallel p_intel: {
def TAG="$BUILD_TIMESTAMP-$BUIlD_ID"
sh "docker push sdelrio/claymore-exporter:${TAG}"
},
p_arm: {
def TAG="$BUILD_TIMESTAMP-$BUIlD_ID"
sh "docker push sdelrio/claymore-exporter-arm:${TAG}"
}
}
}


} finally {
stage("Cleanup") {
sh 'docker system prune -af'
Expand Down

0 comments on commit 231787d

Please sign in to comment.