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
41 changes: 34 additions & 7 deletions scripts/pulp_upload.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,26 @@ resolve_os_version_for_repo() {
printf '%s\n' "$os_label"
}

resolve_deb_upload_dir() {
local ceph_dist_dir="${1%/}"
local deb_tree="${ceph_dist_dir}/debs/${OS_NAME}"
local pool_main="${deb_tree}/pool/main"

if [ -d "${pool_main}" ]; then
log "Using APT pool layout under ${pool_main}"
printf '%s\n' "${pool_main}"
return 0
fi
local workdir="${deb_tree}/WORKDIR"
if [ -d "${workdir}" ]; then
log "pool/main not found; falling back to ${workdir}"
printf '%s\n' "${workdir}"
return 0
fi
log "WARNING: no pool/main or WORKDIR under ${deb_tree}; searching ${deb_tree}"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be just a warning or be fatal?

printf '%s\n' "${deb_tree}"
}

add_pulp_uploaded_packages_to_repository() {
local content_type="$1"
local repo_name="$2"
Expand Down Expand Up @@ -85,7 +105,8 @@ upload_deb_to_pulp() {
jq -r '.prn | split(":") | last'
))
done < <(
find "${deb_dir}/" -regextype egrep -regex ".*(${_arch}\.deb)$"
find "${deb_dir}/" -regextype egrep -regex ".*(${_arch}\.deb)$" |
awk -F/ '{name = $NF; if (!seen[name]++) print $0}'
)
log "Finished DEB uploads (repository=${repo_name})"
[[ ${#pulp_uuid[@]} -gt 0 ]]
Expand Down Expand Up @@ -132,16 +153,21 @@ publish_pulp_distribution() {
return
fi

local i
local i distro_version
distro_version="${OS_VERSION_NAME}"
if [ "$OS_NAME" == "centos" ] && [ "$OS_VERSION" -ge 8 ]; then
distro_version="${OS_VERSION}.stream"
fi
local -a labels=(
project "${PULP_PROJECT}"
version "${package_version}"
ref "${BRANCH}"
branch "${BRANCH}"
arch "${repo_arch}"
sha1 "${SHA1}"
distro "${OS_NAME}"
distro_version "${OS_VERSION_NAME}"
flavor "${FLAVOR}"
distro_version "${distro_version}"
flavors "${FLAVOR}"
)
log "Setting distribution labels: ${labels[@]}"
for ((i = 0; i < ${#labels[@]}; i += 2)); do
Expand Down Expand Up @@ -250,9 +276,10 @@ elif [ "$OS_PKG_TYPE" = "deb" ]; then
PACKAGE_MANAGER_VERSION="${VERSION}-1${OS_VERSION_NAME}"
log "Starting DEB upload (OS_PKG_TYPE=${OS_PKG_TYPE})"

log "Uploading DEB artifacts to ${REPO_NAME}-${ARCH}"
_deb_upload_dir=$(resolve_deb_upload_dir "${WORKSPACE}/dist/ceph")
log "Uploading DEB artifacts to ${REPO_NAME}-${ARCH} from ${_deb_upload_dir}"
_deb_pulp_uuids=()
if upload_deb_to_pulp "${WORKSPACE}/dist/ceph" "${REPO_NAME}-${ARCH}" \
if upload_deb_to_pulp "${_deb_upload_dir}" "${REPO_NAME}-${ARCH}" \
"${ARCH}" _deb_pulp_uuids; then
add_pulp_uploaded_packages_to_repository deb "${REPO_NAME}-${ARCH}" \
_deb_pulp_uuids
Expand All @@ -265,7 +292,7 @@ elif [ "$OS_PKG_TYPE" = "deb" ]; then
log "WARNING: DEB upload failed;" \
"skipping content modification and publication for ${REPO_NAME}-${ARCH}"
fi
unset _deb_pulp_uuids
unset _deb_pulp_uuids _deb_upload_dir

else
log "ERROR: Unsupported OS_PKG_TYPE='${OS_PKG_TYPE}' (expected rpm or deb)"
Expand Down
2 changes: 1 addition & 1 deletion scripts/setup_pulp.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ source "$WORKSPACE/scripts/setup_uv.sh"

export PATH="$HOME/.local/bin:$PATH"

PULP_SERVER_URL="https://pulp.apps.pok.os.sepia.ceph.com"
PULP_SERVER_URL="https://pulp.front.sepia.ceph.com"

uv tool install pulp-cli --with pulp-cli-deb

Expand Down