Skip to content
Open
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
7 changes: 4 additions & 3 deletions packaging/Dockerfile.mockbuild
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ LABEL maintainer="[email protected]"
ARG REPO_FILE_URL
ARG DAOS_LAB_CA_FILE_URL
ARG REPOSITORY_NAME

# script to install OS updates basic tools and daos dependencies
# COPY ./utils/scripts/install-fedora.sh /tmp/install.sh
# script to setup local repo if available
Expand All @@ -26,9 +27,9 @@ RUN chmod +x /tmp/repo-helper.sh && \
rm -f /tmp/repo-helper.sh

# Install basic tools
RUN dnf -y install mock make \
rpm-build createrepo rpmlint redhat-lsb-core git \
python-srpm-macros rpmdevtools && \
RUN dnf -y install mock make \
rpm-build createrepo rpmlint git \
python-srpm-macros rpmdevtools && \
dnf -y clean all

# use same UID as host and default value of 1000 if not specified
Expand Down
28 changes: 24 additions & 4 deletions packaging/scripts/repo-helper-fedora.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,26 @@ set -uex
: "${FVERSION:=latest}"
: "${REPOSITORY_NAME:=artifactory}"
: "${archive:=}"
if [ "$FVERSION" != "latest" ]; then
archive="-archive"
fi

is_fedora_eol() {
local eol_url fedora_version eol_date today
if [ -n "$REPO_FILE_URL" ]; then
eol_url="${REPO_FILE_URL%repo-files/}eol-proxy/fedora.json"
fedora_version=$(grep VERSION_ID /etc/os-release | cut -d= -f2 | \
tr -d '"')
eol_date=$(curl -s "$eol_url" | sed 's/},{/}\n{/g' | \
grep "cycle\":\"$fedora_version\"" | \
sed -n 's/.*"eol":"\([^"]*\)".*/\1/p')
if [[ -z "$eol_date" ]]; then
return 1 # Assume NOT EOL if data missing
fi
today=$(date +%Y-%m-%d)
[[ "$today" > "$eol_date" ]]
return $? # Return 0 if EOL, 1 if not
else
return 1 # Assume NOT EOL if url is missing
fi
}

# shellcheck disable=SC2120
disable_repos () {
Expand Down Expand Up @@ -58,11 +75,14 @@ install_optional_ca() {
if [ -n "$REPO_FILE_URL" ]; then
install_curl
install_optional_ca
if is_fedora_eol; then
archive="-archive"
fi
mkdir -p /etc/yum.repos.d
pushd /etc/yum.repos.d/
curl -k --noproxy '*' -sSf \
-o "daos_ci-fedora${archive}-${REPOSITORY_NAME}.repo" \
"{$REPO_FILE_URL}daos_ci-fedora${archive}-${REPOSITORY_NAME}.repo"
"${REPO_FILE_URL}daos_ci-fedora${archive}-${REPOSITORY_NAME}.repo"
disable_repos /etc/yum.repos.d/
popd
fi
Expand Down