Building Axon.ivy Projects on Bitbucket Pipelines - The Koch Family
The Koch Family The Koch Family

Latest news

جاري التحميل ...

Building Axon.ivy Projects on Bitbucket Pipelines


Read me if you don't know what Axon.ivy (Ivy) is.

Motivation

Ivy projects are designed to be built on a continuous integration (CI) server like Jenkins
- Today, Bitbucket supports for CI with Bitbucket Pipelines
- We're using Bitbucket. Then, why not? It must be very cool and convenient for us if we can centralize our CI and VCS (version control system) tools in one place.

Here is an approach

We have to use a maven plugin called project-build-plugin to build ivy projects. This plugin requires an instance of Ivy engine during building time.

Bitbucket Pipelines allows us to specify our own docker image as a build environment. What we need to do  is to prepare our docker image with needed stuffs such as JDK, Maven, Ivy engine, etc.

Step 1. Prepare Docker images

For testing purpose, I already created two docker images: Maven and Axon.ivy engine. They are now available on Docker Hub

This image for Maven using Oracle JDK 8
## Install Oracle Java 8
FROM ubuntu:16.04
MAINTAINER Huong Nguyen vnnvanhuong@gmail.com
# Update the package repository
RUN echo "deb http://archive.ubuntu.com/ubuntu xenial main universe" > /etc/apt/sources.list
RUN apt-get -y update
# Install python-software-properties
RUN DEBIAN_FRONTEND=noninteractive apt-get install -y -q python-software-properties software-properties-common
# Install Oracle Java 8
ENV JAVA_VER 8
ENV JAVA_HOME /usr/lib/jvm/java-8-oracle
RUN echo 'deb http://ppa.launchpad.net/webupd8team/java/ubuntu trusty main' >> /etc/apt/sources.list && \
echo 'deb-src http://ppa.launchpad.net/webupd8team/java/ubuntu trusty main' >> /etc/apt/sources.list && \
apt-key adv --keyserver keyserver.ubuntu.com --recv-keys C2518248EEA14886 && \
apt-get update && \
echo oracle-java${JAVA_VER}-installer shared/accepted-oracle-license-v1-1 select true | /usr/bin/debconf-set-selections && \
apt-get install -y --force-yes --no-install-recommends oracle-java${JAVA_VER}-installer oracle-java${JAVA_VER}-set-default && \
apt-get clean && \
rm -rf /var/cache/oracle-jdk${JAVA_VER}-installer
# Set Oracle Java as the default Java
RUN update-java-alternatives -s java-8-oracle
RUN echo "export JAVA_HOME=/usr/lib/jvm/java-8-oracle" >> ~/.bashrc
# Clean Up APT when finished
RUN apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
## Install Maven 3.3.9
ENV MAVEN_VERSION 3.3.9
RUN apt-get update && apt-get install curl
RUN mkdir -p /usr/share/maven \
&& curl -fsSL http://apache.osuosl.org/maven/maven-3/$MAVEN_VERSION/binaries/apache-maven-$MAVEN_VERSION-bin.tar.gz \
| tar -xzC /usr/share/maven --strip-components=1 \
&& ln -s /usr/share/maven/bin/mvn /usr/bin/mvn
ENV MAVEN_HOME /usr/share/maven
VOLUME /root/.m2
This image for Axon.ivy Engine 7.0.1
FROM vnnvanhuong/maven-oracle-jdk:8
MAINTAINER Huong Nguyen vnnvanhuong@gmail.com
# Install wget, unzip
RUN apt-get update && \
apt-get install -y --no-install-recommends \
wget \
unzip
# Download and extract Axon.ivy Engine
RUN wget https://download.axonivy.com/7.0.1/AxonIvyEngine7.0.1.56047_All_x64.zip -O AxonIvyEngine7.zip && \
unzip AxonIvyEngine7.zip -d /opt/AxonIvyEngine7 && \
rm -f AxonIvyEngine7.zip && \
useradd -s /sbin/nologin axonivy && \
chown -R axonivy:axonivy /opt/AxonIvyEngine7

Step 2. Configure Maven plugin at pom.xml

We need is define path to Ivy engine within the docker image.
<?xml version="1.0" encoding="UTF-8"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<groupId>vn.nvanhuong</groupId>
<artifactId>pipelines-axonivy</artifactId>
<version>1.0.0-SNAPSHOT</version>
<packaging>iar</packaging>
<properties>
<engine.path>/opt/AxonIvyEngine7</engine.path>
<ivy.version>7.0.1</ivy.version>
</properties>
<build>
<plugins>
<plugin>
<groupId>com.axonivy.ivy.ci</groupId>
<artifactId>project-build-plugin</artifactId>
<version>7.0.0</version>
<extensions>true</extensions>
<configuration>
<engineDirectory>${engine.path}</engineDirectory>
<ivyVersion>${ivy.version}</ivyVersion>
</configuration>
</plugin>
</plugins>
</build>
</project>

Step 3. Enable and Configure BitBucket Pipelines at bitbucket-pipelines.yml

Specify our docker image that we defined above.
# This is a sample build configuration for Java (Maven).
# Check our guides at https://confluence.atlassian.com/x/zd-5Mw for more examples.
# Only use spaces to indent your .yml configuration.
# -----
# You can specify a custom docker image from Docker Hub as your build environment.
image: vnnvanhuong/axonivy-engine:7.0.1
pipelines:
default:
- step:
caches:
- maven
script: # Modify the commands below to build your repository.
- mvn verify # -B batch mode makes Maven less verbose

Have fun

This is my result from Bitbucket Pipelines. ;)



References
[1]. https://www.youtube.com/watch?v=5mtxVkZbJcg&list=PLzvRQMJ9HDiT-KJHqyY-79dpmIo9lrMcy
[2]. https://runnable.com/docker/java/dockerize-your-java-application
[3]. https://answers.axonivy.com/questions/2281/maven-complete-setup-for-build
[4]. https://answers.axonivy.com/questions/2388/how-to-start-an-axon-ivy-project-in-a-docker-container
[5]. https://github.com/dgauch/docker-axonivy-engine
[6]. https://hub.docker.com/r/dgauch/axonivy-engine/
[7]. https://axonivy.github.io/project-build-plugin/release/7.0/index.html
[8]. https://developer.axonivy.com/doc/latest/DesignerGuideHtml/ivy.concepts.html#ivy-ci

Comments



If you like the content of our blog, we hope to stay in constant communication, just enter your email to subscribe to the blog's express mail to receive new blog updates, and you can send a message by clicking on the button next ...

إتصل بنا

About the site

author The Koch Family <<  Welcome! I'm so glad that you stopped by Your Modern Family blog. Together, we will talk about raising kids, organizing the home and saving money! and Tips & tricks and more…

< Learn more ←

Blog stats

Sparkline 2513183

All Copyrights Reserved

The Koch Family

2020

انتباه! تم الكشف عن مانع الإعلانات!

يرجى تعطيل برنامج حظر الإعلانات أو وضع القائمة البيضاء لموقعنا على الويب.

تحديث طريقة الإيقاف

انتباه! تم الكشف عن مانع الإعلانات!

يرجى تعطيل برنامج حظر الإعلانات أو وضع القائمة البيضاء لموقعنا على الويب.

تحديث طريقة الإيقاف