forked from rpm-software-management/ci-dnf-stack
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
With a separate Dockerfile for now.
- Loading branch information
Showing
2 changed files
with
130 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
# Build | ||
# ----- | ||
# $ podman build -f Dockerfile.ansible -t ansible | ||
# | ||
# Run | ||
# --- | ||
# $ podman run -it --rm ansible ./ansible | ||
|
||
|
||
# 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 | ||
|
||
|
||
FROM fedora:31 | ||
ARG TYPE=local | ||
|
||
|
||
# if not TYPE == copr nor local, disable nightly copr | ||
RUN set -x && \ | ||
dnf -y install dnf-plugins-core; \ | ||
if [ "$TYPE" != "distro" ]; then \ | ||
dnf -y copr enable rpmsoftwaremanagement/dnf-nightly; \ | ||
fi | ||
|
||
|
||
# upgrade all packages to the latest available versions | ||
RUN set -x && \ | ||
dnf -y --refresh upgrade | ||
|
||
|
||
RUN set -x && \ | ||
dnf -y install glibc-langpack-en python3-pip python3-jinja2 python3-pyyaml git findutils man-db which | ||
|
||
|
||
# install local RPMs if available | ||
COPY ./rpms/ /tmp/rpms/ | ||
RUN set -x && \ | ||
rm /tmp/rpms/*-{devel,debuginfo,debugsource}*.rpm; \ | ||
if [ -n "$(find /tmp/rpms/ -maxdepth 1 -name '*.rpm' -print -quit)" ]; then \ | ||
dnf -y install /tmp/rpms/*.rpm --disableplugin=local; \ | ||
fi | ||
|
||
|
||
COPY ./integration/ /tmp/integration/ | ||
|
||
|
||
WORKDIR /tmp/integration |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
#!/bin/bash | ||
set -xeuo pipefail | ||
|
||
ANSIBLE_BRANCH="stable-2.10" | ||
TEST_TARGETS="yum dnf" | ||
JUNIT_DIR="" | ||
|
||
fatal() { | ||
printf >&2 "Error: %s\n" "$*" | ||
exit 1 | ||
} | ||
|
||
show_usage() { | ||
printf >&2 "Try \`$0 --help' for more information.\n" | ||
exit 1 | ||
} | ||
|
||
show_help() { | ||
cat << EOF | ||
Usage: $0 [OPTIONS...] | ||
Options: | ||
-h, --help Show this help | ||
--junit-directory The directory to save JUnit test output to | ||
EOF | ||
exit 0 | ||
} | ||
|
||
TEMP=$(getopt -n $0 -o h -l help,junit-directory: -- "$@") || show_usage | ||
eval set -- "$TEMP" | ||
|
||
while :; do | ||
case "$1" in | ||
--) shift; break;; | ||
-h|--help) show_help;; | ||
--junit-directory) JUNIT_DIR=$2; shift 2;; | ||
*) fatal "Option not implemented: $1" | ||
esac | ||
done | ||
|
||
if [ "$JUNIT_DIR" -a ! -d "$JUNIT_DIR" ]; then | ||
fatal "JUnit directory \"${JUNIT_DIR}\" is not a directory." | ||
fi | ||
|
||
git clone -b ${ANSIBLE_BRANCH} --single-branch --depth 1 https://github.com/ansible/ansible ansible-git | ||
|
||
pushd ansible-git | ||
# intentionally break some tests | ||
#sed -i 's/shell: rpm -q sos/shell: rpm -q sosxxx/' test/integration/targets/dnf/tasks/dnf.yml | ||
|
||
# temporary fix for RHEL8 (there is no "default" stream of swig:3.0) | ||
#sed -i 's/@swig:3\.0\/default/@swig:3.0\/common/' test/integration/targets/dnf/tasks/modularity.yml | ||
|
||
if [ "$JUNIT_DIR" ]; then | ||
# ansible test suite outputs junit xmls if junit-xml is detected | ||
pip install junit-xml | ||
fi | ||
|
||
source hacking/env-setup | ||
|
||
# run dnf integration tests | ||
COMMAND="ansible-test integration $TEST_TARGETS --allow-destructive" | ||
TEST_EXIT=0 | ||
|
||
$COMMAND || TEST_EXIT=1 | ||
|
||
if [ -d "$JUNIT_DIR" ]; then | ||
# output is in test/results/junit/ | ||
cp test/results/junit/*.xml "$JUNIT_DIR" | ||
fi | ||
popd | ||
|
||
exit $TEST_EXIT |