Skip to content

Commit

Permalink
Revamp docker files
Browse files Browse the repository at this point in the history
  • Loading branch information
Daniel Mach authored and m-blaha committed Apr 17, 2019
1 parent e79e170 commit c47bd3c
Show file tree
Hide file tree
Showing 5 changed files with 257 additions and 49 deletions.
111 changes: 111 additions & 0 deletions Dockerfile.centos7
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
# Build
# -----
# $ podman build --build-arg TYPE=local -t dnf-bot/ci-dnf-stack:centos7 -f Dockerfile.centos7
#
#
# Run
# ---
# $ podman run -it dnf-bot/ci-dnf-stack:centos7 behave -Ddnf_executable=dnf --junit --junit-directory=/opt/behave/junit/ [--wip --no-skipped]
#
#
# Build types
# -----------
# distro
# install distro packages
# copr
# install distro packages
# then upgrade to copr packages
# local
# install distro packages
# then upgrade to copr packages
# then install packages from local rpms/ folder
# install also additional tools for debugging in the container


FROM centos:7
ENV LANG C
ARG TYPE=local


# disable deltas and weak deps
RUN set -x && \
echo -e "deltarpm=0" >> /etc/yum.conf && \
echo -e "install_weak_deps=0" >> /etc/yum.conf


# install EPEL repo
RUN set -x && \
rpm -Uvh http://download.fedoraproject.org/pub/epel/7/x86_64/Packages/e/epel-release-7-11.noarch.rpm


# if TYPE == copr or local, enable nightly copr
RUN set -x && \
if [ "$TYPE" == "copr" -o "$TYPE" == "local" ]; then \
yum -y install yum-plugin-copr; \
yum -y copr enable rpmsoftwaremanagement/dnf-nightly; \
fi


# upgrade all packages to the latest available versions
RUN set -x && \
yum -y upgrade


# remove yum-utils, they conflict with dnf-utils
RUN set -x && \
yum -y remove yum-utils


# install the test environment and additional packages
RUN set -x && \
yum -y install \
# behave and test requirements
# python2-behave - version >= 1.2.6 is not available as an RPM; install it from pip instead
python2-pip \
pexpect \
# if TYPE == local, install debugging tools
$(if [ "$TYPE" == "local" ]; then \
echo \
less \
openssh-clients \
procps-ng \
psmisc \
screen \
strace \
tcpdump \
vim-enhanced \
vim-minimal \
wget \
; \
fi) \
# install dnf stack
createrepo_c \
dnf \
dnf-plugins-core \
# dnf-utils are disabled in the latest builds
# dnf-utils \
libdnf \
microdnf && \
pip install 'behave >= 1.2.6'


