Skip to content

Commit

Permalink
run-container: add routine to add/refresh an update repo
Browse files Browse the repository at this point in the history
The default repository for a BCI might not contain much software.
Thus add SUSE distro specific (internal) update repositories.
At the beginning just support SLE15.

Signed-off-by: Andreas Herrmann <aherrmann@suse.de>
Signed-off-by: Mel Gorman <mgorman@techsingularity.net>
  • Loading branch information
Andreas Herrmann authored and gormanm committed Jan 14, 2025
1 parent 64dee07 commit 7c74f17
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions run-container.sh
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ Runtime variables:
CONTAINER_NO_PIDS_LIMIT increase pids.max value (unlimited or very large)
CONTAINER_NO_SECCOMP turn off seccomp confinement
CONTAINER_PRIVILEGED run container in privileged mode
CONTAINER_ADD_UPDATE_REPO add distro specific update repo (SUSE only)
EOF
shift; exit 0;;
Expand Down Expand Up @@ -170,18 +171,28 @@ function autoselect_image() {
case "${sp}" in
sp2)
image=registry.suse.com/suse/sle15:15.2
urepo_uri=http://download.suse.de/ibs/SUSE:/SLE-15-SP2:/Update/standard
urepo_alias=SLE-15-SP2-Update
;;
sp3)
image=registry.suse.com/suse/sle15:15.3
urepo_uri=http://download.suse.de/ibs/SUSE:/SLE-15-SP3:/Update/standard
urepo_alias=SLE-15-SP3-Update
;;
sp4)
image=registry.suse.com/suse/sle15:15.4
urepo_uri=http://download.suse.de/ibs/SUSE:/SLE-15-SP4:/Update/standard
urepo_alias=SLE-15-SP4-Update
;;
sp5)
image=registry.suse.com/suse/sle15:15.5
urepo_uri=http://download.suse.de/ibs/SUSE:/SLE-15-SP5:/Update/standard
urepo_alias=SLE-15-SP5-Update
;;
sp6)
image=registry.suse.com/suse/sle15:15.6
urepo_uri=http://download.suse.de/ibs/SUSE:/SLE-15-SP6:/GA/standard/
urepo_alias=SLE-15-SP6-GA
;;
*)
echo "ERROR: Distribution SP not supported"
Expand Down Expand Up @@ -280,6 +291,14 @@ function start_container() {
echo "container_id: ${container_id}"
}

# add update repository (for SUSE only)
function add_update_repo() {
if [ "${urepo_uri}" != "" -a "${urepo_alias}" != "" ]; then
${cli} exec ${container_id} zypper ar ${urepo_uri} ${urepo_alias}
${cli} exec ${container_id} zypper refresh ${urepo_alias}
fi
}

# some distro specific preparations
function update_container() {
if $(echo ${image} | grep -q ubuntu); then
Expand All @@ -294,6 +313,9 @@ function update_container() {
--clean-deps patterns-base-fips
fi
fi
if [ "${CONTAINER_ADD_UPDATE_REPO}" = "yes" ]; then
add_update_repo
fi
}

function prepare_mmtests() {
Expand Down

0 comments on commit 7c74f17

Please sign in to comment.