Start implementing testing in cirus

Hook up regular tests to run on fedora/ubuntu natively.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
This commit is contained in:
Daniel J Walsh 2019-05-17 04:56:50 -04:00
parent 89a7ad744a
commit 1522cc04e5
No known key found for this signature in database
GPG Key ID: A2DF901DABE2C028
6 changed files with 98 additions and 15 deletions

View File

@ -22,7 +22,6 @@ env:
FEDORA_CACHE_IMAGE_NAME: "fedora-cloud-base-30-1-2-1556821664"
PRIOR_FEDORA_CACHE_IMAGE_NAME: "fedora-cloud-base-29-1-2-1541789245"
UBUNTU_CACHE_IMAGE_NAME: "ubuntu-1904-disco-v20190514"
PRIOR_UBUNTU_CACHE_IMAGE_NAME: "ubuntu-1804-bionic-v20190514"
####
#### Command variables to help avoid duplication
@ -55,7 +54,6 @@ testing_task:
image_name: "${FEDORA_CACHE_IMAGE_NAME}"
image_name: "${PRIOR_FEDORA_CACHE_IMAGE_NAME}"
image_name: "${UBUNTU_CACHE_IMAGE_NAME}"
image_name: "${PRIOR_UBUNTU_CACHE_IMAGE_NAME}"
# Separate scripts for separate outputs, makes debugging easier.
setup_script: '${CIRRUS_WORKING_DIR}/${SCRIPT_BASE}/setup.sh |& ${_TIMESTAMP}'
@ -72,7 +70,7 @@ testing_task:
on_failure: # Script names must be different from above
failure_df_script: '${_DFCMD} || true'
failure_rh_audit_log_script: '${_RAUDITCMD} || true'
faulure_ubuntu_audit_log_script: '${_UAUDITCMD} || true'
failure_ubuntu_audit_log_script: '${_UAUDITCMD} || true'
failure_journal_log_script: '${_JOURNALCMD} || true'
@ -90,7 +88,6 @@ meta_task:
${FEDORA_CACHE_IMAGE_NAME}
${PRIOR_FEDORA_CACHE_IMAGE_NAME}
${UBUNTU_CACHE_IMAGE_NAME}
${PRIOR_UBUNTU_CACHE_IMAGE_NAME}
BUILDID: "${CIRRUS_BUILD_ID}"
REPOREF: "${CIRRUS_CHANGE_IN_REPO}"
GCPJSON: ENCRYPTED[244a93fe8b386b48b96f748342bf741350e43805eee81dd04b45093bdf737e540b993fc735df41f131835fa0f9b65826]

View File

@ -5,4 +5,26 @@ set -e
source $(dirname $0)/lib.sh
cd $GOSRC
/bin/true # STUB: Add call to build & install project
make install.tools
echo "Build Binary"
make local-binary
echo "local-test-integration Overlay"
make STORAGE_DRIVER=overlay local-test-integration
echo "local-test-integration Fuse-overlay"
make STORAGE_DRIVER=overlay STORAGE_OPTION=overlay.mount_program=/usr/bin/fuse-overlayfs local-test-integration
case "$OS_REL_VER" in
ubuntu-19)
echo "local-test-integration Aufs"
make STORAGE_DRIVER=aufs local-test-integration
echo "local-test-unit"
make local-test-unit
;;
fedora-30)
echo "local-test-unit"
make local-test-unit
;;
esac
#make STORAGE_DRIVER=vfs local-test-integration
#make STORAGE_DRIVER=overlay FUSE_OVERLAYFS_DISABLE_OVL_WHITEOUT=1 STORAGE_OPTION=overlay.mount_program=/usr/bin/fuse-overlayfs local-test-integration
#make STORAGE_DRIVER=devicemapper STORAGE_OPTION=dm.directlvm_device=/dev/abc local-test-integration

View File

