Browse Source

CI: add basic gitlab-ci jobs

Adds simple jobs for building the the Engine for Debian 10.

Pre-built docker images containing des will be pulled down and used
to build the Adapter.

Upon successful compilation an image containing the build output will be
pushed to a docker registry.
JNI-129
Devan Carpenter 6 months ago
parent
commit
73e0d639c7
Signed by: dvn GPG Key ID: E1707CFFD7B85A02
5 changed files with 160 additions and 0 deletions
  1. +34
    -0
      .gitlab-ci-files/common-prepare.yml
  2. +43
    -0
      .gitlab-ci.yml
  3. +31
    -0
      scripts/debian10/Makefile
  4. +28
    -0
      scripts/debian10/build_pEpJNIAdapter.sh
  5. +24
    -0
      scripts/debian10/pEpJNIAdapter.debian10.Dockerfile

+ 34
- 0
.gitlab-ci-files/common-prepare.yml View File

@ -0,0 +1,34 @@
.ensure_docker: &ensure_docker
# Check for docker and install if missing
- 'which docker || ( sudo apt-get update -y && sudo apt-get install docker.io -y )'
.ensure_rsync: &ensure_rsync
# Install rsync and deps if missing
- 'which ssh-agent || ( sudo apt-get update -y && sudo apt-get install openssh-client -y )'
- 'which rsync || ( sudo apt-get update -y && sudo apt-get install rsync -y )'
- 'which make || ( sudo apt-get update -y && sudo apt-get install make -y )'
.enable_insecure_docker_registries: &enable_insecure_docker_registries
# Enable "insecure" docker registries
- |
cat <<EOD > /tmp/docker-daemon.json
{
"insecure-registries" : ["${DOCKER_REGISTRY_HOST}"]
}
EOD
- sudo cp /tmp/docker-daemon.json /etc/docker/daemon.json
- sudo systemctl restart docker.service
.standard_job:
tags: [kvm]
before_script:
- *ensure_docker
- *ensure_rsync
- *enable_insecure_docker_registries
.make_in_docker:
extends: .standard_job
script:
- docker login -u ${DOCKER_REGISTRY_USER} -p ${DOCKER_REGISTRY_PASS} ${DOCKER_REGISTRY_HOST}
- cd scripts/${CI_DISTRO_TARGET}
- make

+ 43
- 0
.gitlab-ci.yml View File

@ -0,0 +1,43 @@
include:
- '.gitlab-ci-files/common-prepare.yml'
stages:
- build
# CentOS/RHEL
centos8:build:
extends: .make_in_docker
stage: build
variables:
CI_DISTRO_TARGET: "centos8"
centos8:tagged-build:
extends: .make_in_docker
stage: build
variables:
CI_DISTRO_TARGET: "centos8"
TAGGED_BUILD: "true"
rules:
- if: $CI_COMMIT_TAG
# Debian
debian10:build:
extends: .make_in_docker
stage: build
variables:
CI_DISTRO_TARGET: "debian10"
DEBIAN_FRONTEND: "noninteractive"
debian10:tagged-build:
extends: .make_in_docker
stage: build
variables:
CI_DISTRO_TARGET: "debian10"
DEBIAN_FRONTEND: "noninteractive"
TAGGED_BUILD: "true"
rules:
- if: $CI_COMMIT_TAG

+ 31
- 0
scripts/debian10/Makefile View File

