Public | Automated Build

Last pushed: a month ago
Short Description
Some containers used in eXo CI environment
Full Description

eXo Docker Images for CI

-

The aim of this repository is to give the configuration to build all eXo Platform components in Docker containers for Development and Continous Integration purpose.

It contains Dockerfiles, Tests and configuration for the following CI Images:

Image JDK Build tool Size Tests
exoplatform/ci:base n/a n/a goss.yaml
exoplatform/ci:jdk6 1.6.0_45 n/a goss.yaml
exoplatform/ci:jdk7 1.7.0_79 n/a goss.yaml
exoplatform/ci:jdk8 1.8.0_92 n/a goss.yaml
exoplatform/ci:jdk8-gradle2 1.8.0_92 Gradle 2.14 goss.yaml
exoplatform/ci:jdk8-gradle2-android 1.8.0_92 Gradle 2.14 / Android 23/24 goss.yaml
exoplatform/ci:jdk6-maven30 1.6.0_45 Maven 3.0.5 goss.yaml
exoplatform/ci:jdk6-maven32 1.6.0_45 Maven 3.2.5 goss.yaml
exoplatform/ci:jdk7-maven30 1.7.0_79 Maven 3.0.5 goss.yaml
exoplatform/ci:jdk7-maven32 1.7.0_79 Maven 3.2.5 goss.yaml
exoplatform/ci:jdk8-maven30 1.8.0_92 Maven 3.0.5 goss.yaml
exoplatform/ci:jdk8-maven32 1.8.0_92 Maven 3.2.5 goss.yaml
exoplatform/ci:jdk8-maven33 1.8.0_92 Maven 3.3.9 goss.yaml

Overview

This diagram show an overview of the inheritance in eXo CI Docker images:

How to execute tests?

To run tests, you have to install dgoss

You can build and test all images by running the script:

$ ./test_all_images.sh

If you want to execute test on a specific Docker image:

$ cd maven/jdk7-maven32/tests
$ ./test_image.sh

Then you should have a log like below:

INFO: Starting docker container
INFO: Container ID: 59897f6f
INFO: Sleeping for 0.2
INFO: Running Tests
Title: Validating the presence of eXo GLOBAL settings file
File: /usr/share/maven/conf/settings.xml: exists: matches expectation: [true]
Title: Validating the presence Maven repository folder
File: /home/ciagent/.m2/repository: exists: matches expectation: [true]
Title: Validating the absence of eXo USER settings file
File: /home/ciagent/.m2/settings.xml: exists: matches expectation: [false]
Title: Check that git is installed
Package: git: installed: matches expectation: [true]
Command: mvn --version: exit-status: matches expectation: [0]
Command: mvn --version: stdout: matches expectation: [3.2.5 1.7.0 Default locale: en_US, platform encoding: UTF-8]


Total Duration: 0.650s
Count: 6, Failed: 0, Skipped: 0
INFO: Deleting container

real    0m2.929s
user    0m0.064s
sys     0m0.288s

How to use a eXo CI Docker Image?

Basic Example with JDK7 - Maven 3.0

$ cd my-project
$ docker run --name=my-project-build -it -v $(pwd):/srv/ciagent/workspace \
     -v ~/.m2/repository:/home/ciagent/.m2/repository \
     -v ~/.m2/settings.xml:/home/ciagent/.m2/settings.xml \
     exoplatform/ci:jdk7-maven30 clean package

Advanced example with JDK8 - Maven 3.2 and Release Profile

$ cd my-project
$ docker run --name=my-project-build -it -v $(pwd):/srv/ciagent/workspace \
     -v ~/.m2/repository:/home/ciagent/.m2/repository \
     -v ~/.m2/settings.xml:/home/ciagent/.m2/settings.xml \
     -v ~/.gnupg/pubring.gpg:/home/ciagent/.gnupg/pubring.gpg:ro \
     -v ~/.gnupg/secring.gpg:/home/ciagent/.gnupg/secring.gpg:ro \
     -v ~/.gnupg/gpg.conf:/home/ciagent/.gnupg/gpg.conf:ro \
     exoplatform/ci:jdk8-maven32 install -Prelease