@ -29,7 +29,7 @@ fi
CIRRUS_WORKING_DIR="${CIRRUS_WORKING_DIR:-$GOPATH/src/github.com/containers/storage}"
export GOSRC="${GOSRC:-$CIRRUS_WORKING_DIR}"
export PATH="$HOME/bin:$GOPATH/bin:/usr/local/bin:$PATH"
SCRIPT_BASE=${SCRIPT_BASE:-./contrib/cirrus}
SCRIPT_BASE=${GOSRC}/contrib/cirrus
cd $GOSRC
if type -P git &> /dev/null
@ -144,3 +144,24 @@ timeout_attempt_delay_command() {
exit 125
fi
}
# Helper/wrapper script to only show stderr/stdout on non-zero exit
install_ooe() {
req_env_var SCRIPT_BASE
echo "Installing script to mask stdout/stderr unless non-zero exit."
sudo install -D -m 755 "$SCRIPT_BASE/ooe.sh" /usr/local/bin/ooe.sh
}
install_fuse_overlayfs_from_git(){
wd=$(pwd)
DEST="$GOPATH/src/github.com/containers/fuse-overlayfs"
rm -rf "$DEST"
ooe.sh git clone https://github.com/containers/fuse-overlayfs.git "$DEST"
cd "$DEST"
ooe.sh git fetch origin --tags
ooe.sh ./autogen.sh
ooe.sh ./configure
ooe.sh make
sudo make install prefix=/usr
cd $wd
}

39
contrib/cirrus/ooe.sh Executable file
View File

@ -0,0 +1,39 @@
#!/bin/bash
# This script executes a command while logging all output to a temporary
# file. If the command exits non-zero, then all output is sent to the console,
# before returning the exit code. If the script itself fails, the exit code 121
# is returned.
set -eo pipefail
SCRIPT_BASEDIR="$(basename $0)"
badusage() {
echo "Incorrect usage: $SCRIPT_BASEDIR) <command> [options]" > /dev/stderr
echo "ERROR: $1"
exit 121
}
COMMAND="$@"
[[ -n "$COMMAND" ]] || badusage "No command specified"
OUTPUT_TMPFILE="$(mktemp -p '' ${SCRIPT_BASEDIR}_output_XXXX)"
output_on_error() {
RET=$?
set +e
if [[ "$RET" -ne "0" ]]
then
echo "---------------------------"
cat "$OUTPUT_TMPFILE"
echo "[$(date --iso-8601=second)] <exit $RET> $COMMAND"
fi
rm -f "$OUTPUT_TMPFILE"
}
trap "output_on_error" EXIT
"$@" 2>&1 | while IFS='' read LINE # Preserve leading/trailing whitespace
do
# Every stdout and (copied) stderr line
echo "[$(date --iso-8601=second)] $LINE"
done >> "$OUTPUT_TMPFILE"

View File

@ -4,24 +4,28 @@ set -e
source $(dirname $0)/lib.sh
install_ooe
show_env_vars
cd $GOSRC
export RPMBuildRequires="podman autoconf automake golang go-md2man gpgme-devel device-mapper-devel btrfs-progs-devel libassuan-devel libseccomp-devel glib2-devel ostree-devel make bats fuse3-devel fuse3"
export AptBuildRequires="autoconf automake golang go-md2man libgpgme11-dev libdevmapper-dev libseccomp-dev libglib2.0-dev libostree-dev make bats aufs-tools fuse3 libfuse3-dev libbtrfs-dev"
case "$OS_REL_VER" in
fedora-30)
echo "Setting up $OS_RELEASE_ID $OS_RELEASE_VER" # STUB: Add VM setup instructions here
;;
fedora-29)
fedora-*)
echo "Setting up $OS_RELEASE_ID $OS_RELEASE_VER" # STUB: Add VM setup instructions here
dnf -y update
dnf -y install $RPMBuildRequires
dnf -y remove gcc-go
install_fuse_overlayfs_from_git
;;
ubuntu-19)
echo "Setting up $OS_RELEASE_ID $OS_RELEASE_VER" # STUB: Add VM setup instructions here
$SHORT_APTGET update # Fetch latest package metadata
;;
ubuntu-18)
echo "Setting up $OS_RELEASE_ID $OS_RELEASE_VER" # STUB: Add VM setup instructions here
$SHORT_APTGET update # Fetch latest package metadata
$SHORT_APTGET -qq install $AptBuildRequires
install_fuse_overlayfs_from_git
;;
*)
bad_os_id_ver

View File

@ -4,7 +4,7 @@ set -e
source $(dirname $0)/lib.sh
cd $GOSRC/$SCRIPT_BASE
cd $SCRIPT_BASE
./lib.sh.t
cd $GOSRC