Skip to content

Commit c49c0f8

Browse files
author
Sebastian B
authored
Merge pull request #5 from kwening/develop
Continuous Integration setup and README
2 parents 96595b2 + 775ac2c commit c49c0f8

File tree

5 files changed

+178
-31
lines changed

5 files changed

+178
-31
lines changed

Jenkinsfile

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
pipeline {
2+
agent {
3+
label "docker"
4+
}
5+
6+
environment{
7+
def DOCKER_IMAGE = "jenkins-oft-arch-builder"
8+
def DOCKER_REGISTRY = ""
9+
}
10+
11+
stages{
12+
stage("checkout") {
13+
steps{
14+
checkout scm
15+
}
16+
}
17+
18+
stage("build docker") {
19+
steps{
20+
sh "docker build -t ${DOCKER_IMAGE} -f docker/Dockerfile ."
21+
}
22+
}
23+
24+
stage("render html") {
25+
steps {
26+
sh "docker run --rm -v $WORKSPACE:/home/jenkins -v $WORKSPACE/.m2/:/root/.m2/repository ${DOCKER_IMAGE} mvn -B -U clean compile"
27+
archiveArtifacts artifacts: '**/target/*.html,**/target/**/*', fingerprint: true
28+
}
29+
}
30+
31+
stage("render pdf") {
32+
steps {
33+
sh "docker run --rm -v $WORKSPACE:/home/jenkins -v $WORKSPACE/.m2/:/root/.m2/repository ${DOCKER_IMAGE} mvn -B -U compile -P render-pdf"
34+
archiveArtifacts artifacts: '**/target/*.pdf', fingerprint: true
35+
}
36+
}
37+
}
38+
39+
options {
40+
buildDiscarder(logRotator(numToKeepStr:'10'))
41+
timeout(time: 60, unit: 'MINUTES')
42+
disableConcurrentBuilds()
43+
}
44+
}

