Browse Source

Merge branch 'master' into Release_2.1

pull/5/head
heck 2 years ago
parent
commit
34b227446a
9 changed files with 152 additions and 6 deletions
  1. +34
    -0
      .gitlab-ci-files/common-prepare.yml
  2. +25
    -0
      .gitlab-ci.yml
  3. +1
    -6
      Makefile
  4. +15
    -0
      scripts/centos8/Makefile
  5. +8
    -0
      scripts/centos8/build_libpEpAdapter.sh
  6. +23
    -0
      scripts/centos8/libpEpAdapter.centos8.Dockerfile
  7. +15
    -0
      scripts/debian10/Makefile
  8. +8
    -0
      scripts/debian10/build_libpEpAdapter.sh
  9. +23
    -0
      scripts/debian10/libpEpAdapter.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

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

@ -0,0 +1,25 @@
include:
- '.gitlab-ci-files/common-prepare.yml'
stages:
- build
# CentOS/RHEL
centos8:build:
extends: .make_in_docker
stage: build
variables:
CI_MAKE_TARGET: libpepadapter
CI_DISTRO_TARGET: centos8
# Debian
debian10:build:
extends: .make_in_docker
stage: build
variables:
CI_MAKE_TARGET: libpepadapter
CI_DISTRO_TARGET: debian10
DEBIAN_FRONTEND: noninteractive

+ 1
- 6
Makefile View File

@ -13,15 +13,10 @@ SOURCE=$(wildcard *.cc)
HEADERS=$(wildcard *.hh *.hxx)
OBJECTS=$(subst .cc,.o,$(SOURCE))
DEPENDS=$(subst .cc,.d,$(SOURCE))
CXXFLAGS+= -MMD -MP
all: $(TARGET)
%.d: %.cc
@set -e; rm -f $@; \
$(CXX) -MM $(CPPFLAGS) $(CXXFLAGS) $< > $@.$$$$; \
sed 's,\($*\)\.o[ :]*,\1.o $@ : ,g' < $@.$$$$ > $@; \
rm -f $@.$$$$
ifneq ($(MAKECMDGOALS),clean)
-include $(DEPENDS)
endif


+ 15
- 0
scripts/centos8/Makefile View File

@ -0,0 +1,15 @@
CURRENT_DISTRO=$(shell basename $(shell pwd))
LIBPEPADAPTER_VERSION=$(shell git rev-parse --short=8 HEAD)
IMAGE_NAME=${DOCKER_REGISTRY_HOST}/pep-$(CURRENT_DISTRO)-libpepadapter
DOCKERFILE=libpEpAdapter.$(CURRENT_DISTRO).Dockerfile
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 LIBPEPADAPTER_VERSION=$(LIBPEPADAPTER_VERSION) \
--cache-from $(IMAGE_NAME):latest \
--tag=$(IMAGE_NAME):$(LIBPEPADAPTER_VERSION) \
--tag=$(IMAGE_NAME):latest \
-f scripts/${CURRENT_DISTRO}/$(DOCKERFILE) .
docker push $(IMAGE_NAME):${LIBPEPADAPTER_VERSION}
docker push $(IMAGE_NAME):latest

+ 8
- 0
scripts/centos8/build_libpEpAdapter.sh View File

@ -0,0 +1,8 @@
#!/usr/bin/env sh
set -exo
echo "ENGINE_LIB_PATH=${INSTPREFIX}/lib" >> local.conf
echo "ENGINE_INC_PATH=${INSTPREFIX}/include" >> local.conf
make
make install PREFIX="${INSTPREFIX}"

+ 23
- 0
scripts/centos8/libpEpAdapter.centos8.Dockerfile View File

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

+ 15
- 0
scripts/debian10/Makefile View File

@ -0,0 +1,15 @@
CURRENT_DISTRO=$(shell basename $(shell pwd))
LIBPEPADAPTER_VERSION=$(shell git rev-parse --short=8 HEAD)
IMAGE_NAME=${DOCKER_REGISTRY_HOST}/pep-$(CURRENT_DISTRO)-libpepadapter
DOCKERFILE=libpEpAdapter.$(CURRENT_DISTRO).Dockerfile
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 LIBPEPADAPTER_VERSION=$(LIBPEPADAPTER_VERSION) \
--cache-from $(IMAGE_NAME):latest \
--tag=$(IMAGE_NAME):$(LIBPEPADAPTER_VERSION) \
--tag=$(IMAGE_NAME):latest \
-f scripts/${CURRENT_DISTRO}/$(DOCKERFILE) .
docker push $(IMAGE_NAME):${LIBPEPADAPTER_VERSION}
docker push $(IMAGE_NAME):latest

+ 8
- 0
scripts/debian10/build_libpEpAdapter.sh View File

@ -0,0 +1,8 @@
#!/usr/bin/env sh
set -exo
echo "ENGINE_LIB_PATH=${INSTPREFIX}/lib" >> local.conf
echo "ENGINE_INC_PATH=${INSTPREFIX}/include" >> local.conf
make
make install PREFIX="${INSTPREFIX}"

+ 23
- 0
scripts/debian10/libpEpAdapter.debian10.Dockerfile View File

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

Loading…
Cancel
Save