Skip to content

Commit 0abd16e

Browse files
authored
New version 3.3.0, adds Docker support (OpenModelica#129)
For example, use `OMCSessionZMQ(docker="openmodelica/openmodelica:v1.16.0-minimal")` or `OMCSessionZMQ(docker="openmodelica/openmodelica:v1.16.1-minimal", port=11111)`
1 parent dfd59b4 commit 0abd16e

6 files changed

Lines changed: 367 additions & 198 deletions

File tree

‎.jenkins/python2/Dockerfile‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@ RUN apt-get update \
77
&& apt-get update \
88
&& apt-get install -qy --no-install-recommends omc \
99
&& rm -rf /var/lib/apt/lists/*
10-
RUN pip2 install --no-cache pytest
10+
RUN pip2 install --no-cache pytest psutil

‎.jenkins/python3/Dockerfile‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@ RUN apt-get update \
77
&& apt-get update \
88
&& apt-get install -qy --no-install-recommends omc \
99
&& rm -rf /var/lib/apt/lists/*
10-
RUN pip3 install --no-cache pytest
10+
RUN pip3 install --no-cache pytest psutil

‎Jenkinsfile‎

Lines changed: 26 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -5,38 +5,42 @@ pipeline {
55
parallel {
66
stage('python2') {
77
agent {
8-
dockerfile {
9-
// Large image with full OpenModelica build dependencies; lacks omc and OMPython
10-
label 'linux'
11-
dir '.jenkins/python2'
12-
additionalBuildArgs '--pull'
13-
}
8+
label 'linux'
149
}
1510
steps {
16-
sh 'python2 setup.py build'
17-
timeout(3) {
18-
sh 'python2 /usr/local/bin/py.test -v --junitxml py2.xml tests'
11+
script {
12+
def deps = docker.build('ompython-jenkins-python2', '--pull .jenkins/python2')
13+
def dockergid = sh (script: 'stat -c %g /var/run/docker.sock', returnStdout: true).trim()
14+
sh "docker pull openmodelica/openmodelica:v1.16.1-minimal" // Avoid timeout
15+
deps.inside("-v /var/run/docker.sock:/var/run/docker.sock --network=host --pid=host --group-add '${dockergid}'") {
16+
sh 'python2 setup.py build'
17+
timeout(3) {
18+
sh 'python2 /usr/local/bin/py.test -v --junitxml py2.xml tests'
19+
}
20+
sh 'HOME="$PWD" python2 setup.py install --user'
21+
}
22+
junit 'py2.xml'
1923
}
20-
sh 'HOME="$PWD" python2 setup.py install --user'
21-
junit 'py2.xml'
2224
}
2325
}
2426
stage('python3') {
2527
agent {
26-
dockerfile {
27-
// Large image with full OpenModelica build dependencies; lacks omc and OMPython
28-
label 'linux'
29-
dir '.jenkins/python3'
30-
additionalBuildArgs '--pull'
31-
}
28+
label 'linux'
3229
}
3330
steps {
34-
sh 'python3 setup.py build'
35-
timeout(3) {
36-
sh 'python3 /usr/local/bin/py.test -v --junitxml py3.xml tests'
31+
script {
32+
def deps = docker.build('ompython-jenkins-python3', '--pull .jenkins/python3')
33+
def dockergid = sh (script: 'stat -c %g /var/run/docker.sock', returnStdout: true).trim()
34+
sh "docker pull openmodelica/openmodelica:v1.16.1-minimal" // Avoid timeout
35+
deps.inside("-v /var/run/docker.sock:/var/run/docker.sock --network=host --pid=host --group-add '${dockergid}'") {
36+
sh 'python3 setup.py build'
37+
timeout(3) {
38+
sh 'python3 /usr/local/bin/py.test -v --junitxml py3.xml tests'
39+
}
40+
sh 'HOME="$PWD" python3 setup.py install --user'
41+
}
42+
junit 'py3.xml'
3743
}
38-
sh 'HOME="$PWD" python3 setup.py install --user'
39-
junit 'py3.xml'
4044
}
4145
}
4246
}

0 commit comments

Comments
 (0)