README.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,3 +194,24 @@ linkchecker --check-extern target/*.html
194194
```
195195

196196
If you remove the command line switch `--check-extern` only local links are checked.
197+
198+
## Continuous Integration
199+
200+
This project contains a CI setup for Jenkins. The build uses [Docker](https://www.docker.com/) to provide a stable environment for its execution. So Jenkins needs to be able to execute Docker commands.
201+
The build process itself is defined within `Jenkinsfile` and consists of these stages:
202+
- checkout : Get the source from repo
203+
- build docker : Create the Docker image to be used during build execution (only once if it doesn't exist locally)
204+
- render html : render a HTML file from sources
205+
- render pdf : render a PDF file from source
206+
207+
The rendering of HTML, PDF,... is controlled with Maven profiles (`render-html`, `render-pdf`). To enable other/ additional formats new profiles can be defined within `pom.xml`.
208+
209+
### Build without Docker
210+
211+
If there is no Docker installation available the required tools/ dependencies described above need to be provided on Jenkins or at least one of its agents.
212+
- [docker/Dockerfile](docker/Dockerfile) can be used as template for the setup of the required tools.
213+
- the Jenkins agents should be labeled accordingly (i.e. pandoc)
214+
- `Jenkinsfile` : label needs to match agent-labels (i.e. pandoc)
215+
- `Jenkinsfile` : the "build docker" stage has to be removed
216+
- `Jenkinsfile` : the "run docker"-part has to be removed from sh-executions
217+

docker/Dockerfile

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
FROM maven:3.5-jdk-8
2+
3+
ARG PANDOC_VERSION="2.2.3.2"
4+
5+
# Install dependencies texlive, graphviz
6+
RUN apt-get update \
7+
&& apt-get install -y texlive-latex-base graphviz \
8+
&& apt-get autoremove --purge -y \
9+
&& apt-get autoclean -y \
10+
&& apt-get clean
11+
12+
# pandoc 2.x required
13+
RUN curl -fL https://github.com/jgm/pandoc/releases/download/${PANDOC_VERSION}/pandoc-${PANDOC_VERSION}-linux.tar.gz | tar xzv --strip-components 1 -C /usr/local/
14+
15+
RUN apt-get install -y texlive-fonts-recommended librsvg2-bin
16+
17+
# Set workdir (also mountpoint for docker volume)
18+
WORKDIR /home/jenkins

pom.xml

Lines changed: 87 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,19 @@
1616
<maven.build.timestamp.format>yyyy-MM-dd</maven.build.timestamp.format>
1717
<spec.version>${project.version}</spec.version>
1818
<spec.date>${maven.build.timestamp}</spec.date>
19-
<spec.title>AutoYummiBox ${spec.version} - Software Architectural Design</spec.title>
19+
<spec.title>AutoYummiBox ${spec.version} - Software
20+
Architectural
21+
Design</spec.title>
2022
<spec.authors>S. Bär, M. Thielcke</spec.authors>
2123
<spec.filename>SwAD-AutoYummiBox</spec.filename>
2224
<spec.files>architecture.md introduction.md context.md
2325
solution_strategy.md building_block_view.md
2426
building_block_view/MachineApplication.md runtime_view.md
25-
runtime_view/ordering_dishes.md runtime_view/preparing_dishes.md
27+
runtime_view/ordering_dishes.md
28+
runtime_view/preparing_dishes.md
2629
runtime_view/paying_with_credit_card.md deployment_view.md
27-
concepts.md design_decisions.md quality_scenarios.md risks.md
30+
concepts.md design_decisions.md quality_scenarios.md
31+
risks.md
2832
glossary.md bibliography.md</spec.files>
2933
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
3034
<!-- Do not change the properties below -->
@@ -94,33 +98,6 @@
9498
</dependency>
9599
</dependencies>
96100
</plugin>
97-
<plugin>
98-
<groupId>org.codehaus.mojo</groupId>
99-
<artifactId>exec-maven-plugin</artifactId>
100-
<version>1.6.0</version>
101-
<executions>
102-
<execution>
103-
<id>pandoc</id>
104-
<phase>compile</phase>
105-
<configuration>
106-
<executable>pandoc</executable>
107-
<workingDirectory>${spec.source.directory}</workingDirectory>
108-
<commandlineArgs>--from=markdown --to=html5 --standalone
109-
--toc --number-sections
110-
--css=${spec.source.css.directory}/spec.css
111-
--lua-filter=${lua.source.directory}/link_converter.lua
112-
--strip-comments --output=${spec.file.html}
113-
--metadata=title:"${spec.title}"
114-
--metadata=date:"${spec.date}"
115-
--metadata=author:"${spec.authors}"
116-
${spec.files}</commandlineArgs>
117-
</configuration>
118-
<goals>
119-
<goal>exec</goal>
120-
</goals>
121-
</execution>
122-
</executions>
123-
</plugin>
124101
<plugin>
125102
<!-- See http://www.mojohaus.org/license-maven-plugin/examples/example-add-license.html -->
126103
<groupId>org.codehaus.mojo</groupId>
@@ -175,7 +152,7 @@
175152
<version>3.1.0</version>
176153
<configuration>
177154
<descriptors>
178-
<descriptor>${project.basedir}/src/assembly/htmldoc.xml</descriptor>
155+
<descriptor>${project.basedir}/src/assembly/htmldoc.xml</descriptor>
179156
</descriptors>
180157
<finalName>${spec.filename}-${project.version}</finalName>
181158
</configuration>
@@ -191,4 +168,83 @@
191168
</plugin>
192169
</plugins>
193170
</build>
171+
<profiles>
172+
<profile>
173+
<id>render-pdf</id>
174+
<build>
175+
<plugins>
176+
<plugin>
177+
<groupId>org.codehaus.mojo</groupId>
178+
<artifactId>exec-maven-plugin</artifactId>
179+
<version>1.6.0</version>
180+
<executions>
181+
<execution>
182+
<id>pandoc-pdf</id>
183+
<phase>compile</phase>
184+
<configuration>
185+
<executable>pandoc</executable>
186+
<workingDirectory>${spec.source.directory}</workingDirectory>
187+
<commandlineArgs>--from=markdown --to=pdf
188+
--standalone
189+
--toc
190+
--number-sections -t latex
191+
--css=${spec.source.css.directory}/spec.css
192+
--lua-filter=${lua.source.directory}/pdf_image_path_converter.lua
193+
--strip-comments
194+
--output=${spec.file.pdf}
195+
--metadata=title:"${spec.title}"
196+
--metadata=date:"${spec.date}"
197+
--metadata=author:"${spec.authors}"
198+
${spec.files}</commandlineArgs>
199+
</configuration>
200+
<goals>
201+
<goal>exec</goal>
202+
</goals>
203+
</execution>
204+
</executions>
205+
</plugin>
206+
</plugins>
207+
</build>
208+
</profile>
209+
<profile>
210+
<id>render-html</id>
211+
<activation>
212+
<activeByDefault>true</activeByDefault>
213+
</activation>
214+
<build>
215+
<plugins>
216+
<plugin>
217+
<groupId>org.codehaus.mojo</groupId>
218+
<artifactId>exec-maven-plugin</artifactId>
219+
<version>1.6.0</version>
220+
<executions>
221+
<execution>
222+
<id>pandoc</id>
223+
<phase>compile</phase>
224+
<configuration>
225+
<executable>pandoc</executable>
226+
<workingDirectory>${spec.source.directory}</workingDirectory>
227+
<commandlineArgs>--from=markdown
228+
--to=html5
229+
--standalone
230+
--toc
231+
--number-sections
232+
--css=${spec.source.css.directory}/spec.css
233+
--lua-filter=${lua.source.directory}/link_converter.lua
234+
--strip-comments --output=${spec.file.html}
235+
--metadata=title:"${spec.title}"
236+
--metadata=date:"${spec.date}"
237+
--metadata=author:"${spec.authors}"
238+
${spec.files}</commandlineArgs>
239+
</configuration>
240+
<goals>
241+
<goal>exec</goal>
242+
</goals>
243+
</execution>
244+
</executions>
245+
</plugin>
246+
</plugins>
247+
</build>
248+
</profile>
249+
</profiles>
194250
</project>
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
function Image(image)
2+
src = image.src
3+
4+
src = "../../target/" .. src
5+
image.src = src
6+
7+
return image
8+
end

0 commit comments

Comments
 (0)