Consistency: Use 0/1 for false/true everywhere

And consolidate 'edge' distro configuration.
This commit is contained in:
Greg Cymbalski
2025-12-03 14:06:36 -08:00
parent 28a8dc83ef
commit 7ccb33cd30
5 changed files with 24 additions and 15 deletions

View File

@@ -1,8 +1,8 @@
ARG IMAGE_SOURCE=library/centos:centos7.9.2009
FROM "${IMAGE_SOURCE}"
ARG PUB_OR_VAULT=pub
ENV PUB_OR_VAULT=${PUB_OR_VAULT}
ARG IS_EDGE=1
ENV IS_EDGE=${IS_EDGE}
ARG HTTP_PROXY=http://package-mirror.vpn.versity.com:3128
ENV HTTP_PROXY=${HTTP_PROXY}
ARG http_proxy=http://package-mirror.vpn.versity.com:3128
@@ -11,7 +11,7 @@ ARG SKIP_REPO_FIXUP=false
ENV SKIP_REPO_FIXUP=${SKIP_REPO_FIXUP}
COPY repo-fixup.sh /tmp/repo-fixup.sh
RUN PUB_OR_VAULT="${PUB_OR_VAULT}" bash /tmp/repo-fixup.sh
RUN IS_EDGE="${IS_EDGE}" bash /tmp/repo-fixup.sh
RUN bash -c "yum install -y diff || yum install -y diffutils"
RUN yum groupinstall -y 'Development Tools'
RUN yum install -y epel-release rpm-build sudo

View File

@@ -11,5 +11,6 @@ done
# then legacy
for EL_VER in 8.9 9.4 9.5; do
IS_EDGE=0
bash ./build-minor.sh
done

View File

@@ -6,9 +6,8 @@ export EL_MAJOR_VER="${EL_MAJOR_VER:-9.5}"
export EL_VER="${EL_VER:-${EL_MAJOR_VER}}"
export MAJOR_VER="${EL_VER%%.*}"
export MINOR_VER="${EL_VER#*.}"
export PUB_OR_VAULT="${PUB_OR_VAULT:-vault}"
export FORCE_REBUILD_DOCKER_IMAGE="${FORCE_REBUILD_DOCKER_IMAGE:-false}"
export IS_EDGE="${IS_EDGE:-0}"
export FORCE_REBUILD_DOCKER_IMAGE="${FORCE_REBUILD_DOCKER_IMAGE:-0}"
if [ -z "${MINOR_VER}" ] || [ -z "${MAJOR_VER}" ]; then
echo "Major/minor versions could not be inferred from required version ${EL_VER}, bailing out"
@@ -24,10 +23,10 @@ else
fi
# build fresh 'builder' images only if we don't have them or want to force a rebuild
if [ "$(docker images -q scoutfs-builder:el${MAJOR_VER}.${MINOR_VER})" == "" ] || [ "${FORCE_REBUILD_DOCKER_IMAGE}" == "true" ]; then
if [ "$(docker images -q scoutfs-builder:el${MAJOR_VER}.${MINOR_VER})" == "" ] || [ "${FORCE_REBUILD_DOCKER_IMAGE}" == '1' ]; then
docker_args=()
if [[ "${SKIP_CACHE}" == 'true' ]]; then
docker_args+=(--no-cache)
fi
docker build . "${docker_args[@]}" --build-arg PUB_OR_VAULT="${PUB_OR_VAULT}" --build-arg IMAGE_SOURCE="${IMAGE_BASE}:${IMAGE_VERSION}" -t "scoutfs-builder:el${MAJOR_VER}.${MINOR_VER}"
docker build . "${docker_args[@]}" --build-arg IS_EDGE="${IS_EDGE}" --build-arg IMAGE_SOURCE="${IMAGE_BASE}:${IMAGE_VERSION}" -t "scoutfs-builder:el${MAJOR_VER}.${MINOR_VER}"
fi

View File

@@ -7,7 +7,8 @@ export MAJOR_VER="${EL_VER%%.*}"
export MINOR_VER="${EL_VER#*.}"
export RELEASE="${RELEASE:-0}"
export IS_EDGE="${IS_EDGE:-0}"
export FORCE_REBUILD_DOCKER_IMAGE="${FORCE_REBUILD_DOCKER_IMAGE:-false}"
export VERBOSE="${VERBOSE:-1}"
export FORCE_REBUILD_DOCKER_IMAGE="${FORCE_REBUILD_DOCKER_IMAGE:-0}"
export PUB_OR_VAULT
if [ "${IS_EDGE}" = 0 ]; then
@@ -21,7 +22,7 @@ bash build-container.sh
for KVER in $(bash build-packages.sh get-kvers); do
echo "Building for ${KVER} on ${EL_VER}"
docker run --rm --privileged \
-e "VERBOSE=0" \
-e "VERBOSE=${VERBOSE}" \
-e "KVERSION=${KVER}" \
-e "EL_VER=${EL_VER}" \
-e "RELEASE=${RELEASE}" \

View File

@@ -12,12 +12,20 @@ else
MINOR_VER=""
fi
DISTRO="${ID}"
PUB_OR_VAULT="${PUB_OR_VAULT:-pub}"
IS_EDGE="${IS_EDGE:-0}"
if [ "${IS_EDGE}" = 0 ]; then
PUB_OR_VAULT=vault
else
PUB_OR_VAULT=pub
fi
VAULT_PREFIX=""
PUB_PREFIX=""
# - Accept ${SKIP_REPO_FIXUP} to take no action at all
# - Accept ${PUB_OR_VAULT} as pub/vault for whether we should lock to the *vaulted* repo vs. the current public one
# - Accept ${IS_EDGE} as 1/0 for whether we should lock to the *vaulted* repo vs. the current public one
if [ "${SKIP_REPO_FIXUP}" = 'true' ]; then
echo "Requested to take no action on repositories; exiting cleanly"
@@ -44,7 +52,7 @@ case ${DISTRO} in
;;
esac
if [ "${PUB_OR_VAULT}" = 'true' ]; then
if [ "${IS_EDGE}" = 0 ]; then
BASE_URL="${VAULT_PREFIX}/${RELEASE}"
else
BASE_URL="${PUB_PREFIX}/${RELEASE}"
@@ -55,12 +63,12 @@ for repo in "/etc/yum.repos.d/"*; do
-e "s|^metalink|#metalink|g" -e "s|https|http|g" "$repo"
if ! [[ "$repo" =~ .*epel.* ]]; then
sed -i -e "s|http.*releasever|${BASE_URL}|g" "$repo"
if [ "${PUB_OR_VAULT}" = 'vault' ]; then
if [ "${IS_EDGE}" = 0 ]; then
sed -i -e "s|pub|vault|g" "$repo"
fi
else
sed -i -e "s|download.example|archives.fedoraproject.org|g" "$repo"
if [ "${PUB_OR_VAULT}" = 'vault' ]; then
if [ "${IS_EDGE}" = 0 ]; then
sed -i -e "s|pub/epel/${MAJOR_VER}|pub/archive/epel/${VERSION_ID}|g" "$repo"
fi
fi