How to use eXo Puppet Docker Image

$ cd my-project
$ docker run --name puppet-validation -it -v ${PWD}:/srv/ciagent/workspace \
      exoplatform/ci:puppet

You can specify the -u option to force the modules update via r10k
Example :

docker run --name puppet-validation -it -v ${PWD}:/srv/ciagent/workspace \
      exoplatform/ci:puppet -u

XMLStarlet

XMLStarlet is a set of command line utilities (tools) which can be used to transform, query, validate, and edit XML documents and files using simple set of shell commands in similar way it is done for plain text files using UNIX grep, sed, awk, diff, patch, join, etc commands.

At eXo, we use it to update Maven POM XML files for FB and Translation process.

examples:

$ cd /tmp/xmlstarlet
$ wget https://raw.githubusercontent.com/exoplatform/maven-parent-pom/develop/pom.xml
$ docker run -it --rm --name=xmlstartlet  -v $(pwd):/srv/ciagent/workspace --entrypoint=/bin/bash  exoplatform/ci:jdk8-maven32

# Update POM version from X-SNAPSHOT to X-translation-SNAPSHOT
ciagent@b32b684a1d6b:/srv/ciagent/workspace$ xmlstarlet ed --inplace -N pom=http://maven.apache.org/POM/4.0.0 \
  -u '/pom:project/pom:version[contains(text(), "-SNAPSHOT")]' \
  -x "concat(substring-before(.,'-SNAPSHOT'), '-translation-SNAPSHOT')" \
  pom.xml

# Update all POMs files in a Maven reactor project
ciagent@b32b684a1d6b:/srv/ciagent/workspace$ find . -name pom.xml | xargs -t -n 1 xmlstarlet ed -P --inplace -N pom=http://maven.apache.org/POM/4.0.0 -u '/pom:project/pom:version[contains(text(), "-SNAPSHOT")]' -x "concat(substring-before(.,'-SNAPSHOT'), '-translation-SNAPSHOT')"

Developer configuration

Configure your .bash_profile

In order to quickly run build with different stack (Maven and JDK), you can configure your .bash_profile file
with the following alias:

#!/bin/bash
# Run Maven commands in Containers

c-mvn(){
      mvnInContainer "exoplatform/ci:jdk8-maven33" "$@"
}
jdk8mvn32(){
      mvnInContainer "exoplatform/ci:jdk8-maven32" "$@"
}

jdk8mvn30(){
      mvnInContainer "exoplatform/ci:jdk8-maven30" "$@"
}

jdk7mvn32(){
      mvnInContainer "exoplatform/ci:jdk7-maven32" "$@"
}

jdk7mvn30(){
      mvnInContainer "exoplatform/ci:jdk7-maven30" "$@"
}

jdk6mvn30(){
      mvnInContainer "exoplatform/ci:jdk6-maven30" "$@"
}

# Run Maven commands in a container
mvnInContainer(){
      local dockerImage=$1

      docker run --rm \
        -v $(pwd):/srv/ciagent/workspace \
        -v ~/.gnupg/gpg.conf:/home/ciagent/.gnupg/gpg.conf:ro \
        -v ~/.gnupg/pubring.gpg:/home/ciagent/.gnupg/pubring.gpg:ro \
        -v ~/.gnupg/secring.gpg:/home/ciagent/.gnupg/secring.gpg:ro \
        -v ~/.gnupg/trustdb.gpg:/home/ciagent/.gnupg/trustdb.gpg:ro \
        -v ~/.gnupg:/home/ciagent/.gnupg \
        -v ~/.m2/repository:/home/ciagent/.m2/repository \
        -v ~/.m2/settings.xml:/home/ciagent/.m2/settings.xml \
        --workdir /srv/ciagent/workspace \
        ${dockerImage} "${@:2}"
}
puppet_validate(){
docker run --name puppet-validation -it -v ${PWD}:/srv/ciagent/workspace \
      exoplatform/ci:puppet $*
}

Build with the right configuration

$ source ~/.bash_profile
$ cd my-project
$ jdk8mvn32 clean package
Docker Pull Command
Owner
exoplatform
Source Repository

Comments (0)