Skip to content

Commit

Permalink
Merge pull request #186 from sclorg/devel_repo
Browse files Browse the repository at this point in the history
Add possibility to use a development repo
  • Loading branch information
hhorak committed Feb 5, 2021
2 parents 63545b1 + f753269 commit 509c137
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 1 deletion.
25 changes: 25 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ _parse_output_inner ()
parse_output ()
{
local command=$1 filter=$2 var=$3 stream=$4
echo "-> building using $command"
local raw_output='' rc=0
{
# shellcheck disable=SC2034
Expand Down Expand Up @@ -119,6 +120,8 @@ function pull_image {
function docker_build_with_version {
local dockerfile="$1"
local exclude=.exclude-${OS}
local devel_repo_file=.devel-repo-${OS}
local devel_repo_var="DEVEL_REPO_$OS"
if [ -e "$exclude" ]; then
echo "-> $exclude file exists for version $dir, skipping build."
clean_image
Expand All @@ -136,6 +139,28 @@ function docker_build_with_version {
if [[ "${UPDATE_BASE}" == "1" ]]; then
BUILD_OPTIONS+=" --pull=true"
fi

# Add possibility to use a development repo
#
# This is useful if we want to work with RPMs that are not available publically yet.
#
# How to use it:
# First, we create a file that only tells the scripts to use the development repository,
# e.g. .devel-repo-rhel8, similarly as we use .exclude-rhel8 for excluding particular
# variant of the Dockerfile. Content of the file is not important at this point.
#
# If such a file exists in the repository, then the building scripts will take a look
# at a correspondent variable, e.g. DEVEL_REPO_rhel8, and will use the repository file
# defined by that variable.
#
# That means that definition of the DEVEL_REPO_rhel8 variable is a responsibility of
# the test/CI environment.
if [ -f "$devel_repo_file" ] && [[ -v "$devel_repo_var" ]] ; then
CUSTOM_REPO=$(mktemp)
curl -Lk "${!devel_repo_var}" >"${CUSTOM_REPO}"
echo "-> $devel_repo_file file exists for version $dir, so using ${!devel_repo_var}."
fi

if [ -n "$CUSTOM_REPO" ]; then
if [ -f "$CUSTOM_REPO" ]; then
BUILD_OPTIONS+=" -v $CUSTOM_REPO:/etc/yum.repos.d/sclorg_custom.repo:Z"
Expand Down
2 changes: 1 addition & 1 deletion test-lib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -818,7 +818,7 @@ ct_show_resources()
echo "Memory:"
free -h
echo "Storage:"
df -h
df -h || :
echo "CPU"
lscpu
}
Expand Down

0 comments on commit 509c137

Please sign in to comment.