@ -0,0 +1,31 @@
include ../../DEPENDENCIES
export
LIBPEPADAPTER_VERSION=${libpEpAdapter}
PEPENGINE_VERSION=${pEpEngine}
SEQUOIA_VERSION=${sequoia}
CURRENT_DISTRO=$(shell basename $(shell pwd))
IMAGE_NAME=${DOCKER_REGISTRY_HOST}/pep-$(CURRENT_DISTRO)-jniadapter
DOCKERFILE=pEpJNIAdapter.$(CURRENT_DISTRO).Dockerfile
IS_TAGGED=${TAGGED_BUILD}
ifeq ($(IS_TAGGED), true)
# $CI_COMMIT_TAG is a predefined environment variable from Gitlab
PEPJNIADAPTER_VERSION=${CI_COMMIT_TAG}
else
PEPJNIADAPTER_VERSION=$(shell git rev-parse --short=8 HEAD)
endif
all:
-docker pull $(IMAGE_NAME):latest
cd ../../ && docker build --build-arg CURRENT_DISTRO=$(CURRENT_DISTRO) \
--build-arg DOCKER_REGISTRY_HOST=${DOCKER_REGISTRY_HOST} \
--build-arg PEPJNIADAPTER_VERSION=$(PEPJNIADAPTER_VERSION) \
--build-arg LIBPEPADAPTER_VERSION=$(LIBPEPADAPTER_VERSION) \
--build-arg PEPENGINE_VERSION=$(PEPENGINE_VERSION) \
--build-arg SEQUOIA_VERSION=$(SEQUOIA_VERSION) \
--cache-from $(IMAGE_NAME):latest \
--tag=$(IMAGE_NAME):$(PEPJNIADAPTER_VERSION) \
--tag=$(IMAGE_NAME):$(PEPJNIADAPTER_VERSION)_libpepadapter-$(LIBPEPADAPTER_VERSION)_engine-$(PEPENGINE_VERSION) \
--tag=$(IMAGE_NAME):latest \
-f scripts/${CURRENT_DISTRO}/$(DOCKERFILE) .
docker push $(IMAGE_NAME):$(PEPJNIADAPTER_VERSION)
docker push $(IMAGE_NAME):$(PEPJNIADAPTER_VERSION)_libpepadapter-$(LIBPEPADAPTER_VERSION)_engine-$(PEPENGINE_VERSION)
docker push $(IMAGE_NAME):latest

+ 28
- 0
scripts/debian10/build_pEpJNIAdapter.sh View File

@ -0,0 +1,28 @@
#!/usr/bin/env sh
set -exo
export LC_ALL=en_US.UTF-8 && \
# JAVA_HOME (only for the pEpJNIAdapter)
if [ $(uname) == "Linux" ]; then {
export JAVA_HOME=$(dirname $(dirname $(readlink -f /usr/bin/javac)));
} fi
if [ $(uname) == "Darwin" ]; then {
export JAVA_HOME=$(dirname $(dirname $(readlink /usr/bin/javac)));
} fi
echo $JAVA_HOME
cat >local.conf <<__LOCAL__
PREFIX=${INSTPREFIX}
DEBUG=0
JAVA_HOME=${JAVA_HOME}
YML2_PATH=${INSTPREFIX}/yml2
YML2_PROC=${INSTPREFIX}/yml2/yml2proc --encoding=utf8
#YML2_OPTS=--encoding=utf8
ENGINE_INC_PATH=${INSTPREFIX}/include
ENGINE_LIB_PATH=${INSTPREFIX}/lib
AD_INC_PATH=${INSTPREFIX}/include
AD_LIB_PATH=${INSTPREFIX}/lib
__LOCAL__
make WARN= DEBUG=

+ 24
- 0
scripts/debian10/pEpJNIAdapter.debian10.Dockerfile View File

@ -0,0 +1,24 @@
ARG DOCKER_REGISTRY_HOST
ARG CURRENT_DISTRO
ARG LIBPEPADAPTER_VERSION
ARG PEPENGINE_VERSION
FROM ${DOCKER_REGISTRY_HOST}/pep-${CURRENT_DISTRO}-libpepadapter:${LIBPEPADAPTER_VERSION}_engine-${PEPENGINE_VERSION}
ENV BUILDROOT /build
ENV INSTPREFIX /install
ENV OUTDIR /out
### Setup working directory
RUN mkdir ${BUILDROOT}/pEpJNIAdapter
COPY . ${BUILDROOT}/pEpJNIAdapter
USER root
RUN chown -R pep-builder:pep-builder ${BUILDROOT}/pEpJNIAdapter
USER pep-builder
WORKDIR ${BUILDROOT}/pEpJNIAdapter
ARG PEPJNIADAPTER_VERSION
ARG CURRENT_DISTRO
### Build libpEpAdapter
RUN sh ./scripts/${CURRENT_DISTRO}/build_pEpJNIAdapter.sh && \
rm -rf ${BUILDROOT}/*

Loading…
Cancel
Save