# if TYPE == local, install local RPMs
COPY ./rpms/ /opt/behave/rpms/
RUN if [ "$TYPE" == "local" -a -n "$(find /opt/behave/rpms/ -maxdepth 1 -name '*.rpm' -print -quit)" ]; then \
dnf -y install /opt/behave/rpms/*.rpm \
-x '*-debuginfo' \
-x '*-debugsource' \
-x '*plugin-versionlock*' \
-x '*plugin-local*' \
-x '*plugin-torproxy*' \
-x '*plugin-migrate*' \
; \
fi


# copy test suite
COPY ./dnf-behave-tests/ /opt/behave/


VOLUME ["/opt/behave/junit"]
WORKDIR /opt/behave
85 changes: 46 additions & 39 deletions Dockerfile → Dockerfile.f29
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
FROM fedora:29
ENV LANG C


# Build
# -----
# $ podman build --build-arg TYPE=local -t dnf-bot/ci-dnf-stack:f29 -f Dockerfile.f29
#
#
# Run
# ---
# $ podman run -it dnf-bot/ci-dnf-stack:f29 behave -Ddnf_executable=dnf --junit --junit-directory=/opt/behave/junit/ [--wip --no-skipped]
#
#
# Build types
# -----------
# distro
Expand All @@ -11,56 +17,70 @@
# then upgrade to copr packages
# local
# install distro packages
# then upgrade to copr packages
# then install packages from local rpms/ folder
# install also additional tools for debugging in the container
# then upgrade to packages from local rpms/ folder
#
# Example: docker build . --build-arg=TYPE=copr
ARG TYPE=local


# copy copr repo file to make it available for TYPE=local build
COPY ./docker/_copr_rpmsoftwaremanagement-dnf-nightly.repo /opt/behave/data/
FROM fedora:29
ENV LANG C
ARG TYPE=local



# disable deltas and weak deps
RUN set -x && \
# disable deltas and weak deps
echo -e "deltarpm=0" >> /etc/dnf/dnf.conf && \
echo -e "install_weak_deps=0" >> /etc/dnf/dnf.conf && \
#
# if TYPE == local, copy the copr repo file to reposdir
if [ "$TYPE" == "copr" ]; then \
cp /opt/behave/data/_copr_rpmsoftwaremanagement-dnf-nightly.repo /etc/yum.repos.d/; \
fi && \
#
# upgrade all packages to the latest available versions
dnf -y --refresh upgrade && \
#
# install the test environment and additional packages
echo -e "install_weak_deps=0" >> /etc/dnf/dnf.conf


# if TYPE == copr or local, enable nightly copr
RUN set -x && \
if [ "$TYPE" == "copr" -o "$TYPE" == "local" ]; then \
dnf -y install dnf-plugins-core; \
dnf -y copr enable rpmsoftwaremanagement/dnf-nightly; \
fi


# upgrade all packages to the latest available versions
RUN set -x && \
dnf -y --refresh upgrade


# install the test environment and additional packages
RUN set -x && \
dnf -y install \
# behave and test requirements
findutils \
python3-behave \
python3-pexpect \
# if TYPE == local, install debugging tools
$(if [ "$TYPE" == "local" ]; then \
echo \
less \
openssh-clients \
procps-ng \
psmisc \
screen \
strace \
tcpdump \
vim-enhanced \
vim-minimal \
wget \
; \
fi) \
# install dnf stack
libdnf \
createrepo_c \
dnf \
dnf-plugins-core \
dnf-utils \
libdnf \
microdnf


# if TYPE == local, install local RPMs
COPY ./docker/rpms/ /opt/behave/rpms/
RUN if [ "$TYPE" == "local" ]; then \
COPY ./rpms/ /opt/behave/rpms/
RUN if [ "$TYPE" == "local" -a -n "$(find /opt/behave/rpms/ -maxdepth 1 -name '*.rpm' -print -quit)" ]; then \
dnf -y install /opt/behave/rpms/*.rpm \
-x '*-debuginfo' \
-x '*-debugsource' \
Expand All @@ -77,17 +97,4 @@


VOLUME ["/opt/behave/junit"]


# Run docker:
#
# $ docker run -it <hash> /bin/bash
# $ cd /opt/behave
# $ ./run-tests
#
# or
#
# $ docker run -it <hash> behave -Ddnf_executable=dnf-3 --junit --junit-directory=/opt/behave/junit/ [--wip --no-skipped] /opt/behave/features
# TODO: this doesn't work yet because repos have relative paths to workdir
# probably need to change the relative paths to be relative to repo file
# or replace relative with absolute paths
WORKDIR /opt/behave
100 changes: 100 additions & 0 deletions Dockerfile.f30
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
# Build
# -----
# $ podman build --build-arg TYPE=local -t dnf-bot/ci-dnf-stack:f30 -f Dockerfile.f30
#
#
# Run
# ---
# $ podman run -it dnf-bot/ci-dnf-stack:f30 behave -Ddnf_executable=dnf --junit --junit-directory=/opt/behave/junit/ [--wip --no-skipped]
#
#
# Build types
# -----------
# distro
# install distro packages
# copr
# install distro packages
# then upgrade to copr packages
# local
# install distro packages
# then upgrade to copr packages
# then install packages from local rpms/ folder
# install also additional tools for debugging in the container


FROM fedora:30
ENV LANG C
ARG TYPE=local



# disable deltas and weak deps
RUN set -x && \
echo -e "deltarpm=0" >> /etc/dnf/dnf.conf && \
echo -e "install_weak_deps=0" >> /etc/dnf/dnf.conf


# if TYPE == copr or local, enable nightly copr
RUN set -x && \
if [ "$TYPE" == "copr" -o "$TYPE" == "local" ]; then \
dnf -y install dnf-plugins-core; \
dnf -y copr enable rpmsoftwaremanagement/dnf-nightly; \
fi


# upgrade all packages to the latest available versions
RUN set -x && \
dnf -y --refresh upgrade


# install the test environment and additional packages
RUN set -x && \
dnf -y install \
# behave and test requirements
findutils \
python3-behave \
python3-pexpect \
# if TYPE == local, install debugging tools
$(if [ "$TYPE" == "local" ]; then \
echo \
less \
openssh-clients \
procps-ng \
psmisc \
screen \
strace \
tcpdump \
vim-enhanced \
vim-minimal \
wget \
; \
fi) \
# install dnf stack
createrepo_c \
dnf \
dnf-plugins-core \
dnf-utils \
libdnf \
microdnf


# if TYPE == local, install local RPMs
COPY ./rpms/ /opt/behave/rpms/
RUN if [ "$TYPE" == "local" -a -n "$(find /opt/behave/rpms/ -maxdepth 1 -name '*.rpm' -print -quit)" ]; then \
dnf -y install /opt/behave/rpms/*.rpm \
-x '*-debuginfo' \
-x '*-debugsource' \
-x '*plugin-versionlock*' \
-x '*plugin-local*' \
-x '*plugin-torproxy*' \
-x '*plugin-migrate*' \
; \
fi


# copy test suite
COPY ./dnf-behave-tests/ /opt/behave/


VOLUME ["/opt/behave/junit"]
WORKDIR /opt/behave
10 changes: 0 additions & 10 deletions docker/_copr_rpmsoftwaremanagement-dnf-nightly.repo

This file was deleted.

File renamed without changes.

0 comments on commit c47bd3c

Please sign in to comment.