Continuous Integration and
Automatic Testing for the FLUKA
release using Jenkins (and Docker)
Vittorio BOCCONEDefinitions
Continuous Integration (CI)
is a development practice
that requires developers to integrate code into a shared
repository several times a day. At each iteration the code
is then verified by an automated build system, allowing
teams to detect problems early.
Continuous Delivery (CD
) is a design practice used in
software development to automate and improve the
process of software delivery
Continuous Integration tools
Continuous Integration tools (CI)
are software
packages which orchestrate the build process and automate
the building, testing, archiving and (eventually) deploy
procedures.
Functions:
- Automate repetitive and error prone task;
- Automate builds and test for each commit;
- Execute test;
- Archive artifacts;
- Handle and log building report.
CI implementation
Reliable Builds:
- Creation a new expandable builders (Docker containers);
- The builder live only the time to build the code and than is purged.
Avoid dependencies misalignment:
- Encode the dependencies source code;
- Satisfy the dependencies just before building using the packages in the YUM repository;
- Dependencies will also be inherited by the produced RPM package; A positive byproduct is that we could define a “fluka-toolchain”
package whose dependencies solve the installation problems for the most common distributions (RH-like and Debian-like)
Monitor and Evaluate the code development:
- Handle the testing of the code; - Monitor the code health status;
Example of CI implementation at DECTRIS
YUM RPM Repositories Fresh Builders dectris-corelib dectris-boost jaun jaun-ui dectris-hdf5 eiger eiger-tools eiger-firmwareExample @ DECTRIS Main Software Components fetch fe tch co mm it Git SCM repo rt Te st CI Tool Testing
Why Jenkins? Why Docker?
Jenkins (automation tool)
- Relatively OS independent as it works on everything where an SSH connection or a Java apps can be run;
- Integrate with SVN/Git and bug tracking tools (Jira)
- Free version extendable to an Enterprise version. Cost is based on the size
of the CI infrastructure;
- Easy to install, setup and maintain (no hidden cost for IT);
- Fastest growing tool in CI community, yet stable.
Docker (lightweight Linux container alternative to VMs)
- Fresh Linux container (Ubuntu, CentOS, Fedora...) in matter of seconds; - Free version extendable with plugins;
- Easy to install, setup and maintain (no hidden manpower cost);
- Easy to use, new clean development environment on the fly (no it needed to request a dedicated VMs);
Continuous Integration @Dectris
Tools
- Jenkins as Continuous Integration manager. - Docker for the Linux builder infrastructure.
Requirements
- Each component must be in a versioning scheme and in a SCM; - Each (meaningful) build should be tracked and defined.
- The components workflow should be defined and clear;
Automatic Testing
- Unit, Integration and Functional testing.
- Test with real simulation input files batteries - Report generation
Debugging
- Automatic reporting and identification of culprits.
Important: Tools are just tools and we should be flexible in case we would need to replace one tool with another
Continuous Integration @Dectris
Continuous integration and Science
-
Dectris is PSI spin-off and produces X-Ray detectors
for the synchrotron, laboratory and industry market;
-
Application of Continuous Integration methods does
not only apply strictly to software development but
also to simulation and calibration projects;
Scientific Software Development @Dectris
-
Software Core Team:6 developers (mostly physicist) + 1 (IT);
-
60-70 packages supported (external customers + internal user) +
hundreds of scripts for detector and sensor testing and calibration;
-
Scientific software and simulation support to the other groups
(Development, Support and Production groups);
`
Minimal CI workflow
Commit to SCM Trigger Build Notify Build FailureBuild TestU/F
Notify Test Failure Fail Fail Pass Archive Artifact (RPM) Trigger Code Test Pass Test #N Test #1 Test [...] Report Generation Automated Procedure YUM RPM Repository
Extended CI workflow
Commit to
SCM Trigger Build
Notify Build Failure
Build TestU/F
Notify Test Failure Fail Fail Pass Trigger Code Test Pass Test #N Test #1 Test [...] Report Generation Result Archive Artifact (RPM) Notify Integration Failure Release ? Pass Fail Automated Procedure YUM RPM Repository
Example: FLUKA deployment test
Process
- Take the generated artifacts (RPMS and tarballs) - Apply the installation procedure:
- rpm:
yum install <package> - tarball: tar -zxvf <tarball> export FLUPRO=/path/to/fluka export FLUFOR=g77/gfortran make
RPM Jenkins’s job
- Matrix job with two axis OS (centos6, centos7) and the artifact ARCHITECTURE (32 and 64bit)
- Use Docker to provide clean OS containers
mkdir fluka
mv "ARCHITECTURE="${ARCHITECTURE}/*.rpm fluka/
docker run --rm -v $(pwd)/fluka:/fluka -t centos:$OS bash -c 'yum \ install -y /fluka/*.rpm'
Example: FLUKA RPM deployment test
Results
Each job execution is nicely logged in its own console log accessible in the job’s menu
- CentOS6 (64bit):
- FLUKA g77 (32bit) works out of the box - FLUKA gfortran (64bit) requires new gfortran
which is not provided by the standard repositories
- CentOS7 (64bit)
- FLUKA gfortran (64bit) works out of the box - FLUKA g77 (32bit) requires cross compilation
packages which are not included in the dependencies (and discontinued)
--> Finished Dependency Resolution
Error: Package: fluka-2011.2c-3.x86_64 (/fluka-2011.2c-3.x86_64) Requires: libgfortran.so.3(GFORTRAN_1.4)(64bit)
Error: Package: fluka-2011.2c-3.x86_64 (/fluka-2011.2c-3.x86_64) Requires: libquadmath.so.0()(64bit)
Error: Package: fluka-2011.2c-3.x86_64 (/fluka-2011.2c-3.x86_64) Requires: libc.so.6(GLIBC_2.14)(64bit)
--> Finished Dependency Resolution
Error: Package: fluka-2011.2c-3.i686 (/fluka-2011.2c-3.i686) Requires: compat-gcc-34
Other FLUKA-related applications
FLUKA Benchmarking/Testing
- Run predefined test simulation for each version and monitor execution and result;
- Trigger the analysis of the output data and provide a reliable logging of the operation.
Large Projects/Simulations:
- Monitor a release branch of a large scale simulation project and trigger (and analyse) test simulation (short runs) as soon a commit appears. - Identify implementation errors (i.e. geometry, settings)
Flair/Geoviewer
FLUPIX automatic ISO file generation
Handle FLUKA development version
- FLUKA collaboration members could pick them up directly from the Jenkins server.