changeset 19:02c83c12d3d5

added jenkins build
author am@osimis.io
date Thu, 19 Jul 2018 15:04:00 +0200
parents e252d740436f
children 549d67db766c
files .dockerignore Dockerfile Jenkinsfile NEWS scripts/ciBuildDockerImage.sh scripts/ciPushToAws.sh
diffstat 6 files changed, 89 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.dockerignore	Thu Jul 19 15:04:00 2018 +0200
@@ -0,0 +1,6 @@
+scripts/
+NEWS
+NOTES.txt
+README
+Jenkinsfile
+Dockerfile
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Dockerfile	Thu Jul 19 15:04:00 2018 +0200
@@ -0,0 +1,31 @@
+
+FROM jodogne/orthanc:1.2.0
+
+WORKDIR /root/source
+
+RUN apt-get update && \
+    DEBIAN_FRONTEND=noninteractive apt-get -y install \
+      libxml++2.6-dev libxml++2.6-doc uuid-dev \
+      git \
+      python3-dev \
+      python3.4-venv \
+      python3-pip && \
+    rm -rf /var/lib/apt/lists/*
+
+# Used to copy the plugin to AWS after successful integration tests
+RUN pip3 install awscli
+
+COPY . /root/source/
+
+# Build the plugin
+RUN mkdir /root/build/
+WORKDIR /root/build
+RUN cmake -DALLOW_DOWNLOADS=ON \
+    -DSTATIC_BUILD=ON \
+    -DCMAKE_BUILD_TYPE=Release \
+    /root/source
+RUN make "--jobs=$(grep --count ^processor /proc/cpuinfo)"
+RUN make install
+
+ENTRYPOINT [ "Orthanc" ]
+CMD [ "/etc/orthanc/" ]
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Jenkinsfile	Thu Jul 19 15:04:00 2018 +0200
@@ -0,0 +1,21 @@
+try {
+  node('docker') {
+    stage 'Retrieve sources'
+    deleteDir()
+    checkout scm
+
+    lock(resource: 'orthanc-authorization-plugin', inversePrecedence: false) {
+      stage 'Build Docker image & run unit tests'
+      sh 'scripts/ciBuildDockerImage.sh'
+    }
+    
+    withCredentials([[$class: 'AmazonWebServicesCredentialsBinding', credentialsId: 'aws-orthanc.osimis.io']]) {
+      stage 'Push Docker plugin to AWS'
+      sh 'scripts/ciPushToAws.sh ${BRANCH_NAME}'
+    }
+  }
+} 
+catch (e) {
+    slackSend color: '#FF0000', message: "${env.JOB_NAME} has failed ${env.JOB_URL}"
+    throw e
+} 
\ No newline at end of file
--- a/NEWS	Fri Mar 09 10:29:15 2018 +0100
+++ b/NEWS	Thu Jul 19 15:04:00 2018 +0200
@@ -2,6 +2,8 @@
 ===============================
 
 
+* Added automated build
+
 2018-03-08 - v 0.2.0
 ====================
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/ciBuildDockerImage.sh	Thu Jul 19 15:04:00 2018 +0200
@@ -0,0 +1,9 @@
+#!/usr/bin/env bash
+# Builds the Orthanc authorization plugin Docker image
+# Arguments:
+
+set -x # Trace execution
+set -e # Stop on error
+set -u # Stop on uninitialized variable
+
+docker build -t osimis/orthanc-authorization-plugin .
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/ciPushToAws.sh	Thu Jul 19 15:04:00 2018 +0200
@@ -0,0 +1,20 @@
+#!/usr/bin/env bash
+# Builds the MSSQL Orthanc plugin Docker image
+# Arguments:
+#   $1 - Git branch name
+
+set -e # Stop on error
+set -u # Stop on uninitialized variable
+set -x # Trace execution
+
+branchName=${1:-$(hg branch)} #if no argument defined, get the branch name from git
+commitId=$(hg identify --id)
+
+if [[ $branchName == "default" ]]; then
+    releaseTag=$commitId
+else
+    releaseTag=$branchName
+fi
+
+docker run --rm -e AWS_ACCESS_KEY_ID -e AWS_SECRET_ACCESS_KEY --entrypoint bash osimis/orthanc-authorization-plugin -c \
+  "aws s3 --region eu-west-1 cp /usr/local/share/orthanc/plugins/libOrthancAuthorization.so s3://orthanc.osimis.io/docker-so/orthanc-authorization/$releaseTag/ --cache-control max-age=1"
\ No newline at end of file