Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 22 additions & 12 deletions test/bin/build_images.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,14 @@ source "${SCRIPTDIR}/common.sh"

mkdir -p "${IMAGEDIR}"

if [ $# -ne 0 ]; then
TEMPLATES="$*"
BUILD_INSTALLER=false
else
TEMPLATES="${TESTDIR}/image-blueprints/*.toml"
BUILD_INSTALLER=true
fi

# Determine the version of the RPM in the local repo so we can use it
# in the blueprint templates.
if [ ! -d "${LOCAL_REPO}" ]; then
Expand Down Expand Up @@ -66,7 +74,7 @@ BUILDIDS=""
mkdir -p "${IMAGEDIR}/blueprints"
mkdir -p "${IMAGEDIR}/builds"
# shellcheck disable=SC2231 # allow glob expansion without quotes in for loop
for template in ${TESTDIR}/image-blueprints/*.toml; do
for template in ${TEMPLATES}; do
echo
echo "Blueprint ${template}"

Expand Down Expand Up @@ -98,17 +106,19 @@ for template in ${TESTDIR}/image-blueprints/*.toml; do
BUILDIDS="${BUILDIDS} ${buildid}"
done

# In the future we may need to build multiple images with different
# formats but for now we just have one special case to build an
# installer image in a different format.
echo "Building image-installer from ${INSTALLER_IMAGE_BLUEPRINT}"
buildid=$(sudo composer-cli compose start \
"${INSTALLER_IMAGE_BLUEPRINT}" \
image-installer \
| awk '{print $2}')
echo "Build ID ${buildid}"
echo "${buildid}" > "${IMAGEDIR}/builds/${blueprint}.image-installer"
BUILDIDS="${BUILDIDS} ${buildid}"
if ${BUILD_INSTALLER}; then
# In the future we may need to build multiple images with different
# formats but for now we just have one special case to build an
# installer image in a different format.
echo "Building image-installer from ${INSTALLER_IMAGE_BLUEPRINT}"
buildid=$(sudo composer-cli compose start \
"${INSTALLER_IMAGE_BLUEPRINT}" \
image-installer \
| awk '{print $2}')
echo "Build ID ${buildid}"
echo "${buildid}" > "${IMAGEDIR}/builds/${blueprint}.image-installer"
BUILDIDS="${BUILDIDS} ${buildid}"
fi

echo "Waiting for builds to complete..."
# shellcheck disable=SC2086 # pass command arguments quotes to allow word splitting
Expand Down
45 changes: 45 additions & 0 deletions test/bin/rebuild_source_images.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
#!/bin/bash
#
# This script should be run on the image build server (usually the
# same as the hypervisor).

set -euo pipefail

SCRIPTDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
source "${SCRIPTDIR}/common.sh"

# Rebuild the RPM from source
cd "${ROOTDIR}"
rm -rf _output/rpmbuild
make rpm

cd "${TESTDIR}"

# Update the local repository
"./bin/create_local_repo.sh"

# Given a blueprint filename, extract the name value. It does not have
# to match the filename, but some commands take the file and others
# take the name, so we need to be able to have both.
get_blueprint_name() {
local filename="${1}"
tomcli-get "${filename}" name
}

TO_BUILD=""

# shellcheck disable=SC2231 # allow glob expansion without quotes in for loop
for template in ${TESTDIR}/image-blueprints/*.toml; do
name=$(get_blueprint_name "${template}")
if [[ "${name}" =~ source ]]; then
TO_BUILD="${TO_BUILD} ${template}"
fi
done

# shellcheck disable=SC2086 # pass command arguments quotes to allow word splitting
./bin/build_images.sh ${TO_BUILD}

# Downloading the images again assumes that all of them are still in
# the composer cache. The logic for building the ostree repo does not
# currently cope with replacing content or updating individual images.
./bin/download_images.sh
31 changes: 31 additions & 0 deletions test/bin/setup_local.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#!/bin/bash
#
# This script runs on the hypervisor, from the iso-build step.

set -euo pipefail

SCRIPTDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
source "${SCRIPTDIR}/common.sh"

# Log output automatically
LOGDIR="${ROOTDIR}/_output/ci-logs"
LOGFILE="${LOGDIR}/$(basename "$0" .sh).log"
if [ ! -d "${LOGDIR}" ]; then
mkdir -p "${LOGDIR}"
fi
echo "Logging to ${LOGFILE}"
# Set fd 1 and 2 to write to the log file
exec &> >(tee >(awk '{ print strftime("%Y-%m-%d %H:%M:%S"), $0; fflush() }' >"${LOGFILE}"))

(cd .. && make rpm)

cd "${TESTDIR}"

./bin/ci_phase_iso_build.sh

# Start the web server to host the kickstart files and ostree commit
# repository.
./bin/start_webserver.sh

echo "Set up complete. Run the scenarios you want by hand, then run"
echo "./bin/manage_vm_connections.sh local"