ci: Rework installed tests to use Fedora Standard Test interface

Reusing the way `standard-test-roles` has support for booting
a qcow2 actually gets us to the "VM-in-container" flow.  Plus
Ansible over shell script is sometimes nicer.

https://fedoraproject.org/wiki/CI/Tests#Testing_an_Atomic_Host

It's better than what we were doing before for installed tests,
and moreover using Ansible more broadly for testing is going
to align us better with Fedora's CI.

As part of this I split off a "libpaprci" which I intend to maintain
as a "copylib" for a little bit between ostree/rpm-ostree, and then
we'll figure out how to expand from there (maybe some of the patterns
get "baked in" to PAPR for example).

Note the `FAH27-insttests` context moves to the top since it's now
of primary importance, and I expect that we start expanding it.

Closes: #1462
Approved by: jlebon
This commit is contained in:
Colin Walters authored and Atomic Bot committed 2018-03-08 20:51:42 +00:00
1 parent 3b7044f45e
commit 6e9d00dbeb
20 files changed
+361 -172

No files matched your search

+39
View File
@@ -0,0 +1,39 @@
# -*- mode: Makefile -*-
mypath = $(dir $(realpath $(firstword $(MAKEFILE_LIST))))
topsrcdir = $(shell git rev-parse --show-toplevel)
GITREV = $(shell git describe --always --tags)
GITREV_FOR_PKG = $(shell echo "$(GITREV)" | sed -e 's,-,\.,g' -e 's,^v,,')
PACKAGE ?= $(shell basename $(topsrcdir))
DISTGIT_NAME ?= $(PACKAGE)
DISTGIT ?= https://src.fedoraproject.org/rpms/$(DISTGIT_NAME)
SPEC ?= $(topsrcdir)/$(DISTGIT_NAME).spec
PKG_VER = $(PACKAGE)-$(GITREV_FOR_PKG)
PKG_CLIENT_VER = $(PACKAGE)-client-$(GITREV_FOR_PKG)
dist-snapshot:
if ! test -f $(PKG_VER).tar.xz; then \
$(mypath)/make-git-snapshot.sh "$(topsrcdir)" "$(PKG_VER)" "$(GITREV)" && \
rm -f $(PKG_VER).tar.xz && \
xz $(PKG_VER).tar; \
fi
srpm: dist-snapshot
if test -f "$(SPEC)"; then \
sed -e "s,^Version:.*,Version: $(GITREV_FOR_PKG)," $(SPEC) > $(DISTGIT_NAME).spec && \
$(mypath)/rpmbuild-cwd -bs $(DISTGIT_NAME).spec ; \
else \
test -d $(DISTGIT_NAME) || git clone --depth=1 $(DISTGIT) && \
mv $(PKG_VER).tar.xz $(DISTGIT_NAME) && \
origdir=$$(pwd); \
cd $(DISTGIT_NAME) && \
git stash && git pull -r && \
sed -i -e "s,^Version:.*,Version: $(GITREV_FOR_PKG)," $(DISTGIT_NAME).spec && \
rm -f *.src.rpm && \
$(mypath)/rpmbuild-cwd -bs $(DISTGIT_NAME).spec && mv *.src.rpm $${origdir}; \
fi
rpm: srpm
./rpmbuild-cwd --rebuild $(PKG_VER)*.src.rpm
+74
View File
@@ -0,0 +1,74 @@
#!/usr/bin/bash
dn=$(cd $(dirname $0) && pwd)
OS_ID=$(. /etc/os-release; echo $ID)
OS_VERSION_ID=$(. /etc/os-release; echo $VERSION_ID)
pkg_upgrade() {
# https://bugzilla.redhat.com/show_bug.cgi?id=1483553
local ecode=0
yum -y distro-sync 2>err.txt || ecode=$?
if test ${ecode} '!=' 0 && grep -q -F -e "BDB1539 Build signature doesn't match environment" err.txt; then
rpm --rebuilddb
yum -y distro-sync
else
if test ${ecode} '!=' 0; then
cat err.txt
exit ${ecode}
fi
fi
}
make() {
/usr/bin/make -j $(getconf _NPROCESSORS_ONLN) "$@"
}
build() {
env NOCONFIGURE=1 ./autogen.sh
./configure --sysconfdir=/etc --prefix=/usr --libdir=/usr/lib64 "$@"
make V=1
}
pkg_install() {
yum -y install "$@"
}
pkg_install_if_os() {
local os=$1
shift
if test "${os}" = "${OS_ID}"; then
pkg_install "$@"
else
echo "Skipping installation targeted for ${os} (current OS: ${OS_ID}): $@"
fi
}
pkg_install_buildroot() {
case "${OS_ID}" in
fedora) pkg_install dnf-plugins-core @buildsys-build;;
centos) pkg_install yum-utils
# Base buildroot, copied from the mock config sadly
pkg_install bash bzip2 coreutils cpio diffutils system-release findutils gawk gcc gcc-c++ \
grep gzip info make patch redhat-rpm-config rpm-build sed shadow-utils tar \
unzip util-linux which xz;;
*) fatal "pkg_install_buildroot(): Unhandled OS ${OS_ID}";;
esac
}
pkg_builddep() {
# This is sadly the only case where it's a different command
if test -x /usr/bin/dnf; then
dnf builddep -y "$@"
else
yum-builddep -y "$@"
fi
}
# Install both build and runtime dependencies for $pkg
pkg_builddep_runtimedep() {
local pkg=$1
pkg_builddep $pkg
pkg_install $pkg
rpm -e $pkg
}
+32
View File
@@ -0,0 +1,32 @@
#!/bin/sh
srcdir=$1
shift
PKG_VER=$1
shift
GITREV=$1
shift
TARFILE=${PKG_VER}.tar
TARFILE_TMP=${TARFILE}.tmp
set -x
set -e
test -n "${srcdir}"
test -n "${PKG_VER}"
test -n "${GITREV}"
TOP=$(git rev-parse --show-toplevel)
echo "Archiving ${PKG_VER} at ${GITREV} to ${TARFILE_TMP}"
(cd ${TOP}; git archive --format=tar --prefix=${PKG_VER}/ ${GITREV}) > ${TARFILE_TMP}
ls -al ${TARFILE_TMP}
(cd ${TOP}; git submodule status) | while read line; do
rev=$(echo ${line} | cut -f 1 -d ' '); path=$(echo ${line} | cut -f 2 -d ' ')
echo "Archiving ${path} at ${rev}"
(cd ${srcdir}/${path}; git archive --format=tar --prefix=${PKG_VER}/${path}/ ${rev}) > submodule.tar
tar -A -f ${TARFILE_TMP} submodule.tar
rm submodule.tar
done
mv ${TARFILE_TMP} ${TARFILE}
+11
View File
@@ -0,0 +1,11 @@
#!/bin/sh
# rpmbuild-cwd:
# Run "rpmbuild", defining all RPM variables to use the current directory.
# This matches Fedora's system.
#
# Licensed under the new-BSD license (http://www.opensource.org/licenses/bsd-license.php)
# Copyright (C) 2010 Red Hat, Inc.
# Written by Colin Walters <walters@verbum.org>
pwd=$(pwd)
exec rpmbuild --define "_sourcedir ${pwd}" --define "_specdir ${pwd}" --define "_builddir ${pwd}" --define "_srcrpmdir ${pwd}" --define "_rpmdir ${pwd}" --define "_buildrootdir ${pwd}/.build" "$@"